summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-06-05 11:51:41 +0200
committerJan Schmidt <thaytan@noraisin.net>2009-06-20 15:21:41 +0100
commite2d8cc99b0436adba5503e3679e4ba21877aee23 (patch)
treeb65343a76cff993eab4b277863ec279289f17dea /sys
parentf80a7279579850ec2e8ceb0d1e5f56ccb7110f66 (diff)
downloadgst-plugins-bad-e2d8cc99b0436adba5503e3679e4ba21877aee23.tar.gz
gst-plugins-bad-e2d8cc99b0436adba5503e3679e4ba21877aee23.tar.bz2
gst-plugins-bad-e2d8cc99b0436adba5503e3679e4ba21877aee23.zip
vdpaumpegdec: add new gst_vdp_mpeg_decoder_flush for flushing the decoder
Diffstat (limited to 'sys')
-rw-r--r--sys/vdpau/gstvdpmpegdecoder.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/sys/vdpau/gstvdpmpegdecoder.c b/sys/vdpau/gstvdpmpegdecoder.c
index 3a161c3a..bee76f1f 100644
--- a/sys/vdpau/gstvdpmpegdecoder.c
+++ b/sys/vdpau/gstvdpmpegdecoder.c
@@ -522,7 +522,7 @@ gst_vdp_mpeg_decoder_parse_quant_matrix (GstVdpMpegDecoder * mpeg_dec,
}
static void
-gst_vdp_mpeg_decoder_reset (GstVdpMpegDecoder * mpeg_dec)
+gst_vdp_mpeg_decoder_flush (GstVdpMpegDecoder * mpeg_dec)
{
if (mpeg_dec->vdp_info.forward_reference != VDP_INVALID_HANDLE)
gst_buffer_unref (mpeg_dec->f_buffer);
@@ -532,8 +532,22 @@ gst_vdp_mpeg_decoder_reset (GstVdpMpegDecoder * mpeg_dec)
gst_vdp_mpeg_decoder_init_info (&mpeg_dec->vdp_info);
gst_adapter_clear (mpeg_dec->adapter);
+}
+
+static void
+gst_vdp_mpeg_decoder_reset (GstVdpMpegDecoder * mpeg_dec)
+{
+ gst_vdp_mpeg_decoder_flush (mpeg_dec);
- //mpeg_dec->byterate = -1;
+ if (mpeg_dec->decoder != VDP_INVALID_HANDLE)
+ mpeg_dec->device->vdp_decoder_destroy (mpeg_dec->decoder);
+ mpeg_dec->decoder = VDP_INVALID_HANDLE;
+ if (mpeg_dec->device)
+ g_object_unref (mpeg_dec->device);
+ mpeg_dec->device = NULL;
+
+ mpeg_dec->broken_gop = FALSE;
+ mpeg_dec->next_timestamp = 0;
}
static GstFlowReturn
@@ -548,7 +562,7 @@ gst_vdp_mpeg_decoder_chain (GstPad * pad, GstBuffer * buffer)
if (G_UNLIKELY (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT))) {
GST_DEBUG_OBJECT (mpeg_dec, "Received discont buffer");
- gst_vdp_mpeg_decoder_reset (mpeg_dec);
+ gst_vdp_mpeg_decoder_flush (mpeg_dec);
}
gst_vdp_mpeg_packetizer_init (&packetizer, buffer);
@@ -733,7 +747,7 @@ gst_vdp_mpeg_decoder_sink_event (GstPad * pad, GstEvent * event)
{
GST_DEBUG_OBJECT (mpeg_dec, "flush stop");
- gst_vdp_mpeg_decoder_reset (mpeg_dec);
+ gst_vdp_mpeg_decoder_flush (mpeg_dec);
res = gst_pad_push_event (mpeg_dec->src, event);
break;
@@ -767,12 +781,6 @@ gst_vdp_mpeg_decoder_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_vdp_mpeg_decoder_reset (mpeg_dec);
-
- mpeg_dec->device->vdp_decoder_destroy (mpeg_dec->decoder);
- mpeg_dec->decoder = VDP_INVALID_HANDLE;
-
- g_object_unref (mpeg_dec->device);
- mpeg_dec->device = NULL;
break;
default:
break;
@@ -860,15 +868,14 @@ gst_vdp_mpeg_decoder_init (GstVdpMpegDecoder * mpeg_dec,
gst_element_add_pad (GST_ELEMENT (mpeg_dec), mpeg_dec->sink);
mpeg_dec->display_name = NULL;
- mpeg_dec->device = NULL;
-
- mpeg_dec->decoder = VDP_INVALID_HANDLE;
- gst_vdp_mpeg_decoder_init_info (&mpeg_dec->vdp_info);
+ mpeg_dec->adapter = gst_adapter_new ();
mpeg_dec->broken_gop = FALSE;
mpeg_dec->next_timestamp = 0;
- mpeg_dec->adapter = gst_adapter_new ();
+ mpeg_dec->device = NULL;
+ mpeg_dec->decoder = VDP_INVALID_HANDLE;
+ gst_vdp_mpeg_decoder_init_info (&mpeg_dec->vdp_info);
}
static void