protonscr

winedmo/libavcodec: fails to compile on latest ffmpeg

wineclosed
ValveSoftware/wine#280 · opened 2025-05-02 by sewnie · updated 2025-05-07 · 5 comments · github
Ssewnie 2025-05-02 github
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c: In function ‘ff_bsf_get_packet’:
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:39:5: error: unknown type name ‘AVBSFInternal’; use ‘struct’ keyword to refer to the type
   39 |     AVBSFInternal *bsfi = ctx->internal;
      |     ^~~~~~~~~~~~~
      |     struct 
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:39:30: error: ‘AVBSFContext’ has no member named ‘internal’
   39 |     AVBSFInternal *bsfi = ctx->internal;
      |                              ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:42:13: error: request for member ‘eof’ in something not a structure or union
   42 |     if (bsfi->eof)
      |             ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:45:22: error: request for member ‘buffer_pkt’ in something not a structure or union
   45 |     if (IS_EMPTY(bsfi->buffer_pkt))
      |                      ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:29:26: note: in definition of macro ‘IS_EMPTY’
   29 | #define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
      |                          ^~~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:45:22: error: request for member ‘buffer_pkt’ in something not a structure or union
   45 |     if (IS_EMPTY(bsfi->buffer_pkt))
      |                      ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:29:42: note: in definition of macro ‘IS_EMPTY’
   29 | #define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
      |                                          ^~~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:52:16: error: request for member ‘buffer_pkt’ in something not a structure or union
   52 |     *pkt = bsfi->buffer_pkt;
      |                ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:53:9: error: request for member ‘buffer_pkt’ in something not a structure or union
   53 |     bsfi->buffer_pkt = tmp_pkt;
      |         ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c: In function ‘init’:
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:80:20: error: ‘AVCodecParameters’ has no member named ‘channels’
   80 |     if (ctx->par_in->channels <= 0 || ctx->par_in->sample_rate <= 0)
      |                    ^~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c: At top level:
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:152:6: error: ‘AVBitStreamFilter’ has no member named ‘filter’
  152 |     .filter         = byte_order_reverse_filter,
      |      ^~~~~~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:152:23: error: initialization of ‘const enum AVCodecID *’ from incompatible pointer type ‘int (*)(AVBSFContext *, AVPacket *)’ [-Wincompatible-pointer-types]
  152 |     .filter         = byte_order_reverse_filter,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:152:23: note: (near initialization for ‘ff_pcm_byte_order_reverse_bsf.codec_ids’)
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:153:6: error: ‘AVBitStreamFilter’ has no member named ‘init’
  153 |     .init           = init,
      |      ^~~~
dlls/winedmo/libavcodec/pcm_byte_order_reverse_bsf.c:153:23: error: initialization of ‘const AVClass *’ from incompatible pointer type ‘int (*)(AVBSFContext *)’ [-Wincompatible-pointer-types]
  153 |     .init           = init,
      |                       ^~~~
TThaodan 2025-05-06 github

I tried to do some research around this. These two commits should explain the reason of the breakage:
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/afeefb306e89b3ea3eb8ac8227996dc79589b669
https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/f4098bbc3b10926f618cf89e24780c9e6ae9b8b5

The patch in this wine causing the issue is:
063a29bc8ba05a97152b2f9a97ad7ab12007e1e7

For now simply reverting it probably the best solution.

Llayercak3 2025-05-07 github

Instead of reverting, you can also build from the release/4.4 branch to a dedicated location and add e.g. FFMPEG_CFLAGS="-I/usr/include/ffmpeg4.4" FFMPEG_LIBS="-L/usr/lib/ffmpeg4.4 -lavcodec -lavformat -lavutil" to the configure arguments (change libdir for 32-bit). Then make sure the library is accessible at runtime by copying the libavcodec.so.58 etc. symlinks to /usr/lib (or equivalent system libdir) or using LD_LIBRARY_PATH/rpath.

I don't think this is something that will be fixed any time soon, they are choosing to use an old ffmpeg submodule (which probably requires using a similarly old gstreamer to build gst-libav) for Proton builds and probably do not see a reason to update it.

TThaodan 2025-05-07 github

Sure of course one can also build against FFmpeg 4.4. howeer I wanted to
avoid the resulting dependency changes in my packing. Simply reverting
patch was easier.

Iivyl 2025-05-07 github

FWIW this Wine version is absolutely untested when it comes to building outside the Proton SDK container using Proton build scripts. It's also not something we have resources to actively support.

The offending file libavcodec/pcm_byte_order_reverse_bsf.c is a purely downstream change and probably will have to be redone if we ever have to compile against a newer version.

Currently we are bound to an "old" ffmpeg version that is provided with Steam.

TThaodan 2025-05-07 github

Arek Hiler @.***> writes:

FWIW this Wine version is absolutely untested when it comes to
building outside the Proton SDK container using Proton build
scripts. It's also not something we have resources to actively
support.

No problem. I don't think the bug report was asking for support but just
reporting the bug.

Maybe the information provided can help to port this downstrem change to
newer FFmpeg when you will update the component.

Nothing extracted yet.