[gst-cvs] CVS: gstreamer/gst gstparse.c,1.28,1.29 gstparse.h,1.6,1.7
Steve Baker
sbaker3 at users.sourceforge.net
Sat Oct 27 06:44:01 PDT 2001
Update of /cvsroot/gstreamer/gstreamer/gst
In directory usw-pr-cvs1:/tmp/cvs-serv14404
Modified Files:
gstparse.c gstparse.h
Log Message:
return a negative error code instead of exiting on parse error
Index: gstparse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstparse.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gstparse.c 2001/10/17 10:21:24 1.28
+++ gstparse.c 2001/10/27 13:43:27 1.29
@@ -246,23 +246,23 @@
// we have the start of a name of the preceding element.
// rename previous element to next arg.
if (arg[1] != '\0') {
- fprintf(stderr,"error, unexpected junk after [\n");
- exit(-1);
+ fprintf(stderr,"error, unexpected junk after [\n");
+ return GST_PARSE_ERROR_SYNTAX;
}
i++;
if (i < argc) {
- gst_element_set_name(previous, argv[i]);
+ gst_element_set_name(previous, argv[i]);
} else {
- fprintf(stderr,"error, expected element name, found end of arguments\n");
- exit(-1);
+ fprintf(stderr,"error, expected element name, found end of arguments\n");
+ return GST_PARSE_ERROR_SYNTAX;
}
i++;
if (i >= argc) {
- fprintf(stderr,"error, expected ], found end of arguments\n");
- exit(-1);
+ fprintf(stderr,"error, expected ], found end of arguments\n");
+ return GST_PARSE_ERROR_SYNTAX;
} else if (strcmp(argv[i], "]") != 0) {
- fprintf(stderr,"error, expected ], found '%s'\n", argv[i]);
- exit(-1);
+ fprintf(stderr,"error, expected ], found '%s'\n", argv[i]);
+ return GST_PARSE_ERROR_SYNTAX;
}
} else {
DEBUG("have element or bin/thread\n");
@@ -273,7 +273,7 @@
element = gst_bin_new(g_strdup_printf("bin%d",priv->bincount++));
if (!element) {
fprintf(stderr,"Couldn't create a bin!\n");
-// exit(-1);
+ return GST_PARSE_ERROR_CREATING_ELEMENT;
}
GST_DEBUG(0,"CREATED bin %s\n",GST_ELEMENT_NAME(element));
} else if (arg[0] == '{') {
@@ -281,7 +281,7 @@
element = gst_thread_new(g_strdup_printf("thread%d",priv->threadcount++));
if (!element) {
fprintf(stderr,"Couldn't create a thread!\n");
-// exit(-1);
+ return GST_PARSE_ERROR_CREATING_ELEMENT;
}
GST_DEBUG(0,"CREATED thread %s\n",GST_ELEMENT_NAME(element));
} else {
@@ -290,7 +290,10 @@
continue;
}
- i += gst_parse_launch_cmdline(argc - i, argv + i + 1, GST_BIN (element), priv);
+ j = gst_parse_launch_cmdline(argc - i, argv + i + 1, GST_BIN (element), priv);
+ //check for parse error
+ if (j < 0) return j;
+ i += j;
} else {
// we have an element
@@ -304,7 +307,7 @@
#else
fprintf(stderr,"Couldn't create a '%s', no such element or need to load pluginn?\n",arg);
#endif
- exit(-1);
+ return GST_PARSE_ERROR_NOSUCH_ELEMENT;
}
GST_DEBUG(0,"CREATED element %s\n",GST_ELEMENT_NAME(element));
}
Index: gstparse.h
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/gstparse.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- gstparse.h 2001/10/20 23:12:36 1.6
+++ gstparse.h 2001/10/27 13:43:27 1.7
@@ -31,6 +31,12 @@
#ifndef GST_DISABLE_PARSE
+typedef enum {
+ GST_PARSE_ERROR_SYNTAX = -1,
+ GST_PARSE_ERROR_CREATING_ELEMENT = -2,
+ GST_PARSE_ERROR_NOSUCH_ELEMENT = -3,
+} GstParseErrors;
+
gint gst_parse_launch (const gchar *cmdline, GstBin *parent);
#else // GST_DISABLE_PARSE
More information about the Gstreamer-commits
mailing list