From: lilo_booter Date: Sun, 29 Feb 2004 10:27:35 +0000 (+0000) Subject: unique ids X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=f0a20dae7fddfce0b3992bb6942145a3640315ba;p=melted unique ids git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@176 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c index cbd41e9..cf568bf 100644 --- a/src/framework/mlt_factory.c +++ b/src/framework/mlt_factory.c @@ -35,6 +35,7 @@ static mlt_repository producers = NULL; static mlt_repository filters = NULL; static mlt_repository transitions = NULL; static mlt_repository consumers = NULL; +static int unique_id = 0; /** Construct the factories. */ @@ -84,6 +85,7 @@ mlt_producer mlt_factory_producer( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_producer_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "producer" ); if ( mlt_properties_get_int( properties, "_mlt_service_hidden" ) == 0 ) mlt_properties_set( properties, "mlt_service", service ); @@ -100,6 +102,7 @@ mlt_filter mlt_factory_filter( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_filter_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "filter" ); mlt_properties_set( properties, "mlt_service", service ); } @@ -115,6 +118,7 @@ mlt_transition mlt_factory_transition( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_transition_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "transition" ); mlt_properties_set( properties, "mlt_service", service ); } @@ -130,6 +134,7 @@ mlt_consumer mlt_factory_consumer( char *service, void *input ) if ( obj != NULL ) { mlt_properties properties = mlt_consumer_properties( obj ); + mlt_properties_set_int( properties, "_unique_id", ++ unique_id ); mlt_properties_set( properties, "mlt_type", "consumer" ); mlt_properties_set( properties, "mlt_service", service ); } diff --git a/src/modules/core/filter_watermark.c b/src/modules/core/filter_watermark.c index 1b343c3..ebddb32 100644 --- a/src/modules/core/filter_watermark.c +++ b/src/modules/core/filter_watermark.c @@ -38,6 +38,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_properties properties = mlt_filter_properties( filter ); mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL ); mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL ); + char *name = mlt_properties_get( properties, "_unique_id" ); if ( composite == NULL ) { @@ -68,7 +69,10 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * { mlt_service service = mlt_producer_service( producer ); mlt_frame b_frame = NULL; + mlt_properties frame_properties = mlt_frame_properties( this ); + mlt_position position = mlt_properties_get_position( frame_properties, name ); + mlt_producer_seek( producer, position ); if ( mlt_service_get_frame( service, &b_frame, 0 ) == 0 ) mlt_transition_process( composite, this, b_frame ); @@ -89,6 +93,15 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { + // Get the properties of the frame + mlt_properties properties = mlt_frame_properties( frame ); + + // Get a unique name to store the frame position + char *name = mlt_properties_get( mlt_filter_properties( this ), "_unique_id" ); + + // Assign the current position to the name + mlt_properties_set_position( properties, name, mlt_frame_get_position( frame ) ); + // Push the filter on to the stack mlt_frame_push_service( frame, this ); diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index b277313..3249cd0 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -64,7 +64,7 @@ mlt_producer producer_libdv_init( char *filename ) // Create the dv_decoder this->dv_decoder = dv_decoder_new( FALSE, FALSE, FALSE ); - this->dv_decoder->quality = DV_QUALITY_BEST; + this->dv_decoder->quality = DV_QUALITY_COLOR | DV_QUALITY_AC_1; this->dv_decoder->audio->arg_audio_emphasis = 2; dv_set_audio_correction( this->dv_decoder, DV_AUDIO_CORRECT_AVERAGE ); @@ -239,7 +239,6 @@ static int producer_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_forma dv_parse_header( decoder, dv_data ); // Obtain required values - //fprintf( stderr, "libdv: frequency %d\n", decoder->audio->frequency ); *frequency = decoder->audio->frequency; *samples = decoder->audio->samples_this_frame; *channels = decoder->audio->num_channels; @@ -334,7 +333,7 @@ static void producer_close( mlt_producer parent ) producer_libdv this = parent->child; // Free the dv deconder - dv_decoder_free( this->dv_decoder ); + //dv_decoder_free( this->dv_decoder ); // Close the file if ( this->fd > 0 ) diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index b7e8411..c26e61a 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -99,7 +99,6 @@ mlt_producer producer_pango_init( const char *filename ) if ( filename == NULL ) { - mlt_properties_set( properties, "resource", "pango" ); mlt_properties_set( properties, "markup", "" ); } else if ( filename[ 0 ] == '+' || strstr( filename, "/+" ) ) @@ -149,7 +148,6 @@ mlt_producer producer_pango_init( const char *filename ) } else { - mlt_properties_set( properties, "resource", "pango" ); mlt_properties_set( properties, "markup", "" ); } } diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index 7ee7b1c..cd32429 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -167,8 +167,11 @@ static void refresh_image( mlt_frame frame, int width, int height ) // Get the time to live for each frame double ttl = mlt_properties_get_int( producer_props, "ttl" ); + // Get the original position of this frame + mlt_position position = mlt_properties_get_position( properties, "pixbuf_position" ); + // Image index - int image_idx = ( int )floor( mlt_frame_get_position( frame ) / ttl ) % this->count; + int image_idx = ( int )floor( ( double )position / ttl ) % this->count; // optimization for subsequent iterations on single picture if ( width != 0 && this->image != NULL && image_idx == this->image_idx ) @@ -329,27 +332,33 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Generate a frame *frame = mlt_frame_init( ); - // Obtain properties of frame and producer - mlt_properties properties = mlt_frame_properties( *frame ); + if ( *frame != NULL && this->count > 0 ) + { + // Obtain properties of frame and producer + mlt_properties properties = mlt_frame_properties( *frame ); - // Set the producer on the frame properties - mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL ); + // Set the producer on the frame properties + mlt_properties_set_data( properties, "producer_pixbuf", this, 0, NULL, NULL ); - // Update timecode on the frame we're creating - mlt_frame_set_position( *frame, mlt_producer_position( producer ) ); + // Update timecode on the frame we're creating + mlt_frame_set_position( *frame, mlt_producer_position( producer ) ); - // Refresh the image - refresh_image( *frame, 0, 0 ); + // Ensure that we have a way to obtain the position in the get_image + mlt_properties_set_position( properties, "pixbuf_position", mlt_producer_position( producer ) ); - // Set producer-specific frame properties - mlt_properties_set_int( properties, "progressive", 1 ); - mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" ) / mlt_properties_get_double( properties, "real_height" ) ); + // Refresh the image + refresh_image( *frame, 0, 0 ); - // Set alpha call back - ( *frame )->get_alpha_mask = producer_get_alpha_mask; + // Set producer-specific frame properties + mlt_properties_set_int( properties, "progressive", 1 ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( properties, "real_width" )/mlt_properties_get_double( properties, "real_height" ) ); - // Push the get_image method - mlt_frame_push_get_image( *frame, producer_get_image ); + // Set alpha call back + ( *frame )->get_alpha_mask = producer_get_alpha_mask; + + // Push the get_image method + mlt_frame_push_get_image( *frame, producer_get_image ); + } // Calculate the next timecode mlt_producer_prepare_next( producer );