From 40fc3060174bc402fdd9584b09b917d696a40724 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 26 Nov 2013 20:50:33 +0100 Subject: [PATCH] videodecoder: make _release_frame external API ... so subclasses can release a frame all the way (also from frame list) without having to pass through _finish_frame or _drop_frame. The latter may not be applicable, or may or may not have already been called for the frame in question. See https://bugzilla.gnome.org/show_bug.cgi?id=693772 --- gst-libs/gst/video/gstvideodecoder.c | 17 ++++++++++++++--- gst-libs/gst/video/gstvideodecoder.h | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index c2808b0722..ca73a461f7 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -436,8 +436,6 @@ static void gst_video_decoder_reset (GstVideoDecoder * decoder, gboolean full, static GstFlowReturn gst_video_decoder_decode_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame); -static void gst_video_decoder_release_frame (GstVideoDecoder * dec, - GstVideoCodecFrame * frame); static GstClockTime gst_video_decoder_get_frame_duration (GstVideoDecoder * decoder, GstVideoCodecFrame * frame); static GstVideoCodecFrame *gst_video_decoder_new_frame (GstVideoDecoder * @@ -2345,18 +2343,31 @@ no_output_buffer: } } -static void +/** + * gst_video_decoder_release_frame: + * @dec: a #GstVideoDecoder + * @frame: (transfer full): the #GstVideoCodecFrame to release + * + * Similar to gst_video_decoder_drop_frame(), but simply releases @frame + * without any processing other than removing it from list of pending frames, + * after which it is considered finished and released. + * + * Since: 1.4 + */ +void gst_video_decoder_release_frame (GstVideoDecoder * dec, GstVideoCodecFrame * frame) { GList *link; /* unref once from the list */ + GST_VIDEO_DECODER_STREAM_LOCK (dec); link = g_list_find (dec->priv->frames, frame); if (link) { gst_video_codec_frame_unref (frame); dec->priv->frames = g_list_delete_link (dec->priv->frames, link); } + GST_VIDEO_DECODER_STREAM_UNLOCK (dec); /* unref because this function takes ownership */ gst_video_codec_frame_unref (frame); diff --git a/gst-libs/gst/video/gstvideodecoder.h b/gst-libs/gst/video/gstvideodecoder.h index 1bdb37dcdd..abe2fbb421 100644 --- a/gst-libs/gst/video/gstvideodecoder.h +++ b/gst-libs/gst/video/gstvideodecoder.h @@ -366,6 +366,9 @@ GstFlowReturn gst_video_decoder_finish_frame (GstVideoDecoder *decoder, GstFlowReturn gst_video_decoder_drop_frame (GstVideoDecoder *dec, GstVideoCodecFrame *frame); +void gst_video_decoder_release_frame (GstVideoDecoder * dec, + GstVideoCodecFrame * frame); + void gst_video_decoder_merge_tags (GstVideoDecoder *dec, const GstTagList *tags, GstTagMergeMode mode);