]> git.sesse.net Git - mlt/blobdiff - src/modules/core/producer_melt.c
Add a reference to the consumer on the frame.
[mlt] / src / modules / core / producer_melt.c
index 3c8368cbd06fb0f9f90dbbc3dd0abb2ab8860dd1..7e56cf3ce99ebb62b4926d60d5d97dbd0ec57467 100644 (file)
@@ -41,6 +41,7 @@ mlt_producer producer_melt_file_init( mlt_profile profile, mlt_service_type type
                        if ( strcmp( temp, "" ) )
                                args[ count ++ ] = strdup( temp );
                }
+               fclose( input );
        }
 
        mlt_producer result = producer_melt_init( profile, type, id, args );
@@ -126,7 +127,7 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con
        int track = 0;
        mlt_producer producer = NULL;
        mlt_tractor mix = NULL;
-       mlt_playlist playlist = mlt_playlist_init( );
+       mlt_playlist playlist = mlt_playlist_new( profile );
        mlt_properties group = mlt_properties_new( );
        mlt_tractor tractor = mlt_tractor_new( );
        mlt_properties properties = MLT_TRACTOR_PROPERTIES( tractor );
@@ -373,7 +374,11 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con
                        if ( producer != NULL && !mlt_producer_is_cut( producer ) )
                                mlt_playlist_append( playlist, producer );
                        producer = NULL;
-                       mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
+                       if ( strchr( argv[ i + 1 ], ':' ) )
+                               mlt_playlist_blank_time( playlist, argv[ ++ i ] );
+                       else
+                               // support for legacy where plain int is an out point instead of length
+                               mlt_playlist_blank( playlist, atof( argv[ ++ i ] ) );
                }
                else if ( !strcmp( argv[ i ], "-track" ) ||
                                  !strcmp( argv[ i ], "-null-track" ) ||
@@ -391,7 +396,7 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con
                        {
                                mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track ++ );
                                track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
-                               playlist = mlt_playlist_init( );
+                               playlist = mlt_playlist_new( profile );
                        }
                        if ( playlist != NULL )
                        {
@@ -458,8 +463,8 @@ mlt_producer producer_melt_init( mlt_profile profile, mlt_service_type type, con
        track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
 
        // We must have a playlist to connect
-       if ( !mlt_properties_get_int( MLT_PLAYLIST_PROPERTIES( playlist ), "_melt_first" ) || 
-                 mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist ) ) > 0 )
+       if ( playlist && ( !mlt_properties_get_int( MLT_PLAYLIST_PROPERTIES( playlist ), "_melt_first" ) ||
+                  mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist ) ) > 0 ) )
                mlt_multitrack_connect( multitrack, MLT_PLAYLIST_PRODUCER( playlist ), track );
 
        mlt_producer prod = MLT_TRACTOR_PRODUCER( tractor );