2003-12-31 David Schleef <ds@schleef.org>
+ * gst/elements/gstidentity.c: (gst_identity_class_init),
+ (gst_identity_init), (gst_identity_chain),
+ (gst_identity_set_property), (gst_identity_get_property):
+ * gst/elements/gstidentity.h:
+ * gst/gstqueue.c: (gst_queue_init):
+ Negotiation fixes.
+
+2003-12-31 David Schleef <ds@schleef.org>
+
* gst/gstcaps.c: (gst_caps_intersect),
(_gst_caps_normalize_foreach), (gst_caps_normalize):
Implement gst_caps_normalize().
ARG_SILENT,
ARG_LAST_MESSAGE,
ARG_DUMP,
- ARG_DELAY_CAPSNEGO,
};
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
g_param_spec_boolean("dump", "Dump", "Dump buffer contents",
FALSE, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY_CAPSNEGO,
- g_param_spec_boolean("delay_capsnego", "Delay Caps Nego", "Delay capsnegotiation to loop/chain function",
- FALSE, G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
}
-static GstCaps*
-gst_identity_getcaps (GstPad *pad)
-{
- GstIdentity *identity;
- GstPad *otherpad;
- GstPad *peer;
-
- identity = GST_IDENTITY (gst_pad_get_parent (pad));
-
- if (identity->delay_capsnego) {
- return NULL;
- }
-
- otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
- peer = GST_PAD_PEER (otherpad);
-
- if (peer) {
- return gst_pad_get_caps (peer);
- } else {
- return gst_caps_new_any ();
- }
-}
-
-static GstPadLinkReturn
-gst_identity_link (GstPad *pad, const GstCaps *caps)
-{
- GstIdentity *identity;
-
- identity = GST_IDENTITY (gst_pad_get_parent (pad));
-
- if (gst_caps_is_fixed (caps)) {
- if (identity->delay_capsnego && GST_PAD_IS_SINK (pad)) {
- identity->srccaps = gst_caps_copy (caps);
-
- return GST_PAD_LINK_OK;
- }
- else {
- GstPad *otherpad;
-
- otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
-
- return gst_pad_try_set_caps (otherpad, caps);
- }
- }
- else
- return GST_PAD_LINK_DELAYED;
-}
-
static void
gst_identity_init (GstIdentity *identity)
{
identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
- gst_pad_set_link_function (identity->sinkpad, gst_identity_link);
- gst_pad_set_getcaps_function (identity->sinkpad, gst_identity_getcaps);
+ gst_pad_set_link_function (identity->sinkpad, gst_pad_proxy_pad_link);
+ gst_pad_set_getcaps_function (identity->sinkpad, gst_pad_proxy_getcaps);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
- gst_pad_set_link_function (identity->srcpad, gst_identity_link);
- gst_pad_set_getcaps_function (identity->srcpad, gst_identity_getcaps);
+ gst_pad_set_link_function (identity->srcpad, gst_pad_proxy_pad_link);
+ gst_pad_set_getcaps_function (identity->srcpad, gst_pad_proxy_getcaps);
identity->loop_based = FALSE;
identity->sleep_time = 0;
identity->silent = FALSE;
identity->dump = FALSE;
identity->last_message = NULL;
- identity->delay_capsnego = FALSE;
identity->srccaps = NULL;
}
identity = GST_IDENTITY (gst_pad_get_parent (pad));
- if (identity->delay_capsnego && identity->srccaps) {
- if (gst_pad_try_set_caps (identity->srcpad, identity->srccaps) <= 0) {
- if (!gst_pad_recover_caps_error (identity->srcpad, identity->srccaps)) {
- gst_buffer_unref (buf);
- return;
- }
- }
- identity->srccaps = NULL;
- }
-
if (identity->error_after >= 0) {
identity->error_after--;
if (identity->error_after == 0) {
case ARG_DUMP:
identity->dump = g_value_get_boolean (value);
break;
- case ARG_DELAY_CAPSNEGO:
- identity->delay_capsnego = g_value_get_boolean (value);
- break;
case ARG_ERROR_AFTER:
identity->error_after = g_value_get_int (value);
break;
case ARG_DUMP:
g_value_set_boolean (value, identity->dump);
break;
- case ARG_DELAY_CAPSNEGO:
- g_value_set_boolean (value, identity->delay_capsnego);
- break;
case ARG_LAST_MESSAGE:
g_value_set_string (value, identity->last_message);
break;
gboolean silent;
gboolean dump;
gchar *last_message;
- gboolean delay_capsnego;
GstCaps *srccaps;
};
GValue *value,
GParamSpec *pspec);
-static GstPadLinkReturn
- gst_queue_link (GstPad *pad,
- const GstCaps *caps);
static void gst_queue_chain (GstPad *pad,
GstData *data);
static GstData *gst_queue_get (GstPad *pad);
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_chain));
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
- gst_pad_set_link_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_link));
+ gst_pad_set_link_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_active (queue->sinkpad, TRUE);
queue->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get));
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
- gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_link));
+ gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_event_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
gst_pad_set_active (queue->srcpad, TRUE);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static GstPad *
-gst_queue_otherpad (GstPad *pad)
-{
- GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
- GstPad *otherpad;
-
- if (pad == queue->srcpad)
- otherpad = queue->sinkpad;
- else
- otherpad = queue->srcpad;
-
- return otherpad;
-}
-
-static GstPadLinkReturn
-gst_queue_link (GstPad *pad, const GstCaps *caps)
-{
- return gst_pad_try_set_caps (gst_queue_otherpad (pad), caps);
-}
-
static void
gst_queue_locked_flush (GstQueue *queue)
{
ARG_SILENT,
ARG_LAST_MESSAGE,
ARG_DUMP,
- ARG_DELAY_CAPSNEGO,
};
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
g_param_spec_boolean("dump", "Dump", "Dump buffer contents",
FALSE, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DELAY_CAPSNEGO,
- g_param_spec_boolean("delay_capsnego", "Delay Caps Nego", "Delay capsnegotiation to loop/chain function",
- FALSE, G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
}
-static GstCaps*
-gst_identity_getcaps (GstPad *pad)
-{
- GstIdentity *identity;
- GstPad *otherpad;
- GstPad *peer;
-
- identity = GST_IDENTITY (gst_pad_get_parent (pad));
-
- if (identity->delay_capsnego) {
- return NULL;
- }
-
- otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
- peer = GST_PAD_PEER (otherpad);
-
- if (peer) {
- return gst_pad_get_caps (peer);
- } else {
- return gst_caps_new_any ();
- }
-}
-
-static GstPadLinkReturn
-gst_identity_link (GstPad *pad, const GstCaps *caps)
-{
- GstIdentity *identity;
-
- identity = GST_IDENTITY (gst_pad_get_parent (pad));
-
- if (gst_caps_is_fixed (caps)) {
- if (identity->delay_capsnego && GST_PAD_IS_SINK (pad)) {
- identity->srccaps = gst_caps_copy (caps);
-
- return GST_PAD_LINK_OK;
- }
- else {
- GstPad *otherpad;
-
- otherpad = (pad == identity->srcpad ? identity->sinkpad : identity->srcpad);
-
- return gst_pad_try_set_caps (otherpad, caps);
- }
- }
- else
- return GST_PAD_LINK_DELAYED;
-}
-
static void
gst_identity_init (GstIdentity *identity)
{
identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad);
gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain));
- gst_pad_set_link_function (identity->sinkpad, gst_identity_link);
- gst_pad_set_getcaps_function (identity->sinkpad, gst_identity_getcaps);
+ gst_pad_set_link_function (identity->sinkpad, gst_pad_proxy_pad_link);
+ gst_pad_set_getcaps_function (identity->sinkpad, gst_pad_proxy_getcaps);
identity->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad);
- gst_pad_set_link_function (identity->srcpad, gst_identity_link);
- gst_pad_set_getcaps_function (identity->srcpad, gst_identity_getcaps);
+ gst_pad_set_link_function (identity->srcpad, gst_pad_proxy_pad_link);
+ gst_pad_set_getcaps_function (identity->srcpad, gst_pad_proxy_getcaps);
identity->loop_based = FALSE;
identity->sleep_time = 0;
identity->silent = FALSE;
identity->dump = FALSE;
identity->last_message = NULL;
- identity->delay_capsnego = FALSE;
identity->srccaps = NULL;
}
identity = GST_IDENTITY (gst_pad_get_parent (pad));
- if (identity->delay_capsnego && identity->srccaps) {
- if (gst_pad_try_set_caps (identity->srcpad, identity->srccaps) <= 0) {
- if (!gst_pad_recover_caps_error (identity->srcpad, identity->srccaps)) {
- gst_buffer_unref (buf);
- return;
- }
- }
- identity->srccaps = NULL;
- }
-
if (identity->error_after >= 0) {
identity->error_after--;
if (identity->error_after == 0) {
case ARG_DUMP:
identity->dump = g_value_get_boolean (value);
break;
- case ARG_DELAY_CAPSNEGO:
- identity->delay_capsnego = g_value_get_boolean (value);
- break;
case ARG_ERROR_AFTER:
identity->error_after = g_value_get_int (value);
break;
case ARG_DUMP:
g_value_set_boolean (value, identity->dump);
break;
- case ARG_DELAY_CAPSNEGO:
- g_value_set_boolean (value, identity->delay_capsnego);
- break;
case ARG_LAST_MESSAGE:
g_value_set_string (value, identity->last_message);
break;
gboolean silent;
gboolean dump;
gchar *last_message;
- gboolean delay_capsnego;
GstCaps *srccaps;
};
GValue *value,
GParamSpec *pspec);
-static GstPadLinkReturn
- gst_queue_link (GstPad *pad,
- const GstCaps *caps);
static void gst_queue_chain (GstPad *pad,
GstData *data);
static GstData *gst_queue_get (GstPad *pad);
queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_chain));
gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad);
- gst_pad_set_link_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_link));
+ gst_pad_set_link_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_active (queue->sinkpad, TRUE);
queue->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get));
gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad);
- gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_link));
+ gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_pad_set_event_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_handle_src_event));
gst_pad_set_active (queue->srcpad, TRUE);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
-static GstPad *
-gst_queue_otherpad (GstPad *pad)
-{
- GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
- GstPad *otherpad;
-
- if (pad == queue->srcpad)
- otherpad = queue->sinkpad;
- else
- otherpad = queue->srcpad;
-
- return otherpad;
-}
-
-static GstPadLinkReturn
-gst_queue_link (GstPad *pad, const GstCaps *caps)
-{
- return gst_pad_try_set_caps (gst_queue_otherpad (pad), caps);
-}
-
static void
gst_queue_locked_flush (GstQueue *queue)
{