avformat/configure: use pkg-config with --avformat-shared
[melted] / src / modules / avformat / factory.c
index b2a836b..fe2d65f 100644 (file)
 #include <string.h>
 #include <pthread.h>
 
-#include <framework/mlt_factory.h>
-#include "producer_avformat.h"
-#include "consumer_avformat.h"
-#include "filter_avcolour_space.h"
-#include "filter_avdeinterlace.h"
-#include "filter_avresample.h"
+#include <framework/mlt.h>
+
+extern mlt_consumer consumer_avformat_init( mlt_profile profile, char *file );
+extern mlt_filter filter_avcolour_space_init( void *arg );
+extern mlt_filter filter_avdeinterlace_init( void *arg );
+extern mlt_filter filter_avresample_init( char *arg );
+extern mlt_producer producer_avformat_init( mlt_profile profile, char *file );
 
 // ffmpeg Header files
 #include <avformat.h>
@@ -60,7 +61,7 @@ void av_free( void *ptr )
 void avformat_destroy( void *ignore )
 {
        // Clean up
-       av_free_static( );
+       // av_free_static( ); -XXX this is deprecated
 
        // Destroy the mutex
        pthread_mutex_destroy( &avformat_mutex );
@@ -91,17 +92,16 @@ static void avformat_init( )
        }
 }
 
-void *mlt_create_producer( char *id, void *arg )
+static void *create_service( mlt_profile profile, mlt_service_type type, const char *id, void *arg )
 {
        avformat_init( );
        if ( !strcmp( id, "avformat" ) )
-               return producer_avformat_init( arg );
-       return NULL;
-}
-
-void *mlt_create_filter( char *id, void *arg )
-{
-       avformat_init( );
+       {
+               if ( type == producer_type )
+                       return producer_avformat_init( profile, arg );
+               else if ( type == consumer_type )
+                       return consumer_avformat_init( profile, arg );          
+       }
        if ( !strcmp( id, "avcolour_space" ) )
                return filter_avcolour_space_init( arg );
 #ifdef USE_MMX
@@ -113,16 +113,12 @@ void *mlt_create_filter( char *id, void *arg )
        return NULL;
 }
 
-void *mlt_create_transition( char *id, void *arg )
+MLT_REPOSITORY
 {
-       return NULL;
-}
-
-void *mlt_create_consumer( char *id, void *arg )
-{
-       avformat_init( );
-       if ( !strcmp( id, "avformat" ) )
-               return consumer_avformat_init( arg );
-       return NULL;
+       MLT_REGISTER( consumer_type, "avformat", create_service );
+       MLT_REGISTER( producer_type, "avformat", create_service );
+       MLT_REGISTER( filter_type, "avcolour_space", create_service );
+       MLT_REGISTER( filter_type, "avcolor_space", create_service );
+       MLT_REGISTER( filter_type, "avdeinterlace", create_service );
+       MLT_REGISTER( filter_type, "avresample", create_service );
 }
-