X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmelted%2Fmelted.c;h=f52e836a5fbcff7920a4e639fd0a544990fa00e9;hb=a9b6a4c79c0d3c75955fc92324b510b940351571;hp=85d638b8fda64c94bfea6738cee64d86a74153bd;hpb=6dd535ac1f7050254e891ee265365099a9c405c4;p=melted diff --git a/src/melted/melted.c b/src/melted/melted.c index 85d638b..f52e836 100644 --- a/src/melted/melted.c +++ b/src/melted/melted.c @@ -58,7 +58,7 @@ static void main_cleanup( ) void usage( char *app ) { - fprintf( stderr, "Usage: %s [-test] [-port NNNN] [-c config-file]\n", app ); + fprintf( stderr, "Usage: %s [-prio NNNN|max] [-test] [-port NNNN] [-c config-file]\n", app ); exit( 0 ); } @@ -71,7 +71,6 @@ int main( int argc, char **argv ) int index = 0; int background = 1; struct timespec tm = { 1, 0 }; - struct sched_param scp; mvcp_status_t status; struct { int clip_index; @@ -79,11 +78,24 @@ int main( int argc, char **argv ) } asrun[ MAX_UNITS ]; const char *config_file = "/etc/melted.conf"; - // 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 ); + for ( index = 1; index < argc; index ++ ) + { + if ( !strcmp( argv[ index ], "-prio" ) ) + { + struct sched_param scp; + char* prio = argv[ ++ index ]; + + memset( &scp, 0, sizeof( scp ) ); + + if( !strcmp( prio, "max" ) ) + scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1; + else + scp.sched_priority = atoi(prio); + + sched_setscheduler( 0, SCHED_FIFO, &scp ); + } + } #endif mlt_factory_init( NULL ); @@ -100,6 +112,8 @@ int main( int argc, char **argv ) background = 0; else if ( !strcmp( argv[ index ], "-c" ) ) config_file = argv[ ++ index ]; + else if ( !strcmp( argv[ index ], "-prio" ) ) + index++; else usage( argv[ 0 ] ); } @@ -115,6 +129,7 @@ int main( int argc, char **argv ) } else { + mlt_log_set_level( MLT_LOG_VERBOSE ); melted_log_init( log_stderr, LOG_DEBUG ); }