639 Commits

Author SHA1 Message Date
FreezyLemon
ef14631f71
Remove old FF_API_* features (#80)
* Clean up FF_API features

Use (for avcodec):
`git log -n1 -p -SFF_API_* -- libavcodec/version_major.h`
to find the last change regarding the relevant FF_API feature.

Removed all flags that are <4.0.
Added comments for the remaining flags

* Remove features gated behind old FF_API flags
2024-10-27 21:56:00 -04:00
FreezyLemon
9ecb233d50 Implement most of the chroma location API 2024-10-27 19:53:51 -04:00
FreezyLemon
251c09e732 Add utils for ptr->&str conversion 2024-10-23 14:44:13 -04:00
FreezyLemon
814f8b9464
FFmpeg 7.1 support (#74)
* Add new build-lib features

* Update CI to use 7.1

jrottenberg/ffmpeg does not have 7.1 yet

* Add libavcodec version for 7.1

* Add FF_API flags for 7.1

* Update crate versions, bump MSRV to 1.65

* Add new audio channel masks

* Add new AVColorSpace variants

* Add new AVFrameSideDataType variants

* Add new AVCodecID variants

* Add new AVPacketSideDataType variants
2024-10-18 00:06:01 -04:00
FreezyLemon
fd44dd339b Drop support for FFmpeg < 4.2
Check https://ffmpeg.org/download.html#releases
and https://trac.ffmpeg.org/wiki/Downstreams

to see the FFmpeg versions that are considered supported or EOL.
2024-10-16 13:25:53 -04:00
FreezyLemon
e70779ad30
Refactor crate::format (#73) 2024-10-15 18:13:27 -04:00
FreezyLemon
03db7c304b Add rustc-check-cfg for ff_api_{...} features 2024-07-22 19:28:15 -04:00
FreezyLemon
3239649dbb
Add rustc-check-cfg for ffmpeg_x_y features (#70)
* sys: Add check-cfg statements

* Add rustc-check-cfg in main crate

The sys build script sets an environment variable for every
feature that needs to be added to rustc-check-cfg.
2024-07-19 18:35:19 -04:00
FreezyLemon
820afa79bb Remove libc error reexports 2024-06-16 16:18:40 -04:00
FreezyLemon
ab0c7549b2
Fix clippy lints (#68)
* Specify type params in transmute calls

* Replace legacy numeric methods with constants
2024-06-14 11:44:38 -04:00
FreezyLemon
0ad8ef0c66 print clang version in build 2024-06-02 14:24:28 -04:00
FreezyLemon
176f12c04d Use libc::c_char over i8
C `char` is unsigned on some platforms
2024-06-02 14:23:50 -04:00
Nebojsa Sabovic
8eb9fa688f
Use clang for inspecting macros instead of compiling the binary. (#11) 2024-05-22 08:44:18 -04:00
FreezyLemon
b65d0de4b0 Don't tell brew to install pkg-config
it's already installed and will cause a warning
2024-05-17 19:11:57 -04:00
FreezyLemon
0fbdfdb371
Make AVOptionType a bitfield/int wrapper (#57)
* Implement option::Type as bitfield struct

This type is no longer strictly an enum in the
Rust sense because the underlying AVOptionType
is now also a bitfield/the AV_OPT_TYPE* consts
now include AV_OPT_TYPE_FLAG_ARRAY, which is a
bitflag.
2024-05-17 19:11:39 -04:00
FreezyLemon
5c6922db8c Implement ChannelLayout::retype 2024-05-17 19:10:37 -04:00
FreezyLemon
44e101406d
Add new (4.0+) API for av_[de]muxer_iterate (#52)
* Add new MuxerIter/DemuxerIter for 4.0+

* Add Default impls for MuxerIter/DemuxerIter

* Add tests for MuxerIter/DemuxerIter

* Use mutable reference over addr_of_mut!

* Don't dereference long_name if nullptr

This happens if FFmpeg is configured with `--enable-small`
2024-05-17 08:44:21 -04:00
FreezyLemon
be7340c39a Update MSRV lockfile 2024-05-16 14:15:18 -04:00
Josh Holmer
d043a323d0 Add more impls 2024-05-06 02:20:01 -04:00
Josh Holmer
5a1246553f Fix minor clippy lints 2024-05-06 02:20:01 -04:00
Josh Holmer
6b0e648959 Version 2.0.0 2024-05-06 02:20:01 -04:00
FreezyLemon
021c111ffb Use AVLibrary for pkg-config probing 2024-05-02 02:02:32 -04:00
FreezyLemon
40b7016177 sys: Fix clippy lints, run cargo fmt 2024-05-02 02:02:00 -04:00
FreezyLemon
a4e4aedc13 Add FFmpeg 7 build to macOS CI job 2024-05-02 02:00:36 -04:00
FreezyLemon
4953bc22ed
Add CI matrix for macOS builds (#43)
* Add FFmpeg version matrix to macOS CI job

* Add macOS PKG_CONFIG_PATH

* Change schedule to run CI builds weekly

* Fix package installation dir

Homebrew apparently always symlinks to /opt/homebrew, so this
one is reliable
2024-04-29 21:39:53 -04:00
FreezyLemon
a3837aeb2b
Update Cargo.toml (again) (#42)
* Move dependencies to top

* Add LICENSE symlink to sys crate, update Cargo.toml

* sys: Move features around a bit

* Move features around a bit

* Replace package `exclude` with `include` list

* Remove Cargo.lock.MSRV from crate package
2024-04-29 21:39:18 -04:00
FreezyLemon
fd2d71c92b
Support FFmpeg 7.0 (#48)
* sys: Run cargo fmt

* sys: Add new channel layout consts

* sys: Update build script for 7.0

- Add new FF_API flags
- Update version_check_info range
- Add ffmpeg_7_0 feature entry

* sys: Update non-exhaustive match statement

* Update enums

* Mark old APIs as removed with 7.0

* Make Audio frame work with 7.0

The .unwrap() in clone() is a bit wonky

* Add API for swr_alloc_set_opts2

* Use AVFrame::duration field in 7.0+

* Include 7.0 in CI runs

* Add fn ChanneLayoutIter::best

* Update examples for new API

* Add/update Context setter for ch layout
2024-04-29 21:38:37 -04:00
FreezyLemon
0107b62f56
Fix avfiltergraph input output (#44)
* Port append_inout to rust

* impl Drop for filter::graph::Parser
2024-04-29 21:36:14 -04:00
FreezyLemon
159e6f924d
Avoid using "static" functions in build script (#40)
* Move fetch & early return into fn build

* Pass ffmpeg_version as parameter

* Pass source_dir as parameter

* Create rustc_link_extralibs

* Use local variable instead of search()

* Pass OUT_DIR to the build function

* Return install_dir from build function

* Parametrize ffmpeg_major_version

* Remove duplicate import
2024-04-27 19:58:42 -04:00
FreezyLemon
22fda65cda
Add AVHeader type to build.rs (#39)
* Rename `is_feature` to `optional`

* Replace Library::new with two separate functions

* Add AVHeader abstraction

* Add Library::enabled helper function
2024-04-27 19:57:23 -04:00
FreezyLemon
3206eedcf0
Add ChannelLayout API (#38)
* Create channel_layout directory

* Rename ChannelLayout -> ChannelLayoutMask

* Add enum Channel (<-> AVChannel)

* Add struct ChannelCustom (<-> AVChannelCustom)

* Add enum ChannelOrder (<-> AVChannelOrder)

* Add struct ChannelLayout

- Smart copy-on-write pointer to AVChannelLayout
- idiomatic Rust API wrapping around FFmpeg APIs
- no Ambisonic support (yet)
- consts will need to be manually updated

* Add ChannelLayoutIter (iterator over all standard layouts)

* Add codec/Audio::ch_layouts

* Add ch_layout API to Audio-related structs
2024-04-23 08:59:15 -04:00
FreezyLemon
3a9f4584a0 Update metadata in Cargo.toml 2024-04-14 13:52:11 -04:00
FreezyLemon
e7901750b4
ffmpeg-sys: Add basic impls for AVChannelLayout (#37) 2024-04-14 13:51:12 -04:00
FreezyLemon
ae70fa3f81
Use allowlist instead of blocklist in build script (#31) 2024-04-14 12:43:48 -04:00
FreezyLemon
684f758978
Replace avutil macros with const fns & clean up some code (#33)
* Replace tag/error macros with const fns

* Remove c_int -> c_int cast

These should always use the same type alias

* Remove duplicate av_strerror definition

* Document breaking change
2024-04-10 09:27:50 -04:00
FreezyLemon
1aa002a2b2 Add FF_API flags from 6.1 2024-04-10 09:26:03 -04:00
FreezyLemon
3cb87c9cae Add FF_API flags from 5.1 2024-04-10 09:26:03 -04:00
FreezyLemon
6231b4bc3a
Move channel_layout_fixed.h to rust (#28)
* Move channel layout definitions to Rust

* Add channel layouts new in 6.1

* Add new AVChannelLayout consts

* Add new channel layout values to ChannelLayout

* Realign ChannelLayout consts
2024-04-10 09:24:10 -04:00
FreezyLemon
d519d152b3
Specify MSRV & verify in CI (#23) 2024-04-08 13:44:49 -04:00
FreezyLemon
c25b7b4dcc Run sys (bindgen) tests in CI 2024-04-07 09:23:38 -04:00
FreezyLemon
82336f4dbb
Refactor fn build in build script (#25)
* Introduce helper fn cargo_feature_enabled

* Move switch and enable! to trait

This allows a simpler `configure.` invocation

* Move external libraries into static list

* Fix incorrect feature name for libdrm
2024-04-07 09:22:37 -04:00
FreezyLemon
2d8dd6c0a5 Remove num_cpus dependency
available_parallelism is stable in Rust 1.59.0
2024-04-07 09:21:19 -04:00
FreezyLemon
52a07ed0c6
Add AVFeature type to build.rs (#22) 2024-04-06 21:35:08 -04:00
FreezyLemon
7a8643f2cc
Migrate crates to Rust edition 2021 (#24)
* Migrate ffmpeg-sys to Edition 2021

* Migrate ffmpeg to Edition 2021

* Remove now-redundant imports

* Reorder imports after edition migration
2024-04-06 21:31:36 -04:00
FreezyLemon
f601a4bb69
Fix Windows CI (#18)
- Update actions
- Download FFmpeg from github
- Remove explicit newline from cmds
  (added automatically)
2024-04-03 14:51:44 -04:00
FreezyLemon
9eab7820bb
Fix PadIter in FFmpeg pre-5.0 (#17) 2024-04-03 14:51:12 -04:00
FreezyLemon
f269020af8
Add missing enum variants for FFmpeg 6.1 (#16) 2024-04-03 12:27:13 -04:00
FreezyLemon
e294e14fe2
Update and fix CI (#15) 2024-04-03 09:26:55 -04:00
FreezyLemon
30aabf9033
Add FFmpeg 6.1 support (#14)
Co-authored-by: Rafie <simulping@protonmail.com>
2024-04-02 08:47:59 -04:00
Josh Holmer
1af767b881 Silence clippy false positive 2023-11-08 08:34:32 -05:00