From c1994697445ad107845b58000bbcac2f1d1d6d81 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 6 Mar 2001 21:39:57 +0000 Subject: [PATCH] Synced with the HEAD branch again... amazing how many changes we have in only a week time... Original commit message from CVS: Synced with the HEAD branch again... amazing how many changes we have in only a week time... --- AUTHORS | 13 +- REQUIREMENTS | 5 +- acconfig.h | 2 + configure.in | 10 + docs/manual/xml.sgml | 2 - examples/helloworld2/helloworld2.c | 8 +- examples/launch/mp3play | 2 +- gst/Makefile.am | 1 + gst/cothreads.c | 3 + gst/gstarch.h | 2 + gst/gstbin.c | 6 +- gst/gstcpu.c | 41 ++-- gst/gstelement.c | 74 +------- gst/gstpad.c | 2 +- gst/gstparse.c | 101 ++++++---- gst/gstplugin.c | 2 +- gst/gstsparc.h | 42 +++++ gst/gstutils.c | 78 ++++++++ gst/gstutils.h | 2 + gstplay/Makefile.am | 2 + gstreamer.m4 | 188 +++++++++++++++++-- test/.gitignore | 1 + test/Makefile.am | 3 +- test/mpeg2parse2.c | 122 ++++++++++++ test/videotest.c | 4 +- test/xml/readreg.c | 15 +- test/xmmstest.c | 61 ++++++ tests/autoplug3.c | 10 +- tests/old/examples/helloworld2/helloworld2.c | 8 +- tests/old/examples/launch/mp3play | 2 +- 30 files changed, 648 insertions(+), 164 deletions(-) create mode 100644 gst/gstsparc.h create mode 100644 test/mpeg2parse2.c create mode 100644 test/xmmstest.c diff --git a/AUTHORS b/AUTHORS index a7e24546e2..a9a6453eb3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,15 @@ Erik Walthinsen +Matt Howell +Brent Bradburn Wim Taymans Richard Boulton -Chris Emerson (PPC port) +David I. Lehn + - debian packaging + - various fixes +Chris Emerson + - PPC port + - small libxml patches +Jens Thiele + - color conversion patches +Thomas Nyberg + - gstreamer.m4 macros diff --git a/REQUIREMENTS b/REQUIREMENTS index e596e322e6..5b19cd0a8f 100644 --- a/REQUIREMENTS +++ b/REQUIREMENTS @@ -9,7 +9,10 @@ Required libraries: =================== glib v1.2.0 or better gtk+ v1.2.0 or better -libxml +libxml (also called gnome-xml, available from http://xmlsoft.org/) + +These libraries are all central parts of gnome, and are available from the +ftp.gnome.org or its mirrors, amongst other places. Optional libraries: =================== diff --git a/acconfig.h b/acconfig.h index bee8dafad0..e6bfe8c852 100644 --- a/acconfig.h +++ b/acconfig.h @@ -19,6 +19,7 @@ #undef HAVE_CPU_PPC #undef HAVE_CPU_ALPHA #undef HAVE_CPU_ARM +#undef HAVE_CPU_SPARC #undef HAVE_GDK_PIXBUF #undef HAVE_LIBGHTTP @@ -29,6 +30,7 @@ #undef HAVE_VORBIS #undef HAVE_LIBJPEG #undef HAVE_NASM +#undef HAVE_MPEG2DEC #undef HAVE_ATOMIC_H diff --git a/configure.in b/configure.in index 3be5a377d8..bff02bde27 100644 --- a/configure.in +++ b/configure.in @@ -124,6 +124,8 @@ case "x${target_cpu}" in AC_DEFINE(HAVE_CPU_ALPHA) ;; xarm*) HAVE_CPU_ARM=yes ; AC_DEFINE(HAVE_CPU_ARM) ;; + xsparc*) HAVE_CPU_SPARC=yes ; + AC_DEFINE(HAVE_CPU_SPARC) ;; esac dnl Determine endianness @@ -358,6 +360,11 @@ AC_MSG_CHECKING(Shout library) AC_CHECK_LIB(shout, shout_init_connection, HAVE_LIBSHOUT=yes, HAVE_LIBSHOUT=no, ) AC_CHECK_HEADER(shout/shout.h, :, HAVE_LIBSHOUT=no) +dnl Check for mpeg2dec +AC_MSG_CHECKING(mpeg2dec library) +AC_CHECK_LIB(mpeg2, mpeg2_init, HAVE_MPEG2DEC=yes, HAVE_MPEG2DEC=no, ) +AC_CHECK_HEADER(mpeg2dec/mpeg2.h, :, HAVE_MPEG2DEC=no) + dnl check if css-auth.c exists (FIXME) AC_MSG_CHECKING(DVD CSS code) @@ -564,6 +571,7 @@ AM_CONDITIONAL(HAVE_CPU_I386, test "x$HAVE_CPU_I386" = "xyes") AM_CONDITIONAL(HAVE_CPU_PPC, test "x$HAVE_CPU_PPC" = "xyes") AM_CONDITIONAL(HAVE_CPU_ALPHA, test "x$HAVE_CPU_ALPHA" = "xyes") AM_CONDITIONAL(HAVE_CPU_ARM, test "x$HAVE_CPU_ARM" = "xyes") +AM_CONDITIONAL(HAVE_CPU_SPARC, test "x$HAVE_CPU_SPARC" = "xyes") AM_CONDITIONAL(HAVE_GDK_PIXBUF, test "x$USE_GDK_PIXBUF" = "xyes") AM_CONDITIONAL(HAVE_LIBGHTTP, test "x$USE_LIBGHTTP" = "xyes") AM_CONDITIONAL(HAVE_LIBMMX, test "x$USE_LIBMMX" = "xyes") @@ -588,6 +596,7 @@ AM_CONDITIONAL(HAVE_LIBLAME, test "x$HAVE_LIBLAME" = "xyes") AM_CONDITIONAL(HAVE_LIBSHOUT, test "x$HAVE_LIBSHOUT" = "xyes") AM_CONDITIONAL(HAVE_LIBESD, test "x$HAVE_LIBESD" = "xyes") AM_CONDITIONAL(HAVE_LIBASOUND, test "x$HAVE_LIBASOUND" = "xyes") +AM_CONDITIONAL(HAVE_MPEG2DEC, test "x$HAVE_MPEG2DEC" = "xyes") @@ -738,6 +747,7 @@ plugins/capture/v4l/Makefile plugins/cdparanoia/Makefile plugins/esd/Makefile plugins/esd/esdsink/Makefile +plugins/xmms/Makefile gstplay/Makefile dnl components/bonobo-gstmediaplay/Makefile test/Makefile diff --git a/docs/manual/xml.sgml b/docs/manual/xml.sgml index 7cc518205c..18413f187b 100644 --- a/docs/manual/xml.sgml +++ b/docs/manual/xml.sgml @@ -149,8 +149,6 @@ main(int argc, char *argv[]) gst_element_set_state (bin, GST_STATE_PLAYING); - playing = TRUE; - while (gst_bin_iterate(GST_BIN(bin))); gst_element_set_state (bin, GST_STATE_NULL); diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c index b4e8a62d73..8b70518eda 100644 --- a/examples/helloworld2/helloworld2.c +++ b/examples/helloworld2/helloworld2.c @@ -28,7 +28,6 @@ int main(int argc,char *argv[]) pipeline = gst_pipeline_new("pipeline"); g_assert(pipeline != NULL); - gst_bin_add(GST_BIN(thread), pipeline); /* create a disk reader */ disksrc = gst_elementfactory_make("disksrc", "disk_source"); @@ -52,8 +51,11 @@ int main(int argc,char *argv[]) } */ - /* make it ready */ - gst_element_set_state(GST_ELEMENT(thread), GST_STATE_READY); + // hmmmm hack? FIXME + GST_FLAG_UNSET (pipeline, GST_BIN_FLAG_MANAGER); + + gst_bin_add(GST_BIN(thread), pipeline); + /* start playing */ gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PLAYING); diff --git a/examples/launch/mp3play b/examples/launch/mp3play index b5fd5ac1ad..0208e13261 100755 --- a/examples/launch/mp3play +++ b/examples/launch/mp3play @@ -1,4 +1,4 @@ #! /bin/sh for loc in "$@"; do -gstreamer-launch disksrc "location=$loc" ! mp3parse ! mpg123 ! audiosink +../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! audiosink done diff --git a/gst/Makefile.am b/gst/Makefile.am index 84be380e69..c5f4e9310e 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -124,6 +124,7 @@ noinst_HEADERS = \ gstppc.h \ gstalpha.h \ gstarm.h \ + gstsparc.h \ gstpropsprivate.h CFLAGS = $(LIBGST_CFLAGS) diff --git a/gst/cothreads.c b/gst/cothreads.c index 8a938f1dff..a2e9aa60e1 100644 --- a/gst/cothreads.c +++ b/gst/cothreads.c @@ -268,6 +268,9 @@ cothread_switch (cothread_state *thread) ctx->current = thread->threadnum; /* save the current stack pointer, frame pointer, and pc */ +#ifdef GST_ARCH_PRESETJMP + GST_ARCH_PRESETJMP(); +#endif enter = setjmp(current->jmp); if (enter != 0) { GST_DEBUG (0,"enter thread #%d %d %p<->%p (%d)\n",current->threadnum, enter, diff --git a/gst/gstarch.h b/gst/gstarch.h index d3b22161ba..d78e768cf7 100644 --- a/gst/gstarch.h +++ b/gst/gstarch.h @@ -35,6 +35,8 @@ #include "gstalpha.h" #elif defined(HAVE_CPU_ARM) #include "gstarm.h" +#elif defined(HAVE_CPU_SPARC) +#include "gstsparc.h" #else #error Need to know about this architecture, or have a generic implementation #endif diff --git a/gst/gstbin.c b/gst/gstbin.c index 00e9acfe13..cffb2f0cb0 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -818,14 +818,14 @@ gst_bin_iterate_func (GstBin *bin) while (entries) { entry = GST_ELEMENT (entries->data); - if (entry->threadstate) + if (entry->threadstate) break; - entries = g_list_next (entries); + entries = g_list_next (entries); } // if we couldn't find one, bail out if (entries == NULL) GST_ERROR(GST_ELEMENT(bin),"no cothreaded elements found!"); - + GST_FLAG_SET (entry, GST_ELEMENT_COTHREAD_STOPPING); GST_DEBUG (0,"set COTHREAD_STOPPING flag on \"%s\"(@%p)\n", GST_ELEMENT_NAME (entry),entry); diff --git a/gst/gstcpu.c b/gst/gstcpu.c index d286bf7487..582bcc43fd 100644 --- a/gst/gstcpu.c +++ b/gst/gstcpu.c @@ -48,31 +48,46 @@ static gchar *stringcat (gchar *a,gchar *b) { return c; } + void _gst_cpu_initialize (void) { gchar *featurelist = NULL; + gboolean AMD; long eax=0, ebx=0, ecx=0, edx=0; + gst_cpuid(0, &eax, &ebx, &ecx, &edx); + + AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65); + gst_cpuid(1, &eax, &ebx, &ecx, &edx); if (edx & (1<<23)) { _gst_cpu_flags |= GST_CPU_FLAG_MMX; featurelist = stringcat(featurelist,"MMX "); - } - if (edx & (1<<25)) { - _gst_cpu_flags |= GST_CPU_FLAG_SSE; - _gst_cpu_flags |= GST_CPU_FLAG_MMXEXT; - featurelist = stringcat(featurelist,"SSE "); - } - if (edx & (1<<24)) { - _gst_cpu_flags |= GST_CPU_FLAG_MMXEXT; - featurelist = stringcat(featurelist,"MMXEXT "); - } - if (edx & (1<<31)) { - _gst_cpu_flags |= GST_CPU_FLAG_3DNOW; - featurelist = stringcat(featurelist,"3DNOW "); + + if (edx & (1<<25)) { + _gst_cpu_flags |= GST_CPU_FLAG_SSE; + _gst_cpu_flags |= GST_CPU_FLAG_MMXEXT; + featurelist = stringcat(featurelist,"SSE "); + } + + gst_cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + + if (eax >= 0x80000001) { + + gst_cpuid(0x80000001, &eax, &ebx, &ecx, &edx); + + if (edx & (1<<31)) { + _gst_cpu_flags |= GST_CPU_FLAG_3DNOW; + featurelist = stringcat(featurelist,"3DNOW "); + } + if (AMD && (edx & (1<<22))) { + _gst_cpu_flags |= GST_CPU_FLAG_MMXEXT; + featurelist = stringcat(featurelist,"MMXEXT "); + } + } } if (!_gst_cpu_flags) { diff --git a/gst/gstelement.c b/gst/gstelement.c index bec7cdcf34..e8dc9ce5f6 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -26,6 +26,7 @@ #include "gstelement.h" #include "gstextratypes.h" #include "gstbin.h" +#include "gstutils.h" /* Element signals and args */ @@ -974,78 +975,7 @@ gst_element_load_thyself (xmlNodePtr self, GstObject *parent) } child = child->next; } - if (name && value) { - GtkType type = GTK_OBJECT_TYPE (element); - GtkArgInfo *info; - gchar *result; - - result = gtk_object_arg_get_info (type, name, &info); - - if (result) { - g_print("gstelement: %s\n", result); - } - else if (info->arg_flags & GTK_ARG_WRITABLE) { - switch (info->type) { - case GTK_TYPE_STRING: - gtk_object_set (GTK_OBJECT (element), name, value, NULL); - break; - case GTK_TYPE_INT: { - gint i; - sscanf (value, "%d", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_LONG: { - glong i; - sscanf (value, "%ld", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_ULONG: { - gulong i; - sscanf (value, "%lu", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_BOOL: { - gboolean i = FALSE; - if (!strcmp ("true", value)) i = TRUE; - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_CHAR: { - gchar i; - sscanf (value, "%c", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_UCHAR: { - guchar i; - sscanf (value, "%c", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_FLOAT: { - gfloat i; - sscanf (value, "%f", &i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - case GTK_TYPE_DOUBLE: { - gdouble i; - sscanf (value, "%g", (float *)&i); - gtk_object_set (GTK_OBJECT (element), name, i, NULL); - break; - } - default: - if (info->type == GST_TYPE_FILENAME) { - gtk_object_set (GTK_OBJECT (element), name, value, NULL); - } - break; - } - - } - } + gst_util_set_object_arg (GTK_OBJECT (element), name, value); } children = children->next; } diff --git a/gst/gstpad.c b/gst/gstpad.c index b28bdcfdbd..e613addae3 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -1212,7 +1212,7 @@ gst_padtemplate_save_thyself (GstPadTemplate *templ, xmlNodePtr parent) GstPadTemplate* gst_padtemplate_load_thyself (xmlNodePtr parent) { - xmlNodePtr field = parent->childs; + xmlNodePtr field = parent->xmlChildrenNode; GstPadTemplate *factory; gchar *name_template = NULL; GstPadDirection direction = GST_PAD_UNKNOWN; diff --git a/gst/gstparse.c b/gst/gstparse.c index 11c51a2360..03e8bf9a43 100644 --- a/gst/gstparse.c +++ b/gst/gstparse.c @@ -30,6 +30,7 @@ #include "gstparse.h" #include "gstpipeline.h" #include "gstthread.h" +#include "gstutils.h" typedef struct _gst_parse_priv gst_parse_priv; struct _gst_parse_priv { @@ -180,7 +181,8 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n"); argval = pos+1; DEBUG("attempting to set argument '%s' to '%s' on element '%s'\n", argname,argval,GST_ELEMENT_NAME(previous)); - gtk_object_set(GTK_OBJECT(previous),argname,argval,NULL); + //gtk_object_set(GTK_OBJECT(previous),argname,argval,NULL); + gst_util_set_object_arg (GTK_OBJECT(previous), argname, argval); g_free(argname); // element or argument, or beginning of bin or thread @@ -321,8 +323,9 @@ gst_parse_launch(const gchar *cmdline,GstBin *parent) gst_parse_priv priv; gchar **argvn; gint newargc; - gint len; - int i,j,k; + gint i; + const gchar *cp, *start, *end; + GSList *string_list = NULL, *slist; priv.bincount = 0; priv.threadcount = 0; @@ -331,46 +334,64 @@ gst_parse_launch(const gchar *cmdline,GstBin *parent) priv.verbose = FALSE; priv.debug = FALSE; - // first walk through quickly and see how many more slots we need - len = strlen(cmdline); - newargc = 1; - for (i=0;i 0) { + // normal argument - copy and add to the list + string_list = g_slist_prepend(string_list, g_strndup(cp, i)); + newargc++; + cp += i; + } + + // skip spaces + while (cp < end && *cp == ' ') + cp++; + + // handle quoted arguments + if (*cp == '"') { + start = ++cp; + + // find matching quote + while (cp < end && *cp != '"') + cp++; + + // make sure we got it + if (cp == end) { + g_warning("gst_parse_launch: Unbalanced quote in command line"); + // FIXME: The list leaks here + return 0; + } + + // copy the string sans quotes + string_list = g_slist_prepend(string_list, g_strndup(start, cp - start)); + newargc++; + cp += 2; // skip the quote aswell + } + + // brackets exist in a separate argument slot + if (*cp && strchr("([{}])", *cp)) { + string_list = g_slist_prepend(string_list, g_strndup(cp, 1)); + newargc++; + cp++; } } // now allocate the new argv array - argvn = g_new0(char *,newargc+1); - GST_DEBUG(0,"supposed to have %d args\n",newargc); + argvn = g_new0(char *,newargc); + GST_DEBUG(0,"got %d args\n",newargc); - // now attempt to construct the new arg list - j = 0;k = 0; - for (i=0;i 0) { - if (cmdline[k] == ' ') k++; - argvn[j] = g_new0(char,(i-k)+1); - memcpy(argvn[j],&cmdline[k],i-k); + // reverse the list and put the strings in the new array + i = newargc; - // catch misparses - if (strlen(argvn[j]) > 0) j++; - } - k = i; + for (slist = string_list; slist; slist = slist->next) + argvn[--i] = slist->data; - // if this is a bracket, construct a word - if ((cmdline[i] != ' ') && (cmdline[i] != '\0')) { - argvn[j++] = g_strdup_printf("%c",cmdline[i]); - k++; - } - } - } + g_slist_free(string_list); // print them out for (i=0;ixmlRootNode->name, "GST-PluginRegistry") || !plugin_times_older_than(get_time(GST_CONFIG_DIR"/reg.xml"))) { if (_gst_warn_old_registry) - g_warning ("gstplugin: registry needs rebuild\n"); + g_warning ("gstplugin: registry needs rebuild: run gstreamer-register\n"); gst_plugin_load_all (); return; } diff --git a/gst/gstsparc.h b/gst/gstsparc.h new file mode 100644 index 0000000000..8dca391cc9 --- /dev/null +++ b/gst/gstsparc.h @@ -0,0 +1,42 @@ +/* GStreamer + * Copyright (C) 1999,2000 Erik Walthinsen + * 2000 Wim Taymans + * + * gstsparc.h: Header for Sparc-specific architecture issues + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GST_GSTSPARC_H__ +#define __GST_GSTSPARC_H__ + +#define GST_ARCH_SET_SP(stackpointer) \ + __asm__( "ta 3\n\t" + "mov %0, %%sp" : : "r"(stackpointer)); + +#define GST_ARCH_CALL(target) \ + __asm__( "call %0,0\n\t" + "nop" : : "r"(target) ); + +#define GST_ARCH_PRESETJMP() \ + __asm__( "ta 3" ); + +// Need to get more information about the stackframe format +// and get the fields more correct. Check GDB sources maybe? + +#define GST_ARCH_SETUP_STACK(sp) sp -= 4 + +#endif /* __GST_GSTSPARC_H__ */ diff --git a/gst/gstutils.c b/gst/gstutils.c index 9ea074a7b0..167a80a861 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -20,6 +20,9 @@ * Boston, MA 02111-1307, USA. */ +#include + +#include "gstextratypes.h" #include "gstutils.h" @@ -183,3 +186,78 @@ void gst_util_dump_mem(guchar *mem, guint size) { } g_print("\n"); } + +void gst_util_set_object_arg (GtkObject *object, guchar *name, gchar *value) +{ + if (name && value) { + GtkType type = GTK_OBJECT_TYPE (object); + GtkArgInfo *info; + gchar *result; + + result = gtk_object_arg_get_info (type, name, &info); + + if (result) { + g_print("gstutil: %s\n", result); + } + else if (info->arg_flags & GTK_ARG_WRITABLE) { + switch (info->type) { + case GTK_TYPE_STRING: + gtk_object_set (GTK_OBJECT (object), name, value, NULL); + break; + case GTK_TYPE_INT: { + gint i; + sscanf (value, "%d", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_LONG: { + glong i; + sscanf (value, "%ld", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_ULONG: { + gulong i; + sscanf (value, "%lu", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_BOOL: { + gboolean i = FALSE; + if (!strcmp ("true", value)) i = TRUE; + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_CHAR: { + gchar i; + sscanf (value, "%c", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_UCHAR: { + guchar i; + sscanf (value, "%c", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_FLOAT: { + gfloat i; + sscanf (value, "%f", &i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + case GTK_TYPE_DOUBLE: { + gdouble i; + sscanf (value, "%g", (float *)&i); + gtk_object_set (GTK_OBJECT (object), name, i, NULL); + break; + } + default: + if (info->type == GST_TYPE_FILENAME) { + gtk_object_set (GTK_OBJECT (object), name, value, NULL); + } + break; + } + } + } +} diff --git a/gst/gstutils.h b/gst/gstutils.h index 3f15ed2c9d..b57f86613b 100644 --- a/gst/gstutils.h +++ b/gst/gstutils.h @@ -39,6 +39,8 @@ guchar* gst_util_get_string_arg (GtkObject *object, guchar *argname); gpointer gst_util_get_pointer_arg (GtkObject *object, guchar *argname); GtkWidget* gst_util_get_widget_arg (GtkObject *object, guchar *argname); +void gst_util_set_object_arg (GtkObject *object, guchar *name, gchar *value); + void gst_util_dump_mem (guchar *mem, guint size); #ifdef __cplusplus diff --git a/gstplay/Makefile.am b/gstplay/Makefile.am index eb4a726d86..93629faf2d 100644 --- a/gstplay/Makefile.am +++ b/gstplay/Makefile.am @@ -31,5 +31,7 @@ noinst_HEADERS = \ gstplayprivate.h +libgstmediaplay_la_LDFLAGS = -rdynamic + gstmediaplay_CFLAGS = $(LIBGLADE_GNOME_CFLAGS) gstmediaplay_LDADD = $(GST_LIBS) $(LIBGLADE_GNOME_LIBS) libgstmediaplay.la diff --git a/gstreamer.m4 b/gstreamer.m4 index 2497de709b..c2be0a5b53 100644 --- a/gstreamer.m4 +++ b/gstreamer.m4 @@ -1,21 +1,179 @@ -# a macro to get the libs/cflags for gscope -# serial 1 +dnl Configure paths for GStreamer +dnl This was based upon the glib.m4 created by Owen Taylor 97-11-3 +dnl Changes mostly involve replacing GLIB with GStreamer +dnl +dnl Written by Thomas Nyberg 2001-03-01 -dnl AM_PATH_GSTREAMER([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Test to see if timestamp is installed, and define GSTREAMER_CFLAGS, LIBS +dnl AM_PATH_GSTREAMER([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for GStreamer, and define GSTREAMER_CFLAGS and GSTREAMER_LIBS dnl AC_DEFUN(AM_PATH_GSTREAMER, -[dnl -dnl Get the cflags and libraries for the GtkScope widget +[ dnl -AC_ARG_WITH(gscope-prefix, -[ --with-gscope-prefix=PFX Prefix where GtkScope is installed], -GSTREAMER_PREFIX="$withval") +dnl Get command-line stuff +dnl + AC_ARG_WITH(gstreamer-prefix,[ --with-gstreamer-prefix=PFX Prefix where GStreamer is installed (optional)], + gstreamer_config_prefix="$withval", gstreamer_config_prefix="") + AC_ARG_WITH(gstreamer-exec-prefix,[ --with-gstreamer-exec-prefix=PFX Exec prefix where GStreamer is installed (optional)], + gstreamer_config_exec_prefix="$withval", gstreamer_config_exec_prefix="") + AC_ARG_ENABLE(gstreamer-test, [ --disable-gstreamer-test Do not try and run a test GStreamer-program], + , enable_gstreamer_test=yes) -AC_CHECK_LIB(gscope,gtk_scope_new, - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no),"$GSTREAMER_PREFIX $LIBS") -AC_SUBST(GSTREAMER_CFLAGS) -AC_SUBST(GSTREAMER_LIBS) -AC_SUBST(HAVE_GSTREAMER) + if test "x$gstreamer_config_prefix" != "x"; then + gstreamer_config_args="$gstreamer_config_args --prefix=$gstreamer_config_prefix" ; + + if test "x${GSTREAMER_CONFIG+set}" != "xset" ; then + GSTREAMER_CONFIG="$glib_config_prefix/bin/gstreamer-config" + fi + fi + if test "x$gstreamer_config_exec_prefix" != "x"; then + gstreamer_config_args="$gstreamer_config_args --exec-prefix=$gstreamer_config_exec_prefix" ; + + if test "x${GSTREAMER_CONFIG+set}" != "xset" ; then + GSTREAMER_CONFIG="$glib_config_exec_prefix/bin/gstreamer-config" + fi + fi + + AC_PATH_PROG(GSTREAMER_CONFIG, gstreamer-config, no) + + if test "x$1" == "x" ; then + min_gstreamer_version="0.0.1" + else + min_gstreamer_version="$1" + fi + +dnl +dnl Check to make sure version wanted is better than the existing version +dnl + AC_MSG_CHECKING(for GStreamer-version >= $min_gstreamer_version) + no_gstreamer="" + + if test "x$GSTREAMER_CONFIG" = "xno" ; then + no_gstreamer=yes + else + GSTREAMER_CFLAGS=`$GSTREAMER_CONFIG $gstreamer_config_args --cflags` + GSTREAMER_LIBS=`$GSTREAMER_CONFIG $gstreamer_config_args --libs` + + gstreamer_config_major_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + gstreamer_config_minor_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + gstreamer_config_micro_version=`$GSTREAMER_CONFIG $gstreamer_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + if test "x$enable_gstreamer_test" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $GSTREAMER_CFLAGS" + LIBS="$GSTREAMER_LIBS $LIBS" +dnl +dnl Try and run a program linked with libs +dnl +AC_TRY_RUN([ +#include +#include +#include +int +main () +{ + int major, minor, micro; + char *tmp_version; + + system("touch conf.gstreamertest"); + + tmp_version = strdup("$min_gstreamer_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_gstreamer_version"); + return 1; + } + + if (($gstreamer_config_major_version > major) || + (($gstreamer_config_major_version == major) && ($gstreamer_config_minor_version > minor)) || + (($gstreamer_config_major_version == major) && ($gstreamer_config_minor_version == minor) && + ($gstreamer_config_micro_version >= micro))) { + return 0; + } else { + printf("\n*** An old version of GStreamer(%d.%d.%d) was found.\n", + $gstreamer_config_major_version, $gstreamer_config_minor_version, + $gstreamer_config_micro_version); + + printf("*** You need a version of GStreamer newer than %d.%d.%d.\n", major, minor, micro); + + } + + return 1; + +} +],, no_gstreamer=yes, [echo $ac_n "cross compiling; assuming OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_gstreamer" = "x" ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else +dnl +dnl Something went wrong, looks like GStreamer was not found +dnl + if test "$GSTREAMER_CONFIG" = "no" ; then + echo "*** The gstreamer-config script installed by GStreamer could not be found" + echo "*** If GStreamer was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GSTREAMER_CONFIG environment variable to the" + echo "*** full path to gstreamer-config." + else + if test -f conf.gstreamertest ; then + : + else + echo "*** Could not run GStreamer test program, checking why..." + CFLAGS="$CFLAGS $GSTREAMER_CFLAGS" + LIBS="$LIBS $GSTREAMER_LIBS" +AC_TRY_LINK([ +#include +#include +], +[ +gst_init(NULL, NULL); +return 0; +], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GStreamer or finding the wrong" + echo "*** version of GStreamer. If it is not finding GStreamer, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GStreamer was incorrectly installed" + echo "*** or that you have moved GStreamer since it was installed. In the latter case, you" + echo "*** may want to edit the gstremaer-config script: $GSTREAMER_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + GSTREAMER_CFLAGS="" + GSTREAMER_LIBS="" + ifelse([$3], , :, [$3]) + fi + +dnl +dnl Define our flags and libs +dnl + AC_SUBST(GSTREAMER_CFLAGS) + AC_SUBST(GSTREAMER_LIBS) + rm -f conf.gstreamertest ]) + + + + + + + + + + + + diff --git a/test/.gitignore b/test/.gitignore index 40244b01f8..537f355523 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -27,6 +27,7 @@ teardown buffer mp3parse mpeg2parse +mpeg2parse2 mp3play ac3parse ac3play diff --git a/test/Makefile.am b/test/Makefile.am index 6b8e7e6c70..a0d2d75862 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,9 +1,10 @@ # FIXME FIXME +bin_PROGRAMS = xmmstest noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \ mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \ aviparse vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest \ - vidcapture2 mp2toavi mp3tovorbis + vidcapture2 mp2toavi mp3tovorbis mpeg2parse2 SUBDIRS = xml bindings diff --git a/test/mpeg2parse2.c b/test/mpeg2parse2.c new file mode 100644 index 0000000000..770c801510 --- /dev/null +++ b/test/mpeg2parse2.c @@ -0,0 +1,122 @@ +#include +#include + +GstElement *parse2, *queue; +GtkWidget *appwindow; + +void eof(GstElement *src) { + g_print("have eos, quitting\n"); + exit(0); +} + +gboolean idle_func(gpointer data) { + gst_bin_iterate(GST_BIN(data)); + return TRUE; +} + +void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) { + + g_print("***** a new pad %s was created\n", gst_pad_get_name(pad)); + gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PAUSED); + + if (strncmp(gst_pad_get_name(pad), "video_", 6) == 0) { + + gst_pad_connect(pad, gst_element_get_pad(queue,"sink")); + } + gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING); +} + +int main(int argc,char *argv[]) { + GstPipeline *pipeline; + GstElement *src, *parse; + GstElement *decode, *show, *thread; + + g_print("have %d args\n",argc); + + g_thread_init(NULL); + gtk_init(&argc,&argv); + gst_init(&argc,&argv); + gnome_init("MPEG2 Video player","0.0.1",argc,argv); + //gst_plugin_load("mpeg1parse"); + + pipeline = GST_PIPELINE(gst_pipeline_new("pipeline")); + g_return_val_if_fail(pipeline != NULL, -1); + thread = GST_ELEMENT(gst_thread_new("thread")); + g_return_val_if_fail(thread != NULL, -1); + + if (strstr(argv[1],"video_ts")) { + src = gst_elementfactory_make("dvdsrc","src"); + g_print("using DVD source\n"); + } else + src = gst_elementfactory_make("disksrc","src"); + + g_return_val_if_fail(src != NULL, -1); + gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL); + if (argc >= 3) { + gtk_object_set(GTK_OBJECT(src),"bytesperread",atoi(argv[2]),NULL); + g_print("block size is %d\n",atoi(argv[2])); + } + g_print("should be using file '%s'\n",argv[1]); + + parse = gst_elementfactory_make("mpeg2parse","parse"); + //parse = gst_elementfactory_make("mpeg1parse","parse"); + g_return_val_if_fail(parse != NULL, -1); + + queue = gst_elementfactory_make("queue","queue"); + g_return_val_if_fail(queue != NULL, -1); + + /**** + * you can substitute mpeg2play with you own player here + * optionally you can remove the parse2 element. make + * sure to remove the pad connections too and don't add the + * mp2videoparse element to the bin. + **/ + //parse2 = gst_elementfactory_make("mp2videoparse","parse"); + //g_return_val_if_fail(parse2 != NULL, -1); + decode = gst_elementfactory_make("mpeg2dec","decode_video"); + g_return_val_if_fail(decode != NULL, -1); + + show = gst_elementfactory_make("videosink","show"); + //gtk_object_set(GTK_OBJECT(show),"xv_enabled",FALSE,NULL); + g_return_val_if_fail(show != NULL, -1); + + appwindow = gnome_app_new("MPEG player","MPEG player"); + gnome_app_set_contents(GNOME_APP(appwindow), + gst_util_get_widget_arg(GTK_OBJECT(show),"widget")); + gtk_widget_show_all(appwindow); + + gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); + gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse)); + gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(queue)); + + //gst_bin_add(GST_BIN(thread),GST_ELEMENT(parse2)); + gst_bin_add(GST_BIN(thread),GST_ELEMENT(decode)); + gst_bin_add(GST_BIN(thread),GST_ELEMENT(show)); + + gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(thread)); + + gtk_signal_connect(GTK_OBJECT(parse),"new_pad",mpeg2parse_newpad, pipeline); + + gtk_signal_connect(GTK_OBJECT(src),"eos",GTK_SIGNAL_FUNC(eof),NULL); + + gst_pad_connect(gst_element_get_pad(src,"src"), + gst_element_get_pad(parse,"sink")); + + gst_pad_connect(gst_element_get_pad(queue,"src"), + // gst_element_get_pad(parse2,"sink")); + //gst_pad_connect(gst_element_get_pad(parse2,"src"), + gst_element_get_pad(decode,"sink")); + gst_pad_connect(gst_element_get_pad(decode,"src"), + gst_element_get_pad(show,"sink")); + + g_print("setting to PLAYING state\n"); + gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING); + + gtk_idle_add(idle_func,pipeline); + + gdk_threads_enter(); + gtk_main(); + gdk_threads_leave(); + + return 0; +} diff --git a/test/videotest.c b/test/videotest.c index 3bd4ad7c3c..6171491a74 100644 --- a/test/videotest.c +++ b/test/videotest.c @@ -38,7 +38,7 @@ int main(int argc,char *argv[]) { g_return_if_fail(videosinkfactory != NULL); src = gst_elementfactory_create(srcfactory,"src"); - //gtk_object_set(GTK_OBJECT(src),"format",3,NULL); + gtk_object_set(GTK_OBJECT(src),"format",3,NULL); gtk_object_set(GTK_OBJECT(src),"width",320,"height",240,NULL); videosink = gst_elementfactory_create(videosinkfactory,"videosink"); @@ -96,6 +96,8 @@ int main(int argc,char *argv[]) { gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING); + gtk_object_set(GTK_OBJECT(src),"bright",32000,"contrast", 32000,NULL); + //gtk_object_set(GTK_OBJECT(src),"tune",133250,NULL); g_idle_add(idle_func,bin); diff --git a/test/xml/readreg.c b/test/xml/readreg.c index 8db054b32e..300a07ce6c 100644 --- a/test/xml/readreg.c +++ b/test/xml/readreg.c @@ -2,6 +2,13 @@ #include #include +// Include compatability defines: if libxml hasn't already defined these, +// we have an old version 1.x +#ifndef xmlChildrenNode +#define xmlChildrenNode childs +#define xmlRootNode root +#endif + typedef struct _GstRegistryPlugin GstRegistryPlugin; typedef struct _GstRegistryElement GstRegistryElement; @@ -17,7 +24,7 @@ struct _GstRegistryElement { }; gchar *getcontents(xmlDocPtr doc,xmlNodePtr cur) { - return g_strdup(xmlNodeListGetString(doc,cur->childs,1)); + return g_strdup(xmlNodeListGetString(doc,cur->xmlChildrenNode,1)); } int main(int argc,char *argv[]) { @@ -51,10 +58,10 @@ int main(int argc,char *argv[]) { exit(1); } - cur = cur->childs; /* 'childs'??? He (Daniel) is Dutch, so... */ + cur = cur->xmlChildrenNode; while (cur != NULL) { if (!strcmp(cur->name,"plugin")) { - xmlNodePtr field = cur->childs; + xmlNodePtr field = cur->xmlChildrenNode; GstRegistryPlugin *plugin = g_new0(GstRegistryPlugin,1); while (field) { @@ -67,7 +74,7 @@ int main(int argc,char *argv[]) { g_print("new plugin '%s' at '%s'\n",plugin->name,plugin->filename); plugins = g_slist_prepend(plugins,plugin); } else if (!strcmp(cur->name,"element")) { - xmlNodePtr field = cur->childs; + xmlNodePtr field = cur->xmlChildrenNode; GstRegistryElement *element = g_new0(GstRegistryElement,1); while (field) { diff --git a/test/xmmstest.c b/test/xmmstest.c new file mode 100644 index 0000000000..382b1f695b --- /dev/null +++ b/test/xmmstest.c @@ -0,0 +1,61 @@ +#include +#include + +extern gboolean _gst_plugin_spew; + +gboolean idle_func(gpointer data); + +int +main (int argc,char *argv[]) +{ + GstElement *bin; + GstElement *src; + GstElement *effect; + GstElement *audiosink; + + gst_init(&argc,&argv); + + bin = gst_bin_new("bin"); + + src = gst_elementfactory_make("XMMS_INPUT_mpeg_layer_1/2/3_player_1.2.4", "xmms_plugin"); + //src = gst_elementfactory_make("XMMS_INPUT_oggvorbis_player_0.1", "xmms_plugin"); + //src = gst_elementfactory_make("XMMS_INPUT_mikmod_player_1.2.4", "xmms_plugin"); + //src = gst_elementfactory_make("XMMS_INPUT_tone_generator_1.2.4", "xmms_plugin"); + g_return_val_if_fail(src != NULL, -1); + + //effect = gst_elementfactory_make("XMMS_EFFECT_voice_removal_plugin_1.2.4", "xmms_effect"); + effect = gst_elementfactory_make("XMMS_EFFECT_extra_stereo_plugin_1.2.4", "xmms_effect"); + //effect = gst_elementfactory_make("XMMS_EFFECT_echo_plugin_1.2.4", "xmms_effect"); + g_return_val_if_fail(effect != NULL, -1); + + gtk_object_set (GTK_OBJECT (src), "location", argv[1], NULL); + //gtk_object_set (GTK_OBJECT (src), "filename", "tone://1000", NULL); + + audiosink = gst_elementfactory_make("audiosink", "audiosink"); + g_return_val_if_fail(audiosink != NULL, -1); + + gst_bin_add(GST_BIN(bin),GST_ELEMENT(src)); + gst_bin_add(GST_BIN(bin),GST_ELEMENT(effect)); + gst_bin_add(GST_BIN(bin),GST_ELEMENT(audiosink)); + + gst_pad_connect(gst_element_get_pad(src,"src"), + gst_element_get_pad(effect,"sink")); + gst_pad_connect(gst_element_get_pad(effect,"src"), + gst_element_get_pad(audiosink,"sink")); + + gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING); + + g_idle_add(idle_func, bin); + + gtk_main(); + + return 0; +} + +gboolean +idle_func (gpointer data) +{ + gst_bin_iterate(GST_BIN(data)); + + return TRUE; +} diff --git a/tests/autoplug3.c b/tests/autoplug3.c index 7d2c3ee2ea..d63726ddca 100644 --- a/tests/autoplug3.c +++ b/tests/autoplug3.c @@ -6,6 +6,7 @@ main (int argc, char *argv[]) GstElement *element; GstElement *sink1, *sink2; GstAutoplug *autoplug; + GstAutoplug *autoplug2; gst_init(&argc,&argv); @@ -13,6 +14,7 @@ main (int argc, char *argv[]) sink2 = gst_elementfactory_make ("audiosink", "audiosink"); autoplug = gst_autoplugfactory_make ("staticrender"); + autoplug2 = gst_autoplugfactory_make ("static"); element = gst_autoplug_to_renderers (autoplug, g_list_append (NULL, gst_caps_new ("mp3caps", "audio/mp3")), sink2, NULL); @@ -24,7 +26,7 @@ main (int argc, char *argv[]) xmlSaveFile ("autoplug3_2.gst", gst_xml_write (element)); } - element = gst_autoplug_to_caps (autoplug, + element = gst_autoplug_to_caps (autoplug2, g_list_append (NULL, gst_caps_new_with_props( "testcaps3", "video/mpeg", @@ -38,7 +40,7 @@ main (int argc, char *argv[]) xmlSaveFile ("autoplug3_3.gst", gst_xml_write (element)); } - element = gst_autoplug_to_caps (autoplug, + element = gst_autoplug_to_caps (autoplug2, g_list_append (NULL, gst_caps_new_with_props( "testcaps5", "video/mpeg", @@ -52,7 +54,7 @@ main (int argc, char *argv[]) xmlSaveFile ("autoplug3_4.gst", gst_xml_write (element)); } - element = gst_autoplug_to_caps (autoplug, + element = gst_autoplug_to_caps (autoplug2, g_list_append (NULL, gst_caps_new( "testcaps7", "video/avi")), @@ -63,7 +65,7 @@ main (int argc, char *argv[]) xmlSaveFile ("autoplug3_5.gst", gst_xml_write (element)); } - element = gst_autoplug_to_caps (autoplug, + element = gst_autoplug_to_caps (autoplug2, g_list_append (NULL, gst_caps_new_with_props( "testcaps10", "video/mpeg", diff --git a/tests/old/examples/helloworld2/helloworld2.c b/tests/old/examples/helloworld2/helloworld2.c index b4e8a62d73..8b70518eda 100644 --- a/tests/old/examples/helloworld2/helloworld2.c +++ b/tests/old/examples/helloworld2/helloworld2.c @@ -28,7 +28,6 @@ int main(int argc,char *argv[]) pipeline = gst_pipeline_new("pipeline"); g_assert(pipeline != NULL); - gst_bin_add(GST_BIN(thread), pipeline); /* create a disk reader */ disksrc = gst_elementfactory_make("disksrc", "disk_source"); @@ -52,8 +51,11 @@ int main(int argc,char *argv[]) } */ - /* make it ready */ - gst_element_set_state(GST_ELEMENT(thread), GST_STATE_READY); + // hmmmm hack? FIXME + GST_FLAG_UNSET (pipeline, GST_BIN_FLAG_MANAGER); + + gst_bin_add(GST_BIN(thread), pipeline); + /* start playing */ gst_element_set_state(GST_ELEMENT(thread), GST_STATE_PLAYING); diff --git a/tests/old/examples/launch/mp3play b/tests/old/examples/launch/mp3play index b5fd5ac1ad..0208e13261 100755 --- a/tests/old/examples/launch/mp3play +++ b/tests/old/examples/launch/mp3play @@ -1,4 +1,4 @@ #! /bin/sh for loc in "$@"; do -gstreamer-launch disksrc "location=$loc" ! mp3parse ! mpg123 ! audiosink +../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! audiosink done