diff --git a/ChangeLog b/ChangeLog index f5247474c7..946fabc0cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-05-16 Andy Wingo + + * 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 * gst/gstminiobject.c: Use g_atomic_int_get() instead of diff --git a/check/gst/gstbin.c b/check/gst/gstbin.c index ad32984fbd..9057279a91 100644 --- a/check/gst/gstbin.c +++ b/check/gst/gstbin.c @@ -79,7 +79,38 @@ START_TEST (test_interface) 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) { @@ -88,6 +119,7 @@ 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; } diff --git a/docs/gst/tmpl/gstbuffer.sgml b/docs/gst/tmpl/gstbuffer.sgml index e56ffe3930..48c9145410 100644 --- a/docs/gst/tmpl/gstbuffer.sgml +++ b/docs/gst/tmpl/gstbuffer.sgml @@ -89,10 +89,9 @@ Last reviewed on August 12th, 2004 (0.8.5) The basic structure of a buffer. -@data_type: +@mini_object: @data: @size: -@maxsize: @timestamp: @duration: @caps: @@ -121,15 +120,13 @@ The basic structure of a buffer. -@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: @@ -194,14 +191,6 @@ Gets the size of the data in this buffer. @buf: a #GstBuffer to get data size of. - - -Gets the maximum size of this buffer. - - -@buf: a #GstBuffer to get maximum size of. - - Gets the timestamp for this buffer. @@ -243,15 +232,6 @@ Increases the refcount of the given buffer by one. @buf: a #GstBuffer to increase the refcount of. - - -Increases the refcount of the buffer by the given value. - - -@buf: a #GstBuffer to increase the refcount of. -@c: the value to add to the refcount. - - Decreases the refcount of the buffer. If the refcount reaches 0, the buffer @@ -287,18 +267,6 @@ Tests if you can safely write data into a buffer's data array. @buf: a #GstBuffer to check - - -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. - - -@buf: a #GstBuffer to copy -@Returns: the #GstBuffer that can safely be written to. - - @@ -366,71 +334,6 @@ The name used for tracing memory allocations - - -Gets a handle to the refcount structure of the buffer. - - -@buf: a #GstBuffer to get the refcount structure of. - - - - -Gets the current refcount value of the buffer. - - -@buf: a #GstBuffer to get the refcount value of. - - - - -Calls the buffer-specific copy function on the given buffer. - - -@buf: a #GstBuffer to copy. - - - - -Calls the buffer-specific free function on the given buffer. - - -@buf: a #GstBuffer to free. - - - - -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. - - -@buf: the #GstBuffer this function belongs to - - - - -the type for the GST_BUFFER_FREE_DATA_FUNC - - -@buffer: the #GstBuffer on which it will operate, when called - - - - -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. - - -@buf: the #GstBuffer this data belongs to - - diff --git a/docs/gst/tmpl/gstdata.sgml b/docs/gst/tmpl/gstdata.sgml index 31181f6db5..9eb52dee44 100644 --- a/docs/gst/tmpl/gstdata.sgml +++ b/docs/gst/tmpl/gstdata.sgml @@ -16,195 +16,3 @@ GstData provides refcounting, freeing and copying for its child classes. #GstBuffer, #GstBufferPool, #GstEvent - - -Cast a pointer to a GstData - - -@data: The pointer to cast - - - - -Get the type of the GstData - - -@data: The data to get the type of - - - - -Get the flags of this GstData - - -@data: The data to get the flags of - - - - -Shift a given flag so that it can be used in an or operation - - -@flag: The flag to shift - - - - -Unset the given flag - - -@data: The data to unset the flag of -@flag: The flag to unset - - - - -The base structure - - -@type: The type of this data. -@refcount: A refcount -@flags: The flags of this GstData - - - -The signature of the free function. Subclasses should provide a free function -with this signature and pass it in the gst_data_init() function. - - -@data: The GstData to free - - - - -The signature of the copy function. Subclasses should provide a copy function -with this signature and pass it in the gst_data_init() function. - - -@data: The GstData to copy -@Returns: A new GstData that is a copy of data - - - - -Various flags that can be set on a GstData - - -@GST_DATA_READONLY: The data is readonly -@GST_DATA_FLAG_LAST: Subclasses can add additional flags starting from this offset - - - -Get access to the refcount field of the GstData - - -@data: The GstData to get the refcount field of - - - - -Get the current refcount value - - -@data: The GstData to query - - - - -Get access to the copy function of the data - - -@data: The data to query - - - - -Get access to the free function of the data - - -@data: The data to query - - - - - - - -@data: -@type: -@flags: -@free: -@copy: - - - - - - - -@data: - - - - - - - -@data: -@target: - - - - - - - -@data: -@Returns: - - - - - - - -@data: -@Returns: - - - - - - - -@data: -@Returns: - - - - - - - -@data: -@Returns: - - - - - - - -@data: -@count: -@Returns: - - - - - - - -@data: - - diff --git a/docs/gst/tmpl/gstevent.sgml b/docs/gst/tmpl/gstevent.sgml index 7528aca46c..b5ed1b91a5 100644 --- a/docs/gst/tmpl/gstevent.sgml +++ b/docs/gst/tmpl/gstevent.sgml @@ -32,7 +32,7 @@ gst_event_new_flush() creates a new flush event. -@data: +@mini_object: @type: @timestamp: @src: @@ -319,15 +319,6 @@ Increase the refcount of this event @ev: The event to refcount - - -Increase the refcount of the event with the given value - - -@ev: The event to refcount -@c: The value to add to the refcount - - Decrease the refcount of an event, freeing it if the refcount reaches 0 diff --git a/gst/gstbin.c b/gst/gstbin.c index 86e83a8361..b698827c80 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -709,7 +709,7 @@ bin_element_is_sink (GstElement * child, GstBin * bin) 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 { diff --git a/tests/check/gst/gstbin.c b/tests/check/gst/gstbin.c index ad32984fbd..9057279a91 100644 --- a/tests/check/gst/gstbin.c +++ b/tests/check/gst/gstbin.c @@ -79,7 +79,38 @@ START_TEST (test_interface) 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) { @@ -88,6 +119,7 @@ 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; }