diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-17 14:30:16 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-17 14:30:16 +0200 |
commit | 9f7344722983ceded1a2715ab0d939199ba87527 (patch) | |
tree | 1b8ae83e70c1d27c2a372c919cfd014a2abcfb5b /gst/goom2k1 | |
parent | 78c7c16e9e932ed9b7a51ecc60d5c777381797dc (diff) |
goom2k1: Fix event handling and negotiate as soon as possible
Diffstat (limited to 'gst/goom2k1')
-rw-r--r-- | gst/goom2k1/gstgoom.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/gst/goom2k1/gstgoom.c b/gst/goom2k1/gstgoom.c index e124edcd7..6376d35b2 100644 --- a/gst/goom2k1/gstgoom.c +++ b/gst/goom2k1/gstgoom.c @@ -106,6 +106,8 @@ static gboolean gst_goom_sink_event (GstPad * pad, GstObject * parent, static gboolean gst_goom_src_query (GstPad * pad, GstObject * parent, GstQuery * query); +static gboolean gst_goom_src_negotiate (GstGoom * goom); + #define gst_goom_parent_class parent_class typedef GstGoom GstGoom2k1; typedef GstGoomClass GstGoom2k1Class; @@ -203,10 +205,12 @@ gst_goom_sink_setcaps (GstGoom * goom, GstCaps * caps) res = gst_structure_get_int (structure, "channels", &goom->channels); res &= gst_structure_get_int (structure, "rate", &goom->rate); + if (!res) + return FALSE; goom->bps = goom->channels * sizeof (gint16); - return res; + return gst_goom_src_negotiate (goom); } static gboolean @@ -356,11 +360,11 @@ gst_goom_src_event (GstPad * pad, GstObject * parent, GstEvent * event) goom->earliest_time = timestamp + diff; GST_OBJECT_UNLOCK (goom); - res = gst_pad_push_event (goom->sinkpad, event); + res = gst_pad_event_default (pad, parent, event); break; } default: - res = gst_pad_push_event (goom->sinkpad, event); + res = gst_pad_event_default (pad, parent, event); break; } @@ -385,12 +389,9 @@ gst_goom_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) gst_event_unref (event); break; } - case GST_EVENT_FLUSH_START: - res = gst_pad_push_event (goom->srcpad, event); - break; case GST_EVENT_FLUSH_STOP: gst_goom_reset (goom); - res = gst_pad_push_event (goom->srcpad, event); + res = gst_pad_event_default (pad, parent, event); break; case GST_EVENT_SEGMENT: { @@ -399,11 +400,11 @@ gst_goom_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) * we can do QoS */ gst_event_copy_segment (event, &goom->segment); - res = gst_pad_push_event (goom->srcpad, event); + res = gst_pad_event_default (pad, parent, event); break; } default: - res = gst_pad_push_event (goom->srcpad, event); + res = gst_pad_event_default (pad, parent, event); break; } @@ -469,12 +470,7 @@ gst_goom_src_query (GstPad * pad, GstObject * parent, GstQuery * query) static GstFlowReturn ensure_negotiated (GstGoom * goom) { - gboolean reconfigure; - - reconfigure = gst_pad_check_reconfigure (goom->srcpad); - - /* we don't know an output format yet, pick one */ - if (reconfigure || !gst_pad_has_current_caps (goom->srcpad)) { + if (gst_pad_check_reconfigure (goom->srcpad)) { if (!gst_goom_src_negotiate (goom)) return GST_FLOW_NOT_NEGOTIATED; } |