X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Finigo%2Finigo.c;h=698908e7f6acdc4fa349e7dd08b9134c7243a7c1;hb=4112170ce8053261b9c67f58df87c2a3573b6602;hp=da12d01a446a2678e2fc01506c3ac9f5c0563b94;hpb=d33f444d4ef4c7bc4074d07a49eca0ab7d108394;p=melted diff --git a/src/inigo/inigo.c b/src/inigo/inigo.c index da12d01..698908e 100644 --- a/src/inigo/inigo.c +++ b/src/inigo/inigo.c @@ -1,6 +1,6 @@ /* * inigo.c -- MLT command line utility - * Copyright (C) 2002-2003 Ushodaya Enterprises Limited + * Copyright (C) 2002-2008 Ushodaya Enterprises Limited * Author: Charles Yates * * This program is free software; you can redistribute it and/or modify @@ -37,7 +37,7 @@ static void transport_action( mlt_producer producer, char *value ) mlt_multitrack multitrack = mlt_properties_get_data( properties, "multitrack", NULL ); mlt_consumer consumer = mlt_properties_get_data( properties, "transport_consumer", NULL ); - mlt_properties_set_int( properties, "stats_off", 0 ); + mlt_properties_set_int( properties, "stats_off", 1 ); if ( strlen( value ) == 1 ) { @@ -265,6 +265,56 @@ static void transport( mlt_producer producer, mlt_consumer consumer ) } } +static void query_metadata( mlt_repository repo, mlt_service_type type, const char *typestr, char *id ) +{ + mlt_properties metadata = mlt_repository_metadata( repo, type, id ); + if ( metadata ) + { + char *s = mlt_properties_serialise_yaml( metadata ); + fprintf( stderr, "%s", s ); + free( s ); + } + else + { + fprintf( stderr, "# No metadata for %s \"%s\"\n", typestr, id ); + } +} + +static void query_services( mlt_repository repo, mlt_service_type type ) +{ + mlt_properties services = NULL; + const char *typestr = NULL; + switch ( type ) + { + case consumer_type: + services = mlt_repository_consumers( repo ); + typestr = "consumers"; + break; + case filter_type: + services = mlt_repository_filters( repo ); + typestr = "filters"; + break; + case producer_type: + services = mlt_repository_producers( repo ); + typestr = "producers"; + break; + case transition_type: + services = mlt_repository_transitions( repo ); + typestr = "transitions"; + break; + default: + return; + } + fprintf( stderr, "---\n%s:\n", typestr ); + if ( services ) + { + int j; + for ( j = 0; j < mlt_properties_count( services ); j++ ) + fprintf( stderr, " - %s\n", mlt_properties_get_name( services, j ) ); + } + fprintf( stderr, "...\n" ); +} + int main( int argc, char **argv ) { int i; @@ -272,18 +322,12 @@ int main( int argc, char **argv ) mlt_producer inigo = NULL; FILE *store = NULL; char *name = NULL; - struct sched_param scp; mlt_profile profile = NULL; - - // Use realtime scheduling if possible - memset( &scp, '\0', sizeof( scp ) ); - scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1; -#ifndef __DARWIN__ - sched_setscheduler( 0, SCHED_FIFO, &scp ); -#endif + int is_progress = 0; + int is_silent = 0; // Construct the factory - mlt_factory_init( NULL ); + mlt_repository repo = mlt_factory_init( NULL ); for ( i = 1; i < argc; i ++ ) { @@ -307,6 +351,71 @@ int main( int argc, char **argv ) if ( pname && pname[0] != '-' ) profile = mlt_profile_init( pname ); } + else if ( !strcmp( argv[ i ], "-progress" ) ) + { + is_progress = 1; + } + // Look for the query option + else if ( !strcmp( argv[ i ], "-query" ) ) + { + const char *pname = argv[ ++ i ]; + if ( pname && pname[0] != '-' ) + { + if ( !strcmp( pname, "consumers" ) || !strcmp( pname, "consumer" ) ) + query_services( repo, consumer_type ); + else if ( !strcmp( pname, "filters" ) || !strcmp( pname, "filter" ) ) + query_services( repo, filter_type ); + else if ( !strcmp( pname, "producers" ) || !strcmp( pname, "producer" ) ) + query_services( repo, producer_type ); + else if ( !strcmp( pname, "transitions" ) || !strcmp( pname, "transition" ) ) + query_services( repo, transition_type ); + + else if ( !strncmp( pname, "consumer=", 9 ) ) + query_metadata( repo, consumer_type, "consumer", strchr( pname, '=' ) + 1 ); + else if ( !strncmp( pname, "filter=", 7 ) ) + query_metadata( repo, filter_type, "filter", strchr( pname, '=' ) + 1 ); + else if ( !strncmp( pname, "producer=", 9 ) ) + 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 + goto query_all; + } + else + { +query_all: + query_services( repo, consumer_type ); + query_services( repo, filter_type ); + query_services( repo, producer_type ); + query_services( repo, transition_type ); + fprintf( stderr, "# You can query the metadata for a specific service using:\n" + "# -query =\n" + "# where is one of: consumer, filter, producer, or transition.\n" ); + } + goto exit_factory; + } + else if ( !strcmp( argv[ i ], "-silent" ) ) + { + is_silent = 1; + } + else if ( !strcmp( argv[ i ], "-verbose" ) ) + { + mlt_log_set_level( MLT_LOG_VERBOSE ); + } + else if ( !strcmp( argv[ i ], "-version" ) || !strcmp( argv[ i ], "--version" ) ) + { + fprintf( stderr, "MLT inigo " VERSION "\n" + "Copyright (C) 2002-2008 Ushodaya Enterprises Limited\n" + "\n" + "This is free software; see the source for copying conditions. There is NO\n" + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" + ); + goto exit_factory; + } + else if ( !strcmp( argv[ i ], "-debug" ) ) + { + mlt_log_set_level( MLT_LOG_DEBUG ); + } } // Create profile if not set explicitly @@ -341,6 +450,10 @@ int main( int argc, char **argv ) { mlt_properties_set_data( MLT_CONSUMER_PROPERTIES( consumer ), "transport_producer", inigo, 0, NULL, NULL ); mlt_properties_set_data( MLT_PRODUCER_PROPERTIES( inigo ), "transport_consumer", consumer, 0, NULL, NULL ); + if ( is_progress ) + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( consumer ), "progress", is_progress ); + if ( is_silent ) + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES( consumer ), "silent", is_silent ); } if ( argc > 1 && inigo != NULL && mlt_producer_get_length( inigo ) > 0 ) @@ -403,20 +516,43 @@ int main( int argc, char **argv ) } else { - fprintf( stderr, "Usage: inigo [ -profile name ]\n" - " [ -serialise [ filename.inigo ] ]\n" - " [ -group [ name=value ]* ]\n" - " [ -consumer id[:arg] [ name=value ]* [ silent=1 ] [ progress=1 ] ]\n" - " [ -filter filter[:arg] [ name=value ]* ]\n" - " [ -attach filter[:arg] [ name=value ]* ]\n" - " [ -mix length [ -mixer transition ]* ]\n" - " [ -transition id[:arg] [ name=value ]* ]\n" - " [ -blank frames ]\n" - " [ -track ]\n" - " [ -split relative-frame ]\n" - " [ -join clips ]\n" - " [ -repeat times ]\n" - " [ producer [ name=value ]* ]+\n" ); + fprintf( stderr, +"Usage: inigo [options] [producer [name=value]* ]+\n" +"Options:\n" +" -attach filter[:arg] [name=value]* Attach a filter to the output\n" +" -attach-cut filter[:arg] [name=value]* Attach a filter to a cut\n" +" -attach-track filter[:arg] [name=value]* Attach a filter to a track\n" +" -attach-clip filter[:arg] [name=value]* Attach a filter to a producer\n" +" -audio-track | -hide-video Add an audio-only track\n" +" -blank frames Add blank silence to a track\n" +" -consumer id[:arg] [name=value]* Set the consumer (sink)\n" +" -debug Set the logging level to debug\n" +" -filter filter[:arg] [name=value]* Add a filter to the current track\n" +" -group [name=value]* Apply properties repeatedly\n" +" -help Show this message\n" +" -join clips Join multiple clips into one cut\n" +" -mix length Add a mix between the last two cuts\n" +" -mixer transition Add a transition to the mix\n" +" -null-track | -hide-track Add a hidden track\n" +" -profile name Set the processing settings\n" +" -progress Display progress along with position\n" +" -remove Remove the most recent cut\n" +" -repeat times Repeat the last cut\n" +" -query List all of the registered services\n" +" -query \"consumers\" | \"consumer\"=id List consumers or show info about one\n" +" -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" +" -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" +" -swap Rearrange the last two cuts\n" +" -track Add a track\n" +" -transition id[:arg] [name=value]* Add a transition\n" +" -verbose Set the logging level to verbose\n" +" -version Show the version and copyright\n" +" -video-track | -hide-audio Add a video-only track\n" +"For more help: \n" ); } // Close the consumer @@ -429,6 +565,9 @@ int main( int argc, char **argv ) // Close the factory mlt_profile_close( profile ); + +exit_factory: + mlt_factory_close( ); return 0;