From 18d9ae818addddc1a836fa7644bbf18df544792b Mon Sep 17 00:00:00 2001 From: ddennedy Date: Tue, 6 Jan 2009 05:32:55 +0000 Subject: [PATCH] consumer_avformat.c: report list of muxers when f=list and codecs when acodec=list or vcodec=list. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1306 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/avformat/consumer_avformat.c | 39 ++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index a56c387..d908db9 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -192,9 +192,44 @@ static int consumer_start( mlt_consumer this ) { // Get the properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( this ); + int error = 0; + + // Report information about available muxers and codecs as YAML Tiny + char *s = mlt_properties_get( properties, "f" ); + if ( s && strcmp( s, "list" ) == 0 ) + { + fprintf( stderr, "---\nformats:\n" ); + AVOutputFormat *format = NULL; + while ( ( format = av_oformat_next( format ) ) ) + fprintf( stderr, " - %s\n", format->name ); + fprintf( stderr, "...\n" ); + error = 1; + } + s = mlt_properties_get( properties, "acodec" ); + if ( s && strcmp( s, "list" ) == 0 ) + { + fprintf( stderr, "---\naudio_codecs:\n" ); + AVCodec *codec = NULL; + while ( ( codec = av_codec_next( codec ) ) ) + if ( codec->encode && codec->type == CODEC_TYPE_AUDIO ) + fprintf( stderr, " - %s\n", codec->name ); + fprintf( stderr, "...\n" ); + error = 1; + } + s = mlt_properties_get( properties, "vcodec" ); + if ( s && strcmp( s, "list" ) == 0 ) + { + fprintf( stderr, "---\nvideo_codecs:\n" ); + AVCodec *codec = NULL; + while ( ( codec = av_codec_next( codec ) ) ) + if ( codec->encode && codec->type == CODEC_TYPE_VIDEO ) + fprintf( stderr, " - %s\n", codec->name ); + fprintf( stderr, "...\n" ); + error = 1; + } // Check that we're not already running - if ( !mlt_properties_get_int( properties, "running" ) ) + if ( !error && !mlt_properties_get_int( properties, "running" ) ) { // Allocate a thread pthread_t *thread = calloc( 1, sizeof( pthread_t ) ); @@ -266,7 +301,7 @@ static int consumer_start( mlt_consumer this ) // Create the thread pthread_create( thread, NULL, consumer_thread, this ); } - return 0; + return error; } /** Stop the consumer. -- 1.7.4.4