+2005-08-20 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * check/elements/.cvsignore:
+ * check/elements/gstfakesrc.c:
+ rename to name of element
+ * check/elements/identity.c: (chain_func), (event_func),
+ (setup_identity), (cleanup_identity), (GST_START_TEST),
+ (identity_suite), (main):
+ add a test for identity
+ * check/Makefile.am:
+ * pkgconfig/Makefile.am:
+ * pkgconfig/gstreamer-check.pc.in:
+ * pkgconfig/gstreamer-check-uninstalled.pc.in:
+ * gst/check:
+ * gst/Makefile.am:
+ * configure.ac:
+ move the check stuff to a library that gets installed
+ * check/gst-libs/controller.c: (GST_START_TEST):
+ * check/gst-libs/gdp.c:
+ * check/gst/gst.c: (GST_START_TEST):
+ * check/gst/gstbin.c:
+ * check/gst/gstbuffer.c: (GST_START_TEST), (gst_test_suite):
+ * check/gst/gstbus.c:
+ * check/gst/gstcaps.c: (GST_START_TEST):
+ * check/gst/gstelement.c:
+ * check/gst/gstghostpad.c:
+ * check/gst/gstiterator.c:
+ * check/gst/gstmessage.c:
+ * check/gst/gstminiobject.c: (thread_ref), (GST_START_TEST):
+ * check/gst/gstobject.c:
+ * check/gst/gstpad.c: (GST_START_TEST):
+ * check/gst/gststructure.c: (GST_START_TEST):
+ * check/gst/gstsystemclock.c: (GST_START_TEST),
+ (gst_systemclock_suite):
+ * check/gst/gsttag.c: (gst_tag_suite):
+ * check/gst/gstvalue.c:
+ * check/pipelines/cleanup.c:
+ * check/pipelines/simple_launch_lines.c:
+ * check/states/sinks.c:
+ change include statement
+
+ * docs/gst/gstreamer-sections.txt:
+ * docs/gst/tmpl/gstpad.sgml:
+ document more pad stuff
+ * gst/gstminiobject.c: (gst_mini_object_ref),
+ (gst_mini_object_unref):
+ debug refcounting
+
2005-08-19 Stefan Kost <ensonic@users.sf.net>
* docs/gst/tmpl/gst.sgml:
* gst/gst.c:
- eliminate another tmpl file, fix spelling in the long-description
+ eliminate another tmpl file, fix spelling in the long-description
2005-08-18 Jan Schmidt <thaytan@mad.scientist.com>
* check/gst/gstevents.c: (GST_START_TEST), (event_probe),
(test_event), (timediff), (gstevents_suite):
- Fix error message output so I might be able to tell why the
+ Fix error message output so I might be able to tell why the
test works here but fails on the build farm.
2005-08-18 Jan Schmidt <thaytan@mad.scientist.com>
gst/gsttag \
gst/gstvalue \
elements/gstfakesrc \
+ elements/identity \
pipelines/simple_launch_lines \
pipelines/cleanup \
states/sinks \
check_PROGRAMS = $(TESTS)
-noinst_LTLIBRARIES = libgstcheck.la
+noinst_HEADERS = gst/capslist.h
-libgstcheck_la_SOURCES = gstcheck.c
-libgstcheck_la_LIBADD = $(GST_OBJ_LIBS)
-noinst_HEADERS = gstcheck.h gst/capslist.h
-
-AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
-LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la
+AM_CFLAGS = $(GST_OBJ_CFLAGS)
+LDADD = $(GST_OBJ_LIBS) \
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la
gst_libs_gdp_SOURCES = \
gst-libs/gdp.c \
# remove GST_ENABLE_NEW when dataprotocol has been declared API-stable
gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
-gst_libs_controller_LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la \
+gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
$(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
# valgrind testing
.dirstamp
-gstfakesrc
+fakesrc
+identity
#include <unistd.h>
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GList *buffers = NULL;
gboolean have_eos = FALSE;
--- /dev/null
+/* GStreamer
+ *
+ * unit test for identity
+ *
+ * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <unistd.h>
+
+#include <gst/check/gstcheck.h>
+
+GList *buffers = NULL;
+gboolean have_eos = FALSE;
+
+/* For ease of programming we use globals to keep refs for our floating
+ * src and sink pads we create; otherwise we always have to do get_pad,
+ * get_peer, and then remove references in every test function */
+GstPad *mysrcpad, *mysinkpad;
+
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
+GstFlowReturn
+chain_func (GstPad * pad, GstBuffer * buffer)
+{
+ GST_DEBUG ("chain_func: received buffer %p", buffer);
+ buffers = g_list_append (buffers, buffer);
+
+ return GST_FLOW_OK;
+}
+
+gboolean
+event_func (GstPad * pad, GstEvent * event)
+{
+ if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+ /* we take the lock here because it's good practice to so, even though
+ * no buffers will be pushed anymore anyway */
+ GST_STREAM_LOCK (pad);
+ have_eos = TRUE;
+ GST_STREAM_UNLOCK (pad);
+ gst_event_unref (event);
+ return TRUE;
+ }
+
+ gst_event_unref (event);
+ return FALSE;
+}
+
+GstElement *
+setup_identity ()
+{
+ GstElement *identity;
+ GstPad *srcpad, *sinkpad;
+
+ GST_DEBUG ("setup_identity");
+
+ identity = gst_element_factory_make ("identity", "identity");
+ fail_if (identity == NULL, "Could not create a identity");
+
+ /* sending pad */
+ mysrcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
+ "src");
+ fail_if (mysrcpad == NULL, "Could not create a mysrcpad");
+ ASSERT_OBJECT_REFCOUNT (mysrcpad, "mysrcpad", 1);
+
+ sinkpad = gst_element_get_pad (identity, "sink");
+ fail_if (sinkpad == NULL, "Could not get source pad from identity");
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+ gst_pad_set_caps (mysrcpad, NULL);
+ fail_unless (gst_pad_link (mysrcpad, sinkpad) == GST_PAD_LINK_OK,
+ "Could not link source and identity sink pads");
+ gst_object_unref (sinkpad); /* because we got it higher up */
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
+
+ /* receiving pad */
+ mysinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
+ "sink");
+ fail_if (mysinkpad == NULL, "Could not create a mysinkpad");
+
+ srcpad = gst_element_get_pad (identity, "src");
+ fail_if (srcpad == NULL, "Could not get source pad from identity");
+ gst_pad_set_caps (mysinkpad, NULL);
+ gst_pad_set_chain_function (mysinkpad, chain_func);
+ gst_pad_set_event_function (mysinkpad, event_func);
+
+ fail_unless (gst_pad_link (srcpad, mysinkpad) == GST_PAD_LINK_OK,
+ "Could not link identity source and mysink pads");
+ gst_object_unref (srcpad); /* because we got it higher up */
+ ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
+
+ return identity;
+}
+
+void
+cleanup_identity (GstElement * identity)
+{
+ GstPad *srcpad, *sinkpad;
+
+ GST_DEBUG ("cleanup_identity");
+
+ fail_unless (gst_element_set_state (identity, GST_STATE_NULL) ==
+ GST_STATE_SUCCESS, "could not set to null");
+ ASSERT_OBJECT_REFCOUNT (identity, "identity", 1);
+
+ /* clean up floating src pad */
+ sinkpad = gst_element_get_pad (identity, "sink");
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+
+ gst_pad_unlink (mysrcpad, sinkpad);
+
+ /* pad refs held by both creator and this function (through _get) */
+ ASSERT_OBJECT_REFCOUNT (mysrcpad, "srcpad", 1);
+ gst_object_unref (mysrcpad);
+ mysrcpad = NULL;
+
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+ gst_object_unref (sinkpad);
+ /* one more ref is held by identity itself */
+
+ /* clean up floating sink pad */
+ srcpad = gst_element_get_pad (identity, "src");
+ gst_pad_unlink (srcpad, mysinkpad);
+
+ /* pad refs held by both creator and this function (through _get) */
+ ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
+ gst_object_unref (srcpad);
+ /* one more ref is held by identity itself */
+
+ ASSERT_OBJECT_REFCOUNT (mysinkpad, "mysinkpad", 1);
+ gst_object_unref (mysinkpad);
+ mysinkpad = NULL;
+
+ ASSERT_OBJECT_REFCOUNT (identity, "identity", 1);
+ gst_object_unref (identity);
+}
+
+GST_START_TEST (test_one_buffer)
+{
+ GstElement *identity;
+ GstBuffer *buffer;
+
+ identity = setup_identity ();
+ fail_unless (gst_element_set_state (identity,
+ GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing");
+
+ buffer = gst_buffer_new_and_alloc (4);
+ ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
+ memcpy (GST_BUFFER_DATA (buffer), "data", 4);
+ /* pushing gives away my reference ... */
+ gst_pad_push (mysrcpad, buffer);
+ /* ... but it ends up being collected on the global buffer list */
+ ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
+
+ /* cleanup */
+ cleanup_identity (identity);
+}
+
+GST_END_TEST;
+
+Suite *
+identity_suite (void)
+{
+ Suite *s = suite_create ("identity");
+ TCase *tc_chain = tcase_create ("general");
+
+ suite_add_tcase (s, tc_chain);
+ tcase_add_test (tc_chain, test_one_buffer);
+
+ return s;
+}
+
+int
+main (int argc, char **argv)
+{
+ int nf;
+
+ Suite *s = identity_suite ();
+ SRunner *sr = srunner_create (s);
+
+ gst_check_init (&argc, &argv);
+
+ srunner_run_all (sr, CK_NORMAL);
+ nf = srunner_ntests_failed (sr);
+ srunner_free (sr);
+
+ return nf;
+}
*/
#include "config.h"
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <gst/controller/gst-controller.h>
/* LOCAL TEST ELEMENT */
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <gst/dataprotocol/dataprotocol.h>
#include "libs/gst/dataprotocol/dp-private.h" /* private header */
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_init)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static void
pop_messages (GstBus * bus, int count)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_caps)
{
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstBus *test_bus = NULL;
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include "capslist.h"
GST_START_TEST (test_from_string)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_add_remove_pad)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static void
assert_gstrefcount (gpointer p, gint i)
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GList *
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GQuark domain;
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_copy)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
/*
Create a fake subclass
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_link)
{
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_from_string_int)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_signedness)
{
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <string.h>
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_deserialize_buffer)
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstElement *
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstElement *
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
/* a sink should go ASYNC to PAUSE. forcing PLAYING is possible */
GST_START_TEST (test_sink)
gst/gstconfig.h
gst/gstversion.h
gst/base/Makefile
+gst/check/Makefile
gst/indexers/Makefile
gst/elements/Makefile
gst/parse/Makefile
pkgconfig/gstreamer-uninstalled.pc
pkgconfig/gstreamer-base.pc
pkgconfig/gstreamer-base-uninstalled.pc
+pkgconfig/gstreamer-check.pc
+pkgconfig/gstreamer-check-uninstalled.pc
pkgconfig/gstreamer-controller.pc
pkgconfig/gstreamer-controller-uninstalled.pc
pkgconfig/gstreamer-dataprotocol.pc
GstPad
GST_PAD_LINK_FAILED
GST_PAD_LINK_SUCCESSFUL
+GstPadActivateFunction
+GstPadActivateModeFunction
+GstPadBlockCallback
GstPadChainFunction
GstPadEventFunction
+GstPadCheckGetRangeFunction
+GstPadGetRangeFunction
GstPadQueryFunction
GstPadIntLinkFunction
GstPadQueryTypeFunction
GstPadLinkFunction
GstPadUnlinkFunction
+GstPadAcceptCapsFunction
+GstPadFixateCapsFunction
GstPadGetCapsFunction
+GstPadSetCapsFunction
GstPadBufferAllocFunction
GstPadDispatcherFunction
GstPadDirection
GstPadFlags
GstPadLinkReturn
GstPadPresence
-GST_PAD_NAME
-GST_PAD_PARENT
-GST_PAD_ELEMENT_PRIVATE
-GST_PAD_PAD_TEMPLATE
-GST_PAD_DIRECTION
-GST_PAD_CAPS
-GST_PAD_PEER
-GST_PAD_IS_LINKED
-GST_PAD_IS_USABLE
-GST_PAD_IS_SRC
-GST_PAD_IS_SINK
+
gst_pad_new
gst_pad_new_from_template
+
gst_pad_get_name
gst_pad_get_direction
+gst_pad_get_parent
+gst_pad_get_parent_element
+
gst_pad_set_active
gst_pad_is_active
+gst_pad_set_blocked
+gst_pad_set_blocked_async
+gst_pad_is_blocked
gst_pad_set_element_private
gst_pad_get_element_private
-gst_pad_get_parent
gst_pad_get_pad_template
gst_pad_set_bufferalloc_function
gst_pad_alloc_buffer
gst_pad_set_chain_function
+gst_pad_chain
+gst_pad_set_checkgetrange_function
+gst_pad_set_getrange_function
+gst_pad_get_range
gst_pad_set_event_function
-gst_pad_set_link_function
-gst_pad_can_link
gst_pad_set_unlink_function
+gst_pad_set_activate_function
+gst_pad_set_activatepull_function
+
+gst_pad_start_task
+gst_pad_pause_task
+gst_pad_stop_task
+
gst_pad_link
gst_pad_unlink
gst_pad_is_linked
-gst_pad_get_peer
+gst_pad_set_link_function
+gst_pad_can_link
+
+gst_pad_accept_caps
gst_pad_get_negotiated_caps
gst_pad_get_caps
+gst_pad_set_caps
gst_pad_get_pad_template_caps
+gst_pad_set_acceptcaps_function
gst_pad_set_getcaps_function
+gst_pad_set_setcaps_function
gst_pad_proxy_getcaps
+gst_pad_proxy_setcaps
gst_pad_get_allowed_caps
+gst_pad_get_fixed_caps_func
+gst_pad_get_peer
+gst_pad_peer_get_caps
+gst_pad_peer_accept_caps
+gst_pad_use_fixed_caps
+gst_pad_fixate_caps
+gst_pad_set_fixatecaps_function
+
+gst_pad_set_activatepush_function
gst_pad_push
+gst_pad_push_event
+gst_pad_check_pull_range
+gst_pad_pull_range
+gst_pad_activate_pull
+gst_pad_activate_push
gst_pad_send_event
gst_pad_event_default
+
gst_pad_set_query_function
gst_pad_set_query_type_function
gst_pad_get_query_types
gst_pad_get_query_types_default
gst_pad_query
gst_pad_query_default
+gst_pad_query_position
+gst_pad_query_convert
+
gst_pad_set_internal_link_function
gst_pad_get_internal_links
gst_pad_get_internal_links_default
gst_pad_dispatcher
gst_pad_load_and_link
+
gst_pad_add_data_probe
gst_pad_add_buffer_probe
gst_pad_add_event_probe
GST_TYPE_PAD_FLAGS
GST_TYPE_PAD_LINK_RETURN
GST_TYPE_PAD_PRESENCE
+
<SUBSECTION Private>
gst_pad_get_type
gst_pad_direction_get_type
gst_pad_flags_get_type
gst_pad_link_return_get_type
gst_pad_presence_get_type
+
+GST_PAD_NAME
+GST_PAD_PARENT
+GST_PAD_ELEMENT_PRIVATE
+GST_PAD_PAD_TEMPLATE
+GST_PAD_DIRECTION
+GST_PAD_CAPS
+GST_PAD_PEER
+GST_PAD_IS_LINKED
+GST_PAD_IS_USABLE
+GST_PAD_IS_SRC
+GST_PAD_IS_SINK
+
+GST_PAD_IS_IN_GETCAPS
+GST_PAD_MODE_ACTIVATE
+GST_PAD_BLOCK_GET_COND
+GST_PAD_BLOCK_SIGNAL
+GST_PAD_BLOCK_WAIT
+GST_PAD_CAST
+GST_PAD_ACTIVATE_MODE
+GST_PAD_DO_BUFFER_SIGNALS
+GST_PAD_DO_EVENT_SIGNALS
+GST_PAD_IS_BLOCKED
+GST_PAD_IS_IN_SETCAPS
+GST_PAD_SET_FLUSHING
+GST_PAD_TASK
+GST_PAD_UNSET_FLUSHING
+
+
+GST_PAD_ACCEPTCAPSFUNC
+GST_PAD_ACTIVATEFUNC
+GST_PAD_ACTIVATEPULLFUNC
+GST_PAD_ACTIVATEPUSHFUNC
+GST_PAD_BUFFERALLOCFUNC
+GST_PAD_CHAINFUNC
+GST_PAD_CHECKGETRANGEFUNC
+GST_PAD_EVENTFUNC
+GST_PAD_FIXATECAPSFUNC
+GST_PAD_GETCAPSFUNC
+GST_PAD_GETRANGEFUNC
+GST_PAD_INTLINKFUNC
+GST_PAD_IS_FLUSHING
+GST_PAD_LINKFUNC
+GST_PAD_QUERYFUNC
+GST_PAD_QUERYTYPEFUNC
+GST_PAD_SETCAPSFUNC
+GST_PAD_UNLINKFUNC
+
</SECTION>
<SECTION>
@ret: the #GstPadLinkReturn value
+<!-- ##### USER_FUNCTION GstPadActivateFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION GstPadActivateModeFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@active:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION GstPadBlockCallback ##### -->
+<para>
+
+</para>
+
+@pad:
+@blocked:
+@user_data:
+
+
<!-- ##### USER_FUNCTION GstPadChainFunction ##### -->
<para>
A function that will be called when chaining buffers.
@Returns: TRUE if the pad could handle the event.
+<!-- ##### USER_FUNCTION GstPadCheckGetRangeFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION GstPadGetRangeFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@offset:
+@length:
+@buffer:
+@Returns:
+
+
<!-- ##### USER_FUNCTION GstPadQueryFunction ##### -->
<para>
The signature of the query function.
@pad:
+<!-- ##### USER_FUNCTION GstPadAcceptCapsFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+@Returns:
+
+
+<!-- ##### USER_FUNCTION GstPadFixateCapsFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+
+
<!-- ##### USER_FUNCTION GstPadGetCapsFunction ##### -->
<para>
Returns a copy of the capabilities of the specified pad. By default this
@caps: the peer's #GstCaps, can be used to filter the capabilities.
+<!-- ##### USER_FUNCTION GstPadSetCapsFunction ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+@Returns:
+
+
<!-- ##### USER_FUNCTION GstPadBufferAllocFunction ##### -->
<para>
@GST_PAD_REQUEST: the pad is only available on request with
gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
-<!-- ##### MACRO GST_PAD_NAME ##### -->
+<!-- ##### FUNCTION gst_pad_new ##### -->
<para>
-Gets the name of the pad.
+
</para>
-@pad: a #GstPad to get the name of.
-@Returns: the pad's name.
+@name:
+@direction:
+@Returns:
-<!-- ##### MACRO GST_PAD_PARENT ##### -->
+<!-- ##### FUNCTION gst_pad_new_from_template ##### -->
<para>
-Gets the parent element of this pad.
+
</para>
-@pad: a #GstPad to get the parent of.
-@Returns: the parent #GstElement of this pad.
+@templ:
+@name:
+@Returns:
-<!-- ##### MACRO GST_PAD_ELEMENT_PRIVATE ##### -->
+<!-- ##### MACRO gst_pad_get_name ##### -->
<para>
-Gets the private data set by the element that owns the pad.
+
</para>
-@pad: a #GstPad to get the private data of.
-#Returns: a gpointer to the private data.
+@pad:
+@Returns:
-<!-- ##### MACRO GST_PAD_PAD_TEMPLATE ##### -->
+<!-- ##### FUNCTION gst_pad_get_direction ##### -->
<para>
-Gets the pad template that was used to create this pad.
+
</para>
-@pad: a #GstPad to get the pad template of.
-#Returns: the #GstPadTemplate used to create the pad, or NULL if none was
-used.
+@pad:
+@Returns:
-<!-- ##### MACRO GST_PAD_DIRECTION ##### -->
+<!-- ##### MACRO gst_pad_get_parent ##### -->
<para>
-Gets the pad's direction.
+
</para>
-@pad: a #GstPad to get the direction of.
-@Returns: the #GstPadDirection of the pad.
+@pad:
+@Returns:
-<!-- ##### MACRO GST_PAD_CAPS ##### -->
+<!-- ##### FUNCTION gst_pad_get_parent_element ##### -->
<para>
-Gets the capabilities of a pad.
+
</para>
-@pad: a #GstPad to get the capabilities of.
-@Returns: the #GstCaps of the pad.
+@pad:
+@Returns:
-<!-- ##### MACRO GST_PAD_PEER ##### -->
+<!-- ##### FUNCTION gst_pad_set_active ##### -->
<para>
-Gets the peer pad of this pad. The peer pad is the pad on to which the parent
-element is linked through this pad.
+
</para>
-@pad: a #GstPad to get the peer pad of.
-@Returns: the peer #GstPad.
+@pad:
+@active:
+@Returns:
+<!-- # Unused Parameters # -->
+@mode:
-<!-- ##### MACRO GST_PAD_IS_LINKED ##### -->
+<!-- ##### FUNCTION gst_pad_is_active ##### -->
<para>
-Checks if the pad is linked.
+
</para>
-@pad: a #GstPad to check.
+@pad:
+@Returns:
-<!-- ##### MACRO GST_PAD_IS_USABLE ##### -->
+<!-- ##### FUNCTION gst_pad_set_blocked ##### -->
<para>
-Checks if a pad is usable. A usable pad is both linked and active.
+
</para>
-@pad: a #GstPad to check
+@pad:
+@blocked:
+@Returns:
-<!-- ##### MACRO GST_PAD_IS_SRC ##### -->
+<!-- ##### FUNCTION gst_pad_set_blocked_async ##### -->
<para>
-Checks if the pad is a source pad.
+
</para>
-@pad: a #GstPad to check.
+@pad:
+@blocked:
+@callback:
+@user_data:
+@Returns:
-<!-- ##### MACRO GST_PAD_IS_SINK ##### -->
+<!-- ##### FUNCTION gst_pad_is_blocked ##### -->
<para>
-Checks if the pad is a sink pad.
+
</para>
-@pad: a #GstPad to check.
+@pad:
+@Returns:
-<!-- ##### FUNCTION gst_pad_new ##### -->
+<!-- ##### FUNCTION gst_pad_set_element_private ##### -->
<para>
</para>
-@name:
-@direction:
-@Returns:
+@pad:
+@priv:
-<!-- ##### FUNCTION gst_pad_new_from_template ##### -->
+<!-- ##### FUNCTION gst_pad_get_element_private ##### -->
<para>
</para>
-@templ:
-@name:
+@pad:
@Returns:
-<!-- ##### MACRO gst_pad_get_name ##### -->
+<!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
<para>
</para>
@Returns:
-<!-- ##### FUNCTION gst_pad_get_direction ##### -->
+<!-- ##### FUNCTION gst_pad_set_bufferalloc_function ##### -->
<para>
</para>
@pad:
-@Returns:
+@bufalloc:
+<!-- # Unused Parameters # -->
+@bufferalloc:
-<!-- ##### FUNCTION gst_pad_set_active ##### -->
+<!-- ##### FUNCTION gst_pad_alloc_buffer ##### -->
<para>
</para>
@pad:
-@active:
+@offset:
+@size:
+@caps:
+@buf:
@Returns:
-<!-- # Unused Parameters # -->
-@mode:
-<!-- ##### FUNCTION gst_pad_is_active ##### -->
+<!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
<para>
</para>
@pad:
-@Returns:
+@chain:
-<!-- ##### FUNCTION gst_pad_set_element_private ##### -->
+<!-- ##### FUNCTION gst_pad_chain ##### -->
<para>
</para>
@pad:
-@priv:
+@buffer:
+@Returns:
-<!-- ##### FUNCTION gst_pad_get_element_private ##### -->
+<!-- ##### FUNCTION gst_pad_set_checkgetrange_function ##### -->
<para>
</para>
@pad:
-@Returns:
+@check:
-<!-- ##### MACRO gst_pad_get_parent ##### -->
+<!-- ##### FUNCTION gst_pad_set_getrange_function ##### -->
<para>
</para>
@pad:
-@Returns:
+@get:
-<!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
+<!-- ##### FUNCTION gst_pad_get_range ##### -->
<para>
</para>
@pad:
+@offset:
+@size:
+@buffer:
@Returns:
-<!-- ##### FUNCTION gst_pad_set_bufferalloc_function ##### -->
+<!-- ##### FUNCTION gst_pad_set_event_function ##### -->
<para>
</para>
@pad:
-@bufalloc:
-<!-- # Unused Parameters # -->
-@bufferalloc:
+@event:
-<!-- ##### FUNCTION gst_pad_alloc_buffer ##### -->
+<!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
<para>
</para>
@pad:
-@offset:
-@size:
-@caps:
-@buf:
-@Returns:
+@unlink:
-<!-- ##### FUNCTION gst_pad_set_chain_function ##### -->
+<!-- ##### FUNCTION gst_pad_set_activate_function ##### -->
<para>
</para>
@pad:
-@chain:
+@activate:
-<!-- ##### FUNCTION gst_pad_set_event_function ##### -->
+<!-- ##### FUNCTION gst_pad_set_activatepull_function ##### -->
<para>
</para>
@pad:
-@event:
+@activatepull:
-<!-- ##### FUNCTION gst_pad_set_link_function ##### -->
+<!-- ##### FUNCTION gst_pad_start_task ##### -->
<para>
</para>
@pad:
-@link:
+@func:
+@data:
+@Returns:
-<!-- ##### FUNCTION gst_pad_can_link ##### -->
+<!-- ##### FUNCTION gst_pad_pause_task ##### -->
<para>
</para>
-@srcpad:
-@sinkpad:
+@pad:
@Returns:
-<!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
+<!-- ##### FUNCTION gst_pad_stop_task ##### -->
<para>
</para>
@pad:
-@unlink:
+@Returns:
<!-- ##### FUNCTION gst_pad_link ##### -->
@Returns:
-<!-- ##### FUNCTION gst_pad_get_peer ##### -->
+<!-- ##### FUNCTION gst_pad_set_link_function ##### -->
+<para>
+
+</para>
+
+@pad:
+@link:
+
+
+<!-- ##### FUNCTION gst_pad_can_link ##### -->
+<para>
+
+</para>
+
+@srcpad:
+@sinkpad:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_accept_caps ##### -->
<para>
</para>
@pad:
+@caps:
@Returns:
@Returns:
+<!-- ##### FUNCTION gst_pad_set_caps ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+@Returns:
+
+
<!-- ##### FUNCTION gst_pad_get_pad_template_caps ##### -->
<para>
@Returns:
+<!-- ##### FUNCTION gst_pad_set_acceptcaps_function ##### -->
+<para>
+
+</para>
+
+@pad:
+@acceptcaps:
+
+
<!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
<para>
@getcaps:
+<!-- ##### FUNCTION gst_pad_set_setcaps_function ##### -->
+<para>
+
+</para>
+
+@pad:
+@setcaps:
+
+
<!-- ##### FUNCTION gst_pad_proxy_getcaps ##### -->
<para>
@Returns:
+<!-- ##### FUNCTION gst_pad_proxy_setcaps ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+@Returns:
+
+
<!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
<para>
@pad:
+<!-- ##### FUNCTION gst_pad_get_fixed_caps_func ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_get_peer ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_peer_get_caps ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_peer_accept_caps ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_use_fixed_caps ##### -->
+<para>
+
+</para>
+
+@pad:
+
+
+<!-- ##### FUNCTION gst_pad_fixate_caps ##### -->
+<para>
+
+</para>
+
+@pad:
+@caps:
+
+
+<!-- ##### FUNCTION gst_pad_set_fixatecaps_function ##### -->
+<para>
+
+</para>
+
+@pad:
+@fixatecaps:
+
+
+<!-- ##### FUNCTION gst_pad_set_activatepush_function ##### -->
+<para>
+
+</para>
+
+@pad:
+@activatepush:
+
+
<!-- ##### FUNCTION gst_pad_push ##### -->
<para>
@buf:
+<!-- ##### FUNCTION gst_pad_push_event ##### -->
+<para>
+
+</para>
+
+@pad:
+@event:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_check_pull_range ##### -->
+<para>
+
+</para>
+
+@pad:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_pull_range ##### -->
+<para>
+
+</para>
+
+@pad:
+@offset:
+@size:
+@buffer:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_activate_pull ##### -->
+<para>
+
+</para>
+
+@pad:
+@active:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_activate_push ##### -->
+<para>
+
+</para>
+
+@pad:
+@active:
+@Returns:
+
+
<!-- ##### FUNCTION gst_pad_send_event ##### -->
<para>
@value:
+<!-- ##### FUNCTION gst_pad_query_position ##### -->
+<para>
+
+</para>
+
+@pad:
+@format:
+@cur:
+@end:
+@Returns:
+
+
+<!-- ##### FUNCTION gst_pad_query_convert ##### -->
+<para>
+
+</para>
+
+@pad:
+@src_format:
+@src_val:
+@dest_fmt:
+@dest_val:
+@Returns:
+
+
<!-- ##### FUNCTION gst_pad_set_internal_link_function ##### -->
<para>
lib_LTLIBRARIES = libgstreamer-@GST_MAJORMINOR@.la
-noinst_LTLIBRARIES =
-#GST_INSTRUMENT_FLAGS = -finstrument-functions -DGST_ENABLE_FUNC_INSTRUMENTATION
+if HAVE_CHECK
+SUBDIRS_CHECK = check
+else
+SUBDIRS_CHECK =
+endif
if GST_DISABLE_LOADSAVE
GST_LOADSAVE_SRC =
if GST_DISABLE_PARSE
GST_PARSE_SRC =
-GST_PARSE_DIRS =
+SUBDIRS_PARSE =
GST_PARSE_LA =
else
GST_PARSE_SRC = gstparse.c
-GST_PARSE_DIRS = parse
+SUBDIRS_PARSE = parse
GST_PARSE_LA = parse/libgstparse.la
endif
if GST_DISABLE_REGISTRY
GST_REGISTRY_SRC =
-GST_REGISTRY_DIRS =
+SUBDIRS_REGISTRY =
GST_REGISTRY_LA =
else
GST_REGISTRY_SRC = gstregistry.c
-GST_REGISTRY_DIRS = registries
+SUBDIRS_REGISTRY = registries
GST_REGISTRY_LA = registries/libgstxmlregistry.la
endif
if GST_DISABLE_INDEX
GST_INDEX_SRC =
-GST_INDEX_DIRS =
+SUBDIRS_INDEX =
else
GST_INDEX_SRC = gstindex.c
-GST_INDEX_DIRS = indexers
+SUBDIRS_INDEX = indexers
endif
if GST_DISABLE_PLUGIN
GST_URI_SRC = gsturi.c
endif
-SUBDIRS = $(GST_PARSE_DIRS) $(GST_REGISTRY_DIRS) . base elements $(GST_INDEX_DIRS)
-DIST_SUBDIRS = base elements parse registries indexers
+SUBDIRS = $(SUBDIRS_PARSE) $(SUBDIRS_REGISTRY) . base elements $(SUBDIRS_INDEX) $(SUBDIRS_CHECK)
+DIST_SUBDIRS = base elements parse registries indexers $(SUBDIRS_CHECK)
# make variables for all generated source and header files to make the
# distinction clear
--- /dev/null
+lib_LTLIBRARIES = libgstcheck-@GST_MAJORMINOR@.la
+
+libgstcheck_@GST_MAJORMINOR@_la_DEPENDENCIES = \
+ ../libgstreamer-@GST_MAJORMINOR@.la
+libgstcheck_@GST_MAJORMINOR@_la_SOURCES = \
+ gstcheck.c
+
+libgstcheck_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
+libgstcheck_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) \
+ ../libgstreamer-@GST_MAJORMINOR@.la
+libgstcheck_@GST_MAJORMINOR@_la_LDFLAGS =
+
+libgstcheck_@GST_MAJORMINOR@includedir = \
+ $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/check
+
+libgstcheck_@GST_MAJORMINOR@include_HEADERS = \
+ gstcheck.h
#include "config.h"
#endif
-#ifndef GST_DISABLE_TRACE
-#include "gsttrace.h"
-#endif
-
#include "gst/gstminiobject.h"
#include "gst/gstinfo.h"
#include "gst/gst_private.h"
#include <gobject/gvaluecollector.h>
+#ifndef GST_DISABLE_TRACE
+#include "gsttrace.h"
+#endif
+
+#define DEBUG_REFCOUNT
+
static void gst_mini_object_base_init (gpointer g_class);
static void gst_mini_object_base_finalize (gpointer g_class);
static void gst_mini_object_class_init (gpointer g_class, gpointer class_data);
{
g_return_val_if_fail (mini_object != NULL, NULL);
+#ifdef DEBUG_REFCOUNT
+ GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p ref %d->%d",
+ mini_object,
+ GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
+ GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) + 1);
+#endif
+
g_atomic_int_inc (&mini_object->refcount);
return mini_object;
}
-
static void
gst_mini_object_free (GstMiniObject * mini_object)
{
g_return_if_fail (mini_object != NULL);
g_return_if_fail (mini_object->refcount > 0);
+#ifdef DEBUG_REFCOUNT
+ GST_CAT_LOG (GST_CAT_REFCOUNTING, "%p unref %d->%d",
+ mini_object,
+ GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
+ GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) - 1);
+#endif
+
if (g_atomic_int_dec_and_test (&mini_object->refcount)) {
gst_mini_object_free (mini_object);
}
--- /dev/null
+lib_LTLIBRARIES = libgstcheck-@GST_MAJORMINOR@.la
+
+libgstcheck_@GST_MAJORMINOR@_la_DEPENDENCIES = \
+ ../libgstreamer-@GST_MAJORMINOR@.la
+libgstcheck_@GST_MAJORMINOR@_la_SOURCES = \
+ gstcheck.c
+
+libgstcheck_@GST_MAJORMINOR@_la_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
+libgstcheck_@GST_MAJORMINOR@_la_LIBADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) \
+ ../libgstreamer-@GST_MAJORMINOR@.la
+libgstcheck_@GST_MAJORMINOR@_la_LDFLAGS =
+
+libgstcheck_@GST_MAJORMINOR@includedir = \
+ $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/check
+
+libgstcheck_@GST_MAJORMINOR@include_HEADERS = \
+ gstcheck.h
### all of the standard pc files we need to generate
+if HAVE_CHECK
+CHECK_PC_I = gstreamer-check-@GST_MAJORMINOR@.pc
+CHECK_PC_U = gstreamer-check-@GST_MAJORMINOR@-uninstalled.pc
+else
+CHECK_PC_I =
+CHECK_PC_U =
+endif
+
pcfiles = \
gstreamer-@GST_MAJORMINOR@.pc \
gstreamer-base-@GST_MAJORMINOR@.pc \
- gstreamer-controller-@GST_MAJORMINOR@.pc \
+ $(CHECK_PC_I) \
+ gstreamer-controller-@GST_MAJORMINOR@.pc \
gstreamer-dataprotocol-@GST_MAJORMINOR@.pc
pcfiles_uninstalled = \
gstreamer-@GST_MAJORMINOR@-uninstalled.pc \
gstreamer-base-@GST_MAJORMINOR@-uninstalled.pc \
+ $(CHECK_PC_U) \
gstreamer-controller-@GST_MAJORMINOR@-uninstalled.pc \
gstreamer-dataprotocol-@GST_MAJORMINOR@-uninstalled.pc
gstreamer-uninstalled.pc.in \
gstreamer-base.pc.in \
gstreamer-base-uninstalled.pc.in \
- gstreamer-controller.pc.in \
+ gstreamer-check.pc.in \
+ gstreamer-check-uninstalled.pc.in \
+ gstreamer-controller.pc.in \
gstreamer-controller-uninstalled.pc.in \
gstreamer-dataprotocol.pc.in \
gstreamer-dataprotocol-uninstalled.pc.in
--- /dev/null
+# the standard variables don't make sense for an uninstalled copy
+prefix=
+exec_prefix=
+libdir=${pcfiledir}/../gst/check
+includedir=${pcfiledir}/..
+
+Name: GStreamer check unittesting, uninstalled
+Description: Unit testing helper library for GStreamer modules
+Requires: gstreamer-@GST_MAJORMINOR@ = @VERSION@
+Version: @VERSION@
+
+Libs: ${libdir}/libgstcheck-@GST_MAJORMINOR@.la
+Cflags: -I${includedir}
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
+
+Name: GStreamer check unittesting
+Description: Unit testing helper library for GStreamer modules
+Requires: gstreamer-@GST_MAJORMINOR@
+Version: @VERSION@
+Libs: -L${libdir} -lgstcheck-@GST_MAJORMINOR@
+Cflags: -I${includedir}
gst/gsttag \
gst/gstvalue \
elements/gstfakesrc \
+ elements/identity \
pipelines/simple_launch_lines \
pipelines/cleanup \
states/sinks \
check_PROGRAMS = $(TESTS)
-noinst_LTLIBRARIES = libgstcheck.la
+noinst_HEADERS = gst/capslist.h
-libgstcheck_la_SOURCES = gstcheck.c
-libgstcheck_la_LIBADD = $(GST_OBJ_LIBS)
-noinst_HEADERS = gstcheck.h gst/capslist.h
-
-AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
-LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la
+AM_CFLAGS = $(GST_OBJ_CFLAGS)
+LDADD = $(GST_OBJ_LIBS) \
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la
gst_libs_gdp_SOURCES = \
gst-libs/gdp.c \
# remove GST_ENABLE_NEW when dataprotocol has been declared API-stable
gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW
-gst_libs_controller_LDADD = $(GST_OBJ_LIBS) $(CHECK_LIBS) libgstcheck.la \
+gst_libs_controller_LDADD = $(GST_OBJ_LIBS) \
+ $(top_builddir)/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
$(top_builddir)/libs/gst/controller/libgstcontroller-@GST_MAJORMINOR@.la
# valgrind testing
.dirstamp
-gstfakesrc
+fakesrc
+identity
#include <unistd.h>
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GList *buffers = NULL;
gboolean have_eos = FALSE;
--- /dev/null
+/* GStreamer
+ *
+ * unit test for identity
+ *
+ * Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <unistd.h>
+
+#include <gst/check/gstcheck.h>
+
+GList *buffers = NULL;
+gboolean have_eos = FALSE;
+
+/* For ease of programming we use globals to keep refs for our floating
+ * src and sink pads we create; otherwise we always have to do get_pad,
+ * get_peer, and then remove references in every test function */
+GstPad *mysrcpad, *mysinkpad;
+
+
+static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
+GstFlowReturn
+chain_func (GstPad * pad, GstBuffer * buffer)
+{
+ GST_DEBUG ("chain_func: received buffer %p", buffer);
+ buffers = g_list_append (buffers, buffer);
+
+ return GST_FLOW_OK;
+}
+
+gboolean
+event_func (GstPad * pad, GstEvent * event)
+{
+ if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+ /* we take the lock here because it's good practice to so, even though
+ * no buffers will be pushed anymore anyway */
+ GST_STREAM_LOCK (pad);
+ have_eos = TRUE;
+ GST_STREAM_UNLOCK (pad);
+ gst_event_unref (event);
+ return TRUE;
+ }
+
+ gst_event_unref (event);
+ return FALSE;
+}
+
+GstElement *
+setup_identity ()
+{
+ GstElement *identity;
+ GstPad *srcpad, *sinkpad;
+
+ GST_DEBUG ("setup_identity");
+
+ identity = gst_element_factory_make ("identity", "identity");
+ fail_if (identity == NULL, "Could not create a identity");
+
+ /* sending pad */
+ mysrcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate),
+ "src");
+ fail_if (mysrcpad == NULL, "Could not create a mysrcpad");
+ ASSERT_OBJECT_REFCOUNT (mysrcpad, "mysrcpad", 1);
+
+ sinkpad = gst_element_get_pad (identity, "sink");
+ fail_if (sinkpad == NULL, "Could not get source pad from identity");
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+ gst_pad_set_caps (mysrcpad, NULL);
+ fail_unless (gst_pad_link (mysrcpad, sinkpad) == GST_PAD_LINK_OK,
+ "Could not link source and identity sink pads");
+ gst_object_unref (sinkpad); /* because we got it higher up */
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
+
+ /* receiving pad */
+ mysinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate),
+ "sink");
+ fail_if (mysinkpad == NULL, "Could not create a mysinkpad");
+
+ srcpad = gst_element_get_pad (identity, "src");
+ fail_if (srcpad == NULL, "Could not get source pad from identity");
+ gst_pad_set_caps (mysinkpad, NULL);
+ gst_pad_set_chain_function (mysinkpad, chain_func);
+ gst_pad_set_event_function (mysinkpad, event_func);
+
+ fail_unless (gst_pad_link (srcpad, mysinkpad) == GST_PAD_LINK_OK,
+ "Could not link identity source and mysink pads");
+ gst_object_unref (srcpad); /* because we got it higher up */
+ ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
+
+ return identity;
+}
+
+void
+cleanup_identity (GstElement * identity)
+{
+ GstPad *srcpad, *sinkpad;
+
+ GST_DEBUG ("cleanup_identity");
+
+ fail_unless (gst_element_set_state (identity, GST_STATE_NULL) ==
+ GST_STATE_SUCCESS, "could not set to null");
+ ASSERT_OBJECT_REFCOUNT (identity, "identity", 1);
+
+ /* clean up floating src pad */
+ sinkpad = gst_element_get_pad (identity, "sink");
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+
+ gst_pad_unlink (mysrcpad, sinkpad);
+
+ /* pad refs held by both creator and this function (through _get) */
+ ASSERT_OBJECT_REFCOUNT (mysrcpad, "srcpad", 1);
+ gst_object_unref (mysrcpad);
+ mysrcpad = NULL;
+
+ ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
+ gst_object_unref (sinkpad);
+ /* one more ref is held by identity itself */
+
+ /* clean up floating sink pad */
+ srcpad = gst_element_get_pad (identity, "src");
+ gst_pad_unlink (srcpad, mysinkpad);
+
+ /* pad refs held by both creator and this function (through _get) */
+ ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 2);
+ gst_object_unref (srcpad);
+ /* one more ref is held by identity itself */
+
+ ASSERT_OBJECT_REFCOUNT (mysinkpad, "mysinkpad", 1);
+ gst_object_unref (mysinkpad);
+ mysinkpad = NULL;
+
+ ASSERT_OBJECT_REFCOUNT (identity, "identity", 1);
+ gst_object_unref (identity);
+}
+
+GST_START_TEST (test_one_buffer)
+{
+ GstElement *identity;
+ GstBuffer *buffer;
+
+ identity = setup_identity ();
+ fail_unless (gst_element_set_state (identity,
+ GST_STATE_PLAYING) == GST_STATE_SUCCESS, "could not set to playing");
+
+ buffer = gst_buffer_new_and_alloc (4);
+ ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
+ memcpy (GST_BUFFER_DATA (buffer), "data", 4);
+ /* pushing gives away my reference ... */
+ gst_pad_push (mysrcpad, buffer);
+ /* ... but it ends up being collected on the global buffer list */
+ ASSERT_BUFFER_REFCOUNT (buffer, "buffer", 1);
+
+ /* cleanup */
+ cleanup_identity (identity);
+}
+
+GST_END_TEST;
+
+Suite *
+identity_suite (void)
+{
+ Suite *s = suite_create ("identity");
+ TCase *tc_chain = tcase_create ("general");
+
+ suite_add_tcase (s, tc_chain);
+ tcase_add_test (tc_chain, test_one_buffer);
+
+ return s;
+}
+
+int
+main (int argc, char **argv)
+{
+ int nf;
+
+ Suite *s = identity_suite ();
+ SRunner *sr = srunner_create (s);
+
+ gst_check_init (&argc, &argv);
+
+ srunner_run_all (sr, CK_NORMAL);
+ nf = srunner_ntests_failed (sr);
+ srunner_free (sr);
+
+ return nf;
+}
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
/* a sink should go ASYNC to PAUSE. forcing PLAYING is possible */
GST_START_TEST (test_sink)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_init)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static void
pop_messages (GstBus * bus, int count)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_caps)
{
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstBus *test_bus = NULL;
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include "capslist.h"
GST_START_TEST (test_from_string)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_add_remove_pad)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static void
assert_gstrefcount (gpointer p, gint i)
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GList *
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GQuark domain;
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_copy)
{
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
/*
Create a fake subclass
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_link)
{
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_from_string_int)
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_signedness)
{
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <string.h>
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
GST_START_TEST (test_deserialize_buffer)
*/
#include "config.h"
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <gst/controller/gst-controller.h>
/* LOCAL TEST ELEMENT */
* Boston, MA 02111-1307, USA.
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
#include <gst/dataprotocol/dataprotocol.h>
#include "libs/gst/dataprotocol/dp-private.h" /* private header */
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstElement *
*/
-#include "../gstcheck.h"
+#include <gst/check/gstcheck.h>
static GstElement *