Skip to content

[WIP] Fixed build when using vcpkg linking updating ffmpeg APIs references#253

Open
aegroto wants to merge 4 commits into
larksuite:masterfrom
aegroto:fix/updated_rusty_api
Open

[WIP] Fixed build when using vcpkg linking updating ffmpeg APIs references#253
aegroto wants to merge 4 commits into
larksuite:masterfrom
aegroto:fix/updated_rusty_api

Conversation

@aegroto

@aegroto aegroto commented May 23, 2026

Copy link
Copy Markdown
Contributor

I have not been able to compile master on Linux, which should correspond to the last released version, when linking through vcpkg. That was the output of cargo build:

Compiling rusty_ffmpeg v0.16.7+ffmpeg.8
   Compiling rsmpeg v0.18.0+ffmpeg.8.0 (/home/lorenzo/repository/rsmpeg)
error[E0615]: attempted to take value of method `name` on type `&bitstream::AVBitStreamFilter`
  --> src/avcodec/bitstream.rs:25:38
   |
25 |         let name = NonNull::new(self.name as *mut _).unwrap();
   |                                      ^^^^ method, not a field
   |
help: use parentheses to call the method
   |
25 |         let name = NonNull::new(self.name() as *mut _).unwrap();
   |                                          ++

error[E0609]: no field `pb` on type `AVFormatContext`
  --> src/avformat/avformat.rs:76:45
   |
