gstreamer/tests/old/testsuite/debug/commandline.c

119 lines
3.6 KiB
C
Raw Normal View History

/*
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* commandline.c: Test if the command line arguments work
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
GST_DEBUG_CATEGORY (cat);
GST_DEBUG_CATEGORY_STATIC (cat_static);
#ifndef GST_DISABLE_GST_DEBUG
static const gchar *lines[] = {
"--gst-debug-disable",
"--gst-debug-no-color",
"--gst-debug-level=4",
gst/gstclock.*: deprecate old interface and disable functions that aren't in use anymore. Original commit message from CVS: 2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/gstclock.c: (gst_clock_class_init), (gst_clock_init), (gst_clock_set_speed), (gst_clock_set_active), (gst_clock_is_active), (gst_clock_reset), (gst_clock_handle_discont): * gst/gstclock.h: deprecate old interface and disable functions that aren't in use anymore. * gst/gstelement.h: * gst/gstelement.c: (gst_element_get_time), (gst_element_wait), (gst_element_set_time), (gst_element_adjust_time): add concept of "element time" and functions to get/set this time. * gst/gstelement.c: (gst_element_change_state): update element time correctly. * gst/gstelement.c: (gst_element_get_compatible_pad_filtered): This is a debug message, not a g_critical. * gst/gstpad.c: (gst_pad_event_default): handle discontinuous events right with element time. * gst/gstscheduler.c: (gst_scheduler_state_transition): update to clocking fixes. set clocks on elements in READY=>PAUSED. The old behaviour caused a wrong element time on the first element that started playing. * gst/schedulers/gstbasicscheduler.c: (gst_basic_scheduler_class_init): * gst/schedulers/gstoptimalscheduler.c: (gst_opt_scheduler_class_init): remove code that just implements the default behaviour. * gst/elements/gstfakesink.c: (gst_fakesink_chain): update to use new clocking functions * testsuite/clock/clock1.c: (gst_clock_debug), (main): * testsuite/clock/clock2.c: (gst_clock_debug), (main): update to test new element time. * gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps): use _get_allowed_caps instead of _get_caps. This catches filtered caps correctly. * testsuite/debug/commandline.c: update for new GST_DEBUG syntax. * testsuite/threads/Makefile.am: disable a test that only works sometimes.
2004-01-14 00:46:48 +00:00
"--gst-debug=cat:4,cat_*:3",
"--gst-debug-level=4 --gst-debug=cat_*:5"
};
static void
debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line, GObject * object,
GstDebugMessage * message, gpointer thread)
{
g_assert_not_reached ();
}
#endif
gint
main (gint argc, gchar * argv[])
{
if (argc == 1) {
/* this is the main run that calls the others */
unsetenv ("GST_DEBUG");
gst_init (&argc, &argv);
#ifndef GST_DISABLE_GST_DEBUG
{
gint i, runs, exit;
gchar *command;
runs = G_N_ELEMENTS (lines);
for (i = 0; i < runs; i++) {
int ret;
command = g_strdup_printf ("./commandline %s %d", lines[i], i);
g_print ("running \"%s\"\n", command);
ret = g_spawn_command_line_sync (command, NULL, NULL, &exit, NULL);
g_assert (ret == TRUE);
g_assert (exit == 0);
g_print ("\"%s\" worked as expected.\n", command);
g_free (command);
}
}
#endif
return 0;
} else {
gst_init (&argc, &argv);
if (argc != 2) {
g_print
("something funny happened to the command line arguments, aborting.\n");
return 1;
}
#ifndef GST_DISABLE_GST_DEBUG
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
#endif
GST_DEBUG_CATEGORY_INIT (cat, "cat", 0, "non-static category");
GST_DEBUG_CATEGORY_INIT (cat_static, "cat_static", 0, "static category");
switch (argv[1][0]) {
case '0':
g_assert (gst_debug_is_active () == FALSE);
#ifndef GST_DISABLE_GST_DEBUG
gst_debug_add_log_function (debug_not_reached, NULL);
#endif
GST_ERROR ("This will not be seen");
return 0;
case '1':
return gst_debug_is_colored ()? 1 : 0;
case '2':
g_assert (gst_debug_get_default_threshold () == 4);
g_assert (gst_debug_category_get_threshold (cat) == 4);
return 0;
case '3':
g_assert (gst_debug_get_default_threshold () == GST_LEVEL_DEFAULT);
g_assert (gst_debug_category_get_threshold (cat) == 4);
g_assert (gst_debug_category_get_threshold (cat_static) == 3);
return 0;
case '4':
g_assert (gst_debug_get_default_threshold () == 4);
g_assert (gst_debug_category_get_threshold (cat) == 4);
g_assert (gst_debug_category_get_threshold (cat_static) == 5);
return 0;
default:
g_print ("usupported command, aborting...\n");
return -1;
}
}
g_assert_not_reached ();
}