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
This commit is contained in:
Mark Nauwelaerts 2013-11-26 20:50:33 +01:00
parent 614d35d795
commit 40fc306017
2 changed files with 17 additions and 3 deletions

View file

@ -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);

View file

@ -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);