check/: Application message API change.

Original commit message from CVS:
2005-07-05  Andy Wingo  <wingo@pobox.com>

* check/gst/gstbus.c (pound_bus_with_messages):
* check/gst/gstmessage.c (START_TEST):
* check/pipelines/simple_launch_lines.c (got_handoff): Application
message API change.

* gst/base/gstbasetransform.c (gst_base_transform_setcaps): More
logic weaks here: always run transform_caps, trying passthrough
operation only if the original caps intersects with the transform.

* gst/gstpad.c (gst_pad_link_check_compatible_unlocked): Debug
source and sink caps.

* gst/base/gstbasetransform.c (gst_base_transform_getcaps):
Intersect the peer caps with the pad template before going into
transform_caps.
(gst_base_transform_transform_caps): More debugging.

* gst/gstmessage.h (gst_message_new_application): Take a GstObject
src argument.
This commit is contained in:
Andy Wingo 2005-07-05 08:47:40 +00:00
parent e3141fc8f5
commit 83a7075f8a
13 changed files with 203 additions and 132 deletions

View file

@ -1,3 +1,25 @@
2005-07-05 Andy Wingo <wingo@pobox.com>
* check/gst/gstbus.c (pound_bus_with_messages):
* check/gst/gstmessage.c (START_TEST):
* check/pipelines/simple_launch_lines.c (got_handoff): Application
message API change.
* gst/base/gstbasetransform.c (gst_base_transform_setcaps): More
logic weaks here: always run transform_caps, trying passthrough
operation only if the original caps intersects with the transform.
* gst/gstpad.c (gst_pad_link_check_compatible_unlocked): Debug
source and sink caps.
* gst/base/gstbasetransform.c (gst_base_transform_getcaps):
Intersect the peer caps with the pad template before going into
transform_caps.
(gst_base_transform_transform_caps): More debugging.
* gst/gstmessage.h (gst_message_new_application): Take a GstObject
src argument.
2005-07-04 Edward Hervey <edward@fluendo.com>
* gst/gstutils.c:

View file

@ -40,7 +40,7 @@ pound_bus_with_messages (gpointer data)
s = gst_structure_new ("test_message",
"thread_id", G_TYPE_INT, thread_id, "msg_id", G_TYPE_INT, i, NULL);
m = gst_message_new_application (s);
m = gst_message_new_application (NULL, s);
gst_bus_post (test_bus, m);
}
return NULL;

View file

@ -148,7 +148,7 @@ START_TEST (test_parsing)
"some_int", G_TYPE_INT, 10,
"a_double", G_TYPE_DOUBLE, (gdouble) 1.8, NULL);
fail_if (structure == NULL);
message = gst_message_new_application (structure);
message = gst_message_new_application (NULL, structure);
fail_if (message == NULL);
struc = gst_message_get_structure (message);
fail_if (struc == NULL);

View file

@ -103,7 +103,8 @@ END_TEST static void
got_handoff (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer unused)
{
gst_element_post_message
(sink, gst_message_new_application (gst_structure_new ("foo", NULL)));
(sink, gst_message_new_application (NULL, gst_structure_new ("foo",
NULL)));
}
static void

View file

@ -822,6 +822,7 @@ Checks if the pad is a sink pad.
@pad:
@handler:
@data:
@Returns:
<!-- ##### FUNCTION gst_pad_add_buffer_probe ##### -->
@ -832,6 +833,7 @@ Checks if the pad is a sink pad.
@pad:
@handler:
@data:
@Returns:
<!-- ##### FUNCTION gst_pad_add_event_probe ##### -->
@ -842,6 +844,7 @@ Checks if the pad is a sink pad.
@pad:
@handler:
@data:
@Returns:
<!-- ##### FUNCTION gst_pad_remove_data_probe ##### -->

View file

