summaryrefslogtreecommitdiffstats
path: root/gst/avi/gstavidemux.c
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2006-02-04 15:41:43 +0000
committerTim-Philipp Müller <tim@centricular.net>2006-02-04 15:41:43 +0000
commit4b5490014fb102cf65481d76222130d885eecebd (patch)
treeb7ca3fd21295b86bfbfa2b5c14b26a705efe0724 /gst/avi/gstavidemux.c
parent4836bfbcf703e9ee38432a43a83a1c901b7eb404 (diff)
gst/avi/gstavidemux.*: Third attempt, use gst_pad_is_linked() this time.
Original commit message from CVS: * gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream), (gst_avi_demux_all_source_pads_unlinked), (gst_avi_demux_process_next_entry): * gst/avi/gstavidemux.h: Third attempt, use gst_pad_is_linked() this time.
Diffstat (limited to 'gst/avi/gstavidemux.c')
-rw-r--r--gst/avi/gstavidemux.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index 74709a59..a67ebc2d 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -1052,6 +1052,7 @@ gst_avi_demux_parse_stream (GstElement * element, GstBuffer * buf)
if (stream->pad)
gst_object_unref (stream->pad);
pad = stream->pad = gst_pad_new_from_template (templ, padname);
+ stream->last_flow = GST_FLOW_OK;
g_free (padname);
gst_pad_use_fixed_caps (pad);
@@ -2243,20 +2244,17 @@ gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf)
static gboolean
gst_avi_demux_all_source_pads_unlinked (GstAviDemux * avi)
{
- gint i, num_unlinked = 0;
+ gint i;
for (i = 0; i < avi->num_streams; ++i) {
- GstPad *peer;
-
- peer = gst_pad_get_peer (avi->stream[i].pad);
- if (peer) {
- gst_object_unref (peer);
- } else if (avi->stream[i].current_frame > 0) {
- ++num_unlinked;
- }
+ if (gst_pad_is_linked (avi->stream[i].pad))
+ return FALSE;
+ /* ignore unlinked state if we haven't tried to push on this pad yet */
+ if (avi->stream[i].last_flow == GST_FLOW_OK)
+ return FALSE;
}
- return (num_unlinked == avi->num_streams);
+ return TRUE;
}
static GstFlowReturn
@@ -2314,6 +2312,7 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
GST_BUFFER_SIZE (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
GST_PAD_NAME (stream->pad));
res = gst_pad_push (stream->pad, buf);
+ stream->last_flow = res;
if (res != GST_FLOW_OK && res != GST_FLOW_NOT_LINKED) {
GST_DEBUG_OBJECT (avi, "Flow on pad %s: %s",
GST_PAD_NAME (stream->pad), gst_flow_get_name (res));