X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Ffactory.c;h=2b6d234ba4028bb3e0653acbbedabdd4b65b663f;hb=54b1664731b8152b45bccfc2e2d34a37cfc25d71;hp=c197d901e68029b4e08abafa12584e55f9a1db94;hpb=d33f444d4ef4c7bc4074d07a49eca0ab7d108394;p=melted diff --git a/src/modules/avformat/factory.c b/src/modules/avformat/factory.c index c197d90..2b6d234 100644 --- a/src/modules/avformat/factory.c +++ b/src/modules/avformat/factory.c @@ -20,6 +20,7 @@ #include #include +#include #include @@ -92,17 +93,16 @@ static void avformat_init( ) } } -void *mlt_create_producer( mlt_profile profile, mlt_service_type type, const 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( profile, arg ); - return NULL; -} - -void *mlt_create_filter( mlt_profile profile, mlt_service_type type, const 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 @@ -114,16 +114,39 @@ void *mlt_create_filter( mlt_profile profile, mlt_service_type type, const char return NULL; } -void *mlt_create_transition( mlt_profile profile, mlt_service_type type, const char *id, void *arg ) +static mlt_properties avformat_metadata( mlt_service_type type, const char *id, void *data ) { - return NULL; + char file[ PATH_MAX ]; + char *service_type = NULL; + switch ( type ) + { + case consumer_type: + service_type = "consumer"; + break; + case filter_type: + service_type = "filter"; + break; + case producer_type: + service_type = "producer"; + break; + case transition_type: + service_type = "transition"; + break; + default: + return NULL; + } + snprintf( file, PATH_MAX, "%s/avformat/%s_%s.yml", mlt_environment( "MLT_DATA" ), service_type, id ); + return mlt_properties_parse_yaml( file ); } -void *mlt_create_consumer( mlt_profile profile, mlt_service_type type, const char *id, void *arg ) +MLT_REPOSITORY { - avformat_init( ); - if ( !strcmp( id, "avformat" ) ) - return consumer_avformat_init( profile, 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 ); + + MLT_REGISTER_METADATA( producer_type, "avformat", avformat_metadata, NULL ); } -