]> git.sesse.net Git - mlt/commitdiff
Add -query formats and codecs to melt.
authorDan Dennedy <dan@dennedy.org>
Mon, 4 Apr 2011 05:43:53 +0000 (22:43 -0700)
committerDan Dennedy <dan@dennedy.org>
Mon, 4 Apr 2011 05:43:53 +0000 (22:43 -0700)
docs/melt.1
docs/melt.txt
src/melt/melt.c

index df8c6ec85603b5f15e93b4b2f662aa8a1d63aae2..664041295d6395c4604efbd90543cc598eb6393b 100644 (file)
@@ -81,6 +81,15 @@ List transitions, show info about one
 \fB\-query\fR "profiles" | "profile"=id
 List profiles, show info about one
 .TP
+\fB\-query\fR "formats"
+List audio/video formats
+.TP
+\fB\-query\fR "audio_codecs"
+List audio codecs
+.TP
+\fB\-query\fR "video_codecs"
+List video codecs
+.TP
 \fB\-serialise\fR [filename]
 Write the commands to a text file
 .TP
index 7dc65dbc8cd0f6bee97997b6947dd3e4e6b46e3e..cf20610e41f92e51d38037ede8ed1ab73cabc575 100644 (file)
@@ -47,7 +47,10 @@ Usage:
       -query "filters" | "filter"=id           List filters or show info about one
       -query "producers" | "producer"=id       List producers or show info about one
       -query "transitions" | "transition"=id   List transitions or show info about one
-      -query "profile" | "profile"=id          List profiles or show info about one
+      -query "profiles" | "profile"=id         List profiles or show info about one
+      -query "formats"                         List audio/video formats
+      -query "audio_codecs"                    List audio codecs
+      -query "video_codecs"                    List video codecs
       -serialise [filename]                    Write the commands to a text file
       -silent                                  Do not display position/transport help
       -split relative-frame                    Split the last cut into two cuts
index 40b03738e3163baa38910ab917fa62f04926632c..91e66c5c8d443e6a9a0989fffb4a31c22b02d263 100644 (file)
@@ -324,6 +324,9 @@ static void show_usage( char *program_name )
 "  -query \"producers\" | \"producer\"=id       List producers or show info about one\n"
 "  -query \"transitions\" | \"transition\"=id   List transitions, show info about one\n"
 "  -query \"profiles\" | \"profile\"=id         List profiles, show info about one\n"
+"  -query \"formats\"                         List audio/video formats\n"
+"  -query \"audio_codecs\"                    List audio codecs\n"
+"  -query \"video_codecs\"                    List video codecs\n"
 "  -serialise [filename]                    Write the commands to a text file\n"
 "  -silent                                  Do not display position/transport\n"
 "  -split relative-frame                    Split the last cut into two cuts\n"
@@ -464,6 +467,51 @@ static void query_profile( const char *id )
        mlt_properties_close( profiles );
 }
 
+static void query_formats( )
+{
+       mlt_consumer consumer = mlt_factory_consumer( NULL, "avformat", NULL );
+       if ( consumer )
+       {
+               mlt_properties_set( MLT_CONSUMER_PROPERTIES(consumer), "f", "list" );
+               mlt_consumer_start( consumer );
+               mlt_consumer_close( consumer );
+       }
+       else
+       {
+               fprintf( stderr, "# No formats - failed to load avformat consumer\n" );
+       }
+}
+
+static void query_acodecs( )
+{
+       mlt_consumer consumer = mlt_factory_consumer( NULL, "avformat", NULL );
+       if ( consumer )
+       {
+               mlt_properties_set( MLT_CONSUMER_PROPERTIES(consumer), "acodec", "list" );
+               mlt_consumer_start( consumer );
+               mlt_consumer_close( consumer );
+       }
+       else
+       {
+               fprintf( stderr, "# No audio codecs - failed to load avformat consumer\n" );
+       }
+}
+
+static void query_vcodecs( )
+{
+       mlt_consumer consumer = mlt_factory_consumer( NULL, "avformat", NULL );
+       if ( consumer )
+       {
+               mlt_properties_set( MLT_CONSUMER_PROPERTIES(consumer), "vcodec", "list" );
+               mlt_consumer_start( consumer );
+               mlt_consumer_close( consumer );
+       }
+       else
+       {
+               fprintf( stderr, "# No video codecs - failed to load avformat consumer\n" );
+       }
+}
+
 static void on_fatal_error( mlt_properties owner, mlt_consumer consumer )
 {
        mlt_consumer_stop( consumer );
@@ -531,7 +579,13 @@ int main( int argc, char **argv )
                                        query_services( repo, transition_type );
                                else if ( !strcmp( pname, "profiles" ) || !strcmp( pname, "profile" ) )
                                        query_profiles();
-                               
+                               else if ( !strncmp( pname, "format", 6 ) )
+                                       query_formats();
+                               else if ( !strncmp( pname, "acodec", 6 ) || !strcmp( pname, "audio_codecs" ) )
+                                       query_acodecs();
+                               else if ( !strncmp( pname, "vcodec", 6 ) || !strcmp( pname, "video_codecs" ) )
+                                       query_vcodecs();
+
                                else if ( !strncmp( pname, "consumer=", 9 ) )
                                        query_metadata( repo, consumer_type, "consumer", strchr( pname, '=' ) + 1 );
                                else if ( !strncmp( pname, "filter=", 7 ) )