From: Dan Dennedy Date: Mon, 4 Apr 2011 05:22:34 +0000 (-0700) Subject: Add -query profile to melt. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=88430aba4cb03efe9cfc83c76a45eeefc5ac286a;p=mlt Add -query profile to melt. --- diff --git a/docs/melt.1 b/docs/melt.1 index 1a8827cf..df8c6ec8 100644 --- a/docs/melt.1 +++ b/docs/melt.1 @@ -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 diff --git a/docs/melt.txt b/docs/melt.txt index 84d505bb..7dc65dbc 100644 --- a/docs/melt.txt +++ b/docs/melt.txt @@ -2,7 +2,8 @@ Melt Documentation Copyright (C) 2004-2009 Ushodaya Enterprised Limited Author: Charles Yates -Last Revision: 2009-05-08 +Author: Dan Dennedy +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 diff --git a/src/melt/melt.c b/src/melt/melt.c index 4d610aa8..40b03738 100644 --- a/src/melt/melt.c +++ b/src/melt/melt.c @@ -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; }