check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Common code for GStreamer unittests
|
|
|
|
*
|
2006-07-01 20:54:25 +00:00
|
|
|
* Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org>
|
2008-02-01 17:16:26 +00:00
|
|
|
* Copyright (C) 2008 Thijs Vermeir <thijsvermeir@gmail.com>
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
*/
|
2005-08-30 08:17:48 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstcheck
|
2017-01-16 14:26:16 +00:00
|
|
|
* @title: GstCheck
|
2005-11-24 18:40:58 +00:00
|
|
|
* @short_description: Common code for GStreamer unit tests
|
2005-08-30 08:17:48 +00:00
|
|
|
*
|
2005-11-24 18:40:58 +00:00
|
|
|
* These macros and functions are for internal use of the unit tests found
|
|
|
|
* inside the 'check' directories of various GStreamer packages.
|
2014-02-19 09:57:33 +00:00
|
|
|
*
|
2015-01-22 10:29:18 +00:00
|
|
|
* One notable feature is that one can use the environment variables GST_CHECKS
|
|
|
|
* and GST_CHECKS_IGNORE to select which tests to run or skip. Both variables
|
2015-01-23 07:59:27 +00:00
|
|
|
* can contain a comma separated list of test name globs (e.g. test_*).
|
2005-08-30 08:17:48 +00:00
|
|
|
*/
|
2013-04-27 10:46:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
|
|
|
#include "gstcheck.h"
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_DEBUG_CATEGORY (check_debug);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
|
|
|
/* logging function for tests
|
|
|
|
* a test uses g_message() to log a debug line
|
|
|
|
* a gst unit test can be run with GST_TEST_DEBUG env var set to see the
|
|
|
|
* messages
|
|
|
|
*/
|
|
|
|
|
|
|
|
gboolean _gst_check_threads_running = FALSE;
|
|
|
|
GList *thread_list = NULL;
|
2012-09-12 10:22:53 +00:00
|
|
|
GMutex mutex;
|
|
|
|
GCond start_cond; /* used to notify main thread of thread startups */
|
|
|
|
GCond sync_cond; /* used to synchronize all threads and main thread */
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2008-01-12 20:22:30 +00:00
|
|
|
GList *buffers = NULL;
|
2012-09-12 10:22:53 +00:00
|
|
|
GMutex check_mutex;
|
|
|
|
GCond check_cond;
|
2008-01-12 20:22:30 +00:00
|
|
|
|
2014-09-25 19:21:09 +00:00
|
|
|
/* FIXME 2.0: shouldn't _gst_check_debug be static? Not used anywhere */
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gboolean _gst_check_debug = FALSE;
|
|
|
|
gboolean _gst_check_raised_critical = FALSE;
|
2005-09-09 14:34:43 +00:00
|
|
|
gboolean _gst_check_raised_warning = FALSE;
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gboolean _gst_check_expecting_log = FALSE;
|
2016-12-02 14:59:43 +00:00
|
|
|
gboolean _gst_check_list_tests = FALSE;
|
2016-05-24 12:57:54 +00:00
|
|
|
static GQueue _gst_check_log_filters = G_QUEUE_INIT;
|
|
|
|
static GMutex _gst_check_log_filters_mutex;
|
|
|
|
|
2017-01-16 14:26:16 +00:00
|
|
|
struct _GstCheckLogFilter
|
|
|
|
{
|
2016-05-24 12:57:54 +00:00
|
|
|
gchar *log_domain;
|
|
|
|
GLogLevelFlags log_level;
|
|
|
|
GRegex *regex;
|
|
|
|
GstCheckLogFilterFunc func;
|
|
|
|
gpointer user_data;
|
|
|
|
GDestroyNotify destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_check_match_log_filter (const GstCheckLogFilter * filter,
|
|
|
|
const gchar * log_domain, GLogLevelFlags log_level, const gchar * message)
|
|
|
|
{
|
|
|
|
if (g_strcmp0 (log_domain, filter->log_domain) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if ((log_level & filter->log_level) == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!g_regex_match (filter->regex, message, 0, NULL))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCheckLogFilter *
|
|
|
|
gst_check_alloc_log_filter (const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
GRegex * regex, GstCheckLogFilterFunc func, gpointer user_data,
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
{
|
|
|
|
GstCheckLogFilter *filter;
|
|
|
|
|
|
|
|
filter = g_slice_new (GstCheckLogFilter);
|
|
|
|
filter->log_domain = g_strdup (log_domain);
|
|
|
|
filter->log_level = log_level;
|
|
|
|
filter->regex = regex;
|
|
|
|
filter->func = func;
|
|
|
|
filter->user_data = user_data;
|
|
|
|
filter->destroy = destroy_data;
|
|
|
|
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_check_free_log_filter (GstCheckLogFilter * filter)
|
|
|
|
{
|
|
|
|
if (!filter)
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_free (filter->log_domain);
|
|
|
|
g_regex_unref (filter->regex);
|
|
|
|
if (filter->destroy)
|
|
|
|
filter->destroy (filter->user_data);
|
|
|
|
g_slice_free (GstCheckLogFilter, filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-03-23 18:17:43 +00:00
|
|
|
* gst_check_add_log_filter: (skip)
|
2016-05-24 12:57:54 +00:00
|
|
|
* @log_domain: the log domain of the message
|
|
|
|
* @log_level: the log level of the message
|
|
|
|
* @regex: (transfer full): a #GRegex to match the message
|
|
|
|
* @func: the function to call for matching messages
|
|
|
|
* @user_data: the user data to pass to @func
|
|
|
|
* @destroy_data: #GDestroyNotify for @user_data
|
|
|
|
*
|
|
|
|
* Add a callback @func to be called for all log messages that matches
|
|
|
|
* @log_domain, @log_level and @regex. If @func is NULL the
|
|
|
|
* matching logs will be silently discarded by GstCheck.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*
|
|
|
|
* Returns: A filter that can be passed to @gst_check_remove_log_filter.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
**/
|
|
|
|
GstCheckLogFilter *
|
|
|
|
gst_check_add_log_filter (const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
GRegex * regex, GstCheckLogFilterFunc func, gpointer user_data,
|
|
|
|
GDestroyNotify destroy_data)
|
|
|
|
{
|
|
|
|
GstCheckLogFilter *filter;
|
|
|
|
|
|
|
|
g_return_val_if_fail (regex != NULL, NULL);
|
|
|
|
|
|
|
|
filter = gst_check_alloc_log_filter (log_domain, log_level, regex,
|
|
|
|
func, user_data, destroy_data);
|
|
|
|
g_mutex_lock (&_gst_check_log_filters_mutex);
|
|
|
|
g_queue_push_tail (&_gst_check_log_filters, filter);
|
|
|
|
g_mutex_unlock (&_gst_check_log_filters_mutex);
|
|
|
|
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_remove_log_filter:
|
|
|
|
* @filter: Filter returned by @gst_check_add_log_filter
|
|
|
|
*
|
|
|
|
* Remove a filter that has been added by @gst_check_add_log_filter.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gst_check_remove_log_filter (GstCheckLogFilter * filter)
|
|
|
|
{
|
|
|
|
g_mutex_lock (&_gst_check_log_filters_mutex);
|
|
|
|
g_queue_remove (&_gst_check_log_filters, filter);
|
|
|
|
gst_check_free_log_filter (filter);
|
|
|
|
g_mutex_unlock (&_gst_check_log_filters_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_clear_log_filter:
|
|
|
|
*
|
|
|
|
* Clear all filters added by @gst_check_add_log_filter.
|
|
|
|
*
|
|
|
|
* MT safe.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
gst_check_clear_log_filter (void)
|
|
|
|
{
|
|
|
|
g_mutex_lock (&_gst_check_log_filters_mutex);
|
|
|
|
g_queue_foreach (&_gst_check_log_filters,
|
|
|
|
(GFunc) gst_check_free_log_filter, NULL);
|
|
|
|
g_queue_clear (&_gst_check_log_filters);
|
|
|
|
g_mutex_unlock (&_gst_check_log_filters_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2017-01-16 14:26:16 +00:00
|
|
|
const gchar *domain;
|
|
|
|
const gchar *message;
|
2016-05-24 12:57:54 +00:00
|
|
|
GLogLevelFlags level;
|
|
|
|
gboolean discard;
|
|
|
|
} LogFilterApplyData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_check_apply_log_filter (GstCheckLogFilter * filter,
|
|
|
|
LogFilterApplyData * data)
|
|
|
|
{
|
|
|
|
if (gst_check_match_log_filter (filter, data->domain, data->level,
|
|
|
|
data->message)) {
|
|
|
|
if (filter->func)
|
|
|
|
data->discard |= filter->func (data->domain, data->level,
|
|
|
|
data->message, filter->user_data);
|
|
|
|
else
|
|
|
|
data->discard = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_check_filter_log_filter (const gchar * log_domain,
|
|
|
|
GLogLevelFlags log_level, const gchar * message)
|
|
|
|
{
|
|
|
|
LogFilterApplyData data;
|
|
|
|
|
|
|
|
data.domain = log_domain;
|
|
|
|
data.level = log_level;
|
|
|
|
data.message = message;
|
|
|
|
data.discard = FALSE;
|
|
|
|
|
|
|
|
g_mutex_lock (&_gst_check_log_filters_mutex);
|
|
|
|
g_queue_foreach (&_gst_check_log_filters, (GFunc) gst_check_apply_log_filter,
|
|
|
|
&data);
|
|
|
|
g_mutex_unlock (&_gst_check_log_filters_mutex);
|
|
|
|
|
|
|
|
if (data.discard)
|
|
|
|
GST_DEBUG ("Discarding message: %s", message);
|
|
|
|
|
|
|
|
return data.discard;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_check_log_fatal_func (const gchar * log_domain, GLogLevelFlags log_level,
|
2017-01-16 14:26:16 +00:00
|
|
|
const gchar * message, gpointer user_data)
|
2016-05-24 12:57:54 +00:00
|
|
|
{
|
|
|
|
if (gst_check_filter_log_filter (log_domain, log_level, message))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
static void gst_check_log_message_func
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
(const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
const gchar * message, gpointer user_data)
|
|
|
|
{
|
2016-05-24 12:57:54 +00:00
|
|
|
if (gst_check_filter_log_filter (log_domain, log_level, message))
|
|
|
|
return;
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
if (_gst_check_debug) {
|
2015-06-23 14:58:56 +00:00
|
|
|
g_print ("%s\n", message);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
static void gst_check_log_critical_func
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
(const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
const gchar * message, gpointer user_data)
|
|
|
|
{
|
2016-05-24 12:57:54 +00:00
|
|
|
if (gst_check_filter_log_filter (log_domain, log_level, message))
|
|
|
|
return;
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
if (!_gst_check_expecting_log) {
|
2018-01-11 12:27:18 +00:00
|
|
|
gchar *trace;
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
g_print ("\n\nUnexpected critical/warning: %s\n", message);
|
2018-01-11 12:27:18 +00:00
|
|
|
|
|
|
|
trace = gst_debug_get_stack_trace (GST_STACK_TRACE_SHOW_FULL);
|
|
|
|
if (trace) {
|
|
|
|
g_print ("\nStack trace:\n%s\n", trace);
|
|
|
|
g_free (trace);
|
|
|
|
}
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
fail ("Unexpected critical/warning: %s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_gst_check_debug) {
|
|
|
|
g_print ("\nExpected critical/warning: %s\n", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log_level & G_LOG_LEVEL_CRITICAL)
|
|
|
|
_gst_check_raised_critical = TRUE;
|
2005-09-09 14:34:43 +00:00
|
|
|
if (log_level & G_LOG_LEVEL_WARNING)
|
|
|
|
_gst_check_raised_warning = TRUE;
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
|
|
|
|
2010-06-01 10:46:17 +00:00
|
|
|
static gint
|
|
|
|
sort_plugins (GstPlugin * a, GstPlugin * b)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = strcmp (gst_plugin_get_source (a), gst_plugin_get_source (b));
|
|
|
|
if (ret == 0)
|
|
|
|
ret = strcmp (gst_plugin_get_name (a), gst_plugin_get_name (b));
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_plugins (void)
|
|
|
|
{
|
|
|
|
GList *plugins, *l;
|
|
|
|
|
2012-01-02 02:22:51 +00:00
|
|
|
plugins = gst_registry_get_plugin_list (gst_registry_get ());
|
2010-06-01 10:46:17 +00:00
|
|
|
plugins = g_list_sort (plugins, (GCompareFunc) sort_plugins);
|
|
|
|
for (l = plugins; l != NULL; l = l->next) {
|
|
|
|
GstPlugin *plugin = GST_PLUGIN (l->data);
|
|
|
|
|
|
|
|
if (strcmp (gst_plugin_get_source (plugin), "BLACKLIST") != 0) {
|
|
|
|
GST_LOG ("%20s@%s", gst_plugin_get_name (plugin),
|
|
|
|
GST_STR_NULL (gst_plugin_get_filename (plugin)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_plugin_list_free (plugins);
|
|
|
|
}
|
|
|
|
|
2016-05-24 12:57:54 +00:00
|
|
|
static void
|
|
|
|
gst_check_deinit (void)
|
|
|
|
{
|
|
|
|
gst_deinit ();
|
|
|
|
gst_check_clear_log_filter ();
|
|
|
|
}
|
|
|
|
|
2016-12-02 14:59:43 +00:00
|
|
|
/* gst_check_init:
|
|
|
|
* @argc: (inout) (allow-none): pointer to application's argc
|
|
|
|
* @argv: (inout) (array length=argc) (allow-none): pointer to application's argv
|
|
|
|
*
|
2016-12-16 18:30:20 +00:00
|
|
|
* Initialize GStreamer testing
|
2016-12-02 14:59:43 +00:00
|
|
|
*
|
|
|
|
* NOTE: Needs to be called before creating the testsuite
|
|
|
|
* so that the tests can be listed.
|
|
|
|
* */
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
void
|
|
|
|
gst_check_init (int *argc, char **argv[])
|
|
|
|
{
|
2013-04-27 10:46:13 +00:00
|
|
|
guint timeout_multiplier = 1;
|
2016-12-02 14:59:43 +00:00
|
|
|
GOptionContext *ctx;
|
|
|
|
GError *err = NULL;
|
|
|
|
GOptionEntry options[] = {
|
|
|
|
{"list-tests", 'l', 0, G_OPTION_ARG_NONE, &_gst_check_list_tests,
|
|
|
|
"List tests present in the testsuite", NULL},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
ctx = g_option_context_new ("gst-check");
|
|
|
|
g_option_context_add_main_entries (ctx, options, NULL);
|
|
|
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
|
|
|
|
|
|
|
if (!g_option_context_parse (ctx, argc, argv, &err)) {
|
|
|
|
if (err)
|
|
|
|
g_printerr ("Error initializing: %s\n", GST_STR_NULL (err->message));
|
|
|
|
else
|
|
|
|
g_printerr ("Error initializing: Unknown error!\n");
|
|
|
|
g_clear_error (&err);
|
|
|
|
}
|
|
|
|
g_option_context_free (ctx);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests");
|
|
|
|
|
2016-05-24 12:57:54 +00:00
|
|
|
if (atexit (gst_check_deinit) != 0) {
|
|
|
|
GST_ERROR ("failed to set gst_check_deinit as exit function");
|
2013-08-16 09:03:30 +00:00
|
|
|
}
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
if (g_getenv ("GST_TEST_DEBUG"))
|
|
|
|
_gst_check_debug = TRUE;
|
|
|
|
|
|
|
|
g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, gst_check_log_message_func,
|
|
|
|
NULL);
|
|
|
|
g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
|
|
|
g_log_set_handler ("GStreamer", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
|
|
|
g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
2012-05-27 23:08:56 +00:00
|
|
|
g_log_set_handler ("GLib-GIO", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
|
|
|
g_log_set_handler ("GLib", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
2007-06-14 17:36:19 +00:00
|
|
|
gst_check_log_critical_func, NULL);
|
2016-05-24 12:57:54 +00:00
|
|
|
g_test_log_set_fatal_handler (gst_check_log_fatal_func, NULL);
|
2006-06-02 16:41:02 +00:00
|
|
|
|
2010-06-01 10:46:17 +00:00
|
|
|
print_plugins ();
|
2013-04-27 10:46:13 +00:00
|
|
|
|
|
|
|
#ifdef TARGET_CPU
|
|
|
|
GST_INFO ("target CPU: %s", TARGET_CPU);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_CPU_ARM
|
|
|
|
timeout_multiplier = 10;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (timeout_multiplier > 1) {
|
|
|
|
const gchar *tmult = g_getenv ("CK_TIMEOUT_MULTIPLIER");
|
|
|
|
|
|
|
|
if (tmult == NULL) {
|
|
|
|
gchar num_str[32];
|
|
|
|
|
|
|
|
g_snprintf (num_str, sizeof (num_str), "%d", timeout_multiplier);
|
|
|
|
GST_INFO ("slow CPU, setting CK_TIMEOUT_MULTIPLIER to %s", num_str);
|
|
|
|
g_setenv ("CK_TIMEOUT_MULTIPLIER", num_str, TRUE);
|
|
|
|
} else {
|
|
|
|
GST_INFO ("CK_TIMEOUT_MULTIPLIER already set to '%s'", tmult);
|
|
|
|
}
|
|
|
|
}
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
2005-08-20 20:15:53 +00:00
|
|
|
|
|
|
|
/* message checking */
|
|
|
|
void
|
|
|
|
gst_check_message_error (GstMessage * message, GstMessageType type,
|
|
|
|
GQuark domain, gint code)
|
|
|
|
{
|
|
|
|
GError *error;
|
|
|
|
gchar *debug;
|
|
|
|
|
2006-07-02 23:22:31 +00:00
|
|
|
fail_unless (GST_MESSAGE_TYPE (message) == type,
|
|
|
|
"message is of type %s instead of expected type %s",
|
|
|
|
gst_message_type_get_name (GST_MESSAGE_TYPE (message)),
|
|
|
|
gst_message_type_get_name (type));
|
2005-08-20 20:15:53 +00:00
|
|
|
gst_message_parse_error (message, &error, &debug);
|
|
|
|
fail_unless_equals_int (error->domain, domain);
|
|
|
|
fail_unless_equals_int (error->code, code);
|
|
|
|
g_error_free (error);
|
|
|
|
g_free (debug);
|
|
|
|
}
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
|
|
|
|
/* helper functions */
|
2018-10-22 09:32:45 +00:00
|
|
|
/**
|
|
|
|
* gst_check_chain_func:
|
|
|
|
*
|
|
|
|
* A fake chain function that appends the buffer to the internal list of
|
|
|
|
* buffers.
|
|
|
|
*/
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstFlowReturn
|
2011-11-17 11:40:45 +00:00
|
|
|
gst_check_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
{
|
2011-11-17 11:40:45 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "chain_func: received buffer %p", buffer);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
buffers = g_list_append (buffers, buffer);
|
|
|
|
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&check_mutex);
|
|
|
|
g_cond_signal (&check_cond);
|
|
|
|
g_mutex_unlock (&check_mutex);
|
2006-06-02 16:41:02 +00:00
|
|
|
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2012-06-20 02:53:54 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_element:
|
|
|
|
* @factory: factory
|
|
|
|
*
|
|
|
|
* setup an element for a filter test with mysrcpad and mysinkpad
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new element
|
|
|
|
*/
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstElement *
|
|
|
|
gst_check_setup_element (const gchar * factory)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
GST_DEBUG ("setup_element");
|
|
|
|
|
|
|
|
element = gst_element_factory_make (factory, factory);
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_if (element == NULL, "Could not create a '%s' element", factory);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (element, factory, 1);
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_element (GstElement * element)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("teardown_element");
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (element, GST_STATE_NULL) ==
|
2005-09-02 15:42:00 +00:00
|
|
|
GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (element, "element", 1);
|
|
|
|
gst_object_unref (element);
|
|
|
|
}
|
|
|
|
|
2012-06-20 02:53:54 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_src_pad:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
*
|
2014-08-01 20:27:39 +00:00
|
|
|
* Does the same as #gst_check_setup_src_pad_by_name with the <emphasis> name </emphasis> parameter equal to "sink".
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): A new pad that can be used to inject data on @element
|
2012-06-20 02:53:54 +00:00
|
|
|
*/
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstPad *
|
2011-11-24 20:36:12 +00:00
|
|
|
gst_check_setup_src_pad (GstElement * element, GstStaticPadTemplate * tmpl)
|
2008-06-21 19:48:53 +00:00
|
|
|
{
|
2011-11-24 20:36:12 +00:00
|
|
|
return gst_check_setup_src_pad_by_name (element, tmpl, "sink");
|
2008-06-21 19:48:53 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 02:53:54 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_src_pad_by_name:
|
2014-08-01 20:27:39 +00:00
|
|
|
* @element: element to setup src pad on
|
2012-06-20 02:53:54 +00:00
|
|
|
* @tmpl: pad template
|
2014-08-01 20:27:39 +00:00
|
|
|
* @name: Name of the @element sink pad that will be linked to the src pad that will be setup
|
|
|
|
*
|
|
|
|
* Creates a new src pad (based on the given @tmpl) and links it to the given @element sink pad (the pad that matches the given @name).
|
|
|
|
* Before using the src pad to push data on @element you need to call #gst_check_setup_events on the created src pad.
|
|
|
|
*
|
|
|
|
* Example of how to push a buffer on @element:
|
|
|
|
*
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
* static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
* GST_PAD_SINK,
|
|
|
|
* GST_PAD_ALWAYS,
|
|
|
|
* GST_STATIC_CAPS (YOUR_CAPS_TEMPLATE_STRING)
|
|
|
|
* );
|
|
|
|
* static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
* GST_PAD_SRC,
|
|
|
|
* GST_PAD_ALWAYS,
|
|
|
|
* GST_STATIC_CAPS (YOUR_CAPS_TEMPLATE_STRING)
|
|
|
|
* );
|
|
|
|
*
|
|
|
|
* GstElement * element = gst_check_setup_element ("element");
|
|
|
|
* GstPad * mysrcpad = gst_check_setup_src_pad (element, &srctemplate);
|
|
|
|
* GstPad * mysinkpad = gst_check_setup_sink_pad (element, &sinktemplate);
|
|
|
|
*
|
|
|
|
* gst_pad_set_active (mysrcpad, TRUE);
|
|
|
|
* gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
* fail_unless (gst_element_set_state (element, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing");
|
|
|
|
*
|
|
|
|
* GstCaps * caps = gst_caps_from_string (YOUR_DESIRED_SINK_CAPS);
|
|
|
|
* gst_check_setup_events (mysrcpad, element, caps, GST_FORMAT_TIME);
|
|
|
|
* gst_caps_unref (caps);
|
|
|
|
*
|
|
|
|
* fail_unless (gst_pad_push (mysrcpad, gst_buffer_new_and_alloc(2)) == GST_FLOW_OK);
|
|
|
|
* ]|
|
2012-06-20 02:53:54 +00:00
|
|
|
*
|
2014-09-05 18:36:02 +00:00
|
|
|
* For very simple input/output test scenarios checkout #gst_check_element_push_buffer_list and #gst_check_element_push_buffer.
|
|
|
|
*
|
2014-08-01 20:27:39 +00:00
|
|
|
* Returns: (transfer full): A new pad that can be used to inject data on @element
|
2012-06-20 02:53:54 +00:00
|
|
|
*/
|
2008-06-21 19:48:53 +00:00
|
|
|
GstPad *
|
|
|
|
gst_check_setup_src_pad_by_name (GstElement * element,
|
2010-07-15 12:46:24 +00:00
|
|
|
GstStaticPadTemplate * tmpl, const gchar * name)
|
2014-04-15 10:58:59 +00:00
|
|
|
{
|
|
|
|
GstPadTemplate *ptmpl = gst_static_pad_template_get (tmpl);
|
|
|
|
GstPad *srcpad;
|
|
|
|
|
2014-09-15 10:06:40 +00:00
|
|
|
srcpad = gst_check_setup_src_pad_by_name_from_template (element, ptmpl, name);
|
2014-04-15 10:58:59 +00:00
|
|
|
|
|
|
|
gst_object_unref (ptmpl);
|
|
|
|
|
|
|
|
return srcpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_setup_src_pad_from_template:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad
|
2014-07-01 06:39:18 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2014-04-15 10:58:59 +00:00
|
|
|
*/
|
|
|
|
GstPad *
|
|
|
|
gst_check_setup_src_pad_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl)
|
|
|
|
{
|
|
|
|
return gst_check_setup_src_pad_by_name_from_template (element, tmpl, "sink");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_setup_src_pad_by_name_from_template:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
* @name: name
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad
|
2014-07-01 06:39:18 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2014-04-15 10:58:59 +00:00
|
|
|
*/
|
|
|
|
GstPad *
|
|
|
|
gst_check_setup_src_pad_by_name_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl, const gchar * name)
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* sending pad */
|
2014-04-15 10:58:59 +00:00
|
|
|
srcpad = gst_pad_new_from_template (tmpl, "src");
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (srcpad == NULL, "Could not create a srcpad");
|
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
|
|
|
|
2008-06-21 19:48:53 +00:00
|
|
|
sinkpad = gst_element_get_static_pad (element, name);
|
|
|
|
if (sinkpad == NULL)
|
|
|
|
sinkpad = gst_element_get_request_pad (element, name);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (sinkpad); /* because we got it higher up */
|
|
|
|
|
|
|
|
return srcpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-03-03 10:45:38 +00:00
|
|
|
gst_check_teardown_pad_by_name (GstElement * element, const gchar * name)
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
{
|
2008-06-21 21:20:13 +00:00
|
|
|
GstPad *pad_peer, *pad_element;
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
|
|
|
|
/* clean up floating src pad */
|
2008-06-21 21:20:13 +00:00
|
|
|
pad_element = gst_element_get_static_pad (element, name);
|
2010-12-05 13:46:28 +00:00
|
|
|
/* We don't check the refcount here since there *might* be
|
|
|
|
* a pad cache holding an extra reference on pad_element.
|
|
|
|
* To get to a state where no pad cache will exist,
|
|
|
|
* we first unlink that pad. */
|
2008-06-21 21:20:13 +00:00
|
|
|
pad_peer = gst_pad_get_peer (pad_element);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
|
2009-02-04 14:07:30 +00:00
|
|
|
if (pad_peer) {
|
|
|
|
if (gst_pad_get_direction (pad_element) == GST_PAD_SINK)
|
|
|
|
gst_pad_unlink (pad_peer, pad_element);
|
|
|
|
else
|
|
|
|
gst_pad_unlink (pad_element, pad_peer);
|
|
|
|
}
|
2006-06-02 16:45:08 +00:00
|
|
|
|
2008-06-21 21:20:13 +00:00
|
|
|
gst_object_unref (pad_element);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
|
2009-02-04 14:07:30 +00:00
|
|
|
if (pad_peer) {
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
}
|
2008-06-21 21:20:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_src_pad (GstElement * element)
|
|
|
|
{
|
|
|
|
gst_check_teardown_pad_by_name (element, "sink");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 02:53:54 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_sink_pad:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
*
|
2014-09-05 18:36:02 +00:00
|
|
|
* Does the same as #gst_check_setup_sink_pad_by_name with the <emphasis> name </emphasis> parameter equal to "src".
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad that can be used to check the output of @element
|
2012-06-20 02:53:54 +00:00
|
|
|
*/
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstPad *
|
2011-11-24 20:36:12 +00:00
|
|
|
gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * tmpl)
|
2008-06-21 19:48:53 +00:00
|
|
|
{
|
2011-11-24 20:36:12 +00:00
|
|
|
return gst_check_setup_sink_pad_by_name (element, tmpl, "src");
|
2008-06-21 19:48:53 +00:00
|
|
|
}
|
|
|
|
|
2012-06-20 02:53:54 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_sink_pad_by_name:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
2014-09-05 18:36:02 +00:00
|
|
|
* @name: Name of the @element src pad that will be linked to the sink pad that will be setup
|
2012-06-20 02:53:54 +00:00
|
|
|
*
|
2015-12-27 18:42:37 +00:00
|
|
|
* Creates a new sink pad (based on the given @tmpl) and links it to the given @element src pad
|
2014-09-05 18:36:02 +00:00
|
|
|
* (the pad that matches the given @name).
|
|
|
|
* You can set event/chain/query functions on this pad to check the output of the @element.
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad that can be used to check the output of @element
|
2012-06-20 02:53:54 +00:00
|
|
|
*/
|
2008-06-21 19:48:53 +00:00
|
|
|
GstPad *
|
|
|
|
gst_check_setup_sink_pad_by_name (GstElement * element,
|
2010-07-15 12:46:24 +00:00
|
|
|
GstStaticPadTemplate * tmpl, const gchar * name)
|
2014-04-15 10:58:59 +00:00
|
|
|
{
|
|
|
|
GstPadTemplate *ptmpl = gst_static_pad_template_get (tmpl);
|
|
|
|
GstPad *sinkpad;
|
|
|
|
|
|
|
|
sinkpad =
|
2014-09-15 10:06:40 +00:00
|
|
|
gst_check_setup_sink_pad_by_name_from_template (element, ptmpl, name);
|
2014-04-15 10:58:59 +00:00
|
|
|
|
|
|
|
gst_object_unref (ptmpl);
|
|
|
|
|
|
|
|
return sinkpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_setup_sink_pad_from_template:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad
|
2014-07-01 06:39:18 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2014-04-15 10:58:59 +00:00
|
|
|
*/
|
|
|
|
GstPad *
|
|
|
|
gst_check_setup_sink_pad_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl)
|
|
|
|
{
|
|
|
|
return gst_check_setup_sink_pad_by_name_from_template (element, tmpl, "src");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_setup_sink_pad_by_name_from_template:
|
|
|
|
* @element: element to setup pad on
|
|
|
|
* @tmpl: pad template
|
|
|
|
* @name: name
|
|
|
|
*
|
|
|
|
* Returns: (transfer full): a new pad
|
2014-07-01 06:39:18 +00:00
|
|
|
*
|
|
|
|
* Since: 1.4
|
2014-04-15 10:58:59 +00:00
|
|
|
*/
|
|
|
|
GstPad *
|
|
|
|
gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl, const gchar * name)
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* receiving pad */
|
2014-04-15 10:58:59 +00:00
|
|
|
sinkpad = gst_pad_new_from_template (tmpl, "sink");
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (sinkpad == NULL, "Could not create a sinkpad");
|
|
|
|
|
2008-06-21 19:48:53 +00:00
|
|
|
srcpad = gst_element_get_static_pad (element, name);
|
|
|
|
if (srcpad == NULL)
|
|
|
|
srcpad = gst_element_get_request_pad (element, name);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (srcpad == NULL, "Could not get source pad from %s",
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
|
|
|
|
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "Linking element src pad and receiving sink pad");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link %s source and sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (srcpad); /* because we got it higher up */
|
|
|
|
|
2019-12-10 08:42:37 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "set up srcpad");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
return sinkpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_sink_pad (GstElement * element)
|
|
|
|
{
|
2008-06-21 21:20:13 +00:00
|
|
|
gst_check_teardown_pad_by_name (element, "src");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
}
|
2006-06-06 13:48:20 +00:00
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
/**
|
|
|
|
* gst_check_drop_buffers:
|
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Unref and remove all buffers that are in the global @buffers GList,
|
|
|
|
* emptying the list.
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
gst_check_drop_buffers (void)
|
2008-02-01 17:16:26 +00:00
|
|
|
{
|
2010-07-03 14:08:12 +00:00
|
|
|
while (buffers != NULL) {
|
|
|
|
gst_buffer_unref (GST_BUFFER (buffers->data));
|
2008-02-19 12:56:28 +00:00
|
|
|
buffers = g_list_delete_link (buffers, buffers);
|
2008-02-01 17:16:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_caps_equal:
|
|
|
|
* @caps1: first caps to compare
|
|
|
|
* @caps2: second caps to compare
|
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Compare two caps with gst_caps_is_equal and fail unless they are
|
|
|
|
* equal.
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2)
|
|
|
|
{
|
|
|
|
gchar *name1 = gst_caps_to_string (caps1);
|
|
|
|
gchar *name2 = gst_caps_to_string (caps2);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps2),
|
|
|
|
"caps ('%s') is not equal to caps ('%s')", name1, name2);
|
|
|
|
g_free (name1);
|
|
|
|
g_free (name2);
|
|
|
|
}
|
|
|
|
|
2011-03-28 13:52:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_buffer_data:
|
|
|
|
* @buffer: buffer to compare
|
|
|
|
* @data: data to compare to
|
|
|
|
* @size: size of data to compare
|
|
|
|
*
|
|
|
|
* Compare the buffer contents with @data and @size.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size)
|
|
|
|
{
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo info;
|
2011-03-28 13:52:17 +00:00
|
|
|
|
2014-04-16 09:40:46 +00:00
|
|
|
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
|
2012-01-20 13:23:57 +00:00
|
|
|
GST_MEMDUMP ("Converted data", info.data, info.size);
|
2011-10-17 07:28:24 +00:00
|
|
|
GST_MEMDUMP ("Expected data", data, size);
|
2019-09-23 15:19:07 +00:00
|
|
|
if (info.size != size) {
|
|
|
|
fail ("buffer sizes not equal: expected %" G_GSIZE_FORMAT " got %"
|
|
|
|
G_GSIZE_FORMAT, size, info.size);
|
|
|
|
}
|
2012-01-20 13:23:57 +00:00
|
|
|
if (memcmp (info.data, data, size) != 0) {
|
2011-10-17 07:28:24 +00:00
|
|
|
g_print ("\nConverted data:\n");
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_util_dump_mem (info.data, info.size);
|
2011-10-17 07:28:24 +00:00
|
|
|
g_print ("\nExpected data:\n");
|
|
|
|
gst_util_dump_mem (data, size);
|
2015-12-27 18:42:37 +00:00
|
|
|
fail ("buffer contents not equal");
|
2011-10-17 07:28:24 +00:00
|
|
|
}
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (buffer, &info);
|
2011-03-28 13:52:17 +00:00
|
|
|
}
|
|
|
|
|
2012-01-28 07:38:03 +00:00
|
|
|
static gboolean
|
|
|
|
buffer_event_function (GstPad * pad, GstObject * noparent, GstEvent * event)
|
|
|
|
{
|
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_CAPS) {
|
2013-05-15 09:21:46 +00:00
|
|
|
GstCaps *event_caps;
|
|
|
|
GstCaps *expected_caps = gst_pad_get_element_private (pad);
|
2012-01-28 07:38:03 +00:00
|
|
|
|
|
|
|
gst_event_parse_caps (event, &event_caps);
|
2013-05-15 09:21:46 +00:00
|
|
|
fail_unless (gst_caps_is_fixed (expected_caps));
|
2012-01-28 07:38:03 +00:00
|
|
|
fail_unless (gst_caps_is_fixed (event_caps));
|
2013-05-15 09:21:46 +00:00
|
|
|
fail_unless (gst_caps_is_equal_fixed (event_caps, expected_caps));
|
2012-01-28 07:38:03 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gst_pad_event_default (pad, noparent, event);
|
|
|
|
}
|
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
/**
|
2010-02-15 01:24:25 +00:00
|
|
|
* gst_check_element_push_buffer_list:
|
|
|
|
* @element_name: name of the element that needs to be created
|
2012-01-28 07:38:03 +00:00
|
|
|
* @buffer_in: (element-type GstBuffer) (transfer full): a list of buffers that needs to be
|
2013-12-07 14:38:19 +00:00
|
|
|
* pushed to the element
|
2014-07-05 16:29:29 +00:00
|
|
|
* @caps_in: the #GstCaps expected of the sinkpad of the element
|
2012-01-28 07:38:03 +00:00
|
|
|
* @buffer_out: (element-type GstBuffer) (transfer full): a list of buffers that we expect from
|
|
|
|
* the element
|
2014-07-05 16:29:29 +00:00
|
|
|
* @caps_out: the #GstCaps expected of the srcpad of the element
|
2008-02-01 17:16:26 +00:00
|
|
|
* @last_flow_return: the last buffer push needs to give this GstFlowReturn
|
|
|
|
*
|
2014-07-05 16:29:29 +00:00
|
|
|
* Create an element using the factory providing the @element_name and push the
|
|
|
|
* buffers in @buffer_in to this element. The element should create the buffers
|
|
|
|
* equal to the buffers in @buffer_out. We only check the size and the data of
|
|
|
|
* the buffers. This function unrefs the buffers in the two lists.
|
2008-02-19 12:56:28 +00:00
|
|
|
* The last_flow_return parameter indicates the expected flow return value from
|
|
|
|
* pushing the final buffer in the list.
|
|
|
|
* This can be used to set up a test which pushes some buffers and then an
|
|
|
|
* invalid buffer, when the final buffer is expected to fail, for example.
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
2014-09-25 19:21:09 +00:00
|
|
|
/* FIXME 2.0: rename this function now that there's GstBufferList? */
|
2008-02-01 17:16:26 +00:00
|
|
|
void
|
|
|
|
gst_check_element_push_buffer_list (const gchar * element_name,
|
2012-01-28 07:38:03 +00:00
|
|
|
GList * buffer_in, GstCaps * caps_in, GList * buffer_out,
|
|
|
|
GstCaps * caps_out, GstFlowReturn last_flow_return)
|
2008-02-01 17:16:26 +00:00
|
|
|
{
|
|
|
|
GstElement *element;
|
|
|
|
GstPad *pad_peer;
|
|
|
|
GstPad *sink_pad = NULL;
|
|
|
|
GstPad *src_pad;
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
GstBuffer *buffer;
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
/* check that there are no buffers waiting */
|
|
|
|
gst_check_drop_buffers ();
|
|
|
|
/* create the element */
|
|
|
|
element = gst_check_setup_element (element_name);
|
|
|
|
fail_if (element == NULL, "failed to create the element '%s'", element_name);
|
|
|
|
fail_unless (GST_IS_ELEMENT (element), "the element is no element");
|
|
|
|
/* create the src pad */
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
buffer = GST_BUFFER (buffer_in->data);
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
fail_unless (GST_IS_BUFFER (buffer), "There should be a buffer in buffer_in");
|
2012-01-28 07:38:03 +00:00
|
|
|
src_pad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
if (caps_in) {
|
|
|
|
fail_unless (gst_caps_is_fixed (caps_in));
|
|
|
|
gst_pad_use_fixed_caps (src_pad);
|
|
|
|
}
|
|
|
|
/* activate the pad */
|
|
|
|
gst_pad_set_active (src_pad, TRUE);
|
|
|
|
GST_DEBUG ("src pad activated");
|
2013-05-15 09:21:46 +00:00
|
|
|
gst_check_setup_events (src_pad, element, caps_in, GST_FORMAT_BYTES);
|
2008-05-21 15:57:52 +00:00
|
|
|
pad_peer = gst_element_get_static_pad (element, "sink");
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_if (pad_peer == NULL);
|
|
|
|
fail_unless (gst_pad_link (src_pad, pad_peer) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
/* don't create the sink_pad if there is no buffer_out list */
|
|
|
|
if (buffer_out != NULL) {
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
GST_DEBUG ("buffer out detected, creating the sink pad");
|
|
|
|
/* get the sink caps */
|
2012-01-28 07:38:03 +00:00
|
|
|
if (caps_out) {
|
|
|
|
gchar *temp;
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_fixed (caps_out));
|
|
|
|
temp = gst_caps_to_string (caps_out);
|
|
|
|
|
|
|
|
GST_DEBUG ("sink caps requested by buffer out: '%s'", temp);
|
|
|
|
g_free (temp);
|
|
|
|
}
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
/* get the sink pad */
|
2012-01-28 07:38:03 +00:00
|
|
|
sink_pad = gst_pad_new ("sink", GST_PAD_SINK);
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_unless (GST_IS_PAD (sink_pad));
|
2012-01-28 07:38:03 +00:00
|
|
|
/* configure the sink pad */
|
|
|
|
gst_pad_set_chain_function (sink_pad, gst_check_chain_func);
|
|
|
|
gst_pad_set_active (sink_pad, TRUE);
|
2013-05-15 09:21:46 +00:00
|
|
|
if (caps_out) {
|
|
|
|
gst_pad_set_element_private (sink_pad, caps_out);
|
2012-01-28 07:38:03 +00:00
|
|
|
gst_pad_set_event_function (sink_pad, buffer_event_function);
|
2013-05-15 09:21:46 +00:00
|
|
|
}
|
2008-02-01 17:16:26 +00:00
|
|
|
/* get the peer pad */
|
2008-05-21 15:57:52 +00:00
|
|
|
pad_peer = gst_element_get_static_pad (element, "src");
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_unless (gst_pad_link (pad_peer, sink_pad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link sink and %s source pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
}
|
|
|
|
fail_unless (gst_element_set_state (element,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
/* push all the buffers in the buffer_in list */
|
|
|
|
fail_unless (g_list_length (buffer_in) > 0, "the buffer_in list is empty");
|
2010-07-03 14:08:12 +00:00
|
|
|
while (buffer_in != NULL) {
|
2008-02-01 17:16:26 +00:00
|
|
|
GstBuffer *next_buffer = GST_BUFFER (buffer_in->data);
|
|
|
|
|
|
|
|
fail_unless (GST_IS_BUFFER (next_buffer),
|
|
|
|
"data in buffer_in should be a buffer");
|
|
|
|
/* remove the buffer from the list */
|
|
|
|
buffer_in = g_list_remove (buffer_in, next_buffer);
|
2010-07-03 14:08:12 +00:00
|
|
|
if (buffer_in == NULL) {
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_unless (gst_pad_push (src_pad, next_buffer) == last_flow_return,
|
2008-02-19 12:56:28 +00:00
|
|
|
"we expect something else from the last buffer");
|
2008-02-01 17:16:26 +00:00
|
|
|
} else {
|
|
|
|
fail_unless (gst_pad_push (src_pad, next_buffer) == GST_FLOW_OK,
|
|
|
|
"Failed to push buffer in");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fail_unless (gst_element_set_state (element,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
/* check that there is a buffer out */
|
2010-07-03 14:08:12 +00:00
|
|
|
fail_unless_equals_int (g_list_length (buffers), g_list_length (buffer_out));
|
|
|
|
while (buffers != NULL) {
|
2008-02-01 17:16:26 +00:00
|
|
|
GstBuffer *new = GST_BUFFER (buffers->data);
|
|
|
|
GstBuffer *orig = GST_BUFFER (buffer_out->data);
|
2012-01-20 13:23:57 +00:00
|
|
|
GstMapInfo newinfo, originfo;
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2014-04-16 09:40:46 +00:00
|
|
|
fail_unless (gst_buffer_map (new, &newinfo, GST_MAP_READ));
|
|
|
|
fail_unless (gst_buffer_map (orig, &originfo, GST_MAP_READ));
|
2008-02-01 17:16:26 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
GST_LOG ("orig buffer: size %" G_GSIZE_FORMAT, originfo.size);
|
|
|
|
GST_LOG ("new buffer: size %" G_GSIZE_FORMAT, newinfo.size);
|
|
|
|
GST_MEMDUMP ("orig buffer", originfo.data, originfo.size);
|
|
|
|
GST_MEMDUMP ("new buffer", newinfo.data, newinfo.size);
|
2010-02-18 13:08:32 +00:00
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
/* remove the buffers */
|
|
|
|
buffers = g_list_remove (buffers, new);
|
|
|
|
buffer_out = g_list_remove (buffer_out, orig);
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
fail_unless (originfo.size == newinfo.size,
|
|
|
|
"size of the buffers are not the same");
|
|
|
|
fail_unless (memcmp (originfo.data, newinfo.data, newinfo.size) == 0,
|
2011-03-21 17:13:55 +00:00
|
|
|
"data is not the same");
|
2011-05-08 10:46:17 +00:00
|
|
|
#if 0
|
2011-05-05 08:37:19 +00:00
|
|
|
gst_check_caps_equal (GST_BUFFER_CAPS (orig), GST_BUFFER_CAPS (new));
|
2011-05-08 10:46:17 +00:00
|
|
|
#endif
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2012-01-20 13:23:57 +00:00
|
|
|
gst_buffer_unmap (orig, &originfo);
|
|
|
|
gst_buffer_unmap (new, &newinfo);
|
2011-03-21 17:13:55 +00:00
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
gst_buffer_unref (new);
|
|
|
|
gst_buffer_unref (orig);
|
|
|
|
}
|
|
|
|
/* teardown the element and pads */
|
|
|
|
gst_pad_set_active (src_pad, FALSE);
|
|
|
|
gst_check_teardown_src_pad (element);
|
|
|
|
gst_pad_set_active (sink_pad, FALSE);
|
|
|
|
gst_check_teardown_sink_pad (element);
|
|
|
|
gst_check_teardown_element (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_element_push_buffer:
|
2008-03-24 16:44:25 +00:00
|
|
|
* @element_name: name of the element that needs to be created
|
2008-02-01 17:16:26 +00:00
|
|
|
* @buffer_in: push this buffer to the element
|
2014-07-05 16:29:29 +00:00
|
|
|
* @caps_in: the #GstCaps expected of the sinkpad of the element
|
2008-02-01 17:16:26 +00:00
|
|
|
* @buffer_out: compare the result with this buffer
|
2014-07-05 16:29:29 +00:00
|
|
|
* @caps_out: the #GstCaps expected of the srcpad of the element
|
2008-02-01 17:16:26 +00:00
|
|
|
*
|
2014-07-05 16:29:29 +00:00
|
|
|
* Create an element using the factory providing the @element_name and
|
|
|
|
* push the @buffer_in to this element. The element should create one buffer
|
2008-02-01 17:16:26 +00:00
|
|
|
* and this will be compared with @buffer_out. We only check the caps
|
|
|
|
* and the data of the buffers. This function unrefs the buffers.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_element_push_buffer (const gchar * element_name,
|
2012-01-28 07:38:03 +00:00
|
|
|
GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out,
|
|
|
|
GstCaps * caps_out)
|
2008-02-01 17:16:26 +00:00
|
|
|
{
|
|
|
|
GList *in = NULL;
|
|
|
|
GList *out = NULL;
|
|
|
|
|
|
|
|
in = g_list_append (in, buffer_in);
|
|
|
|
out = g_list_append (out, buffer_out);
|
|
|
|
|
2012-01-28 07:38:03 +00:00
|
|
|
gst_check_element_push_buffer_list (element_name, in, caps_in, out, caps_out,
|
|
|
|
GST_FLOW_OK);
|
2008-02-01 17:16:26 +00:00
|
|
|
}
|
|
|
|
|
2018-10-22 09:32:45 +00:00
|
|
|
/**
|
|
|
|
* gst_check_abi_list:
|
|
|
|
* @list: A list of GstCheckABIStruct to be verified
|
|
|
|
* @have_abi_sizes: Whether there is a reference ABI size already specified,
|
|
|
|
* if it is %FALSE and the `GST_ABI` environment variable is set, usable code
|
|
|
|
* for @list will be printed.
|
|
|
|
*
|
|
|
|
* Verifies that reference values and current values are equals in @list.
|
|
|
|
*/
|
2006-06-06 13:48:20 +00:00
|
|
|
void
|
|
|
|
gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes)
|
|
|
|
{
|
|
|
|
if (have_abi_sizes) {
|
|
|
|
gboolean ok = TRUE;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; list[i].name; i++) {
|
|
|
|
if (list[i].size != list[i].abi_size) {
|
|
|
|
ok = FALSE;
|
|
|
|
g_print ("sizeof(%s) is %d, expected %d\n",
|
|
|
|
list[i].name, list[i].size, list[i].abi_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fail_unless (ok, "failed ABI check");
|
|
|
|
} else {
|
2007-01-16 09:57:50 +00:00
|
|
|
const gchar *fn;
|
|
|
|
|
|
|
|
if ((fn = g_getenv ("GST_ABI"))) {
|
|
|
|
GError *err = NULL;
|
|
|
|
GString *s;
|
2006-06-06 13:48:20 +00:00
|
|
|
gint i;
|
|
|
|
|
2007-01-16 09:57:50 +00:00
|
|
|
s = g_string_new ("\nGstCheckABIStruct list[] = {\n");
|
2006-06-06 13:48:20 +00:00
|
|
|
for (i = 0; list[i].name; i++) {
|
2007-01-16 09:57:50 +00:00
|
|
|
g_string_append_printf (s, " {\"%s\", sizeof (%s), %d},\n",
|
|
|
|
list[i].name, list[i].name, list[i].size);
|
|
|
|
}
|
|
|
|
g_string_append (s, " {NULL, 0, 0}\n");
|
|
|
|
g_string_append (s, "};\n");
|
|
|
|
if (!g_file_set_contents (fn, s->str, s->len, &err)) {
|
|
|
|
g_print ("%s", s->str);
|
|
|
|
g_printerr ("\nFailed to write ABI information: %s\n", err->message);
|
2015-09-15 01:56:40 +00:00
|
|
|
g_clear_error (&err);
|
2007-01-16 09:57:50 +00:00
|
|
|
} else {
|
|
|
|
g_print ("\nWrote ABI information to '%s'.\n", fn);
|
2006-06-06 13:48:20 +00:00
|
|
|
}
|
2007-01-16 09:57:50 +00:00
|
|
|
g_string_free (s, TRUE);
|
2006-06-06 13:48:20 +00:00
|
|
|
} else {
|
|
|
|
g_print ("No structure size list was generated for this architecture.\n");
|
|
|
|
g_print ("Run with GST_ABI environment variable set to output header.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-07-01 20:54:25 +00:00
|
|
|
|
2019-03-23 18:17:43 +00:00
|
|
|
/**
|
|
|
|
* gst_check_run_suite: (skip)
|
|
|
|
* @suite: the check test suite
|
|
|
|
* @name: name
|
|
|
|
* @fname: file name
|
|
|
|
*
|
|
|
|
* Returns: number of failed tests
|
|
|
|
*/
|
2006-07-01 20:54:25 +00:00
|
|
|
gint
|
|
|
|
gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname)
|
|
|
|
{
|
2011-01-13 15:41:50 +00:00
|
|
|
SRunner *sr;
|
|
|
|
gchar *xmlfilename = NULL;
|
2006-07-01 20:54:25 +00:00
|
|
|
gint nf;
|
2013-03-23 12:44:51 +00:00
|
|
|
GTimer *timer;
|
2006-07-01 20:54:25 +00:00
|
|
|
|
2011-01-13 15:41:50 +00:00
|
|
|
sr = srunner_create (suite);
|
2006-07-01 20:54:25 +00:00
|
|
|
|
|
|
|
if (g_getenv ("GST_CHECK_XML")) {
|
|
|
|
/* how lucky we are to have __FILE__ end in .c */
|
2011-01-13 15:41:50 +00:00
|
|
|
xmlfilename = g_strdup_printf ("%sheck.xml", fname);
|
2006-07-01 20:54:25 +00:00
|
|
|
|
|
|
|
srunner_set_xml (sr, xmlfilename);
|
|
|
|
}
|
|
|
|
|
2013-03-23 12:44:51 +00:00
|
|
|
timer = g_timer_new ();
|
2006-07-01 20:54:25 +00:00
|
|
|
srunner_run_all (sr, CK_NORMAL);
|
|
|
|
nf = srunner_ntests_failed (sr);
|
2013-03-23 12:44:51 +00:00
|
|
|
g_print ("Check suite %s ran in %.3fs (tests failed: %d)\n",
|
|
|
|
name, g_timer_elapsed (timer, NULL), nf);
|
|
|
|
g_timer_destroy (timer);
|
2011-01-13 15:41:50 +00:00
|
|
|
g_free (xmlfilename);
|
2006-07-01 20:54:25 +00:00
|
|
|
srunner_free (sr);
|
|
|
|
return nf;
|
|
|
|
}
|
2007-10-16 16:12:36 +00:00
|
|
|
|
2014-02-09 16:38:10 +00:00
|
|
|
static gboolean
|
|
|
|
gst_check_have_checks_list (const gchar * env_var_name)
|
|
|
|
{
|
|
|
|
const gchar *env_val;
|
|
|
|
|
|
|
|
env_val = g_getenv (env_var_name);
|
|
|
|
return (env_val != NULL && *env_val != '\0');
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_check_func_is_in_list (const gchar * env_var, const gchar * func_name)
|
2007-10-16 16:12:36 +00:00
|
|
|
{
|
|
|
|
const gchar *gst_checks;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
gchar **funcs, **f;
|
|
|
|
|
2014-02-09 16:38:10 +00:00
|
|
|
gst_checks = g_getenv (env_var);
|
2007-10-16 16:12:36 +00:00
|
|
|
|
|
|
|
if (gst_checks == NULL || *gst_checks == '\0')
|
2014-02-09 16:38:10 +00:00
|
|
|
return FALSE;
|
2007-10-16 16:12:36 +00:00
|
|
|
|
|
|
|
/* only run specified functions */
|
|
|
|
funcs = g_strsplit (gst_checks, ",", -1);
|
|
|
|
for (f = funcs; f != NULL && *f != NULL; ++f) {
|
2010-06-06 20:19:58 +00:00
|
|
|
if (g_pattern_match_simple (*f, func_name)) {
|
2007-10-16 16:12:36 +00:00
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_strfreev (funcs);
|
|
|
|
return res;
|
|
|
|
}
|
2013-05-09 21:17:14 +00:00
|
|
|
|
2014-02-09 16:38:10 +00:00
|
|
|
gboolean
|
|
|
|
_gst_check_run_test_func (const gchar * func_name)
|
|
|
|
{
|
|
|
|
/* if we have a whitelist, run it only if it's in the whitelist */
|
|
|
|
if (gst_check_have_checks_list ("GST_CHECKS"))
|
|
|
|
return gst_check_func_is_in_list ("GST_CHECKS", func_name);
|
|
|
|
|
|
|
|
/* if we have a blacklist, run it only if it's not in the blacklist */
|
|
|
|
if (gst_check_have_checks_list ("GST_CHECKS_IGNORE"))
|
|
|
|
return !gst_check_func_is_in_list ("GST_CHECKS_IGNORE", func_name);
|
|
|
|
|
|
|
|
/* no filter specified => run all checks */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-05-09 21:17:14 +00:00
|
|
|
/**
|
2013-07-01 09:10:00 +00:00
|
|
|
* gst_check_setup_events_with_stream_id:
|
2013-05-09 21:17:14 +00:00
|
|
|
* @srcpad: The src #GstPad to push on
|
|
|
|
* @element: The #GstElement use to create the stream id
|
|
|
|
* @caps: (allow-none): #GstCaps in case caps event must be sent
|
|
|
|
* @format: The #GstFormat of the default segment to send
|
2013-07-01 09:10:00 +00:00
|
|
|
* @stream_id: A unique identifier for the stream
|
2013-05-09 21:17:14 +00:00
|
|
|
*
|
2013-12-07 14:38:19 +00:00
|
|
|
* Push stream-start, caps and segment event, which consist of the minimum
|
2013-07-01 09:10:00 +00:00
|
|
|
* required events to allow streaming. Caps is optional to allow raw src
|
|
|
|
* testing.
|
2013-05-09 21:17:14 +00:00
|
|
|
*/
|
|
|
|
void
|
2013-07-01 09:10:00 +00:00
|
|
|
gst_check_setup_events_with_stream_id (GstPad * srcpad, GstElement * element,
|
|
|
|
GstCaps * caps, GstFormat format, const gchar * stream_id)
|
2013-05-09 21:17:14 +00:00
|
|
|
{
|
|
|
|
GstSegment segment;
|
|
|
|
|
|
|
|
gst_segment_init (&segment, format);
|
|
|
|
|
|
|
|
fail_unless (gst_pad_push_event (srcpad,
|
|
|
|
gst_event_new_stream_start (stream_id)));
|
|
|
|
if (caps)
|
|
|
|
fail_unless (gst_pad_push_event (srcpad, gst_event_new_caps (caps)));
|
|
|
|
fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment)));
|
2013-07-01 09:10:00 +00:00
|
|
|
}
|
2013-05-09 21:17:14 +00:00
|
|
|
|
2013-07-01 09:10:00 +00:00
|
|
|
/**
|
|
|
|
* gst_check_setup_events:
|
|
|
|
* @srcpad: The src #GstPad to push on
|
|
|
|
* @element: The #GstElement use to create the stream id
|
|
|
|
* @caps: (allow-none): #GstCaps in case caps event must be sent
|
|
|
|
* @format: The #GstFormat of the default segment to send
|
|
|
|
*
|
2013-12-07 14:38:19 +00:00
|
|
|
* Push stream-start, caps and segment event, which consist of the minimum
|
2013-07-01 09:10:00 +00:00
|
|
|
* required events to allow streaming. Caps is optional to allow raw src
|
|
|
|
* testing. If @element has more than one src or sink pad, use
|
|
|
|
* gst_check_setup_events_with_stream_id() instead.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_setup_events (GstPad * srcpad, GstElement * element,
|
|
|
|
GstCaps * caps, GstFormat format)
|
|
|
|
{
|
|
|
|
gchar *stream_id;
|
|
|
|
|
|
|
|
stream_id = gst_pad_create_stream_id (srcpad, element, NULL);
|
|
|
|
gst_check_setup_events_with_stream_id (srcpad, element, caps, format,
|
|
|
|
stream_id);
|
2013-05-09 21:17:14 +00:00
|
|
|
g_free (stream_id);
|
|
|
|
}
|
2014-09-11 13:52:32 +00:00
|
|
|
|
|
|
|
typedef struct _DestroyedObjectStruct
|
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
gboolean destroyed;
|
|
|
|
} DestroyedObjectStruct;
|
|
|
|
|
|
|
|
static void
|
|
|
|
weak_notify (DestroyedObjectStruct * destroyed, GObject ** object)
|
|
|
|
{
|
|
|
|
destroyed->destroyed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_objects_destroyed_on_unref:
|
|
|
|
* @object_to_unref: The #GObject to unref
|
2014-12-18 15:04:22 +00:00
|
|
|
* @first_object: (allow-none): The first object that should be destroyed as a
|
2014-09-11 13:52:32 +00:00
|
|
|
* concequence of unrefing @object_to_unref.
|
|
|
|
* @... : Additional object that should have been destroyed.
|
|
|
|
*
|
|
|
|
* Unrefs @object_to_unref and checks that is has properly been
|
|
|
|
* destroyed, also checks that the other objects passed in
|
2019-10-06 15:12:11 +00:00
|
|
|
* parameter have been destroyed as a concequence of
|
2014-09-11 13:52:32 +00:00
|
|
|
* unrefing @object_to_unref. Last variable argument should be NULL.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
void
|
2014-11-28 13:17:54 +00:00
|
|
|
gst_check_objects_destroyed_on_unref (gpointer object_to_unref,
|
|
|
|
gpointer first_object, ...)
|
2014-09-11 13:52:32 +00:00
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
GList *objs = NULL, *tmp;
|
|
|
|
DestroyedObjectStruct *destroyed = g_slice_new0 (DestroyedObjectStruct);
|
|
|
|
|
|
|
|
destroyed->object = object_to_unref;
|
|
|
|
g_object_weak_ref (object_to_unref, (GWeakNotify) weak_notify, destroyed);
|
|
|
|
objs = g_list_prepend (objs, destroyed);
|
|
|
|
|
|
|
|
if (first_object) {
|
|
|
|
va_list varargs;
|
|
|
|
|
|
|
|
object = first_object;
|
|
|
|
|
|
|
|
va_start (varargs, first_object);
|
|
|
|
while (object) {
|
|
|
|
destroyed = g_slice_new0 (DestroyedObjectStruct);
|
|
|
|
destroyed->object = object;
|
|
|
|
g_object_weak_ref (object, (GWeakNotify) weak_notify, destroyed);
|
|
|
|
objs = g_list_prepend (objs, destroyed);
|
|
|
|
object = va_arg (varargs, GObject *);
|
|
|
|
}
|
|
|
|
va_end (varargs);
|
|
|
|
}
|
|
|
|
gst_object_unref (object_to_unref);
|
|
|
|
|
|
|
|
for (tmp = objs; tmp; tmp = tmp->next) {
|
|
|
|
DestroyedObjectStruct *destroyed = tmp->data;
|
|
|
|
|
2014-11-28 13:17:54 +00:00
|
|
|
if (!destroyed->destroyed) {
|
|
|
|
fail_unless (destroyed->destroyed,
|
2014-09-11 13:52:32 +00:00
|
|
|
"%s_%p is not destroyed, %d refcounts left!",
|
2014-11-28 13:17:54 +00:00
|
|
|
GST_IS_OBJECT (destroyed->
|
|
|
|
object) ? GST_OBJECT_NAME (destroyed->object) :
|
|
|
|
G_OBJECT_TYPE_NAME (destroyed), destroyed->object,
|
|
|
|
destroyed->object->ref_count);
|
2014-09-11 13:52:32 +00:00
|
|
|
}
|
|
|
|
g_slice_free (DestroyedObjectStruct, tmp->data);
|
|
|
|
}
|
|
|
|
g_list_free (objs);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_object_destroyed_on_unref:
|
|
|
|
* @object_to_unref: The #GObject to unref
|
|
|
|
*
|
|
|
|
* Unrefs @object_to_unref and checks that is has properly been
|
|
|
|
* destroyed.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_object_destroyed_on_unref (gpointer object_to_unref)
|
|
|
|
{
|
|
|
|
gst_check_objects_destroyed_on_unref (object_to_unref, NULL, NULL);
|
|
|
|
}
|
2015-01-21 17:07:09 +00:00
|
|
|
|
|
|
|
/* For ABI compatibility with GStreamer < 1.5 */
|
2015-09-28 15:01:55 +00:00
|
|
|
/* *INDENT-OFF* */
|
2018-08-12 18:04:51 +00:00
|
|
|
GST_CHECK_API void
|
2015-09-28 15:01:55 +00:00
|
|
|
_fail_unless (int result, const char *file, int line, const char *expr, ...)
|
|
|
|
G_GNUC_PRINTF (4, 5);
|
|
|
|
/* *INDENT-ON* */
|
2015-01-21 17:07:09 +00:00
|
|
|
|
2015-09-15 01:52:55 +00:00
|
|
|
void
|
|
|
|
_fail_unless (int result, const char *file, int line, const char *expr, ...)
|
2015-01-21 17:07:09 +00:00
|
|
|
{
|
|
|
|
gchar *msg;
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
if (result) {
|
2015-09-15 01:52:55 +00:00
|
|
|
_mark_point (file, line);
|
2015-01-21 17:07:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
va_start (args, expr);
|
|
|
|
msg = g_strdup_vprintf (expr, args);
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
_ck_assert_failed (file, line, msg, NULL);
|
|
|
|
g_free (msg);
|
|
|
|
}
|