summaryrefslogtreecommitdiffstats
path: root/gst/wavparse
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2007-09-13 12:37:56 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2007-09-13 12:37:56 +0000
commitd78b9e274b8a5cdcaf994f98301c7aba13e82419 (patch)
treec5d5bbf2c6cd8f11d3e4dd0cd09cf2b387158645 /gst/wavparse
parent8a6f9aa51a68fc33ca91ac43b16c683d7a3ad71d (diff)
gst/wavparse/gstwavparse.c: Add EOS logic for the push-based mode too. Fixes #476514.
Original commit message from CVS: * gst/wavparse/gstwavparse.c: (gst_wavparse_perform_eos), (gst_wavparse_loop), (gst_wavparse_chain): Add EOS logic for the push-based mode too. Fixes #476514.
Diffstat (limited to 'gst/wavparse')
-rw-r--r--gst/wavparse/gstwavparse.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c
index 43f11609..2f698c98 100644
--- a/gst/wavparse/gstwavparse.c
+++ b/gst/wavparse/gstwavparse.c
@@ -1703,6 +1703,43 @@ push_error:
}
static void
+gst_wavparse_perform_eos (GstWavParse * wav, GstFlowReturn ret)
+{
+ if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
+ if (ret == GST_FLOW_UNEXPECTED) {
+ /* add pad before we perform EOS */
+ if (G_UNLIKELY (wav->first)) {
+ wav->first = FALSE;
+ gst_wavparse_add_src_pad (wav, NULL);
+ }
+ /* perform EOS logic */
+ if (wav->segment.flags & GST_SEEK_FLAG_SEGMENT) {
+ GstClockTime stop;
+
+ if ((stop = wav->segment.stop) == -1)
+ stop = wav->segment.duration;
+
+ gst_element_post_message (GST_ELEMENT_CAST (wav),
+ gst_message_new_segment_done (GST_OBJECT_CAST (wav),
+ wav->segment.format, stop));
+ } else {
+ if (wav->srcpad != NULL)
+ gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
+ }
+ } else {
+ /* for fatal errors we post an error message, post the error
+ * first so the app knows about the error first. */
+ GST_ELEMENT_ERROR (wav, STREAM, FAILED,
+ (_("Internal data flow error.")),
+ ("streaming task paused, reason %s (%d)", gst_flow_get_name (ret),
+ ret));
+ if (wav->srcpad != NULL)
+ gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
+ }
+ }
+}
+
+static void
gst_wavparse_loop (GstPad * pad)
{
GstFlowReturn ret;
@@ -1746,37 +1783,7 @@ pause:
wav->segment_running = FALSE;
gst_pad_pause_task (pad);
- if (GST_FLOW_IS_FATAL (ret) || ret == GST_FLOW_NOT_LINKED) {
- if (ret == GST_FLOW_UNEXPECTED) {
- /* add pad before we perform EOS */
- if (G_UNLIKELY (wav->first)) {
- wav->first = FALSE;
- gst_wavparse_add_src_pad (wav, NULL);
- }
- /* perform EOS logic */
- if (wav->segment.flags & GST_SEEK_FLAG_SEGMENT) {
- GstClockTime stop;
-
- if ((stop = wav->segment.stop) == -1)
- stop = wav->segment.duration;
-
- gst_element_post_message (GST_ELEMENT_CAST (wav),
- gst_message_new_segment_done (GST_OBJECT_CAST (wav),
- wav->segment.format, stop));
- } else {
- if (wav->srcpad != NULL)
- gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
- }
- } else {
- /* for fatal errors we post an error message, post the error
- * first so the app knows about the error first. */
- GST_ELEMENT_ERROR (wav, STREAM, FAILED,
- (_("Internal data flow error.")),
- ("streaming task paused, reason %s (%d)", reason, ret));
- if (wav->srcpad != NULL)
- gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
- }
- }
+ gst_wavparse_perform_eos (wav, ret);
return;
}
}
@@ -1815,11 +1822,14 @@ gst_wavparse_chain (GstPad * pad, GstBuffer * buf)
/* fall-through */
case GST_WAVPARSE_DATA:
if ((ret = gst_wavparse_stream_data (wav)) != GST_FLOW_OK)
- goto done;
+ goto eos;
break;
default:
g_assert_not_reached ();
}
+eos:
+ gst_wavparse_perform_eos (wav, ret);
+ /* fallthrough */
done:
return ret;
}