summaryrefslogtreecommitdiff
path: root/ext/faad/gstfaad.c
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2010-02-10 23:14:21 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2010-02-11 22:22:51 +0100
commit96ad733207619873c5b218036b99e37c9019230b (patch)
tree8ea956c0e67857247d2892bd3b6996d05eec1110 /ext/faad/gstfaad.c
parentf6ea21779240cf09e0c730febad6a0d0d5393999 (diff)
downloadgstreamer-plugins-bad-96ad733207619873c5b218036b99e37c9019230b.tar.gz
faad: refactor some partial stream reset
Diffstat (limited to 'ext/faad/gstfaad.c')
-rw-r--r--ext/faad/gstfaad.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index 4f0fca6bb..1a215b143 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -230,6 +230,16 @@ gst_faad_init (GstFaad * faad)
}
static void
+gst_faad_reset_stream_state (GstFaad * faad)
+{
+ faad->sync_flush = 0;
+ gst_adapter_clear (faad->adapter);
+ clear_queued (faad);
+ if (faad->handle)
+ faacDecPostSeekReset (faad->handle, 0);
+}
+
+static void
gst_faad_reset (GstFaad * faad)
{
gst_segment_init (&faad->segment, GST_FORMAT_TIME);
@@ -244,11 +254,11 @@ gst_faad_reset (GstFaad * faad)
faad->bytes_in = 0;
faad->sum_dur_out = 0;
faad->error_count = 0;
- faad->sync_flush = 0;
- gst_adapter_clear (faad->adapter);
- clear_queued (faad);
+
+ gst_faad_reset_stream_state (faad);
}
+
static void
gst_faad_finalize (GObject * object)
{
@@ -613,13 +623,12 @@ gst_faad_sink_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
- gst_adapter_clear (faad->adapter);
- clear_queued (faad);
+ gst_faad_reset_stream_state (faad);
res = gst_pad_push_event (faad->srcpad, event);
break;
case GST_EVENT_EOS:
gst_faad_drain (faad);
- gst_adapter_clear (faad->adapter);
+ gst_faad_reset_stream_state (faad);
res = gst_pad_push_event (faad->srcpad, event);
break;
case GST_EVENT_NEWSEGMENT:
@@ -997,8 +1006,7 @@ gst_faad_chain (GstPad * pad, GstBuffer * buffer)
if (GST_BUFFER_IS_DISCONT (buffer)) {
gst_faad_drain (faad);
- faacDecPostSeekReset (faad->handle, 0);
- gst_adapter_clear (faad->adapter);
+ gst_faad_reset_stream_state (faad);
faad->discont = TRUE;
}