move check stuff to its own library to be used by other modules

Original commit message from CVS:
move check stuff to its own library to be used by other modules
This commit is contained in:
Thomas Vander Stichele 2005-08-20 12:14:28 +00:00
parent 60f5fbb210
commit 8ce827c406
65 changed files with 1167 additions and 222 deletions

View file

@ -1,8 +1,56 @@
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>
@ -46,7 +94,7 @@
* 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>

View file

@ -49,6 +49,7 @@ TESTS = $(top_builddir)/tools/gst-register \
gst/gsttag \
gst/gstvalue \
elements/gstfakesrc \
elements/identity \
pipelines/simple_launch_lines \
pipelines/cleanup \
states/sinks \
@ -57,14 +58,11 @@ TESTS = $(top_builddir)/tools/gst-register \
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 \
@ -72,7 +70,8 @@ gst_libs_gdp_SOURCES = \
# 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

View file

@ -1,2 +1,3 @@
.dirstamp
gstfakesrc
fakesrc
identity

View file

@ -22,7 +22,7 @@
#include <unistd.h>
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GList *buffers = NULL;
gboolean have_eos = FALSE;

211
check/elements/identity.c Normal file
View file

@ -0,0 +1,211 @@
/* 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;
}

View file

@ -21,7 +21,7 @@
*/
#include "config.h"
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include <gst/controller/gst-controller.h>
/* LOCAL TEST ELEMENT */

View file

