producer_avformat.{c,yml}: support special constructor argument values to list availa...
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 6 Jan 2009 06:08:22 +0000 (06:08 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 6 Jan 2009 06:08:22 +0000 (06:08 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1308 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/producer_avformat.c
src/modules/avformat/producer_avformat.yml

index 4ddec9a..b5fd38a 100644 (file)
@@ -51,6 +51,41 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index
 
 mlt_producer producer_avformat_init( mlt_profile profile, char *file )
 {
+       int error = 0;
+
+       // Report information about available demuxers and codecs as YAML Tiny
+       if ( file && strstr( file, "f-list" ) )
+       {
+               fprintf( stderr, "---\nformats:\n" );
+               AVInputFormat *format = NULL;
+               while ( ( format = av_iformat_next( format ) ) )
+                       fprintf( stderr, "  - %s\n", format->name );
+               fprintf( stderr, "...\n" );
+               error = 1;
+       }
+       if ( file && strstr( file, "acodec-list" ) )
+       {
+               fprintf( stderr, "---\naudio_codecs:\n" );
+               AVCodec *codec = NULL;
+               while ( ( codec = av_codec_next( codec ) ) )
+                       if ( codec->decode && codec->type == CODEC_TYPE_AUDIO )
+                               fprintf( stderr, "  - %s\n", codec->name );
+               fprintf( stderr, "...\n" );
+               error = 1;
+       }
+       if ( file && strstr( file, "vcodec-list" ) )
+       {
+               fprintf( stderr, "---\nvideo_codecs:\n" );
+               AVCodec *codec = NULL;
+               while ( ( codec = av_codec_next( codec ) ) )
+                       if ( codec->decode && codec->type == CODEC_TYPE_VIDEO )
+                               fprintf( stderr, "  - %s\n", codec->name );
+               fprintf( stderr, "...\n" );
+               error = 1;
+       }
+       if ( error )
+               return NULL;
+
        mlt_producer this = NULL;
 
        // Check that we have a non-NULL argument
index 5bc8dee..86ce738 100644 (file)
@@ -64,7 +64,9 @@ parameters:
       For example, video4linux:/dev/video1?width:320&height:240
       Note: on the bash command line, & must be escaped as '\&'.
       Also, note the use of ':' instead of '=' for parameters.
-      Use 'ffmpeg -formats' to see a list of supported protocols and formats.
+      Use 'f-list' to see a list of supported file formats.
+      Use 'vcodec-list' to see a list of supported video decoders.
+      Use 'acodec-list' to see a list of supported audio decoders.
     readonly: no
     required: yes
     mutable: no