producer_inigo.c: bugfix regression in last commit that caused env vars in argv to...
[melted] / src / modules / inigo / producer_inigo.c
index 1970f9c..e27e4da 100644 (file)
@@ -24,9 +24,9 @@
 
 #include <framework/mlt.h>
 
-mlt_producer producer_inigo_init( mlt_profile profile, char **argv );
+mlt_producer producer_inigo_init( mlt_profile profile, mlt_service_type type, const char *id, char **argv );
 
-mlt_producer producer_inigo_file_init( mlt_profile profile, char *file )
+mlt_producer producer_inigo_file_init( mlt_profile profile, mlt_service_type type, const char *id, char *file )
 {
        FILE *input = fopen( file, "r" );
        char **args = calloc( sizeof( char * ), 1000 );
@@ -43,7 +43,7 @@ mlt_producer producer_inigo_file_init( mlt_profile profile, char *file )
                }
        }
 
-       mlt_producer result = producer_inigo_init( profile, args );
+       mlt_producer result = producer_inigo_init( profile, type, id, args );
 
        if ( result != NULL )
        {
@@ -120,7 +120,7 @@ static mlt_transition create_transition( mlt_profile profile, mlt_field field, c
        return transition;
 }
 
-mlt_producer producer_inigo_init( mlt_profile profile, char **argv )
+mlt_producer producer_inigo_init( mlt_profile profile, mlt_service_type type, const char *id, char **argv )
 {
        int i;
        int track = 0;
@@ -405,17 +405,22 @@ mlt_producer producer_inigo_init( mlt_profile profile, char **argv )
                }
                else
                {
-                       if ( !strcmp( argv[ i ], "-serialise" ) )
-                               i += 2;
-                       else if ( !strcmp( argv[ i ], "-consumer" ) )
-                               i += 2;
-                       else if ( !strcmp( argv[ i ], "-profile" ) )
+                       int backtrack = 0;
+                       if ( !strcmp( argv[ i ], "-serialise" ) ||
+                            !strcmp( argv[ i ], "-consumer" ) ||
+                            !strcmp( argv[ i ], "-profile" ) )
+                       {
                                i += 2;
+                               backtrack = 1;
+                       }
 
                        while ( argv[ i ] != NULL && strchr( argv[ i ], '=' ) )
+                       {
                                i ++;
-
-                       i --;
+                               backtrack = 1;
+                       }
+                       if ( backtrack )
+                               i --;
                }
        }