mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 06:52:41 +00:00
Negotiation fixes
Original commit message from CVS: Negotiation fixes
This commit is contained in:
parent
58f4b89e95
commit
e7d186c69a
7 changed files with 21 additions and 198 deletions
|
@ -1,3 +1,12 @@
|
|||
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),
|
||||
|
|
|
@ -57,7 +57,6 @@ enum {
|
|||
ARG_SILENT,
|
||||
ARG_LAST_MESSAGE,
|
||||
ARG_DUMP,
|
||||
ARG_DELAY_CAPSNEGO,
|
||||
};
|
||||
|
||||
|
||||
|
@ -138,9 +137,6 @@ gst_identity_class_init (GstIdentityClass *klass)
|
|||
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,
|
||||
|
@ -152,67 +148,19 @@ gst_identity_class_init (GstIdentityClass *klass)
|
|||
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;
|
||||
|
@ -222,7 +170,6 @@ gst_identity_init (GstIdentity *identity)
|
|||
identity->silent = FALSE;
|
||||
identity->dump = FALSE;
|
||||
identity->last_message = NULL;
|
||||
identity->delay_capsnego = FALSE;
|
||||
identity->srccaps = NULL;
|
||||
}
|
||||
|
||||
|
@ -239,16 +186,6 @@ gst_identity_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
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) {
|
||||
|
@ -358,9 +295,6 @@ gst_identity_set_property (GObject *object, guint prop_id, const GValue *value,
|
|||
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;
|
||||
|
@ -402,9 +336,6 @@ static void gst_identity_get_property(GObject *object, guint prop_id, GValue *va
|
|||
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;
|
||||
|
|
|
@ -58,7 +58,6 @@ struct _GstIdentity {
|
|||
gboolean silent;
|
||||
gboolean dump;
|
||||
gchar *last_message;
|
||||
gboolean delay_capsnego;
|
||||
GstCaps *srccaps;
|
||||
};
|
||||
|
||||
|
|
|
@ -83,9 +83,6 @@ static void gst_queue_get_property (GObject *object,
|
|||
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);
|
||||
|
@ -250,14 +247,14 @@ gst_queue_init (GstQueue *queue)
|
|||
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);
|
||||
|
@ -314,26 +311,6 @@ gst_queue_dispose (GObject *object)
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,6 @@ enum {
|
|||
ARG_SILENT,
|
||||
ARG_LAST_MESSAGE,
|
||||
ARG_DUMP,
|
||||
ARG_DELAY_CAPSNEGO,
|
||||
};
|
||||
|
||||
|
||||
|
@ -138,9 +137,6 @@ gst_identity_class_init (GstIdentityClass *klass)
|
|||
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,
|
||||
|
@ -152,67 +148,19 @@ gst_identity_class_init (GstIdentityClass *klass)
|
|||
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;
|
||||
|
@ -222,7 +170,6 @@ gst_identity_init (GstIdentity *identity)
|
|||
identity->silent = FALSE;
|
||||
identity->dump = FALSE;
|
||||
identity->last_message = NULL;
|
||||
identity->delay_capsnego = FALSE;
|
||||
identity->srccaps = NULL;
|
||||
}
|
||||
|
||||
|
@ -239,16 +186,6 @@ gst_identity_chain (GstPad *pad, GstData *_data)
|
|||
|
||||
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) {
|
||||
|
@ -358,9 +295,6 @@ gst_identity_set_property (GObject *object, guint prop_id, const GValue *value,
|
|||
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;
|
||||
|
@ -402,9 +336,6 @@ static void gst_identity_get_property(GObject *object, guint prop_id, GValue *va
|
|||
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;
|
||||
|
|
|
@ -58,7 +58,6 @@ struct _GstIdentity {
|
|||
gboolean silent;
|
||||
gboolean dump;
|
||||
gchar *last_message;
|
||||
gboolean delay_capsnego;
|
||||
GstCaps *srccaps;
|
||||
};
|
||||
|
||||
|
|
|
@ -83,9 +83,6 @@ static void gst_queue_get_property (GObject *object,
|
|||
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);
|
||||
|
@ -250,14 +247,14 @@ gst_queue_init (GstQueue *queue)
|
|||
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);
|
||||
|
@ -314,26 +311,6 @@ gst_queue_dispose (GObject *object)
|
|||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue