]> git.sesse.net Git - mlt/commitdiff
pre-beta cleanup part 1
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 4 Feb 2004 15:34:47 +0000 (15:34 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 4 Feb 2004 15:34:47 +0000 (15:34 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@107 d19143bc-622f-0410-bfdd-b5b2a6649095

13 files changed:
src/framework/mlt_factory.c
src/framework/mlt_field.c
src/framework/mlt_repository.c
src/framework/mlt_tractor.c
src/inigo/inigo.c
src/miracle/miracle_unit.c
src/modules/Makefile
src/modules/core/filter_obscure.c
src/modules/inigo/configure
src/modules/inigo/factory.c
src/modules/inigo/producer_inigo.c
src/modules/inigo/producer_inigo.h
src/modules/westley/producer_westley.c

index 02c60c105d573b585a7ac47d31f029a57c7c8e31..419a7d324b2d7d6e3758cf7b2e826e52178a6f1b 100644 (file)
@@ -22,6 +22,7 @@
 #include "mlt.h"
 #include "mlt_repository.h"
 
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -51,8 +52,7 @@ int mlt_factory_init( char *prefix )
                mlt_prefix = strdup( prefix );
 
                // Create the object list.
-               object_list = calloc( sizeof( struct mlt_properties_s ), 1 );
-               mlt_properties_init( object_list, NULL );
+               object_list = mlt_properties_new( );
 
                // Create a repository for each service type
                producers = mlt_repository_init( object_list, prefix, "producers.dat", "mlt_create_producer" );
index 3730d5ea95aa824e785ec8b73e8e80309c188d46..eede159b871292add65de218fd80a819633d19b6 100644 (file)
@@ -152,8 +152,6 @@ int mlt_field_plant_transition( mlt_field this, mlt_transition that, int a_track
 
 void mlt_field_close( mlt_field this )
 {
-       //mlt_tractor_close( this->tractor );
-       //mlt_multitrack_close( this->multitrack );
        free( this );
 }
 
index cba58183a479931930bd184b76a8b65b33fcaae8..9e0b1a879e9f98e272a03eb7e15a573583b2abe2 100644 (file)
@@ -29,7 +29,6 @@
 struct mlt_repository_s
 {
        struct mlt_properties_s parent;
-       mlt_properties object_list;
 };
 
 static char *construct_full_file( char *output, char *prefix, char *file )
@@ -51,7 +50,6 @@ static char *chomp( char *input )
 static mlt_properties construct_object( char *prefix, char *id )
 {
        mlt_properties output = mlt_properties_new( );
-       mlt_properties_init( output, NULL );
        mlt_properties_set( output, "prefix", prefix );
        mlt_properties_set( output, "id", id );
        return output;
@@ -60,7 +58,6 @@ static mlt_properties construct_object( char *prefix, char *id )
 static mlt_properties construct_service( mlt_properties object, char *id )
 {
        mlt_properties output = mlt_properties_new( );
-       mlt_properties_init( output, NULL );
        mlt_properties_set_data( output, "object", object, 0, NULL, NULL );
        mlt_properties_set( output, "id", id );
        return output;
@@ -98,7 +95,7 @@ static void *construct_instance( mlt_properties service_properties, char *symbol
                        fprintf( stderr, "Failed to load plugin: %s\n", dlerror() );
 
                // Set it on the properties
-               mlt_properties_set_data( object_properties, "dlopen", object, 0, ( void (*)( void * ) )dlclose, NULL );
+               mlt_properties_set_data( object_properties, "dlopen", object, 0, ( mlt_destructor )dlclose, NULL );
        }
 
        // Now check if we have this symbol pointer
@@ -127,9 +124,6 @@ mlt_repository mlt_repository_init( mlt_properties object_list, char *prefix, ch
        // Add the symbol to THIS repository properties.
        mlt_properties_set( &this->parent, "_symbol", symbol );
 
-       // Asociate the repository to the global object_list
-       this->object_list = object_list;
-
        // Construct full file
        construct_full_file( full_file, prefix, data );
 
index f68079a1b436ff2e0f47eed4c6e99887d6b234b2..5e0caca72ebf9dcbe575ac6a288199b85a79ad9d 100644 (file)
@@ -41,6 +41,7 @@ struct mlt_tractor_s
 */
 
 static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int track );
+static void producer_close( mlt_producer this );
 
 /** Constructor for the tractor.
 
@@ -55,10 +56,12 @@ mlt_tractor mlt_tractor_init( )
                mlt_producer producer = &this->parent;
                if ( mlt_producer_init( producer, this ) == 0 )
                {
-                       producer->get_frame = producer_get_frame;
                        mlt_properties_set( mlt_producer_properties( producer ), "resource", "<tractor>" );
                        mlt_properties_set( mlt_producer_properties( producer ), "mlt_type", "mlt_producer" );
                        mlt_properties_set( mlt_producer_properties( producer ), "mlt_service", "tractor" );
+
+                       producer->get_frame = producer_get_frame;
+                       producer->close = producer_close;
                }
                else
                {
@@ -202,7 +205,16 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
 
 void mlt_tractor_close( mlt_tractor this )
 {
+       this->parent.close = NULL;
        mlt_producer_close( &this->parent );
        free( this );
 }
 
+/** Close the producer.
+*/
+
+void producer_close( mlt_producer this )
+{
+       mlt_tractor_close( this->child );
+}
+
index 76edbc923785ace5729370f4b48681e4c2e72239..acbd83edf8db03f2c48abf633b96f1b23c658eae 100644 (file)
@@ -205,9 +205,6 @@ int main( int argc, char **argv )
                // Get inigo's properties
                mlt_properties inigo_props = mlt_producer_properties( inigo );
 
-               // Get the field service from inigo
-               mlt_field field = mlt_properties_get_data( inigo_props, "field", 0 );
-
                // Get the last group
                mlt_properties group = mlt_properties_get_data( inigo_props, "group", 0 );
 
@@ -252,8 +249,8 @@ int main( int argc, char **argv )
                        mlt_properties properties = mlt_consumer_properties( consumer );
                        mlt_properties_inherit( properties, group );
 
-                       // Connect consumer to tractor
-                       mlt_consumer_connect( consumer, mlt_field_service( field ) );
+                       // Connect consumer to inigo
+                       mlt_consumer_connect( consumer, mlt_producer_service( inigo ) );
 
                        // Start the consumer
                        mlt_consumer_start( consumer );
index b194e7c225a341e286072cad5d64b8c032dd05e0..b10179b2e4218eb75bf46f7214bbff2a91729d77 100644 (file)
@@ -142,10 +142,7 @@ static mlt_producer create_producer( miracle_unit unit, char *file )
        {
                // 1st Line preferences
                if ( strstr( file, ".inigo" ) )
-               {
-                       char *args[ 2 ] = { file, NULL };
-                       result = mlt_factory_producer( "inigo", args );
-               }
+                       result = mlt_factory_producer( "inigo_file", file );
                else if ( strstr( file, ".westley" ) )
                        result = mlt_factory_producer( "westley", file );
                else if ( strstr( file, ".mpg" ) )
index 4691b5e6d4ca35557240c24ad715b40b5a84d982..68b8a38c5d55b7e01b89cda0525dd748685ae9d1 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo avformat vorbis westley
+SUBDIRS = core gtk2 dv sdl mainconcept bluefish ffmpeg resample inigo avformat vorbis speex westley
 
 all clean depend install:
        list='$(SUBDIRS)'; \
index 1867a41ab5de01cd8c73cd2e8586ba2bb4b20304..c68ac9952b6d130f7b36dc689644be8b5bd0cec2 100644 (file)
@@ -257,7 +257,7 @@ mlt_filter filter_obscure_init( void *arg )
        mlt_properties properties = mlt_filter_properties( this );
        mlt_filter_init( this, NULL );
        this->process = filter_process;
-       mlt_properties_set( properties, "start", "40,40:20x20" );
+       mlt_properties_set( properties, "start", "0,0:100x100" );
        mlt_properties_set( properties, "end", "" );
        return this;
 }
index 1e75d7cc538146d524f16a7b4ebaa77d5e4a0513..9b1808f3766254a849a55f85d4a0a47d77ca007b 100755 (executable)
@@ -5,6 +5,7 @@ then
 
 cat << EOF >> ../producers.dat
 inigo                  libmltinigo.so
+inigo_file             libmltinigo.so
 EOF
 
 fi
index 29320a879ff3f6fe07e90fb16dd47394ee952461..1df7f52c07bb52f2716626e7942d57293a52c5ed 100644 (file)
@@ -24,6 +24,8 @@
 
 void *mlt_create_producer( char *id, void *arg )
 {
+       if ( !strcmp( id, "inigo_file" ) )
+               return producer_inigo_file_init( arg );
        if ( !strcmp( id, "inigo" ) )
                return producer_inigo_init( arg );
        return NULL;
index 1b82b943d0dc3246cc31301b8a5b46eed8c0fccb..893c01e1fc5aaaed2c1fb602b4cbadd2791b369e 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <framework/mlt.h>
 
-static mlt_producer parse_inigo( char *file )
+mlt_producer producer_inigo_file_init( char *file )
 {
        FILE *input = fopen( file, "r" );
        char **args = calloc( sizeof( char * ), 1000 );
@@ -58,13 +58,22 @@ static mlt_producer parse_inigo( char *file )
        return result;
 }
 
-static mlt_producer create_producer( char *file )
+static void track_service( mlt_field field, void *service, mlt_destructor destructor )
+{
+       mlt_properties properties = mlt_field_properties( field );
+       int registered = mlt_properties_get_int( properties, "registered" );
+       char *key = mlt_properties_get( properties, "registered" );
+       mlt_properties_set_data( properties, key, service, 0, destructor, NULL );
+       mlt_properties_set_int( properties, "registered", ++ registered );
+}
+
+static mlt_producer create_producer( mlt_field field, char *file )
 {
        mlt_producer result = NULL;
 
        // 1st Line preferences
        if ( strstr( file, ".inigo" ) )
-               result = parse_inigo( file );
+               result = mlt_factory_producer( "inigo_file", file );
        else if ( strstr( file, ".mpg" ) )
                result = mlt_factory_producer( "mcmpeg", file );
        else if ( strstr( file, ".mpeg" ) )
@@ -102,16 +111,10 @@ static mlt_producer create_producer( char *file )
        if ( result == NULL )
                result = mlt_factory_producer( "ffmpeg", file );
 
-       return result;
-}
+       if ( result != NULL )
+               track_service( field, result, ( mlt_destructor )mlt_producer_close );
 
-static void track_service( mlt_field field, void *service, mlt_destructor destructor )
-{
-       mlt_properties properties = mlt_field_properties( field );
-       int registered = mlt_properties_get_int( properties, "registered" );
-       char *key = mlt_properties_get( properties, "registered" );
-       mlt_properties_set_data( properties, key, service, 0, destructor, NULL );
-       mlt_properties_set_int( properties, "registered", ++ registered );
+       return result;
 }
 
 static mlt_filter create_filter( mlt_field field, char *id, int track )
@@ -201,6 +204,7 @@ mlt_producer producer_inigo_init( char **argv )
                                mlt_playlist_append( playlist, producer );
                        producer = NULL;
                        mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track ++ );
+                       track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
                        playlist = mlt_playlist_init( );
                }
                else if ( strstr( argv[ i ], "=" ) )
@@ -211,7 +215,7 @@ mlt_producer producer_inigo_init( char **argv )
                {
                        if ( producer != NULL )
                                mlt_playlist_append( playlist, producer );
-                       producer = create_producer( argv[ i ] );
+                       producer = create_producer( field, argv[ i ] );
                        if ( producer != NULL )
                        {
                                properties = mlt_producer_properties( producer );
@@ -232,16 +236,16 @@ mlt_producer producer_inigo_init( char **argv )
                }
        }
 
-       // Connect producer to playlist
+       // Connect last producer to playlist
        if ( producer != NULL )
                mlt_playlist_append( playlist, producer );
 
-       // We must have a producer at this point
+       // Track the last playlist too
+       track_service( field, playlist, ( mlt_destructor )mlt_playlist_close );
+
+       // We must have a playlist to connect
        if ( mlt_playlist_count( playlist ) > 0 )
-       {
-               // Connect multitrack to producer
                mlt_multitrack_connect( multitrack, mlt_playlist_producer( playlist ), track );
-       }
 
        mlt_tractor tractor = mlt_field_tractor( field );
        mlt_producer prod = mlt_tractor_producer( tractor );
index be65692cfded80a997a5c4cc5c2ab14db8f16d28..1baf19790d9e73648f6077a0169b1db56d07a553 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <framework/mlt_producer.h>
 
+extern mlt_producer producer_inigo_file_init( char *args );
 extern mlt_producer producer_inigo_init( char **args );
 
 #endif
index 2bd3204107b01e2273e8438d29b0b968d5615e8e..923d42aa03e6b072751a92e0ef406c0c0c211ad3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * producer_libdv.c -- a libxml2 parser of mlt service networks
+ * producer_westley.c -- a libxml2 parser of mlt service networks
  * Copyright (C) 2003-2004 Ushodaya Enterprises Limited
  * Author: Dan Dennedy <dan@dennedy.org>
  *
@@ -395,8 +395,11 @@ static void on_end_element( void *ctx, const xmlChar *name )
 
 mlt_producer producer_westley_init( char *filename )
 {
+       static int init = 0;
        xmlSAXHandler *sax = calloc( 1, sizeof( xmlSAXHandler ) );
        struct deserialise_context_s *context = calloc( 1, sizeof( struct deserialise_context_s ) );
+       mlt_properties properties = NULL;
+       int i = 0;
 
        context->producer_map = mlt_properties_new();
        context->destructors = mlt_properties_new();
@@ -405,19 +408,50 @@ mlt_producer producer_westley_init( char *filename )
        sax->startElement = on_start_element;
        sax->endElement = on_end_element;
 
-       xmlInitParser();
+       if ( !init )
+       {
+               xmlInitParser();
+               init = 1;
+       }
+
        xmlSAXUserParseFile( sax, context, filename );
-       xmlCleanupParser();
        free( sax );
 
-       mlt_properties_close( context->producer_map );
+       // Need the complete producer list for various reasons
+       properties = context->destructors;
 
+       // Get the last producer on the stack
        mlt_service service = context_pop_service( context );
-       // make the returned service destroy the connected services
-       mlt_properties_set_data( mlt_service_properties( service ), "__destructors__", context->destructors, 0, (mlt_destructor) mlt_properties_close, NULL );
-       free( context );
 
-       mlt_properties_set( mlt_service_properties( service ), "resource", filename );
+       // Do we actually have a producer here?
+       if ( service != NULL )
+       {
+               // Now make sure we don't have a reference to the service in the properties
+               for ( i = mlt_properties_count( properties ) - 1; i >= 1; i -- )
+               {
+                       char *name = mlt_properties_get_name( properties, i );
+                       if ( mlt_properties_get_data( properties, name, NULL ) == service )
+                       {
+                               mlt_properties_set_data( properties, name, service, 0, NULL, NULL );
+                               break;
+                       }
+               }
+       
+               // make the returned service destroy the connected services
+               mlt_properties_set_data( mlt_service_properties( service ), "__destructors__", context->destructors, 0, (mlt_destructor) mlt_properties_close, NULL );
+
+               // Now assign additional properties
+               mlt_properties_set( mlt_service_properties( service ), "resource", filename );
+       }
+       else
+       {
+               // Clean up
+               mlt_properties_close( properties );
+       }
+
+       free( context->stack_service );
+       mlt_properties_close( context->producer_map );
+       free( context );
 
        return MLT_PRODUCER( service );
 }