fixed a bug with NULL args, but need to fix the parser that created them

Original commit message from CVS:
fixed a bug with NULL args, but need to fix the parser that created them
This commit is contained in:
Erik Walthinsen 2001-01-07 03:06:28 +00:00
parent 2763642766
commit c116d7baa5

View file

@ -79,6 +79,8 @@ gint parse_cmdline(int argc,char *argv[],GstBin *parent) {
while (i < argc) { while (i < argc) {
arg = argv[i]; arg = argv[i];
// FIXME this is a lame solution for problems with the first parser
if (arg == NULL) { i++;continue; }
len = strlen(arg); len = strlen(arg);
element = NULL; element = NULL;
DEBUG("** ARGUMENT is '%s'\n",arg); DEBUG("** ARGUMENT is '%s'\n",arg);
@ -166,10 +168,18 @@ gint parse_cmdline(int argc,char *argv[],GstBin *parent) {
if (arg[0] == '(') { if (arg[0] == '(') {
// create a bin and add it to the current parent // create a bin and add it to the current parent
element = gst_bin_new(g_strdup_printf("bin%d",bincount++)); element = gst_bin_new(g_strdup_printf("bin%d",bincount++));
if (!element) {
fprintf(stderr,"Couldn't create a bin!\n");
exit(-1);
}
VERBOSE("CREATED bin %s\n",gst_element_get_name(element)); VERBOSE("CREATED bin %s\n",gst_element_get_name(element));
} else if (arg[0] == '{') { } else if (arg[0] == '{') {
// create a thread and add it to the current parent // create a thread and add it to the current parent
element = gst_thread_new(g_strdup_printf("thread%d",threadcount++)); element = gst_thread_new(g_strdup_printf("thread%d",threadcount++));
if (!element) {
fprintf(stderr,"Couldn't create a thread!\n");
exit(-1);
}
VERBOSE("CREATED thread %s\n",gst_element_get_name(element)); VERBOSE("CREATED thread %s\n",gst_element_get_name(element));
} }
@ -179,6 +189,10 @@ gint parse_cmdline(int argc,char *argv[],GstBin *parent) {
// we have an element // we have an element
DEBUG("attempting to create element '%s'\n",arg); DEBUG("attempting to create element '%s'\n",arg);
element = gst_elementfactory_make(arg,unique_name(arg)); element = gst_elementfactory_make(arg,unique_name(arg));
if (!element) {
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstraemer-register?\n",arg);
exit(-1);
}
VERBOSE("CREATED element %s\n",gst_element_get_name(element)); VERBOSE("CREATED element %s\n",gst_element_get_name(element));
DEBUG("created element %s\n",gst_element_get_name(element)); DEBUG("created element %s\n",gst_element_get_name(element));
} }
@ -334,7 +348,6 @@ gint parse(int argc,char *argv[],GstBin *parent) {
int main(int argc,char *argv[]) { int main(int argc,char *argv[]) {
GstElement *pipeline; GstElement *pipeline;
int firstarg; int firstarg;
guint i;
gst_init(&argc,&argv); gst_init(&argc,&argv);