static void gst_adder_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static gboolean gst_adder_setcaps (GstPad * pad, GstCaps * caps);
+static gboolean gst_adder_setcaps (GstAdder * adder, GstPad * pad,
+ GstCaps * caps);
static gboolean gst_adder_query (GstPad * pad, GstQuery * query);
static gboolean gst_adder_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_adder_sink_event (GstPad * pad, GstEvent * event);
* the other sinkpads because we can only mix streams with the same caps.
*/
static gboolean
-gst_adder_setcaps (GstPad * pad, GstCaps * caps)
+gst_adder_setcaps (GstAdder * adder, GstPad * pad, GstCaps * caps)
{
- GstAdder *adder;
GstStructure *structure;
const char *media_type;
GstIterator *it;
IterData idata;
gboolean done;
- adder = GST_ADDER (GST_PAD_PARENT (pad));
-
- GST_LOG_OBJECT (adder, "setting caps on pad %p,%s to %" GST_PTR_FORMAT, pad,
+ GST_LOG_OBJECT (adder, "setting caps pad %p,%s to %" GST_PTR_FORMAT, pad,
GST_PAD_NAME (pad), caps);
it = gst_element_iterate_pads (GST_ELEMENT_CAST (adder));
GST_DEBUG_PAD_NAME (pad));
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ ret = gst_adder_setcaps (adder, pad, caps);
+ gst_event_unref (event);
+
+ goto beach;
+ }
case GST_EVENT_FLUSH_STOP:
/* we received a flush-stop. The collect_event function will push the
* event past our element. We simply forward all flush-stop events, even
gst_pad_set_getcaps_function (adder->srcpad,
GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
- gst_pad_set_setcaps_function (adder->srcpad,
- GST_DEBUG_FUNCPTR (gst_adder_setcaps));
gst_pad_set_query_function (adder->srcpad,
GST_DEBUG_FUNCPTR (gst_adder_query));
gst_pad_set_event_function (adder->srcpad,
gst_pad_set_getcaps_function (newpad,
GST_DEBUG_FUNCPTR (gst_adder_sink_getcaps));
- gst_pad_set_setcaps_function (newpad, GST_DEBUG_FUNCPTR (gst_adder_setcaps));
gst_collect_pads_add_pad (adder->collect, newpad, sizeof (GstCollectData));
/* FIXME: hacked way to override/extend the event function of
}
static gboolean
-gst_audio_rate_setcaps (GstPad * pad, GstCaps * caps)
+gst_audio_rate_setcaps (GstAudioRate * audiorate, GstCaps * caps)
{
- GstAudioRate *audiorate;
GstStructure *structure;
- GstPad *otherpad;
- gboolean ret = FALSE;
gint channels, width, rate;
- audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
-
structure = gst_caps_get_structure (caps, 0);
if (!gst_structure_get_int (structure, "channels", &channels))
audiorate->rate = rate;
- /* the format is correct, configure caps on other pad */
- otherpad = (pad == audiorate->srcpad) ? audiorate->sinkpad :
- audiorate->srcpad;
-
- ret = gst_pad_set_caps (otherpad, caps);
-
-done:
- gst_object_unref (audiorate);
- return ret;
+ return TRUE;
/* ERRORS */
wrong_caps:
{
GST_DEBUG_OBJECT (audiorate, "could not get channels/width from caps");
- goto done;
+ return FALSE;
}
wrong_format:
{
GST_DEBUG_OBJECT (audiorate, "bytes_per_samples gave 0");
- goto done;
+ return FALSE;
}
}
gst_pad_new_from_static_template (&gst_audio_rate_sink_template, "sink");
gst_pad_set_event_function (audiorate->sinkpad, gst_audio_rate_sink_event);
gst_pad_set_chain_function (audiorate->sinkpad, gst_audio_rate_chain);
- gst_pad_set_setcaps_function (audiorate->sinkpad, gst_audio_rate_setcaps);
gst_pad_set_getcaps_function (audiorate->sinkpad, gst_pad_proxy_getcaps);
gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->sinkpad);
audiorate->srcpad =
gst_pad_new_from_static_template (&gst_audio_rate_src_template, "src");
gst_pad_set_event_function (audiorate->srcpad, gst_audio_rate_src_event);
- gst_pad_set_setcaps_function (audiorate->srcpad, gst_audio_rate_setcaps);
gst_pad_set_getcaps_function (audiorate->srcpad, gst_pad_proxy_getcaps);
gst_element_add_pad (GST_ELEMENT (audiorate), audiorate->srcpad);
audiorate = GST_AUDIO_RATE (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ if ((res = gst_audio_rate_setcaps (audiorate, caps))) {
+ res = gst_pad_push_event (audiorate->srcpad, event);
+ } else {
+ gst_event_unref (event);
+ }
+ break;
+ }
case GST_EVENT_FLUSH_STOP:
GST_DEBUG_OBJECT (audiorate, "handling FLUSH_STOP");
gst_audio_rate_reset (audiorate);
break;
}
- /* NEW_SEGMENT : lock, wait for other stream to EOS, select stream, unlock, push */
+ /* SEGMENT : lock, wait for other stream to EOS, select stream, unlock, push */
/* EOS : lock, mark pad as unused, unlock , drop event */
/* CUSTOM_REAL_EOS : push EOS downstream */
/* FLUSH_START : lock, mark as flushing, unlock. if wasn't flushing forward */
}
static gboolean
-gst_stream_combiner_sink_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstStreamCombiner *stream_combiner =
- (GstStreamCombiner *) GST_PAD_PARENT (pad);
- GstPad *peer;
- gboolean res = FALSE;
-
- GST_DEBUG_OBJECT (pad, "caps:%" GST_PTR_FORMAT, caps);
-
- peer = gst_pad_get_peer (stream_combiner->srcpad);
- if (peer) {
- GST_DEBUG_OBJECT (peer, "Setting caps");
- res = gst_pad_set_caps (peer, caps);
- gst_object_unref (peer);
- } else
- GST_WARNING_OBJECT (stream_combiner, "sourcepad has no peer !");
- return res;
-}
-
-static gboolean
gst_stream_combiner_src_event (GstPad * pad, GstEvent * event)
{
GstStreamCombiner *stream_combiner =
GST_DEBUG_OBJECT (element, "templ:%p, name:%s", templ, name);
sinkpad = gst_pad_new_from_static_template (&sink_template, name);
- /* FIXME : No buffer alloc for the time being, it will resort to the fallback */
- /* gst_pad_set_bufferalloc_function (sinkpad, gst_stream_combiner_buffer_alloc); */
gst_pad_set_chain_function (sinkpad, gst_stream_combiner_chain);
gst_pad_set_event_function (sinkpad, gst_stream_combiner_sink_event);
gst_pad_set_getcaps_function (sinkpad, gst_stream_combiner_sink_getcaps);
- gst_pad_set_setcaps_function (sinkpad, gst_stream_combiner_sink_setcaps);
STREAMS_LOCK (stream_combiner);
stream_combiner->sinkpads =
static void gst_stream_splitter_dispose (GObject * object);
+static gboolean gst_stream_splitter_sink_setcaps (GstPad * pad, GstCaps * caps);
+
static GstPad *gst_stream_splitter_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
static void gst_stream_splitter_release_pad (GstElement * element,
GST_EVENT_TYPE_NAME (event));
switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ res = gst_stream_splitter_sink_setcaps (pad, caps);
+
+ store = TRUE;
+ break;
+ }
case GST_EVENT_FLUSH_STOP:
flushpending = TRUE;
toall = TRUE;
gst_stream_splitter_sink_event);
gst_pad_set_getcaps_function (stream_splitter->sinkpad,
gst_stream_splitter_sink_getcaps);
- gst_pad_set_setcaps_function (stream_splitter->sinkpad,
- gst_stream_splitter_sink_setcaps);
gst_element_add_pad (GST_ELEMENT (stream_splitter), stream_splitter->sinkpad);
stream_splitter->lock = g_mutex_new ();
gst_ssa_parse_init (GstSsaParse * parse)
{
parse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
- gst_pad_set_setcaps_function (parse->sinkpad,
- GST_DEBUG_FUNCPTR (gst_ssa_parse_setcaps));
gst_pad_set_chain_function (parse->sinkpad,
GST_DEBUG_FUNCPTR (gst_ssa_parse_chain));
gst_pad_set_event_function (parse->sinkpad,
static gboolean
gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event)
{
- return gst_pad_event_default (pad, event);
+ gboolean res;
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps *caps;
+
+ gst_event_parse_caps (event, &caps);
+ res = gst_ssa_parse_setcaps (pad, caps);
+ gst_event_unref (event);
+ break;
+ }
+ default:
+ res = gst_pad_event_default (pad, event);
+ break;
+ }
+ return res;
}
static gboolean