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

index 1a8827cf5e430ef56d1040df7dfed9a74f1b01cf..df8c6ec85603b5f15e93b4b2f662aa8a1d63aae2 100644 (file)
@@ -78,6 +78,9 @@ List producers or show info about one
 \fB\-query\fR "transitions" | "transition"=id
 List transitions, show info about one
 .TP
+\fB\-query\fR "profiles" | "profile"=id
+List profiles, show info about one
+.TP
 \fB\-serialise\fR [filename]
 Write the commands to a text file
 .TP
index 84d505bb9787fd3ae0882baee4e40748fdec399b..7dc65dbc8cd0f6bee97997b6947dd3e4e6b46e3e 100644 (file)
@@ -2,7 +2,8 @@ Melt Documentation
 
 Copyright (C) 2004-2009 Ushodaya Enterprised Limited
 Author: Charles Yates <charles.yates@pandora.be>
-Last Revision: 2009-05-08
+Author: Dan Dennedy <dan@dennedy.org>
+Last Revision: 2011-04-03
 
 
 MELT
@@ -46,6 +47,7 @@ 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
       -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 4d610aa8d4769de87aed373b6f3e520d30fd5171..40b03738e3163baa38910ab917fa62f04926632c 100644 (file)
@@ -323,6 +323,7 @@ static void show_usage( char *program_name )
 "  -query \"filters\" | \"filter\"=id           List filters or show info about one\n"
 "  -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"
 "  -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"
@@ -432,6 +433,37 @@ static void query_services( mlt_repository repo, mlt_service_type type )
        fprintf( stderr, "...\n" );
 }
 
+static void query_profiles()
+{
+       mlt_properties profiles = mlt_profile_list();
+       fprintf( stderr, "---\nprofiles:\n" );
+       if ( profiles )
+       {
+               int j;
+               for ( j = 0; j < mlt_properties_count( profiles ); j++ )
+                       fprintf( stderr, "  - %s\n", mlt_properties_get_name( profiles, j ) );
+       }
+       fprintf( stderr, "...\n" );
+       mlt_properties_close( profiles );
+}
+
+static void query_profile( const char *id )
+{
+       mlt_properties profiles = mlt_profile_list();
+       mlt_properties profile = mlt_properties_get_data( profiles, id, NULL );
+       if ( profile )
+       {
+               char *s = mlt_properties_serialise_yaml( profile );
+               fprintf( stderr, "%s", s );
+               free( s );
+       }
+       else
+       {
+               fprintf( stderr, "# No metadata for profile \"%s\"\n", id );
+       }
+       mlt_properties_close( profiles );
+}
+
 static void on_fatal_error( mlt_properties owner, mlt_consumer consumer )
 {
        mlt_consumer_stop( consumer );
@@ -497,6 +529,8 @@ int main( int argc, char **argv )
                                        query_services( repo, producer_type );
                                else if ( !strcmp( pname, "transitions" ) || !strcmp( pname, "transition" ) )
                                        query_services( repo, transition_type );
+                               else if ( !strcmp( pname, "profiles" ) || !strcmp( pname, "profile" ) )
+                                       query_profiles();
                                
                                else if ( !strncmp( pname, "consumer=", 9 ) )
                                        query_metadata( repo, consumer_type, "consumer", strchr( pname, '=' ) + 1 );
@@ -506,6 +540,8 @@ int main( int argc, char **argv )
                                        query_metadata( repo, producer_type, "producer", strchr( pname, '=' ) + 1 );
                                else if ( !strncmp( pname, "transition=", 11 ) )
                                        query_metadata( repo, transition_type, "transition", strchr( pname, '=' ) + 1 );
+                               else if ( !strncmp( pname, "profile=", 8 ) )
+                                       query_profile( strchr( pname, '=' ) + 1 );
                                else
                                        goto query_all;
                        }