diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-05-19 11:53:57 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2011-05-19 11:53:57 +0200 |
commit | 07fb2432ce840d8fb6db1ab57be1e8cf52d2ac5b (patch) | |
tree | d36935727f433151eb55d4ebb8cf03b92e3eefa4 | |
parent | 4a646e0e76cd578a70a06031e1a8fd54ae04796d (diff) |
caps: remve the setcaps functionremove-setcaps
Remove the setcaps function an require plugins to use the CAPS event to
configure things.
-rw-r--r-- | gst/gstghostpad.c | 8 | ||||
-rw-r--r-- | gst/gstghostpad.h | 2 | ||||
-rw-r--r-- | gst/gstpad.c | 13 | ||||
-rw-r--r-- | gst/gstpad.h | 6 | ||||
-rw-r--r-- | libs/gst/base/gstbaseparse.c | 20 | ||||
-rw-r--r-- | libs/gst/base/gstbasesrc.c | 17 | ||||
-rw-r--r-- | plugins/elements/gstoutputselector.c | 8 | ||||
-rw-r--r-- | plugins/elements/gsttee.c | 4 | ||||
-rw-r--r-- | plugins/elements/gsttypefindelement.c | 11 | ||||
-rw-r--r-- | tools/gst-inspect.c | 2 |
10 files changed, 83 insertions, 8 deletions
diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 23ed3ba2b..e9d7a12d5 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -665,7 +665,7 @@ gst_proxy_pad_init (GstProxyPad * ppad) gst_pad_set_getcaps_function (pad, gst_proxy_pad_getcaps_default); gst_pad_set_acceptcaps_function (pad, gst_proxy_pad_acceptcaps_default); gst_pad_set_fixatecaps_function (pad, gst_proxy_pad_fixatecaps_default); - gst_pad_set_setcaps_function (pad, gst_proxy_pad_setcaps_default); + //gst_pad_set_setcaps_function (pad, gst_proxy_pad_setcaps_default); gst_pad_set_unlink_function (pad, gst_proxy_pad_unlink_default); } @@ -914,6 +914,7 @@ gst_ghost_pad_unlink_default (GstPad * pad) gst_proxy_pad_set_target (internal, NULL); } +#if 0 /** * gst_ghost_pad_setcaps_default: * @pad: the #GstPad to link. @@ -936,6 +937,7 @@ gst_ghost_pad_setcaps_default (GstPad * pad, GstCaps * caps) return gst_proxy_pad_setcaps_default (pad, caps); } +#endif static void gst_ghost_pad_class_init (GstGhostPadClass * klass) @@ -946,7 +948,9 @@ gst_ghost_pad_class_init (GstGhostPadClass * klass) gobject_class->dispose = gst_ghost_pad_dispose; +#if 0 GST_DEBUG_REGISTER_FUNCPTR (gst_ghost_pad_setcaps_default); +#endif GST_DEBUG_REGISTER_FUNCPTR (gst_ghost_pad_activate_pull_default); GST_DEBUG_REGISTER_FUNCPTR (gst_ghost_pad_activate_push_default); GST_DEBUG_REGISTER_FUNCPTR (gst_ghost_pad_link_default); @@ -958,8 +962,10 @@ gst_ghost_pad_init (GstGhostPad * pad) GST_GHOST_PAD_PRIVATE (pad) = G_TYPE_INSTANCE_GET_PRIVATE (pad, GST_TYPE_GHOST_PAD, GstGhostPadPrivate); +#if 0 gst_pad_set_setcaps_function (GST_PAD_CAST (pad), gst_ghost_pad_setcaps_default); +#endif gst_pad_set_activatepull_function (GST_PAD_CAST (pad), gst_ghost_pad_activate_pull_default); gst_pad_set_activatepush_function (GST_PAD_CAST (pad), diff --git a/gst/gstghostpad.h b/gst/gstghostpad.h index 3225e2aa1..8d0e5136a 100644 --- a/gst/gstghostpad.h +++ b/gst/gstghostpad.h @@ -122,7 +122,9 @@ gboolean gst_ghost_pad_set_target (GstGhostPad *gpad, GstPad *newtarget); gboolean gst_ghost_pad_construct (GstGhostPad *gpad); +#if 0 gboolean gst_ghost_pad_setcaps_default (GstPad * pad, GstCaps * caps); +#endif void gst_ghost_pad_unlink_default (GstPad * pad); GstPadLinkReturn gst_ghost_pad_link_default (GstPad * pad, GstPad * peer); gboolean gst_ghost_pad_activate_pull_default (GstPad * pad, gboolean active); diff --git a/gst/gstpad.c b/gst/gstpad.c index b058b9e67..64925d8de 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1647,6 +1647,7 @@ gst_pad_set_fixatecaps_function (GstPad * pad, GST_DEBUG_FUNCPTR_NAME (fixatecaps)); } +#if 0 /** * gst_pad_set_setcaps_function: * @pad: a #GstPad. @@ -1667,6 +1668,7 @@ gst_pad_set_setcaps_function (GstPad * pad, GstPadSetCapsFunction setcaps) GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "setcapsfunc set to %s", GST_DEBUG_FUNCPTR_NAME (setcaps)); } +#endif /** * gst_pad_unlink: @@ -2734,6 +2736,7 @@ gst_pad_set_caps (GstPad * pad, GstCaps * caps) return res; } +#if 0 static gboolean gst_pad_call_setcaps (GstPad * pad, GstCaps * caps) { @@ -2758,8 +2761,6 @@ gst_pad_call_setcaps (GstPad * pad, GstCaps * caps) } GST_OBJECT_UNLOCK (pad); - g_object_notify_by_pspec ((GObject *) pad, pspec_caps); - return TRUE; /* ERRORS */ @@ -2768,6 +2769,7 @@ setcaps_failed: return FALSE; } } +#endif static gboolean do_event_function (GstPad * pad, GstEvent * event, @@ -2787,8 +2789,12 @@ do_event_function (GstPad * pad, GstEvent * event, if (!gst_caps_can_intersect (caps, templ)) goto not_accepted; +#if 0 if (!gst_pad_call_setcaps (pad, caps)) goto not_accepted; +#endif + + g_object_notify_by_pspec ((GObject *) pad, pspec_caps); gst_caps_unref (templ); break; @@ -4614,12 +4620,15 @@ gst_pad_push_event (GstPad * pad, GstEvent * event) /* backwards compatibility mode for caps */ if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) { +#if 0 GstCaps *caps; gst_event_parse_caps (event, &caps); /* FIXME, this is awkward because we don't check flushing here which means * that we can call the setcaps functions on flushing pads, this is not * quite what we want */ gst_pad_call_setcaps (pad, caps); +#endif + g_object_notify_by_pspec ((GObject *) pad, pspec_caps); } /* now check the peer pad */ diff --git a/gst/gstpad.h b/gst/gstpad.h index 18b7776d6..783130896 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -435,6 +435,7 @@ typedef void (*GstPadUnlinkFunction) (GstPad *pad); */ typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *filter); +#if 0 /** * GstPadSetCapsFunction: * @pad: the #GstPad to set the capabilities of. @@ -447,6 +448,7 @@ typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *filter); * Returns: TRUE if the caps could be set on the pad. */ typedef gboolean (*GstPadSetCapsFunction) (GstPad *pad, GstCaps *caps); +#endif /** * GstPadAcceptCapsFunction: * @pad: the #GstPad to check @@ -609,7 +611,9 @@ struct _GstPad { /* the pad capabilities */ GstPadGetCapsFunction getcapsfunc; +#if 0 GstPadSetCapsFunction setcapsfunc; +#endif GstPadAcceptCapsFunction acceptcapsfunc; GstPadFixateCapsFunction fixatecapsfunc; @@ -846,7 +850,9 @@ GstPad* gst_pad_get_peer (GstPad *pad); void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps); void gst_pad_set_acceptcaps_function (GstPad *pad, GstPadAcceptCapsFunction acceptcaps); void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps); +#if 0 void gst_pad_set_setcaps_function (GstPad *pad, GstPadSetCapsFunction setcaps); +#endif GstCaps* gst_pad_get_pad_template_caps (GstPad *pad); diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c index 15a0b06f4..b75b75274 100644 --- a/libs/gst/base/gstbaseparse.c +++ b/libs/gst/base/gstbaseparse.c @@ -377,7 +377,9 @@ static void gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event); static gboolean gst_base_parse_src_event (GstPad * pad, GstEvent * event); static gboolean gst_base_parse_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_base_parse_query (GstPad * pad, GstQuery * query); +#if 0 static gboolean gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps); +#endif static const GstQueryType *gst_base_parse_get_querytypes (GstPad * pad); static GstFlowReturn gst_base_parse_chain (GstPad * pad, GstBuffer * buffer); @@ -509,8 +511,10 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass) parse->sinkpad = gst_pad_new_from_template (pad_template, "sink"); gst_pad_set_event_function (parse->sinkpad, GST_DEBUG_FUNCPTR (gst_base_parse_sink_event)); +#if 0 gst_pad_set_setcaps_function (parse->sinkpad, GST_DEBUG_FUNCPTR (gst_base_parse_sink_setcaps)); +#endif gst_pad_set_chain_function (parse->sinkpad, GST_DEBUG_FUNCPTR (gst_base_parse_chain)); gst_pad_set_activate_function (parse->sinkpad, @@ -913,6 +917,20 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) GstEvent **eventp; switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_CAPS: + { + GstCaps *caps; + GstBaseParseClass *klass; + + gst_event_parse_caps (event, &caps); + + GST_DEBUG_OBJECT (parse, "caps: %" GST_PTR_FORMAT, caps); + + klass = GST_BASE_PARSE_GET_CLASS (parse); + if (klass->set_sink_caps) + handled = klass->set_sink_caps (parse, caps); + break; + } case GST_EVENT_SEGMENT: { const GstSegment *in_segment; @@ -3800,6 +3818,7 @@ gst_base_parse_handle_tag (GstBaseParse * parse, GstEvent * event) } } +#if 0 static gboolean gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps) { @@ -3817,6 +3836,7 @@ gst_base_parse_sink_setcaps (GstPad * pad, GstCaps * caps) return res; } +#endif static void gst_base_parse_set_index (GstElement * element, GstIndex * index) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index f2d8a4426..d1e5215d2 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -281,7 +281,9 @@ gst_base_src_get_type (void) } static GstCaps *gst_base_src_getcaps (GstPad * pad, GstCaps * filter); +#if 0 static gboolean gst_base_src_setcaps (GstPad * pad, GstCaps * caps); +#endif static void gst_base_src_fixate (GstPad * pad, GstCaps * caps); static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active); @@ -383,7 +385,9 @@ gst_base_src_class_init (GstBaseSrcClass * klass) GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_pad_get_range); GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_pad_check_get_range); GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_getcaps); +#if 0 GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_setcaps); +#endif GST_DEBUG_REGISTER_FUNCPTR (gst_base_src_fixate); } @@ -419,7 +423,9 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class) gst_pad_set_checkgetrange_function (pad, gst_base_src_pad_check_get_range); gst_pad_set_getrange_function (pad, gst_base_src_pad_get_range); gst_pad_set_getcaps_function (pad, gst_base_src_getcaps); +#if 0 gst_pad_set_setcaps_function (pad, gst_base_src_setcaps); +#endif gst_pad_set_fixatecaps_function (pad, gst_base_src_fixate); /* hold pointer to pad */ @@ -769,18 +775,19 @@ gst_base_src_new_seamless_segment (GstBaseSrc * src, gint64 start, gint64 stop, } static gboolean -gst_base_src_setcaps (GstPad * pad, GstCaps * caps) +gst_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps) { GstBaseSrcClass *bclass; - GstBaseSrc *bsrc; gboolean res = TRUE; - bsrc = GST_BASE_SRC (GST_PAD_PARENT (pad)); bclass = GST_BASE_SRC_GET_CLASS (bsrc); if (bclass->set_caps) res = bclass->set_caps (bsrc, caps); + if (res) { + gst_pad_push_event (GST_BASE_SRC_PAD (bsrc), gst_event_new_caps (caps)); + } return res; } @@ -2596,7 +2603,7 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) if (gst_caps_is_fixed (caps)) { /* yay, fixed caps, use those then, it's possible that the subclass does * not accept this caps after all and we have to fail. */ - result = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), caps); + result = gst_base_src_setcaps (basesrc, caps); } } gst_caps_unref (caps); @@ -2712,7 +2719,7 @@ gst_base_src_start (GstBaseSrc * basesrc) if (!(caps = gst_type_find_helper (basesrc->srcpad, size))) goto typefind_failed; - result = gst_pad_set_caps (basesrc->srcpad, caps); + result = gst_base_src_setcaps (basesrc, caps); gst_caps_unref (caps); } else { /* use class or default negotiate function */ diff --git a/plugins/elements/gstoutputselector.c b/plugins/elements/gstoutputselector.c index 56f0f6921..5377fc67a 100644 --- a/plugins/elements/gstoutputselector.c +++ b/plugins/elements/gstoutputselector.c @@ -309,6 +309,7 @@ gst_output_selector_sink_getcaps (GstPad * pad, GstCaps * filter) return caps; } +#if 0 static gboolean gst_output_selector_sink_setcaps (GstPad * pad, GstCaps * caps) { @@ -329,6 +330,7 @@ gst_output_selector_sink_setcaps (GstPad * pad, GstCaps * caps) } return ret; } +#endif static void gst_output_selector_switch_pad_negotiation_mode (GstOutputSelector * sel, @@ -337,15 +339,21 @@ gst_output_selector_switch_pad_negotiation_mode (GstOutputSelector * sel, sel->pad_negotiation_mode = mode; if (mode == GST_OUTPUT_SELECTOR_PAD_NEGOTIATION_MODE_ALL) { gst_pad_set_getcaps_function (sel->sinkpad, gst_pad_proxy_getcaps); +#if 0 gst_pad_set_setcaps_function (sel->sinkpad, gst_pad_proxy_setcaps); +#endif } else if (mode == GST_OUTPUT_SELECTOR_PAD_NEGOTIATION_MODE_NONE) { gst_pad_set_getcaps_function (sel->sinkpad, NULL); +#if 0 gst_pad_set_setcaps_function (sel->sinkpad, NULL); +#endif } else { /* active */ gst_pad_set_getcaps_function (sel->sinkpad, gst_output_selector_sink_getcaps); +#if 0 gst_pad_set_setcaps_function (sel->sinkpad, gst_output_selector_sink_setcaps); +#endif } } diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index 3edd39822..ae4929dd7 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -245,8 +245,10 @@ gst_tee_init (GstTee * tee) tee->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); tee->sink_mode = GST_ACTIVATE_NONE; +#if 0 gst_pad_set_setcaps_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps)); +#endif gst_pad_set_getcaps_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_pad_set_acceptcaps_function (tee->sinkpad, @@ -319,8 +321,10 @@ gst_tee_request_new_pad (GstElement * element, GstPadTemplate * templ, if (!res) goto activate_failed; +#if 0 gst_pad_set_setcaps_function (srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps)); +#endif gst_pad_set_getcaps_function (srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps)); gst_pad_set_activatepull_function (srcpad, diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index b34c3bd5b..518f00050 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -259,8 +259,10 @@ gst_type_find_element_init (GstTypeFindElement * typefind) gst_pad_set_activate_function (typefind->sink, GST_DEBUG_FUNCPTR (gst_type_find_element_activate)); +#if 0 gst_pad_set_setcaps_function (typefind->sink, GST_DEBUG_FUNCPTR (gst_type_find_element_setcaps)); +#endif gst_pad_set_chain_function (typefind->sink, GST_DEBUG_FUNCPTR (gst_type_find_element_chain)); gst_pad_set_event_function (typefind->sink, @@ -553,6 +555,14 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) case GST_EVENT_FLUSH_START: res = gst_pad_push_event (typefind->src, event); break; + case GST_EVENT_CAPS: + { + GstCaps *caps; + + gst_event_parse_caps (event, &caps); + res = gst_type_find_element_setcaps (pad, caps); + break; + } default: GST_DEBUG_OBJECT (typefind, "Saving %s event to send later", GST_EVENT_TYPE_NAME (event)); @@ -568,6 +578,7 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) res = gst_pad_push_event (typefind->src, event); break; case MODE_ERROR: + gst_event_unref (event); break; default: g_assert_not_reached (); diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index ec9f67afe..0a587d651 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -840,9 +840,11 @@ print_pad_info (GstElement * element) if (pad->getcapsfunc) n_print (" Has getcapsfunc(): %s\n", GST_DEBUG_FUNCPTR_NAME (pad->getcapsfunc)); +#if 0 if (pad->setcapsfunc) n_print (" Has setcapsfunc(): %s\n", GST_DEBUG_FUNCPTR_NAME (pad->setcapsfunc)); +#endif /* gst_pad_acceptcaps_default is static :/ */ if (pad->acceptcapsfunc) n_print (" Has acceptcapsfunc(): %s\n", |