Hi again,
Le ven. 14 févr. 2025 à 12:08, Romain Beauxis <romain.beau...@gmail.com> a écrit : > > Le ven. 14 févr. 2025 à 11:55, Lynne <d...@lynne.ee> a écrit : > > Swallow the extra/metadata. Do not let OpusHead or their equivalents in > > other codecs inside packets. > > Emit AV_PKT_DATA_NEW_EXTRADATA from the demuxer instead with the new > > data, which would contain the OpusHead unit (extradata). > > In the codec, if a packet contains AV_PKT_DATA_NEW_EXTRADATA, reinit the > > decoder with it (we should do this in decode.c, but for now, doing it in > > opusdec.c would be good enough). > > > > In the muxer, if a packet contains AV_PKT_DATA_NEW_EXTRADATA, write it > > to the bitstream. > > > > This also removes the need to cache metadata updates. If a packet > > contains metadata, simply pass that into the AVFrame->metadata once the > > frame leaves the decoder in decode.c. The packet is not dereferenced > > yet, so you don't even need to cache it while the packet is being decoded. > > This sounds like a plan, thanks I'll get to it. I'm looking into this again. Here are some notes: * Frames can potentially span several ogg packets so metadata should be cached in case a packet does not immediately return a decoded frame * The problem is extra header packets in the demuxed bitstream is orthogonal to the problem is passing new metadata * It seems more clear to use AV_PKT_DATA_METADATA_UPDATE to pass metadata updates and AV_PKT_DATA_NEW_EXTRADATA to pass new header packets Thus, I would like to divide up the work in the following order: 1. First a patcheset that adds a generic method to insert new metadata to decoded frames using AV_PKT_DATA_NEW_EXTRADATA. These changes wouldn't change the demuxing logic currently in place. 2. Then a patchset to start adding ogg packet headers from secondary chained streams as AV_PKT_DATA_NEW_EXTRADATA and suppress them from the bitstream #2 might need some iterations, maybe one series that stash them header packets and hides them from the demuxer and another one that starts dumping them into the bitstream in the muxer. The reason being that, in order to be able to dump them in the muxer, we will also need to revise the PTS/DTS logic and that seems like a lot of work for one single patch series. How does the plan feel for you? -- Romain _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".