76 |                     (*input_format_context).pb = match io_context {
   |                                             ^^ unknown field
   |
   = note: available field is: `_address`

error[E0615]: attempted to take value of method `streams` on type `&'stream AVFormatContextInput`
   --> src/avformat/avformat.rs:218:28
    |
218 |         let streams = self.streams as *const *const ffi::AVStream as *const AVStreamRef<'stream>;
    |                            ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
218 |         let streams = self.streams() as *const *const ffi::AVStream as *const AVStreamRef<'stream>;
    |                                   ++

error[E0609]: no field `nb_streams` on type `&'stream AVFormatContextInput`
   --> src/avformat/avformat.rs:220:24
    |
220 |         let len = self.nb_streams as usize;
    |                        ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `something_should_not_be_touched_directly`, `io_context`
    = note: available field is: `_address`

error[E0615]: attempted to take value of method `streams` on type `&'stream AVFormatContextInput`
   --> src/avformat/avformat.rs:226:49
    |
226 |                 std::slice::from_raw_parts(self.streams as *const *const ffi::AVStream, len)
    |                                                 ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
226 |                 std::slice::from_raw_parts(self.streams() as *const *const ffi::AVStream, len)
    |                                                        ++

error[E0282]: type annotations needed for `&[_]`
   --> src/avformat/avformat.rs:225:17
    |
225 |             let arr = unsafe {
    |                 ^^^
...
229 |                 assert!(!ptr.is_null());
    |                          --- type must be known at this point
    |
help: consider giving `arr` an explicit type, where the placeholders `_` are specified
    |
225 |             let arr: &[T] = unsafe {
    |                    ++++++

error[E0615]: attempted to take value of method `streams` on type `&'stream mut AVFormatContextInput`
   --> src/avformat/avformat.rs:245:28
    |
245 |         let streams = self.streams as *mut AVStreamMut<'stream>;
    |                            ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
245 |         let streams = self.streams() as *mut AVStreamMut<'stream>;
    |                                   ++

error[E0609]: no field `nb_streams` on type `&'stream mut AVFormatContextInput`
   --> src/avformat/avformat.rs:247:24
    |
247 |         let len = self.nb_streams as usize;
    |                        ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `something_should_not_be_touched_directly`, `io_context`
    = note: available field is: `_address`

error[E0615]: attempted to take value of method `streams` on type `&'stream mut AVFormatContextInput`
   --> src/avformat/avformat.rs:253:49
    |
253 |                 std::slice::from_raw_parts(self.streams as *const *const ffi::AVStream, len)
    |                                                 ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
253 |                 std::slice::from_raw_parts(self.streams() as *const *const ffi::AVStream, len)
    |                                                        ++

error[E0282]: type annotations needed for `&[_]`
   --> src/avformat/avformat.rs:252:17
    |
252 |             let arr = unsafe {
    |                 ^^^
...
256 |                 assert!(!ptr.is_null());
    |                          --- type must be known at this point
    |
help: consider giving `arr` an explicit type, where the placeholders `_` are specified
    |
252 |             let arr: &[T] = unsafe {
    |                    ++++++

error[E0615]: attempted to take value of method `iformat` on type `&'stream AVFormatContextInput`
   --> src/avformat/avformat.rs:267:63
    |
267 |         unsafe { AVInputFormatRef::from_raw(NonNull::new(self.iformat as *mut _).unwrap()) }
    |                                                               ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
267 |         unsafe { AVInputFormatRef::from_raw(NonNull::new(self.iformat() as *mut _).unwrap()) }
    |                                                                      ++

error[E0615]: attempted to take value of method `metadata` on type `&'stream AVFormatContextInput`
   --> src/avformat/avformat.rs:277:27
    |
277 |         NonNull::new(self.metadata).map(|x| unsafe { AVDictionaryRef::from_raw(x) })
    |                           ^^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
277 |         NonNull::new(self.metadata()).map(|x| unsafe { AVDictionaryRef::from_raw(x) })
    |                                   ++

error[E0609]: no field `pb` on type `&mut AVFormatContext`
   --> src/avformat/avformat.rs:359:55
    |
359 |                     output_format_context.deref_mut().pb = io_context.as_mut_ptr();
    |                                                       ^^ unknown field
    |
    = note: available field is: `_address`

error[E0615]: attempted to take value of method `streams` on type `&'stream AVFormatContextOutput`
   --> src/avformat/avformat.rs:446:28
    |
446 |         let streams = self.streams as *const *const ffi::AVStream as *const AVStreamRef<'stream>;
    |                            ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
446 |         let streams = self.streams() as *const *const ffi::AVStream as *const AVStreamRef<'stream>;
    |                                   ++

error[E0609]: no field `nb_streams` on type `&'stream AVFormatContextOutput`
   --> src/avformat/avformat.rs:448:24
    |
448 |         let len = self.nb_streams as usize;
    |                        ^^^^^^^^^^ unknown field
    |
    = note: available fields are: `something_should_not_be_touched_directly`, `io_context`
    = note: available field is: `_address`

error[E0615]: attempted to take value of method `streams` on type `&'stream AVFormatContextOutput`
   --> src/avformat/avformat.rs:454:49
    |
454 |                 std::slice::from_raw_parts(self.streams as *const *const ffi::AVStream, len)
    |                                                 ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
454 |                 std::slice::from_raw_parts(self.streams() as *const *const ffi::AVStream, len)
    |                                                        ++

error[E0282]: type annotations needed for `&[_]`
   --> src/avformat/avformat.rs:453:17
    |
453 |             let arr = unsafe {
    |                 ^^^
...
457 |                 assert!(!ptr.is_null());
    |                          --- type must be known at this point
    |
help: consider giving `arr` an explicit type, where the placeholders `_` are specified
    |
453 |             let arr: &[T] = unsafe {
    |                    ++++++

error[E0615]: attempted to take value of method `oformat` on type `&AVFormatContextOutput`
   --> src/avformat/avformat.rs:468:64
    |
468 |         unsafe { AVOutputFormatRef::from_raw(NonNull::new(self.oformat as *mut _).unwrap()) }
    |                                                                ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
468 |         unsafe { AVOutputFormatRef::from_raw(NonNull::new(self.oformat() as *mut _).unwrap()) }
    |                                                                       ++

error[E0609]: no field `oformat` on type `&mut AVFormatContext`
   --> src/avformat/avformat.rs:475:30
    |
475 |             self.deref_mut().oformat = format.as_ptr() as _;
    |                              ^^^^^^^ unknown field
    |
    = note: available field is: `_address`

error[E0615]: attempted to take value of method `oformat` on type `&mut AVFormatContextOutput`
   --> src/avformat/avformat.rs:496:27
    |
496 |         if unsafe { *self.oformat }.flags & ffi::AVFMT_NOFILE as i32 == 0 {
    |                           ^^^^^^^ method, not a field
    |
help: use parentheses to call the method
    |
496 |         if unsafe { *self.oformat() }.flags & ffi::AVFMT_NOFILE as i32 == 0 {
    |                                  ++

error[E0609]: no field `pb` on type `&mut AVFormatContextOutput`
   --> src/avformat/avformat.rs:497:49
    |
497 |             if let Some(pb) = NonNull::new(self.pb) {
    |                                                 ^^ unknown field
    |
    = note: available fields are: `something_should_not_be_touched_directly`, `io_context`
    = note: available field is: `_address`

Some errors have detailed explanations: E0282, E0609, E0615.
For more information about an error, try `rustc --explain E0282`.
error: could not compile `rsmpeg` (lib) due to 21 previous errors

Tests compile, but still do not pass after my fixes. I have never worked with ffmpeg's ffi so I'd be grateful if you could give a second look. At the time of writing I am still working on fixing the tests, I will update the PR accordingly.

Edit: the only failing test is misc::frame_image_copy_to_buffer::test_frame_copy_to_buffer0, but I am not sure if the problem is in the ground-truth file which output is not byte-identical to the one given by the last vcpkg release or if it's due to a problem in the code. It could be useful to pin a specific vcpkg commit for each rsmpeg release.

@CLAassistant

CLAassistant commented May 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ldm0 ldm0 self-requested a review May 23, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants