From: lilo_booter Date: Wed, 17 Nov 2004 10:40:04 +0000 (+0000) Subject: Added ref_count method to properties; temporary work around for test card; titles... X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=2e467c2eeba2b51aecddda21d4bb97bef4cd1459;p=melted Added ref_count method to properties; temporary work around for test card; titles with valerie git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@527 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index c6babd8..b904f13 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -170,7 +170,9 @@ int mlt_consumer_start( mlt_consumer this ) if ( producer != NULL ) { // Test card should loop I guess... - mlt_properties_set( mlt_producer_properties( producer ), "eof", "loop" ); + mlt_properties_set( mlt_producer_properties( producer ), "eof", "pause" ); + mlt_producer_set_speed( producer, 0 ); + mlt_producer_set_in_and_out( producer, 0, 0 ); // Set the test card on the consumer mlt_properties_set_data( properties, "test_card_producer", producer, 0, ( mlt_destructor )mlt_producer_close, NULL ); diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 6e23964..ff92fbf 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -120,7 +120,8 @@ int mlt_frame_set_aspect_ratio( mlt_frame this, double value ) mlt_position mlt_frame_get_position( mlt_frame this ) { - return mlt_properties_get_position( mlt_frame_properties( this ), "_position" ); + int pos = mlt_properties_get_position( mlt_frame_properties( this ), "_position" ); + return pos < 0 ? 0 : pos; } /** Set the position of this frame. diff --git a/src/framework/mlt_properties.c b/src/framework/mlt_properties.c index 01c4ba2..e84ee07 100644 --- a/src/framework/mlt_properties.c +++ b/src/framework/mlt_properties.c @@ -202,6 +202,19 @@ int mlt_properties_dec_ref( mlt_properties this ) return 0; } +/** Return the ref count of this object. +*/ + +int mlt_properties_ref_count( mlt_properties this ) +{ + if ( this != NULL ) + { + property_list *list = this->local; + return list->ref_count; + } + return 0; +} + /** Allow the specification of a mirror. */ diff --git a/src/framework/mlt_properties.h b/src/framework/mlt_properties.h index a331029..ff87dc0 100644 --- a/src/framework/mlt_properties.h +++ b/src/framework/mlt_properties.h @@ -45,6 +45,7 @@ extern mlt_properties mlt_properties_new( ); extern mlt_properties mlt_properties_load( char *file ); extern int mlt_properties_inc_ref( mlt_properties self ); extern int mlt_properties_dec_ref( mlt_properties self ); +extern int mlt_properties_ref_count( mlt_properties self ); extern void mlt_properties_mirror( mlt_properties self, mlt_properties that ); extern int mlt_properties_inherit( mlt_properties self, mlt_properties that ); extern int mlt_properties_pass( mlt_properties self, mlt_properties that, char *prefix ); diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index 82a231d..998d3e0 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -446,7 +446,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) mlt_frame_get_image( frame, &image, &vfmt, &width, &height, 0 ); } - if ( 1 ) + if ( image != NULL ) { char *rescale = mlt_properties_get( properties, "rescale" ); if ( rescale != NULL && strcmp( rescale, "none" ) ) @@ -512,7 +512,7 @@ static int consumer_play_video( consumer_sdl this, mlt_frame frame ) if ( unlock != NULL ) unlock( ); - return 0; + return 1; } /** Threaded wrapper for pipe. @@ -528,7 +528,7 @@ static void *consumer_thread( void *arg ) // internal intialization mlt_frame frame = NULL; - struct timespec tm = { 0, 400000 }; + struct timespec tm = { 0, 1000000 }; if ( mlt_properties_get_int( mlt_consumer_properties( consumer ), "sdl_started" ) == 0 ) { @@ -561,9 +561,9 @@ static void *consumer_thread( void *arg ) // Ensure that we have a frame if ( frame != NULL ) { - consumer_play_video( this, frame ); + if ( consumer_play_video( this, frame ) == 0 ) + nanosleep( &tm, NULL ); mlt_frame_close( frame ); - nanosleep( &tm, NULL ); } } diff --git a/src/modules/valerie/consumer_valerie.c b/src/modules/valerie/consumer_valerie.c index 5126701..4c36a9e 100644 --- a/src/modules/valerie/consumer_valerie.c +++ b/src/modules/valerie/consumer_valerie.c @@ -86,9 +86,10 @@ static int consumer_start( mlt_consumer this ) // Get all the properties now char *server = mlt_properties_get( properties, "server" ); int port = mlt_properties_get_int( properties, "port" ); - char *command = mlt_properties_get( properties, "command" ); + char *cmd = mlt_properties_get( properties, "command" ); int unit = mlt_properties_get_int( properties, "unit" ); char *title = mlt_properties_get( properties, "title" ); + char command[ 2048 ]; // If this is a reuse, then a valerie object will exist valerie connection = mlt_properties_get_data( properties, "connection", NULL ); @@ -96,6 +97,24 @@ static int consumer_start( mlt_consumer this ) // Special case - we can get a doc too... char *doc = mlt_properties_get( properties, "westley" ); + // Set the title if provided + if ( service != NULL ) + { + if ( title != NULL ) + mlt_properties_set( mlt_service_properties( service ), "title", title ); + else if ( mlt_properties_get( mlt_service_properties( service ), "title" ) == NULL ) + mlt_properties_set( mlt_service_properties( service ), "title", "Anonymous Submission" ); + title = mlt_properties_get( mlt_service_properties( service ), "title" ); + } + + strcpy( command, cmd == NULL ? "" : cmd ); + if ( strstr( command, "title=" ) == NULL && title != NULL ) + { + strcat( command, " title=\"" ); + strcat( command, title ); + strcat( command, "\"" ); + } + if ( service != NULL || doc != NULL ) { // Initiate the connection if required @@ -125,12 +144,6 @@ static int consumer_start( mlt_consumer this ) { int error; - // Set the title if provided - if ( title != NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", title ); - else if ( mlt_properties_get( mlt_service_properties( service ), "title" ) == NULL ) - mlt_properties_set( mlt_service_properties( service ), "title", "Anonymous Submission" ); - // Push the service error = valerie_unit_push( connection, unit, command, service );