2003-06-29 14:05:49 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-13 03:19:48 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2003-06-29 14:05:49 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY (cat);
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (cat_static);
|
|
|
|
|
2004-04-05 04:31:00 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2004-03-13 15:27:01 +00:00
|
|
|
static const gchar *lines[] = {
|
2004-02-27 12:45:28 +00:00
|
|
|
"--gst-debug-disable",
|
2003-06-29 14:05:49 +00:00
|
|
|
"--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",
|
2004-03-13 15:27:01 +00:00
|
|
|
"--gst-debug-level=4 --gst-debug=cat_*:5"
|
2003-06-29 14:05:49 +00:00
|
|
|
};
|
|
|
|
|
2004-04-05 04:10:05 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
debug_not_reached (GstDebugCategory * category, GstDebugLevel level,
|
|
|
|
const gchar * file, const gchar * function, gint line, GObject * object,
|
|
|
|
GstDebugMessage * message, gpointer thread)
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
2004-04-05 04:10:05 +00:00
|
|
|
#endif
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
gint
|
|
|
|
main (gint argc, gchar * argv[])
|
2003-06-29 14:05:49 +00:00
|
|
|
{
|
|
|
|
if (argc == 1) {
|
|
|
|
/* this is the main run that calls the others */
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
unsetenv ("GST_DEBUG");
|
|
|
|
gst_init (&argc, &argv);
|
2004-04-05 04:10:05 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
2004-04-05 04:31:00 +00:00
|
|
|
{
|
|
|
|
gint i, runs, exit;
|
|
|
|
gchar *command;
|
|
|
|
|
|
|
|
runs = G_N_ELEMENTS (lines);
|
|
|
|
for (i = 0; i < runs; i++) {
|
|
|
|
command = g_strdup_printf ("%s %s %d", argv[0], lines[i], i);
|
|
|
|
g_print ("running \"%s\"\n", command);
|
|
|
|
g_assert (g_spawn_command_line_sync (command, NULL, NULL, &exit,
|
|
|
|
NULL) == TRUE);
|
|
|
|
g_assert (exit == 0);
|
|
|
|
g_print ("\"%s\" worked as expected.\n", command);
|
|
|
|
g_free (command);
|
|
|
|
}
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
2004-04-05 04:10:05 +00:00
|
|
|
#endif
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-06-29 14:05:49 +00:00
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
gst_init (&argc, &argv);
|
|
|
|
if (argc != 2) {
|
2004-03-13 15:27:01 +00:00
|
|
|
g_print
|
2004-03-15 19:27:17 +00:00
|
|
|
("something funny happened to the command line arguments, aborting.\n");
|
2003-06-29 14:05:49 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2004-04-05 04:10:05 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
g_assert (gst_debug_remove_log_function (gst_debug_log_default) == 1);
|
|
|
|
#endif
|
2003-06-29 14:05:49 +00:00
|
|
|
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':
|
2004-03-15 19:27:17 +00:00
|
|
|
g_assert (gst_debug_is_active () == FALSE);
|
2004-04-05 04:10:05 +00:00
|
|
|
#ifndef GST_DISABLE_GST_DEBUG
|
|
|
|
gst_debug_add_log_function (debug_not_reached, NULL);
|
|
|
|
#endif
|
2004-03-15 19:27:17 +00:00
|
|
|
GST_ERROR ("This will not be seen");
|
|
|
|
return 0;
|
2003-06-29 14:05:49 +00:00
|
|
|
case '1':
|
2004-03-15 19:27:17 +00:00
|
|
|
return gst_debug_is_colored ()? 1 : 0;
|
2003-06-29 14:05:49 +00:00
|
|
|
case '2':
|
2004-03-15 19:27:17 +00:00
|
|
|
g_assert (gst_debug_get_default_threshold () == 4);
|
|
|
|
g_assert (gst_debug_category_get_threshold (cat) == 4);
|
|
|
|
return 0;
|
2003-06-29 14:05:49 +00:00
|
|
|
case '3':
|
2004-03-15 19:27:17 +00:00
|
|
|
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;
|
2003-06-29 14:05:49 +00:00
|
|
|
case '4':
|
2004-03-15 19:27:17 +00:00
|
|
|
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;
|
2003-06-29 14:05:49 +00:00
|
|
|
default:
|
2004-03-15 19:27:17 +00:00
|
|
|
g_print ("usupported command, aborting...\n");
|
|
|
|
return -1;
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
g_assert_not_reached ();
|
2003-06-29 14:05:49 +00:00
|
|
|
}
|