From: Dan Dennedy Date: Tue, 31 May 2011 04:36:56 +0000 (-0700) Subject: Fix melted with sdl_preview consumer. X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=fea346dab32efbc7dba10246d66cab7ace9d4055;p=melted Fix melted with sdl_preview consumer. --- diff --git a/src/melted/melted.c b/src/melted/melted.c index 85d638b..ad903bf 100644 --- a/src/melted/melted.c +++ b/src/melted/melted.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include diff --git a/src/melted/melted_local.c b/src/melted/melted_local.c index 580aedf..2f5c7be 100644 --- a/src/melted/melted_local.c +++ b/src/melted/melted_local.c @@ -342,7 +342,7 @@ static mvcp_response melted_local_connect( melted_local local ) signal( SIGINT, signal_handler ); signal( SIGTERM, SIG_DFL ); signal( SIGSTOP, signal_handler ); - signal( SIGPIPE, signal_handler ); +// signal( SIGPIPE, signal_handler ); signal( SIGALRM, signal_handler ); signal( SIGCHLD, SIG_IGN ); if ( getenv( "MLT_SIGSEGV" ) ) diff --git a/src/melted/melted_unit.c b/src/melted/melted_unit.c index 9f68cc6..8c7ad5d 100644 --- a/src/melted/melted_unit.c +++ b/src/melted/melted_unit.c @@ -174,11 +174,13 @@ static void clear_unit( melted_unit unit ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); + mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist ) ); mlt_playlist_clear( playlist ); mlt_producer_seek( producer, 0 ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES(consumer), "refresh", 1 ); mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist ) ); update_generation( unit ); @@ -191,6 +193,7 @@ static void clean_unit( melted_unit unit ) { mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); + mlt_consumer consumer = mlt_properties_get_data( properties, "consumer", NULL ); mlt_playlist_clip_info info; int current = mlt_playlist_current_clip( playlist ); mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); @@ -207,6 +210,7 @@ static void clean_unit( melted_unit unit ) mlt_playlist_append_io( playlist, info.producer, info.frame_in, info.frame_out ); mlt_producer_seek( producer, position ); mlt_producer_set_speed( producer, speed ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES(consumer), "refresh", 1 ); mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist ) ); mlt_producer_close( info.producer ); } @@ -439,6 +443,7 @@ void melted_unit_play( melted_unit_t *unit, int speed ) mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); mlt_producer_set_speed( producer, ( double )speed / 1000 ); mlt_consumer_start( consumer ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES(consumer), "refresh", 1 ); melted_unit_status_communicate( unit ); } @@ -608,6 +613,7 @@ void melted_unit_change_position( melted_unit unit, int clip, int32_t position ) { int32_t frame_start = info.start; int32_t frame_offset = position; + mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); if ( frame_offset < 0 ) frame_offset = info.frame_out; @@ -617,6 +623,7 @@ void melted_unit_change_position( melted_unit unit, int clip, int32_t position ) frame_offset = info.frame_out; mlt_producer_seek( producer, frame_start + frame_offset - info.frame_in ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES(consumer), "refresh", 1 ); } melted_unit_status_communicate( unit ); @@ -688,8 +695,10 @@ void melted_unit_step( melted_unit unit, int32_t offset ) mlt_properties properties = unit->properties; mlt_playlist playlist = mlt_properties_get_data( properties, "playlist", NULL ); mlt_producer producer = MLT_PLAYLIST_PRODUCER( playlist ); + mlt_consumer consumer = mlt_properties_get_data( unit->properties, "consumer", NULL ); mlt_position position = mlt_producer_frame( producer ); mlt_producer_seek( producer, position + offset ); + mlt_properties_set_int( MLT_CONSUMER_PROPERTIES(consumer), "refresh", 1 ); } /** Set the unit's clip mode regarding in and out points. diff --git a/src/mvcp-console/mvcp-console.c b/src/mvcp-console/mvcp-console.c index bda4918..04692cd 100644 --- a/src/mvcp-console/mvcp-console.c +++ b/src/mvcp-console/mvcp-console.c @@ -47,6 +47,13 @@ void report( mvcp_response response ) printf( "%4d: %s\n", index, mvcp_response_get_line( response, index ) ); } +static void cleanup() +{ + int i; + for ( i = 0; i < MAX_UNITS; i++ ) + melted_unit_close( melted_get_unit(i) ); +} + int main( int argc, char **argv ) { mvcp_parser parser = NULL; @@ -54,6 +61,7 @@ int main( int argc, char **argv ) char temp[ 1024 ]; int index = 1; + atexit( cleanup ); if ( argc > 2 && !strcmp( argv[ 1 ], "-s" ) ) { printf( "Melted Client Instance\n" );