@ -180,14 +180,21 @@ static GstCaps *
gst_base_transform_transform_caps (GstBaseTransform * trans, GstPad * pad,
GstCaps * caps)
{
GstCaps *ret;
GstBaseTransformClass *klass;
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_DEBUG_OBJECT (trans, "from: %" GST_PTR_FORMAT, caps);
if (klass->transform_caps)
return klass->transform_caps (trans, pad, caps);
ret = klass->transform_caps (trans, pad, caps);
else
return gst_caps_ref (caps);
ret = gst_caps_ref (caps);
GST_DEBUG_OBJECT (trans, "to: %" GST_PTR_FORMAT, ret);
return ret;
}
static GstCaps *
@ -207,10 +214,13 @@ gst_base_transform_getcaps (GstPad * pad)
if (caps) {
GstCaps *temp;
temp = gst_base_transform_transform_caps (trans, otherpad, caps);
temp = gst_caps_intersect (caps, gst_pad_get_pad_template_caps (otherpad));
gst_caps_unref (caps);
caps = gst_caps_intersect (temp, gst_pad_get_pad_template_caps (pad));
caps = gst_base_transform_transform_caps (trans, otherpad, temp);
gst_caps_unref (temp);
temp = gst_caps_intersect (caps, gst_pad_get_pad_template_caps (pad));
gst_caps_unref (caps);
caps = temp;
} else {
/* no peer, our padtemplate is enough then */
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
@ -224,9 +234,9 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
{
GstBaseTransform *trans;
GstBaseTransformClass *klass;
GstStructure *structure;
GstPad *otherpad, *otherpeer;
gboolean ret = TRUE;
GstCaps *othercaps = NULL;
gboolean ret = FALSE;
trans = GST_BASE_TRANSFORM (GST_PAD_PARENT (pad));
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
@ -234,70 +244,78 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
otherpeer = gst_pad_get_peer (otherpad);
if (GST_PAD_IS_IN_SETCAPS (otherpad))
if (GST_PAD_IS_IN_SETCAPS (otherpad)) {
ret = TRUE;
goto done;
}
if (otherpeer == NULL || gst_pad_accept_caps (otherpeer, caps)) {
/* the peer accepts the caps as they are */
gst_pad_set_caps (otherpad, caps);
/* let the element know */
if (klass->set_caps)
klass->set_caps (trans, caps, caps);
ret = TRUE;
} else {
GstCaps *peercaps;
GstCaps *intersect;
GstCaps *transform = NULL;
GstCaps *othercaps;
/* see how we can transform the input caps */
othercaps = gst_base_transform_transform_caps (trans, pad, caps);
if (!othercaps) {
ret = FALSE;
goto done;
}
/* other pad has a peer, so we have to figure out how to do the conversion
*/
/* see how we can transform the input caps */
transform = gst_base_transform_transform_caps (trans, pad, caps);
if (!gst_caps_is_fixed (othercaps)) {
GstCaps *temp;
if (!transform)
goto done;
/* see what the peer can do */
peercaps = gst_pad_get_caps (otherpeer);
GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
/* filter against our possibilities */
intersect = gst_caps_intersect (peercaps, transform);
gst_caps_unref (peercaps);
gst_caps_unref (transform);
GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
/* take first possibility */
othercaps = gst_caps_copy_nth (intersect, 0);
gst_caps_unref (intersect);
structure = gst_caps_get_structure (othercaps, 0);
/* and fixate if necessary */
gst_pad_fixate_caps (otherpad, othercaps);
g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
gst_pad_set_caps (otherpad, othercaps);
/* let the element know */
if (klass->set_caps) {
if (pad == trans->sinkpad) {
klass->set_caps (trans, caps, othercaps);
} else {
klass->set_caps (trans, othercaps, caps);
temp = gst_caps_intersect (othercaps, caps);
if (temp) {
/* try passthrough. we know it's fixed, because caps is fixed */
if (gst_pad_accept_caps (otherpeer, caps)) {
gst_caps_unref (othercaps);
othercaps = gst_caps_ref (caps);
/* will fall though. calls accept_caps again, should fix that. */
}
gst_caps_unref (temp);
}
}
ret = TRUE;
if (!gst_caps_is_fixed (othercaps) && otherpeer) {
/* intersect against what the peer can do */
if (otherpeer) {
GstCaps *peercaps;
GstCaps *intersect;
peercaps = gst_pad_get_caps (otherpeer);
intersect = gst_caps_intersect (peercaps, othercaps);
gst_caps_unref (peercaps);
gst_caps_unref (othercaps);
othercaps = intersect;
GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
}
}
if (!gst_caps_is_fixed (othercaps)) {
GstCaps *temp;
/* take first possibility and fixate if necessary */
temp = gst_caps_copy_nth (othercaps, 0);
gst_caps_unref (othercaps);
othercaps = temp;
gst_pad_fixate_caps (otherpad, othercaps);
}
g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
if (otherpeer && !gst_pad_accept_caps (otherpeer, othercaps)) {
GST_DEBUG ("FAILED to get peer of %" GST_PTR_FORMAT
" to accept %" GST_PTR_FORMAT, otherpad, othercaps);
ret = FALSE;
goto done;
}
/* we know this will work, we implement the setcaps */
gst_pad_set_caps (otherpad, othercaps);
/* success, let the element know */
if (klass->set_caps) {
if (pad == trans->sinkpad)
ret = klass->set_caps (trans, caps, othercaps);
else
ret = klass->set_caps (trans, othercaps, caps);
}
done:
@ -305,6 +323,9 @@ done:
if (otherpeer)
gst_object_unref (otherpeer);
if (othercaps)
gst_caps_unref (othercaps);
return ret;
}

View file

@ -310,6 +310,7 @@ gst_message_new_state_changed (GstObject * src, GstElementState old,
/**
* gst_message_new_application:
* @src: The object originating the message.
* @structure: The structure for the message. The message will take ownership of
* the structure.
*
@ -321,13 +322,13 @@ gst_message_new_state_changed (GstObject * src, GstElementState old,
* MT safe.
*/
GstMessage *
gst_message_new_application (GstStructure * structure)
gst_message_new_application (GstObject * src, GstStructure * structure)
{
GstMessage *message;
g_return_val_if_fail (GST_IS_STRUCTURE (structure), NULL);
message = gst_message_new (GST_MESSAGE_APPLICATION, NULL);
message = gst_message_new (GST_MESSAGE_APPLICATION, src);
gst_structure_set_parent_refcount (structure, &message->mini_object.refcount);
message->structure = structure;

View file

@ -133,7 +133,7 @@ GstMessage * gst_message_new_warning (GstObject * src, GError * error, gchar *
GstMessage * gst_message_new_tag (GstObject * src, GstTagList * tag_list);
GstMessage * gst_message_new_state_changed (GstObject * src, GstElementState old_state,
GstElementState new_state);
GstMessage * gst_message_new_application (GstStructure *structure);
GstMessage * gst_message_new_application (GstObject * src, GstStructure *structure);
void gst_message_parse_error (GstMessage *message, GError **gerror, gchar **debug);
void gst_message_parse_warning (GstMessage *message, GError **gerror, gchar **debug);

View file

@ -1367,7 +1367,8 @@ gst_pad_link_check_compatible_unlocked (GstPad * src, GstPad * sink)
srccaps = gst_pad_get_caps_unlocked (src);
sinkcaps = gst_pad_get_caps_unlocked (sink);
GST_CAT_DEBUG (GST_CAT_CAPS, "got caps %p and %p", srccaps, sinkcaps);
GST_CAT_DEBUG (GST_CAT_CAPS, " src caps %" GST_PTR_FORMAT, srccaps);
GST_CAT_DEBUG (GST_CAT_CAPS, "sink caps %" GST_PTR_FORMAT, sinkcaps);
if (srccaps && sinkcaps) {
GstCaps *icaps;

View file

@ -180,14 +180,21 @@ static GstCaps *
gst_base_transform_transform_caps (GstBaseTransform * trans, GstPad * pad,
GstCaps * caps)
{
GstCaps *ret;
GstBaseTransformClass *klass;
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
GST_DEBUG_OBJECT (trans, "from: %" GST_PTR_FORMAT, caps);
if (klass->transform_caps)
return klass->transform_caps (trans, pad, caps);
ret = klass->transform_caps (trans, pad, caps);
else
return gst_caps_ref (caps);
ret = gst_caps_ref (caps);
GST_DEBUG_OBJECT (trans, "to: %" GST_PTR_FORMAT, ret);
return ret;
}
static GstCaps *
@ -207,10 +214,13 @@ gst_base_transform_getcaps (GstPad * pad)
if (caps) {
GstCaps *temp;
temp = gst_base_transform_transform_caps (trans, otherpad, caps);
temp = gst_caps_intersect (caps, gst_pad_get_pad_template_caps (otherpad));
gst_caps_unref (caps);
caps = gst_caps_intersect (temp, gst_pad_get_pad_template_caps (pad));
caps = gst_base_transform_transform_caps (trans, otherpad, temp);
gst_caps_unref (temp);
temp = gst_caps_intersect (caps, gst_pad_get_pad_template_caps (pad));
gst_caps_unref (caps);
caps = temp;
} else {
/* no peer, our padtemplate is enough then */
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
@ -224,9 +234,9 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
{
GstBaseTransform *trans;
GstBaseTransformClass *klass;
GstStructure *structure;
GstPad *otherpad, *otherpeer;
gboolean ret = TRUE;
GstCaps *othercaps = NULL;
gboolean ret = FALSE;
trans = GST_BASE_TRANSFORM (GST_PAD_PARENT (pad));
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
@ -234,70 +244,78 @@ gst_base_transform_setcaps (GstPad * pad, GstCaps * caps)
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
otherpeer = gst_pad_get_peer (otherpad);
if (GST_PAD_IS_IN_SETCAPS (otherpad))
if (GST_PAD_IS_IN_SETCAPS (otherpad)) {
ret = TRUE;
goto done;
}
if (otherpeer == NULL || gst_pad_accept_caps (otherpeer, caps)) {
/* the peer accepts the caps as they are */
gst_pad_set_caps (otherpad, caps);
/* let the element know */
if (klass->set_caps)
klass->set_caps (trans, caps, caps);
ret = TRUE;
} else {
GstCaps *peercaps;
GstCaps *intersect;
GstCaps *transform = NULL;
GstCaps *othercaps;
/* see how we can transform the input caps */
othercaps = gst_base_transform_transform_caps (trans, pad, caps);
if (!othercaps) {
ret = FALSE;
goto done;
}
/* other pad has a peer, so we have to figure out how to do the conversion
*/
/* see how we can transform the input caps */
transform = gst_base_transform_transform_caps (trans, pad, caps);
if (!gst_caps_is_fixed (othercaps)) {
GstCaps *temp;
if (!transform)
goto done;
/* see what the peer can do */
peercaps = gst_pad_get_caps (otherpeer);
GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
/* filter against our possibilities */
intersect = gst_caps_intersect (peercaps, transform);
gst_caps_unref (peercaps);
gst_caps_unref (transform);
GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
/* take first possibility */
othercaps = gst_caps_copy_nth (intersect, 0);
gst_caps_unref (intersect);
structure = gst_caps_get_structure (othercaps, 0);
/* and fixate if necessary */
gst_pad_fixate_caps (otherpad, othercaps);
g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
gst_pad_set_caps (otherpad, othercaps);
/* let the element know */
if (klass->set_caps) {
if (pad == trans->sinkpad) {
klass->set_caps (trans, caps, othercaps);
} else {
klass->set_caps (trans, othercaps, caps);
temp = gst_caps_intersect (othercaps, caps);
if (temp) {
/* try passthrough. we know it's fixed, because caps is fixed */
if (gst_pad_accept_caps (otherpeer, caps)) {
gst_caps_unref (othercaps);
othercaps = gst_caps_ref (caps);
/* will fall though. calls accept_caps again, should fix that. */
}
gst_caps_unref (temp);
}
}
ret = TRUE;
if (!gst_caps_is_fixed (othercaps) && otherpeer) {
/* intersect against what the peer can do */
if (otherpeer) {
GstCaps *peercaps;
GstCaps *intersect;
peercaps = gst_pad_get_caps (otherpeer);
intersect = gst_caps_intersect (peercaps, othercaps);
gst_caps_unref (peercaps);
gst_caps_unref (othercaps);
othercaps = intersect;
GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
}
}
if (!gst_caps_is_fixed (othercaps)) {
GstCaps *temp;
/* take first possibility and fixate if necessary */
temp = gst_caps_copy_nth (othercaps, 0);
gst_caps_unref (othercaps);
othercaps = temp;
gst_pad_fixate_caps (otherpad, othercaps);
}
g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
if (otherpeer && !gst_pad_accept_caps (otherpeer, othercaps)) {
GST_DEBUG ("FAILED to get peer of %" GST_PTR_FORMAT
" to accept %" GST_PTR_FORMAT, otherpad, othercaps);
ret = FALSE;
goto done;
}
/* we know this will work, we implement the setcaps */
gst_pad_set_caps (otherpad, othercaps);
/* success, let the element know */
if (klass->set_caps) {
if (pad == trans->sinkpad)
ret = klass->set_caps (trans, caps, othercaps);
else
ret = klass->set_caps (trans, othercaps, caps);
}
done:
@ -305,6 +323,9 @@ done:
if (otherpeer)
gst_object_unref (otherpeer);
if (othercaps)
gst_caps_unref (othercaps);
return ret;
}

View file

@ -40,7 +40,7 @@ pound_bus_with_messages (gpointer data)
s = gst_structure_new ("test_message",
"thread_id", G_TYPE_INT, thread_id, "msg_id", G_TYPE_INT, i, NULL);
m = gst_message_new_application (s);
m = gst_message_new_application (NULL, s);
gst_bus_post (test_bus, m);
}
return NULL;

View file

@ -148,7 +148,7 @@ START_TEST (test_parsing)
"some_int", G_TYPE_INT, 10,
"a_double", G_TYPE_DOUBLE, (gdouble) 1.8, NULL);
fail_if (structure == NULL);
message = gst_message_new_application (structure);
message = gst_message_new_application (NULL, structure);
fail_if (message == NULL);
struc = gst_message_get_structure (message);
fail_if (struc == NULL);

View file

@ -103,7 +103,8 @@ END_TEST static void
got_handoff (GstElement * sink, GstBuffer * buf, GstPad * pad, gpointer unused)
{
gst_element_post_message
(sink, gst_message_new_application (gst_structure_new ("foo", NULL)));
(sink, gst_message_new_application (NULL, gst_structure_new ("foo",
NULL)));
}
static void