X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Ffactory.c;h=96af91bc14a815f77fa74f5e50c3e76863ae23f0;hb=8476c63313913b6c7e05f8b505dd4e7bbf2e186a;hp=49d6b93dc3b0d45cd6f442600e9b6c322f517245;hpb=9ec066d86a9b790b19c44f4908e3897fef56042b;p=melted diff --git a/src/modules/avformat/factory.c b/src/modules/avformat/factory.c index 49d6b93..96af91b 100644 --- a/src/modules/avformat/factory.c +++ b/src/modules/avformat/factory.c @@ -3,30 +3,32 @@ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited * Author: Charles Yates * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include +#include -#include -#include "producer_avformat.h" -#include "consumer_avformat.h" -#include "filter_avcolour_space.h" -#include "filter_avdeinterlace.h" -#include "filter_avresample.h" +#include + +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 @@ -60,7 +62,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,38 +93,58 @@ 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 if ( !strcmp( id, "avdeinterlace" ) ) return filter_avdeinterlace_init( arg ); -#endif if ( !strcmp( id, "avresample" ) ) return filter_avresample_init( arg ); return NULL; } -void *mlt_create_transition( 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( char *id, void *arg ) +MLT_REPOSITORY { - 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 ); + + MLT_REGISTER_METADATA( producer_type, "avformat", avformat_metadata, NULL ); } -