+2005-05-16 Andy Wingo <wingo@pobox.com>
+
+ * gst/gstbin.c (sink_iterator_filter): Err... um...
+
+ * check/gst/gstbin.c (test_ghost_pads): New test for the
+ ghosting-if-elements-not-in-same-bin behavior.
+
2005-05-16 David Schleef <ds@schleef.org>
* gst/gstminiobject.c: Use g_atomic_int_get() instead of
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
gst_iterator_free (it);
- g_object_unref (bin);
+ gst_object_unref (GST_OBJECT (bin));
+}
+
+END_TEST
+START_TEST (test_ghost_pads)
+{
+ GstElement *b1, *b2, *src, *i1, *sink;
+
+ b1 = gst_element_factory_make ("pipeline", NULL);
+ b2 = gst_element_factory_make ("bin", NULL);
+ src = gst_element_factory_make ("fakesrc", NULL);
+ i1 = gst_element_factory_make ("identity", NULL);
+ sink = gst_element_factory_make ("fakesink", NULL);
+
+ fail_unless (gst_bin_add (GST_BIN (b2), i1));
+ fail_unless (gst_bin_add (GST_BIN (b1), src));
+ fail_unless (gst_bin_add (GST_BIN (b1), b2));
+ fail_unless (gst_bin_add (GST_BIN (b1), sink));
+ fail_unless (gst_element_link_pads (src, NULL, i1, NULL));
+ fail_unless (gst_element_link_pads (i1, NULL, sink, NULL));
+ GST_LOCK (b2);
+ fail_unless (b2->numsinkpads == 1);
+ fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data));
+ fail_unless (b2->numsrcpads == 1);
+ fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data));
+ GST_UNLOCK (b2);
+
+ fail_unless (gst_element_set_state (b1,
+ GST_STATE_PLAYING) == GST_STATE_SUCCESS);
+ fail_unless (gst_element_set_state (b1, GST_STATE_NULL) == GST_STATE_SUCCESS);
+
+ gst_object_unref (GST_OBJECT (b1));
}
END_TEST Suite * gst_bin_suite (void)
{
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_interface);
+ tcase_add_test (tc_chain, test_ghost_pads);
return s;
}
The basic structure of a buffer.
</para>
-@data_type:
+@mini_object:
@data:
@size:
-@maxsize:
@timestamp:
@duration:
@caps:
</para>
-@GST_BUFFER_READONLY:
-@GST_BUFFER_SUBBUFFER:
-@GST_BUFFER_ORIGINAL:
-@GST_BUFFER_DONTFREE:
-@GST_BUFFER_PREROLL:
-@GST_BUFFER_DISCONT:
-@GST_BUFFER_IN_CAPS:
-@GST_BUFFER_GAP:
-@GST_BUFFER_DELTA_UNIT:
+@GST_BUFFER_FLAG_READONLY:
+@GST_BUFFER_FLAG_ORIGINAL:
+@GST_BUFFER_FLAG_PREROLL:
+@GST_BUFFER_FLAG_DISCONT:
+@GST_BUFFER_FLAG_IN_CAPS:
+@GST_BUFFER_FLAG_GAP:
+@GST_BUFFER_FLAG_DELTA_UNIT:
@GST_BUFFER_FLAG_LAST:
<!-- ##### MACRO GST_BUFFER_FLAGS ##### -->
@buf: a #GstBuffer to get data size of.
-<!-- ##### MACRO GST_BUFFER_MAXSIZE ##### -->
-<para>
-Gets the maximum size of this buffer.
-</para>
-
-@buf: a #GstBuffer to get maximum size of.
-
-
<!-- ##### MACRO GST_BUFFER_TIMESTAMP ##### -->
<para>
Gets the timestamp for this buffer.
@buf: a #GstBuffer to increase the refcount of.
-<!-- ##### MACRO gst_buffer_ref_by_count ##### -->
-<para>
-Increases the refcount of the buffer by the given value.
-</para>
-
-@buf: a #GstBuffer to increase the refcount of.
-@c: the value to add to the refcount.
-
-
<!-- ##### MACRO gst_buffer_unref ##### -->
<para>
Decreases the refcount of the buffer. If the refcount reaches 0, the buffer
@buf: a #GstBuffer to check
-<!-- ##### MACRO gst_buffer_copy_on_write ##### -->
-<para>
-This function returns a buffer that is safe to write to.
-Copy the buffer if the refcount > 1 so that the newly
-created buffer can be safely written to.
-If the refcount is 1, this function just returns the original buffer.
-</para>
-
-@buf: a #GstBuffer to copy
-@Returns: the #GstBuffer that can safely be written to.
-
-
<!-- ##### FUNCTION gst_buffer_create_sub ##### -->
<para>
-<!-- ##### MACRO GST_BUFFER_REFCOUNT ##### -->
-<para>
-Gets a handle to the refcount structure of the buffer.
-</para>
-
-@buf: a #GstBuffer to get the refcount structure of.
-
-
-<!-- ##### MACRO GST_BUFFER_REFCOUNT_VALUE ##### -->
-<para>
-Gets the current refcount value of the buffer.
-</para>
-
-@buf: a #GstBuffer to get the refcount value of.
-
-
-<!-- ##### MACRO GST_BUFFER_COPY_FUNC ##### -->
-<para>
-Calls the buffer-specific copy function on the given buffer.
-</para>
-
-@buf: a #GstBuffer to copy.
-
-
-<!-- ##### MACRO GST_BUFFER_FREE_FUNC ##### -->
-<para>
-Calls the buffer-specific free function on the given buffer.
-</para>
-
-@buf: a #GstBuffer to free.
-
-
-<!-- ##### MACRO GST_BUFFER_FREE_DATA_FUNC ##### -->
-<para>
-A function that should be called if the buffer has no more references left.
-Elements that utilize hardware memory could use this to re-queue
-the buffer after it's been unreferenced. If no free_data_func has been
-provided, the default will be used which simply deallocates the memory
-region and the GstBuffer object. Manual implementations that want to
-free their own memory but don't do anything special otherwise are
-suggested to set the GST_BUFFER_DONTFREE flag on the buffer and call the
-default data free function (gst_buffer_default_free()) from their manual
-implementation.
-</para>
-
-@buf: the #GstBuffer this function belongs to
-
-
-<!-- ##### USER_FUNCTION GstBufferFreeDataFunc ##### -->
-<para>
-the type for the GST_BUFFER_FREE_DATA_FUNC
-</para>
-
-@buffer: the #GstBuffer on which it will operate, when called
-
-
-<!-- ##### MACRO GST_BUFFER_PRIVATE ##### -->
-<para>
-Private data for the buffer. This can be used to store a pointer to the
-object that can then be retrieved in something like the BUFFER_FREE_DATA_FUNC.
-</para>
-
-@buf: the #GstBuffer this data belongs to
-
-
<!-- ##### MACRO GST_BUFFER_OFFSET_NONE ##### -->
<para>
#GstBuffer, #GstBufferPool, #GstEvent
</para>
-<!-- ##### MACRO GST_DATA ##### -->
-<para>
-Cast a pointer to a GstData
-</para>
-
-@data: The pointer to cast
-
-
-<!-- ##### MACRO GST_DATA_TYPE ##### -->
-<para>
-Get the type of the GstData
-</para>
-
-@data: The data to get the type of
-
-
-<!-- ##### MACRO GST_DATA_FLAGS ##### -->
-<para>
-Get the flags of this GstData
-</para>
-
-@data: The data to get the flags of
-
-
-<!-- ##### MACRO GST_DATA_FLAG_SHIFT ##### -->
-<para>
-Shift a given flag so that it can be used in an or operation
-</para>
-
-@flag: The flag to shift
-
-
-<!-- ##### MACRO GST_DATA_FLAG_UNSET ##### -->
-<para>
-Unset the given flag
-</para>
-
-@data: The data to unset the flag of
-@flag: The flag to unset
-
-
-<!-- ##### STRUCT GstData ##### -->
-<para>
-The base structure
-</para>
-
-@type: The type of this data.
-@refcount: A refcount
-@flags: The flags of this GstData
-
-<!-- ##### USER_FUNCTION GstDataFreeFunction ##### -->
-<para>
-The signature of the free function. Subclasses should provide a free function
-with this signature and pass it in the gst_data_init() function.
-</para>
-
-@data: The GstData to free
-
-
-<!-- ##### USER_FUNCTION GstDataCopyFunction ##### -->
-<para>
-The signature of the copy function. Subclasses should provide a copy function
-with this signature and pass it in the gst_data_init() function.
-</para>
-
-@data: The GstData to copy
-@Returns: A new GstData that is a copy of data
-
-
-<!-- ##### ENUM GstDataFlags ##### -->
-<para>
-Various flags that can be set on a GstData
-</para>
-
-@GST_DATA_READONLY: The data is readonly
-@GST_DATA_FLAG_LAST: Subclasses can add additional flags starting from this offset
-
-<!-- ##### MACRO GST_DATA_REFCOUNT ##### -->
-<para>
-Get access to the refcount field of the GstData
-</para>
-
-@data: The GstData to get the refcount field of
-
-
-<!-- ##### MACRO GST_DATA_REFCOUNT_VALUE ##### -->
-<para>
-Get the current refcount value
-</para>
-
-@data: The GstData to query
-
-
-<!-- ##### MACRO GST_DATA_COPY_FUNC ##### -->
-<para>
-Get access to the copy function of the data
-</para>
-
-@data: The data to query
-
-
-<!-- ##### MACRO GST_DATA_FREE_FUNC ##### -->
-<para>
-Get access to the free function of the data
-</para>
-
-@data: The data to query
-
-
-<!-- ##### FUNCTION gst_data_init ##### -->
-<para>
-
-</para>
-
-@data:
-@type:
-@flags:
-@free:
-@copy:
-
-
-<!-- ##### FUNCTION gst_data_dispose ##### -->
-<para>
-
-</para>
-
-@data:
-
-
-<!-- ##### FUNCTION gst_data_copy_into ##### -->
-<para>
-
-</para>
-
-@data:
-@target:
-
-
-<!-- ##### FUNCTION gst_data_copy ##### -->
-<para>
-
-</para>
-
-@data:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_data_is_writable ##### -->
-<para>
-
-</para>
-
-@data:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_data_copy_on_write ##### -->
-<para>
-
-</para>
-
-@data:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_data_ref ##### -->
-<para>
-
-</para>
-
-@data:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_data_ref_by_count ##### -->
-<para>
-
-</para>
-
-@data:
-@count:
-@Returns:
-
-
-<!-- ##### FUNCTION gst_data_unref ##### -->
-<para>
-
-</para>
-
-@data:
-
-
</para>
-@data:
+@mini_object:
@type:
@timestamp:
@src:
@ev: The event to refcount
-<!-- ##### MACRO gst_event_ref_by_count ##### -->
-<para>
-Increase the refcount of the event with the given value
-</para>
-
-@ev: The event to refcount
-@c: The value to add to the refcount
-
-
<!-- ##### MACRO gst_event_unref ##### -->
<para>
Decrease the refcount of an event, freeing it if the refcount reaches 0
static gint
sink_iterator_filter (GstElement * child, GstBin * bin)
{
- if (bin_element_is_sink (child, bin)) {
+ if (bin_element_is_sink (child, bin) == 0) {
/* returns 0 because this is a GCompareFunc */
return 0;
} else {
fail_unless (gst_iterator_next (it, &item) == GST_ITERATOR_DONE);
gst_iterator_free (it);
- g_object_unref (bin);
+ gst_object_unref (GST_OBJECT (bin));
+}
+
+END_TEST
+START_TEST (test_ghost_pads)
+{
+ GstElement *b1, *b2, *src, *i1, *sink;
+
+ b1 = gst_element_factory_make ("pipeline", NULL);
+ b2 = gst_element_factory_make ("bin", NULL);
+ src = gst_element_factory_make ("fakesrc", NULL);
+ i1 = gst_element_factory_make ("identity", NULL);
+ sink = gst_element_factory_make ("fakesink", NULL);
+
+ fail_unless (gst_bin_add (GST_BIN (b2), i1));
+ fail_unless (gst_bin_add (GST_BIN (b1), src));
+ fail_unless (gst_bin_add (GST_BIN (b1), b2));
+ fail_unless (gst_bin_add (GST_BIN (b1), sink));
+ fail_unless (gst_element_link_pads (src, NULL, i1, NULL));
+ fail_unless (gst_element_link_pads (i1, NULL, sink, NULL));
+ GST_LOCK (b2);
+ fail_unless (b2->numsinkpads == 1);
+ fail_unless (GST_IS_GHOST_PAD (b2->sinkpads->data));
+ fail_unless (b2->numsrcpads == 1);
+ fail_unless (GST_IS_GHOST_PAD (b2->srcpads->data));
+ GST_UNLOCK (b2);
+
+ fail_unless (gst_element_set_state (b1,
+ GST_STATE_PLAYING) == GST_STATE_SUCCESS);
+ fail_unless (gst_element_set_state (b1, GST_STATE_NULL) == GST_STATE_SUCCESS);
+
+ gst_object_unref (GST_OBJECT (b1));
}
END_TEST Suite * gst_bin_suite (void)
{
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_interface);
+ tcase_add_test (tc_chain, test_ghost_pads);
return s;
}