@ -20,7 +20,7 @@
* 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 */

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_init)
{

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static void
pop_messages (GstBus * bus, int count)

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_caps)
{

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstBus *test_bus = NULL;

View file

@ -21,7 +21,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include "capslist.h"
GST_START_TEST (test_from_string)

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_add_remove_pad)
{

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static void
assert_gstrefcount (gpointer p, gint i)

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GList *

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GQuark domain;

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_copy)
{

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
/*
Create a fake subclass

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_link)
{

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_from_string_int)

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_signedness)
{

View file

@ -18,7 +18,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include <string.h>

View file

@ -21,7 +21,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_deserialize_buffer)

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstElement *

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstElement *

View file

@ -20,7 +20,7 @@
* 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)

View file

@ -624,6 +624,7 @@ gst/Makefile
gst/gstconfig.h
gst/gstversion.h
gst/base/Makefile
gst/check/Makefile
gst/indexers/Makefile
gst/elements/Makefile
gst/parse/Makefile
@ -694,6 +695,8 @@ pkgconfig/gstreamer.pc
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

View file

@ -844,72 +844,111 @@ xmlNodePtr
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
@ -927,12 +966,61 @@ GST_TYPE_PAD_DIRECTION
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>

View file

@ -161,6 +161,35 @@ successfull negotiation step (OK/DONE).
@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.
@ -184,6 +213,27 @@ Function signature to handle an event for the pad.
@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.
@ -238,6 +288,25 @@ Function signature to handle a new link on the pad.
@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
@ -251,6 +320,16 @@ be overridden.
@caps: the peer's #GstCaps, can be used to filter the capabilities.
<!-- ##### USER_FUNCTION GstPadSetCapsFunction ##### -->
<para>
</para>
@pad:
@caps:
@Returns:
<!-- ##### USER_FUNCTION GstPadBufferAllocFunction ##### -->
<para>
@ -318,103 +397,6 @@ Indicates when this pad will become available.
@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 ##### -->
<para>
Gets the name of the pad.
</para>
@pad: a #GstPad to get the name of.
@Returns: the pad's name.
<!-- ##### MACRO GST_PAD_PARENT ##### -->
<para>
Gets the parent element of this pad.
</para>
@pad: a #GstPad to get the parent of.
@Returns: the parent #GstElement of this pad.
<!-- ##### MACRO GST_PAD_ELEMENT_PRIVATE ##### -->
<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.
<!-- ##### MACRO GST_PAD_PAD_TEMPLATE ##### -->
<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.
<!-- ##### MACRO GST_PAD_DIRECTION ##### -->
<para>
Gets the pad's direction.
</para>
@pad: a #GstPad to get the direction of.
@Returns: the #GstPadDirection of the pad.
<!-- ##### MACRO GST_PAD_CAPS ##### -->
<para>
Gets the capabilities of a pad.
</para>
@pad: a #GstPad to get the capabilities of.
@Returns: the #GstCaps of the pad.
<!-- ##### MACRO GST_PAD_PEER ##### -->
<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.
<!-- ##### MACRO GST_PAD_IS_LINKED ##### -->
<para>
Checks if the pad is linked.
</para>
@pad: a #GstPad to check.
<!-- ##### MACRO GST_PAD_IS_USABLE ##### -->
<para>
Checks if a pad is usable. A usable pad is both linked and active.
</para>
@pad: a #GstPad to check
<!-- ##### MACRO GST_PAD_IS_SRC ##### -->
<para>
Checks if the pad is a source pad.
</para>
@pad: a #GstPad to check.
<!-- ##### MACRO GST_PAD_IS_SINK ##### -->
<para>
Checks if the pad is a sink pad.
</para>
@pad: a #GstPad to check.
<!-- ##### FUNCTION gst_pad_new ##### -->
<para>
@ -453,6 +435,24 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### MACRO gst_pad_get_parent ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_get_parent_element ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_set_active ##### -->
<para>
@ -474,6 +474,37 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### FUNCTION gst_pad_set_blocked ##### -->
<para>
</para>
@pad:
@blocked:
@Returns:
<!-- ##### FUNCTION gst_pad_set_blocked_async ##### -->
<para>
</para>
@pad:
@blocked:
@callback:
@user_data:
@Returns:
<!-- ##### FUNCTION gst_pad_is_blocked ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_set_element_private ##### -->
<para>
@ -492,15 +523,6 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### MACRO gst_pad_get_parent ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_get_pad_template ##### -->
<para>
@ -543,6 +565,46 @@ Checks if the pad is a sink pad.
@chain:
<!-- ##### FUNCTION gst_pad_chain ##### -->
<para>
</para>
@pad:
@buffer:
@Returns:
<!-- ##### FUNCTION gst_pad_set_checkgetrange_function ##### -->
<para>
</para>
@pad:
@check:
<!-- ##### FUNCTION gst_pad_set_getrange_function ##### -->
<para>
</para>
@pad:
@get:
<!-- ##### FUNCTION gst_pad_get_range ##### -->
<para>
</para>
@pad:
@offset:
@size:
@buffer:
@Returns:
<!-- ##### FUNCTION gst_pad_set_event_function ##### -->
<para>
@ -552,25 +614,6 @@ Checks if the pad is a sink pad.
@event:
<!-- ##### FUNCTION gst_pad_set_link_function ##### -->
<para>
</para>
@pad:
@link:
<!-- ##### FUNCTION gst_pad_can_link ##### -->
<para>
</para>
@srcpad:
@sinkpad:
@Returns:
<!-- ##### FUNCTION gst_pad_set_unlink_function ##### -->
<para>
@ -580,6 +623,53 @@ Checks if the pad is a sink pad.
@unlink:
<!-- ##### FUNCTION gst_pad_set_activate_function ##### -->
<para>
</para>
@pad:
@activate:
<!-- ##### FUNCTION gst_pad_set_activatepull_function ##### -->
<para>
</para>
@pad:
@activatepull:
<!-- ##### FUNCTION gst_pad_start_task ##### -->
<para>
</para>
@pad:
@func:
@data:
@Returns:
<!-- ##### FUNCTION gst_pad_pause_task ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_stop_task ##### -->
<para>
</para>
@pad:
@Returns:
<!-- ##### FUNCTION gst_pad_link ##### -->
<para>
@ -609,12 +699,32 @@ Checks if the pad is a sink pad.
@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:
@ -636,6 +746,16 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### FUNCTION gst_pad_set_caps ##### -->
<para>
</para>
@pad:
@caps:
@Returns:
<!-- ##### FUNCTION gst_pad_get_pad_template_caps ##### -->
<para>
@ -645,6 +765,15 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### FUNCTION gst_pad_set_acceptcaps_function ##### -->
<para>
</para>
@pad:
@acceptcaps:
<!-- ##### FUNCTION gst_pad_set_getcaps_function ##### -->
<para>
@ -654,6 +783,15 @@ Checks if the pad is a sink pad.
@getcaps:
<!-- ##### FUNCTION gst_pad_set_setcaps_function ##### -->
<para>
</para>
@pad:
@setcaps:
<!-- ##### FUNCTION gst_pad_proxy_getcaps ##### -->
<para>
@ -663,6 +801,16 @@ Checks if the pad is a sink pad.
@Returns:
<!-- ##### FUNCTION gst_pad_proxy_setcaps ##### -->
<para>
</para>
@pad:
@caps:
@Returns:
<!-- ##### FUNCTION gst_pad_get_allowed_caps ##### -->
<para>
@ -674,6 +822,78 @@ Checks if the pad is a sink pad.
@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>
@ -687,6 +907,57 @@ Checks if the pad is a sink pad.
@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>
@ -771,6 +1042,31 @@ Checks if the pad is a sink pad.
@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>

View file

@ -1,7 +1,10 @@
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 =
@ -11,11 +14,11 @@ endif
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
@ -27,11 +30,11 @@ 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
@ -43,10 +46,10 @@ 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
@ -61,8 +64,8 @@ else
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

17
gst/check/Makefile.am Normal file
View file

@ -0,0 +1,17 @@
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

View file

@ -23,15 +23,17 @@
#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);
@ -189,12 +191,18 @@ gst_mini_object_ref (GstMiniObject * mini_object)
{
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)
{
@ -231,6 +239,13 @@ gst_mini_object_unref (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);
}

View file

@ -0,0 +1,17 @@
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

View file

@ -1,13 +1,23 @@
### 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
@ -27,7 +37,9 @@ EXTRA_DIST = \
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

View file

@ -0,0 +1,13 @@
# 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}

View file

@ -0,0 +1,11 @@
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}

View file

@ -49,6 +49,7 @@ TESTS = $(top_builddir)/tools/gst-register \
gst/gsttag \
gst/gstvalue \
elements/gstfakesrc \
elements/identity \
pipelines/simple_launch_lines \
pipelines/cleanup \
states/sinks \
@ -57,14 +58,11 @@ TESTS = $(top_builddir)/tools/gst-register \
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 \
@ -72,7 +70,8 @@ gst_libs_gdp_SOURCES = \
# 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

View file

@ -1,2 +1,3 @@
.dirstamp
gstfakesrc
fakesrc
identity

View file

@ -22,7 +22,7 @@
#include <unistd.h>
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GList *buffers = NULL;
gboolean have_eos = FALSE;

View file

@ -0,0 +1,211 @@
/* 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;
}

View file

@ -20,7 +20,7 @@
* 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)

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_init)
{

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static void
pop_messages (GstBus * bus, int count)

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_caps)
{

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstBus *test_bus = NULL;

View file

@ -21,7 +21,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include "capslist.h"
GST_START_TEST (test_from_string)

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_add_remove_pad)
{

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static void
assert_gstrefcount (gpointer p, gint i)

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GList *

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GQuark domain;

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_copy)
{

View file

@ -20,7 +20,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
/*
Create a fake subclass

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_link)
{

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_from_string_int)

View file

@ -19,7 +19,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_signedness)
{

View file

@ -18,7 +18,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include <string.h>

View file

@ -21,7 +21,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
GST_START_TEST (test_deserialize_buffer)

View file

@ -21,7 +21,7 @@
*/
#include "config.h"
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
#include <gst/controller/gst-controller.h>
/* LOCAL TEST ELEMENT */

View file

@ -20,7 +20,7 @@
* 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 */

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstElement *

View file

@ -20,7 +20,7 @@
*/
#include "../gstcheck.h"
#include <gst/check/gstcheck.h>
static GstElement *