mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
core is glib2 only now tried to convert to g_strdup_value_contents as much as i could misc other fixes
Original commit message from CVS: * core is glib2 only now * tried to convert to g_strdup_value_contents as much as i could * misc other fixes
This commit is contained in:
parent
27d973f2bf
commit
f7aa64cf33
11 changed files with 64 additions and 340 deletions
|
@ -9,7 +9,6 @@
|
|||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
#undef USE_GLIB2
|
||||
#undef HAVE_LIBXML2
|
||||
|
||||
#undef PLUGINS_DIR
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 48638606945e579672f97b09cb797de3e6aee9e7
|
||||
Subproject commit c2d7711457d468d527890f2057883c133b50c3b7
|
83
configure.ac
83
configure.ac
|
@ -101,7 +101,7 @@ fi
|
|||
|
||||
AC_SUBST(HTML_DIR)
|
||||
|
||||
AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-mkdb, true, false)
|
||||
AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scangobj, true, false)
|
||||
gtk_doc_min_version=0.6
|
||||
if $HAVE_GTK_DOC ; then
|
||||
gtk_doc_version=`gtkdoc-mkdb --version`
|
||||
|
@ -116,8 +116,8 @@ EOF
|
|||
HAVE_GTK_DOC=false
|
||||
fi
|
||||
fi
|
||||
GTK_DOC_SCANOBJ=gtkdoc-scanobj
|
||||
|
||||
# don't you love undocumented command line options?
|
||||
GTK_DOC_SCANOBJ="gtkdoc-scangobj --nogtkinit"
|
||||
AC_SUBST(HAVE_GTK_DOC)
|
||||
AC_SUBST(GTK_DOC_SCANOBJ)
|
||||
|
||||
|
@ -234,73 +234,26 @@ dnl Check for essential libraries first:
|
|||
dnl ====================================
|
||||
|
||||
dnl Check for glib2
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_GLIB2, true)
|
||||
GST_CHECK_FEATURE(GLIB2, [use of glib-2.0 and GObject], , [
|
||||
PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0,
|
||||
HAVE_GLIB2=yes,HAVE_GLIB2=no)
|
||||
GLIB_LIBS=$GLIB2_LIBS
|
||||
GLIB_CFLAGS=$GLIB2_CFLAGS
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
# glib2 is now the default. so if we don't have it here, then use glib1
|
||||
if test "x$HAVE_GLIB2" = "xno"; then
|
||||
AC_MSG_WARN([no glib2 found, falling back to glib1])
|
||||
fi
|
||||
], enabled, [
|
||||
AC_DEFINE(USE_GLIB2)
|
||||
GST_EXT_CFLAGS="$GST_EXT_CFLAGS -DUSE_GLIB2"
|
||||
])
|
||||
AC_SUBST(USE_GLIB2)
|
||||
PKG_CHECK_MODULES(GLIB2, glib-2.0 gobject-2.0 gthread-2.0 gmodule-2.0,
|
||||
HAVE_GLIB2=yes,HAVE_GLIB2=no)
|
||||
GLIB_LIBS=$GLIB2_LIBS
|
||||
GLIB_CFLAGS=$GLIB2_CFLAGS
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
|
||||
if test x$USE_GLIB2 = xno; then
|
||||
GST_PKG_DEPS="glib >= 1.2.0, gtk+ >= 1.2.0"
|
||||
|
||||
dnl Check for glib and gtk
|
||||
AM_PATH_GLIB(1.2.0,,
|
||||
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
|
||||
glib gmodule gthread)
|
||||
AM_PATH_GTK(1.2.0,,
|
||||
AC_MSG_ERROR(Cannot find gtk: Is gtk-config in path?))
|
||||
HAVE_GTK=yes
|
||||
|
||||
GLIB_LIBS="$GLIB_LIBS $GTK_LIBS"
|
||||
GLIB_CFLAGS="$GLIB_CFLAGS $GTK_CFLAGS"
|
||||
else
|
||||
GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
|
||||
|
||||
if $HAVE_GTK_DOC; then
|
||||
AC_CHECK_PROG(HAVE_GTK_DOC, gtkdoc-scangobj, true, false)
|
||||
if $HAVE_GTK_DOC; then
|
||||
# don't you love undocumented command line options?
|
||||
GTK_DOC_SCANOBJ="gtkdoc-scangobj --nogtkinit"
|
||||
else
|
||||
GTK_DOC_SCANOBJ=false
|
||||
fi
|
||||
fi
|
||||
if test "x$HAVE_GLIB2" = "xno"; then
|
||||
AC_MSG_ERROR([GStreamer requires GLib 2.0 to compile.])
|
||||
fi
|
||||
|
||||
GST_PKG_DEPS="glib-2.0, gobject-2.0, gmodule-2.0, gthread-2.0"
|
||||
AC_SUBST(GST_PKG_DEPS)
|
||||
|
||||
dnl Check for libxml
|
||||
if test x$USE_GLIB2 = xno; then
|
||||
LIBXML_PKG=', libxml >= 1.8.1'
|
||||
AC_PATH_PROG(XML_CONFIG, xml-config, no)
|
||||
if test x$XML_CONFIG = xno; then
|
||||
AC_MSG_ERROR(Couldn't find xml-config -- Need version 1.8.1 or better of libxml)
|
||||
fi
|
||||
XML_LIBS="`xml-config --libs`"
|
||||
XML_CFLAGS="`xml-config --cflags`"
|
||||
AC_CHECK_LIB(xml, xmlDocGetRootElement, :,
|
||||
[ AC_MSG_ERROR(Need version 1.8.1 or better of libxml) ],
|
||||
$XML_LIBS)
|
||||
|
||||
LIBXML_PKG=', libxml-2.0'
|
||||
PKG_CHECK_MODULES(XML, libxml-2.0, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
|
||||
if test "x$HAVE_LIBXML2" = "xyes"; then
|
||||
AC_DEFINE(HAVE_LIBXML2)
|
||||
else
|
||||
LIBXML_PKG=', libxml-2.0'
|
||||
PKG_CHECK_MODULES(XML, libxml-2.0, HAVE_LIBXML2=yes, HAVE_LIBXML2=no)
|
||||
if test "x$HAVE_LIBXML2" = "xyes"; then
|
||||
AC_DEFINE(HAVE_LIBXML2)
|
||||
else
|
||||
AC_ERROR(Need libxml2 for glib2 builds)
|
||||
fi
|
||||
AC_ERROR([Need libxml2 for glib2 builds -- you should be able to do without it -- this needs fixing])
|
||||
fi
|
||||
AC_SUBST(LIBXML_PKG)
|
||||
AC_SUBST(XML_LIBS)
|
||||
|
|
|
@ -10,14 +10,6 @@ endif
|
|||
|
||||
#GST_INSTRUMENT_FLAGS = -finstrument-functions -DGST_ENABLE_FUNC_INSTRUMENTATION
|
||||
|
||||
if USE_GLIB2
|
||||
GST_OBJECT_MODEL_SRC = gstmarshal.c
|
||||
GST_OBJECT_MODEL_HDR = gstmarshal.h
|
||||
else
|
||||
GST_OBJECT_MODEL_SRC = gobject2gtk.c
|
||||
GST_OBJECT_MODEL_HDR = gobject2gtk.h
|
||||
endif
|
||||
|
||||
if GST_DISABLE_LOADSAVE
|
||||
GST_LOADSAVE_SRC =
|
||||
else
|
||||
|
@ -50,7 +42,7 @@ else
|
|||
GST_TRACE_SRC = gsttrace.c
|
||||
endif
|
||||
|
||||
EXTRA_libgst_la_SOURCES = gstcpuid_i386.s gstmarshal.list gobject2gtk.c gobject2gtk.h gstxml.c gsttypefind.c gstparse.c gstautoplug.c gsttrace.c
|
||||
EXTRA_libgst_la_SOURCES = gstcpuid_i386.s gstmarshal.list gstxml.c gsttypefind.c gstparse.c gstautoplug.c gsttrace.c
|
||||
|
||||
SUBDIRS = . types elements $(GST_AUTOPLUG_DIRS) schedulers
|
||||
DIST_SUBDIRS = types elements autoplug schedulers
|
||||
|
@ -58,7 +50,7 @@ DIST_SUBDIRS = types elements autoplug schedulers
|
|||
libgst_la_SOURCES = \
|
||||
cothreads.c \
|
||||
gst.c \
|
||||
$(GST_OBJECT_MODEL_SRC) \
|
||||
gstmarshal.c \
|
||||
gstobject.c \
|
||||
$(GST_AUTOPLUG_SRC) \
|
||||
gstbin.c \
|
||||
|
@ -91,14 +83,6 @@ libgst_la_SOURCES = \
|
|||
$(GST_LOADSAVE_SRC)
|
||||
|
||||
|
||||
##### Oh this sucks so badly. This isn't funny. #####
|
||||
|
||||
# the compiler shoots cothreads.c in the head at -O6
|
||||
# FIXME: these manual rules break the dependency generation, so we have a
|
||||
# nasty hack here.
|
||||
#LTCOMPILE2=$(LTCOMPILE) -O2
|
||||
#COMPILE2=$(COMPILE) -O2
|
||||
|
||||
# FIXME this only lists the x86 arch file, we really should merge them all
|
||||
cothreads.lo: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h \
|
||||
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h
|
||||
|
@ -107,39 +91,9 @@ cothreads.o: $(srcdir)/cothreads.c $(srcdir)/cothreads.h $(srcdir)/gst_private.h
|
|||
$(top_builddir)/config.h $(srcdir)/gstinfo.c $(srcdir)/gstarch.h
|
||||
$(COMPILE) -O2 -c $<
|
||||
|
||||
# NOTDEPEND.cothreads.lo: cothreads.c
|
||||
# NOTDEPEND $(LTCOMPILE2) -c $<
|
||||
# NOTDEPEND.cothreads.o: cothreads.c
|
||||
# NOTDEPEND $(COMPILE2) -c $<
|
||||
|
||||
#cothreads.lo: cothreads.c
|
||||
# @echo '$(LTCOMPILE2) -c $<'; \
|
||||
# $(LTCOMPILE2) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
# @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
# < .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
# tr ' ' '\012' < .deps/$(*F).pp \
|
||||
# | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
# >> .deps/$(*F).P; \
|
||||
# rm -f .deps/$(*F).pp
|
||||
#cothreads.o: cothreads.c
|
||||
# @echo '$(COMPILE2) -c $<'; \
|
||||
# $(COMPILE2) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
# @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
# < .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
# tr ' ' '\012' < .deps/$(*F).pp \
|
||||
# | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
# >> .deps/$(*F).P; \
|
||||
# rm -f .deps/$(*F).pp
|
||||
|
||||
##### end immense suckage #####
|
||||
|
||||
##### Other built sources #####
|
||||
|
||||
if USE_GLIB2
|
||||
BUILT_SOURCES = gstmarshal.h gstmarshal.c
|
||||
else
|
||||
BUILT_SOURCES =
|
||||
endif
|
||||
|
||||
# Generate both marshal files together. Makes dependency work easier.
|
||||
gstmarshal.h: gstmarshal.list
|
||||
|
@ -165,7 +119,7 @@ libgstinclude_HEADERS = \
|
|||
cothreads.h \
|
||||
gst.h \
|
||||
gstconfig.h \
|
||||
$(GST_OBJECT_MODEL_HDR) \
|
||||
gstmarshal.h \
|
||||
gstobject.h \
|
||||
gsttypes.h \
|
||||
gstautoplug.h \
|
||||
|
@ -208,12 +162,7 @@ libgst_la_CFLAGS = -D_GNU_SOURCE -DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\" \
|
|||
$(LIBGST_CFLAGS) \
|
||||
-D_GNU_SOURCE \
|
||||
-DG_LOG_DOMAIN=g_log_domain_gstreamer \
|
||||
-DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\" \
|
||||
-W -Wpointer-arith -Wbad-function-cast \
|
||||
-Wcast-align -Wsign-compare \
|
||||
-Wmissing-prototypes -Wmissing-declarations \
|
||||
-Wnested-externs \
|
||||
-Winline -Wno-unused
|
||||
-DGST_CONFIG_DIR=\""$(GST_CONFIG_DIR)"\"
|
||||
|
||||
libgst_la_LIBADD = $(LIBGST_LIBS)
|
||||
|
||||
|
|
26
gst/gst.c
26
gst/gst.c
|
@ -76,23 +76,7 @@ gst_init (int *argc, char **argv[])
|
|||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
g_type_init();
|
||||
#else
|
||||
{
|
||||
gchar *display;
|
||||
/* Only initialise gtk fully if we have an X display.
|
||||
* FIXME: this fails if the display is specified differently, eg, by
|
||||
* a command line parameter. This is okay though, since this is only
|
||||
* a quick hack and should be replaced when we move to gobject.*/
|
||||
display = g_getenv("DISPLAY");
|
||||
if (display == NULL) {
|
||||
gtk_type_init ();
|
||||
} else {
|
||||
gtk_init (argc,argv);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gst_init_check (argc,argv)) {
|
||||
exit (0); /* FIXME! */
|
||||
|
@ -336,9 +320,7 @@ gst_init_check (int *argc,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
static GSList *mainloops = NULL;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* gst_main:
|
||||
|
@ -348,16 +330,12 @@ static GSList *mainloops = NULL;
|
|||
void
|
||||
gst_main (void)
|
||||
{
|
||||
#ifdef USE_GLIB2
|
||||
GMainLoop *loop;
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
mainloops = g_slist_prepend (mainloops, loop);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
#else
|
||||
gtk_main ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -368,7 +346,6 @@ gst_main (void)
|
|||
void
|
||||
gst_main_quit (void)
|
||||
{
|
||||
#ifdef USE_GLIB2
|
||||
if (!mainloops)
|
||||
g_warning ("Quit more loops than there are");
|
||||
else {
|
||||
|
@ -376,9 +353,6 @@ gst_main_quit (void)
|
|||
mainloops = g_slist_delete_link (mainloops, mainloops);
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
#else
|
||||
gtk_main_quit ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1484,7 +1484,6 @@ gst_element_save_thyself (GstObject *object,
|
|||
/* if (element->manager) */
|
||||
/* xmlNewChild(parent, NULL, "manager", GST_ELEMENT_NAME(element->manager)); */
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
/* params */
|
||||
specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (object), &nspecs);
|
||||
|
||||
|
@ -1509,7 +1508,6 @@ gst_element_save_thyself (GstObject *object,
|
|||
g_value_unset(&value);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pads = GST_ELEMENT_PADS (element);
|
||||
|
||||
|
|
|
@ -26,12 +26,8 @@
|
|||
|
||||
#include <gst/gstconfig.h>
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
#include <glib-object.h> /* note that this gets wrapped in __GST_OBJECT_H__ */
|
||||
#include <gst/gstmarshal.h>
|
||||
#else
|
||||
#include <gst/gobject2gtk.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATOMIC_H
|
||||
#include <asm/atomic.h>
|
||||
|
|
110
gst/gstutils.c
110
gst/gstutils.c
|
@ -496,98 +496,42 @@ gst_print_pad_caps (GString * buf, gint indent, GstPad * pad)
|
|||
void
|
||||
gst_print_element_args (GString * buf, gint indent, GstElement * element)
|
||||
{
|
||||
gint num_properties;
|
||||
gint px;
|
||||
guint width;
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
gchar *str = 0;
|
||||
GParamSpec *spec, **specs, **walk;
|
||||
|
||||
GParamSpec **property_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element),
|
||||
&num_properties);
|
||||
|
||||
specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (element), NULL);
|
||||
|
||||
width = 0;
|
||||
for (px = 0; px < num_properties; px++) {
|
||||
GParamSpec *param = property_specs[px];
|
||||
|
||||
if (width < strlen (param->name))
|
||||
width = strlen (param->name);
|
||||
for (walk = specs; *walk; walk++) {
|
||||
spec = *walk;
|
||||
if (width < strlen (spec->name))
|
||||
width = strlen (spec->name);
|
||||
}
|
||||
|
||||
for (px = 0; px < num_properties; px++) {
|
||||
GParamSpec *param = property_specs[px];
|
||||
GValue value;
|
||||
|
||||
ZERO (value);
|
||||
|
||||
g_value_init (&value, param->value_type);
|
||||
g_object_get_property (G_OBJECT (element), param->name, &value);
|
||||
for (walk = specs; *walk; walk++) {
|
||||
spec = *walk;
|
||||
|
||||
if (spec->flags & G_PARAM_READABLE) {
|
||||
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (spec));
|
||||
g_object_get_property (G_OBJECT (element), spec->name, &value);
|
||||
str = g_strdup_value_contents (&value);
|
||||
g_value_unset(&value);
|
||||
} else {
|
||||
str = g_strdup ("Parameter not readable.");
|
||||
}
|
||||
|
||||
string_append_indent (buf, indent);
|
||||
g_string_append (buf, param->name);
|
||||
string_append_indent (buf, 2 + width - strlen (param->name));
|
||||
|
||||
if (G_IS_PARAM_SPEC_ENUM (param)) {
|
||||
GEnumValue *values;
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
|
||||
#else
|
||||
values = gtk_type_enum_get_values (param->value_type);
|
||||
#endif
|
||||
|
||||
g_string_append_printf (buf, "%s (%s)",
|
||||
values[g_value_get_enum (&value)].value_nick,
|
||||
g_type_name (G_VALUE_TYPE (&value)));
|
||||
}
|
||||
else {
|
||||
switch (G_VALUE_TYPE (&value)) {
|
||||
case G_TYPE_STRING:
|
||||
g_string_append_printf (buf, "\"%s\"", g_value_get_string (&value));
|
||||
break;
|
||||
case G_TYPE_BOOLEAN:
|
||||
g_string_append (buf, g_value_get_boolean (&value) ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case G_TYPE_ULONG:{
|
||||
gulong val = g_value_get_ulong (&value);
|
||||
|
||||
g_string_append_printf (buf, "%lu (0x%lx)", val, val);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_LONG:{
|
||||
glong val = g_value_get_long (&value);
|
||||
|
||||
g_string_append_printf (buf, "%ld (0x%lx)", val, val);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_UINT:{
|
||||
guint val = g_value_get_uint (&value);
|
||||
|
||||
g_string_append_printf (buf, "%u (0x%x)", val, val);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_INT:{
|
||||
gint val = g_value_get_int (&value);
|
||||
|
||||
g_string_append_printf (buf, "%d (0x%x)", val, val);
|
||||
break;
|
||||
}
|
||||
case G_TYPE_FLOAT:
|
||||
g_string_append_printf (buf, "%f", g_value_get_float (&value));
|
||||
break;
|
||||
case G_TYPE_DOUBLE:
|
||||
g_string_append_printf (buf, "%f", g_value_get_double (&value));
|
||||
break;
|
||||
default:
|
||||
g_string_append_printf (buf, "unknown value_type %d", G_VALUE_TYPE (&value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append (buf, spec->name);
|
||||
string_append_indent (buf, 2 + width - strlen (spec->name));
|
||||
g_string_append (buf, str);
|
||||
g_string_append_c (buf, '\n');
|
||||
|
||||
if (G_VALUE_TYPE (&value)) {
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
g_free (property_specs);
|
||||
|
||||
g_free (specs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -84,11 +84,7 @@ int main(int argc,char *argv[]) {
|
|||
GEnumValue *values;
|
||||
gint j;
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
|
||||
#else
|
||||
values = gtk_type_enum_get_values (param->value_type);
|
||||
#endif
|
||||
for (j=0;values[j].value_name;j++) {
|
||||
gchar *value = g_strdup_printf("%d",values[j].value);
|
||||
optionnode = xmlNewChild (argnode, NULL, "option", value);
|
||||
|
|
|
@ -314,11 +314,8 @@ print_element_info (GstElementFactory *factory)
|
|||
|
||||
printf("Enum \"%s\" (default %d)", g_type_name (G_VALUE_TYPE (&value)),
|
||||
g_value_get_enum (&value));
|
||||
#ifdef USE_GLIB2
|
||||
values = G_ENUM_CLASS (g_type_class_ref (param->value_type))->values;
|
||||
#else
|
||||
values = gtk_type_enum_get_values (param->value_type);
|
||||
#endif
|
||||
|
||||
while (values[j].value_name) {
|
||||
printf("\n (%d): \t%s", values[j].value, values[j].value_nick);
|
||||
j++;
|
||||
|
@ -340,11 +337,7 @@ print_element_info (GstElementFactory *factory)
|
|||
guint *signals;
|
||||
guint nsignals;
|
||||
gint i;
|
||||
#ifdef USE_GLIB2
|
||||
GSignalQuery *query;
|
||||
#else
|
||||
GtkSignalQuery *query;
|
||||
#endif
|
||||
|
||||
printf("\nElement Signals:\n");
|
||||
|
||||
|
@ -356,18 +349,11 @@ print_element_info (GstElementFactory *factory)
|
|||
const GType *param_types;
|
||||
gint j;
|
||||
|
||||
#ifdef USE_GLIB2
|
||||
query = g_new0(GSignalQuery,1);
|
||||
g_signal_query (signals[i], query);
|
||||
n_params = query->n_params;
|
||||
return_type = query->return_type;
|
||||
param_types = query->param_types;
|
||||
#else
|
||||
query = gtk_signal_query (signals[i]);
|
||||
n_params = query->nparams;
|
||||
return_type = query->return_val;
|
||||
param_types = query->params;
|
||||
#endif
|
||||
|
||||
printf (" \"%s\" :\t %s user_function (%s* object, \n", query->signal_name, g_type_name (return_type),
|
||||
g_type_name (G_OBJECT_TYPE (element)));
|
||||
|
|
|
@ -42,95 +42,26 @@ idle_func (gpointer data)
|
|||
return busy;
|
||||
}
|
||||
|
||||
/* TODO: write more outputs for ParamSpecs*/
|
||||
static void
|
||||
property_change_callback (GObject *object, GstObject *orig, GParamSpec *pspec)
|
||||
{
|
||||
#ifdef USE_GLIB2
|
||||
if (G_IS_PARAM_SPEC_STRING (pspec))
|
||||
{
|
||||
gchar *str;
|
||||
g_object_get (orig, pspec->name, &str, NULL);
|
||||
g_print ("%s: %s = \"%s\"\n", GST_OBJECT_NAME (orig), pspec->name, str);
|
||||
g_free (str);
|
||||
} else if (G_IS_PARAM_SPEC_CHAR (pspec)) {
|
||||
gchar str;
|
||||
g_object_get (orig, pspec->name, &str, NULL);
|
||||
g_print ("%s: %s = \"%c\"\n", GST_OBJECT_NAME (orig), pspec->name, str);
|
||||
} else if (G_IS_PARAM_SPEC_INT (pspec)) {
|
||||
gint i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %d\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_INT64 (pspec)) {
|
||||
gint64 i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %lld\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_UINT (pspec)) {
|
||||
guint i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %u\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_UINT (pspec)) {
|
||||
guint64 i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %llu\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_ENUM (pspec)) {
|
||||
guint64 i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = \"%llu\"\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_FLOAT (pspec)) {
|
||||
gfloat i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %f\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) {
|
||||
gdouble i;
|
||||
g_object_get (orig, pspec->name, &i, NULL);
|
||||
g_print ("%s: %s = %f\n", GST_OBJECT_NAME (orig), pspec->name, i);
|
||||
} else {
|
||||
g_print ("%s: changed \"%s\"\n", GST_OBJECT_NAME (orig), pspec->name);
|
||||
}
|
||||
#endif /* USE_GLIB2 */
|
||||
}
|
||||
|
||||
static void
|
||||
print_props (gpointer data, gpointer user_data)
|
||||
{
|
||||
GstPropsEntry *entry = (GstPropsEntry *)data;
|
||||
GstElement *element = GST_ELEMENT (user_data);
|
||||
|
||||
g_print ("deprecated: %s: %s: ", gst_element_get_name (element),
|
||||
g_quark_to_string (entry->propid));
|
||||
switch (entry->propstype) {
|
||||
case GST_PROPS_INT_ID:
|
||||
g_print ("%d\n", entry->data.int_data);
|
||||
break;
|
||||
case GST_PROPS_STRING_ID:
|
||||
g_print ("%s\n", entry->data.string_data.string);
|
||||
break;
|
||||
case GST_PROPS_FLOAT_ID:
|
||||
g_print ("%f\n", entry->data.float_data);
|
||||
break;
|
||||
default:
|
||||
g_print ("unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
event_func (GstElement *element, GstEvent *event)
|
||||
{
|
||||
GstProps *props;
|
||||
|
||||
if (event == NULL)
|
||||
return;
|
||||
GValue value = { 0, }; /* the important thing is that value.type = 0 */
|
||||
gchar *str = 0;
|
||||
|
||||
if (GST_EVENT_TYPE (event) == GST_EVENT_INFO) {
|
||||
props = GST_EVENT_INFO_PROPS (event);
|
||||
|
||||
g_list_foreach (props->properties, print_props, GST_EVENT_SRC (event));
|
||||
if (pspec->flags & G_PARAM_READABLE) {
|
||||
g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
|
||||
g_object_get_property (G_OBJECT (orig), pspec->name, &value);
|
||||
str = g_strdup_value_contents (&value);
|
||||
g_print ("%s: %s = %s\n", GST_OBJECT_NAME (orig), pspec->name, str);
|
||||
g_free (str);
|
||||
g_value_unset(&value);
|
||||
} else {
|
||||
g_warning ("Parameter not readable. What's up with that?");
|
||||
}
|
||||
}
|
||||
|
||||
static GstElement*
|
||||
xmllaunch_parse_cmdline (const gchar *argv[])
|
||||
xmllaunch_parse_cmdline (const gchar **argv)
|
||||
{
|
||||
GstElement *pipeline = NULL, *e;
|
||||
GstXML *xml;
|
||||
|
@ -141,7 +72,7 @@ xmllaunch_parse_cmdline (const gchar *argv[])
|
|||
gint i = 0;
|
||||
|
||||
if (!(arg = argv[0])) {
|
||||
g_print ("usage: gst-xmllaunch <file.xml> [ element.property=value ... ]\n", arg[0]);
|
||||
g_print ("usage: gst-xmllaunch <file.xml> [ element.property=value ... ]\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
@ -234,8 +165,6 @@ main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (pipeline), "event", G_CALLBACK (event_func), NULL);
|
||||
|
||||
g_signal_connect (pipeline, "deep_notify", G_CALLBACK (property_change_callback), NULL);
|
||||
|
||||
#ifndef GST_DISABLE_LOADSAVE
|
||||
|
|
Loading…
Reference in a new issue