summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/Makefile.am1
-rw-r--r--gst/cothreads.c3
-rw-r--r--gst/gstarch.h2
-rw-r--r--gst/gstbin.c6
-rw-r--r--gst/gstcpu.c41
-rw-r--r--gst/gstelement.c74
-rw-r--r--gst/gstpad.c2
-rw-r--r--gst/gstparse.c103
-rw-r--r--gst/gstplugin.c2
-rw-r--r--gst/gstsparc.h42
-rw-r--r--gst/gstutils.c78
-rw-r--r--gst/gstutils.h2
12 files changed, 228 insertions, 128 deletions
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,47 +334,65 @@ 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<len;i++) {
- // if it's a space, it denotes a new arg
- if (cmdline[i] == ' ') newargc++;
- // if it's a brace and isn't followed by a space, give it an arg
- if (strchr("([{}])",cmdline[i])) {
- // not followed by space, gets one
- if (cmdline[i+1] != ' ') newargc++;
+ end = cmdline + strlen(cmdline);
+ newargc = 0;
+
+ // Extract the arguments to a gslist in reverse order
+ for (cp = cmdline; cp < end; ) {
+ i = strcspn(cp, "([{}]) \"");
+
+ if (i > 0) {
+ // normal argument - copy and add to the list
+ string_list = g_slist_prepend(string_list, g_strndup(cp, i));
+ newargc++;
+ cp += i;
}
- }
- // now allocate the new argv array
- argvn = g_new0(char *,newargc+1);
- GST_DEBUG(0,"supposed to have %d args\n",newargc);
-
- // now attempt to construct the new arg list
- j = 0;k = 0;
- for (i=0;i<len+1;i++) {
- // if it's a delimiter
- if (strchr("([{}]) ",cmdline[i]) || (cmdline[i] == '\0')) {
- // extract the previous arg
- if (i-k > 0) {
- if (cmdline[k] == ' ') k++;
- argvn[j] = g_new0(char,(i-k)+1);
- memcpy(argvn[j],&cmdline[k],i-k);
-
- // catch misparses
- if (strlen(argvn[j]) > 0) j++;
- }
- k = i;
+ // skip spaces
+ while (cp < end && *cp == ' ')
+ cp++;
+
+ // handle quoted arguments
+ if (*cp == '"') {
+ start = ++cp;
- // if this is a bracket, construct a word
- if ((cmdline[i] != ' ') && (cmdline[i] != '\0')) {
- argvn[j++] = g_strdup_printf("%c",cmdline[i]);
- k++;
+ // 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);
+ GST_DEBUG(0,"got %d args\n",newargc);
+
+ // reverse the list and put the strings in the new array
+ i = newargc;
+
+ for (slist = string_list; slist; slist = slist->next)
+ argvn[--i] = slist->data;
+
+ g_slist_free(string_list);
+
// print them out
for (i=0;i<newargc;i++) {
GST_DEBUG(0,"arg %d is: %s\n",i,argvn[i]);
@@ -380,5 +401,11 @@ gst_parse_launch(const gchar *cmdline,GstBin *parent)
// set up the elementcounts hash
priv.elementcounts = g_hash_table_new(g_str_hash,g_str_equal);
- return gst_parse_launch_cmdline(newargc,argvn,parent,&priv);
+ // do it!
+ i = gst_parse_launch_cmdline(newargc,argvn,parent,&priv);
+
+// GST_DEBUG(0, "Finished - freeing temporary argument array");
+// g_strfreev(argvn);
+
+ return i;
}
diff --git a/gst/gstplugin.c b/gst/gstplugin.c
index f372fb920a..557232a27c 100644
--- a/gst/gstplugin.c
+++ b/gst/gstplugin.c
@@ -91,7 +91,7 @@ _gst_plugin_initialize (void)
if (!doc || strcmp (doc->xmlRootNode->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 <omega@cse.ogi.edu>
+ * 2000 Wim Taymans <wtay@chello.be>
+ *
+ * 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 <stdio.h>
+
+#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