Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demux: remove AVPacket global side data injection #15403

Merged

Conversation

jeeb
Copy link
Member

@jeeb jeeb commented Nov 28, 2024

This process has been deprecated since avformat 60.15.100 and
since avcodec 60.30.101 AV_PKT_DATA_DOVI_CONF has been read from
AVCodecContext's coded_side_data. Additionally, the HEVC decoder
is the only one which currently reads this side data from packets,
the native AV1 decoder as well as the libdav1d wrapper instead only
support the newer propagation method via codec context's side data.

How this currently is supposed to propagate is:

  • demuxer copies the codec parameters into sh_stream's lav_codecpar.
  • {ad,sd,vd}_lavc call mp_set_avctx_codec_headers that calls
    avcodec_parameters_to_context, which then sets global side data
    to the codec context.

As this logic is already in place, so no additional changes are required
for things to work and the deprecated function call can just be
cleaned up.

Ref: FFmpeg/FFmpeg@5432d2a
Ref: FFmpeg/FFmpeg@804be7f
Ref: FFmpeg/FFmpeg@12e5116

Copy link

github-actions bot commented Nov 28, 2024

Download the artifacts for this pull request:

Windows
macOS

@jeeb
Copy link
Member Author

jeeb commented Nov 28, 2024

Alternatively we could add either the dovi buffer or array of AVPacketSideData into mp_codec_params. This solution came up as demux_lavf was effectively already utilizing this manner of pass-through.

@jeeb jeeb force-pushed the remove_avpacket_global_side_data_injection branch from fbb8a2e to 4cdba32 Compare November 29, 2024 22:47
jeeb added 3 commits December 2, 2024 19:09
This process has been deprecated since avformat 60.15.100 and
since avcodec 60.30.101 AV_PKT_DATA_DOVI_CONF has been read from
AVCodecContext's coded_side_data. Additionally, the HEVC decoder
is the only one which currently reads this side data from packets,
the native AV1 decoder as well as the libdav1d wrapper instead only
support the newer propagation method via codec context's side data.

How this currently is supposed to propagate is:
* demux_lavf copies the codec parameters into sh_stream's lav_codecpar.
* {ad,sd,vd}_lavc call mp_set_avctx_codec_headers that calls
  avcodec_parameters_to_context, which then sets global side data
  to the codec context.

As this logic is already in place, so no additional changes are required
for things to work and the deprecated function call can just be
cleaned up.

Ref: FFmpeg/FFmpeg@5432d2a
Ref: FFmpeg/FFmpeg@804be7f
Ref: FFmpeg/FFmpeg@12e5116
The first AVPacket method has been deprecated in FFmpeg, and only
the HEVC decoder would read this information from there. The native
AV1 decoder as well as the libdav1d wrapper only support the newer
propagation method via codec context's side data. {ad,sd,vd}_lavc
call mp_set_avctx_codec_headers which copies the side data from
codecpar to codec context, so no changes are required on the
receiving end.
Was already being utilized by demux_raw, and now also created in
demux_mkv.
@jeeb jeeb force-pushed the remove_avpacket_global_side_data_injection branch from 4cdba32 to 5cad2ee Compare December 2, 2024 17:25
@kasper93 kasper93 merged commit 17e62fc into mpv-player:master Dec 2, 2024
24 of 25 checks passed
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