+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:
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;
"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);
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
@pad:
@handler:
@data:
+@Returns:
<!-- ##### FUNCTION gst_pad_add_buffer_probe ##### -->
@pad:
@handler:
@data:
+@Returns:
<!-- ##### FUNCTION gst_pad_add_event_probe ##### -->
@pad:
@handler:
@data:
+@Returns:
<!-- ##### FUNCTION gst_pad_remove_data_probe ##### -->
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 *
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));
{
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);
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 (!transform)
- goto done;
+ if (!gst_caps_is_fixed (othercaps)) {
+ GstCaps *temp;
- /* see what the peer can do */
- peercaps = gst_pad_get_caps (otherpeer);
+ 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);
+ }
+ }
- GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
- GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
+ if (!gst_caps_is_fixed (othercaps) && otherpeer) {
+ /* intersect against what the peer can do */
+ if (otherpeer) {
+ GstCaps *peercaps;
+ GstCaps *intersect;
- /* filter against our possibilities */
- intersect = gst_caps_intersect (peercaps, transform);
- gst_caps_unref (peercaps);
- gst_caps_unref (transform);
+ peercaps = gst_pad_get_caps (otherpeer);
+ intersect = gst_caps_intersect (peercaps, othercaps);
+ gst_caps_unref (peercaps);
+ gst_caps_unref (othercaps);
+ othercaps = intersect;
- GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
+ GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
+ }
+ }
- /* take first possibility */
- othercaps = gst_caps_copy_nth (intersect, 0);
- gst_caps_unref (intersect);
- structure = gst_caps_get_structure (othercaps, 0);
+ if (!gst_caps_is_fixed (othercaps)) {
+ GstCaps *temp;
- /* and fixate if necessary */
+ /* 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);
+ g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
- gst_pad_set_caps (otherpad, othercaps);
+ 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;
+ }
- /* 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);
- }
- }
+ /* we know this will work, we implement the setcaps */
+ gst_pad_set_caps (otherpad, othercaps);
- ret = TRUE;
+ /* 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:
if (otherpeer)
gst_object_unref (otherpeer);
+ if (othercaps)
+ gst_caps_unref (othercaps);
+
return ret;
}
/**
* gst_message_new_application:
+ * @src: The object originating the message.
* @structure: The structure for the message. The message will take ownership of
* the structure.
*
* 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;
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);
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;
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 *
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));
{
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);
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 (!transform)
- goto done;
+ if (!gst_caps_is_fixed (othercaps)) {
+ GstCaps *temp;
- /* see what the peer can do */
- peercaps = gst_pad_get_caps (otherpeer);
+ 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);
+ }
+ }
- GST_DEBUG ("icaps %" GST_PTR_FORMAT, peercaps);
- GST_DEBUG ("transform %" GST_PTR_FORMAT, transform);
+ if (!gst_caps_is_fixed (othercaps) && otherpeer) {
+ /* intersect against what the peer can do */
+ if (otherpeer) {
+ GstCaps *peercaps;
+ GstCaps *intersect;
- /* filter against our possibilities */
- intersect = gst_caps_intersect (peercaps, transform);
- gst_caps_unref (peercaps);
- gst_caps_unref (transform);
+ peercaps = gst_pad_get_caps (otherpeer);
+ intersect = gst_caps_intersect (peercaps, othercaps);
+ gst_caps_unref (peercaps);
+ gst_caps_unref (othercaps);
+ othercaps = intersect;
- GST_DEBUG ("intersect %" GST_PTR_FORMAT, intersect);
+ GST_DEBUG ("filtering against peer yields %" GST_PTR_FORMAT, othercaps);
+ }
+ }
- /* take first possibility */
- othercaps = gst_caps_copy_nth (intersect, 0);
- gst_caps_unref (intersect);
- structure = gst_caps_get_structure (othercaps, 0);
+ if (!gst_caps_is_fixed (othercaps)) {
+ GstCaps *temp;
- /* and fixate if necessary */
+ /* 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);
+ g_return_val_if_fail (gst_caps_is_fixed (othercaps), FALSE);
- gst_pad_set_caps (otherpad, othercaps);
+ 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;
+ }
- /* 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);
- }
- }
+ /* we know this will work, we implement the setcaps */
+ gst_pad_set_caps (otherpad, othercaps);
- ret = TRUE;
+ /* 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:
if (otherpeer)
gst_object_unref (otherpeer);
+ if (othercaps)
+ gst_caps_unref (othercaps);
+
return ret;
}
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;
"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);
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