avviddec: Fix how we get back the codec frame

With the new copy_opaque system, the corresponding frame is stored in the
picture opaque ref.

This also handles the case where the "regular" opaque might be empty in the
case of "DECODE_ONLY" frames, since it that field is set in `get_buffer2()`
which might not be called for those frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6301>
This commit is contained in:
Edward Hervey 2024-03-08 10:53:16 +01:00 committed by GStreamer Marge Bot
parent eacd5c1cb1
commit 086ecb008f

View file

@ -1881,11 +1881,20 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
/* get the output picture timing info again */ /* get the output picture timing info again */
out_dframe = ffmpegdec->picture->opaque; out_dframe = ffmpegdec->picture->opaque;
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT (60, 31, 100)
out_frame =
gst_video_codec_frame_ref (av_buffer_get_opaque (ffmpegdec->
picture->opaque_ref));
#else
g_assert (out_dframe);
out_frame = gst_video_codec_frame_ref (out_dframe->frame); out_frame = gst_video_codec_frame_ref (out_dframe->frame);
#endif
/* also give back a buffer allocated by the frame, if any */ /* also give back a buffer allocated by the frame, if any */
if (out_dframe) {
gst_buffer_replace (&out_frame->output_buffer, out_dframe->buffer); gst_buffer_replace (&out_frame->output_buffer, out_dframe->buffer);
gst_buffer_replace (&out_dframe->buffer, NULL); gst_buffer_replace (&out_dframe->buffer, NULL);
}
/* Extract auxilliary info not stored in the main AVframe */ /* Extract auxilliary info not stored in the main AVframe */
{ {