]> git.sesse.net Git - mlt/commitdiff
unique ids
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 29 Feb 2004 10:27:35 +0000 (10:27 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sun, 29 Feb 2004 10:27:35 +0000 (10:27 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@176 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_factory.c
src/modules/core/filter_watermark.c
src/modules/dv/producer_libdv.c
src/modules/gtk2/producer_pango.c
src/modules/gtk2/producer_pixbuf.c

index cbd41e9521156902688e5eb4745aa0302e655c0b..cf568bf539986d0d799e6bad2dfcd9a678187df8 100644 (file)
@@ -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 );
        }
index 1b343c392afd43ce94a5fb2e56bb435034ce3ea5..ebddb32708829717cb269c4c0043cfb26254ff59 100644 (file)
@@ -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 );
 
index b2773135f48cb9b7c5c4a851c4be232896c44300..3249cd07441e22437ec4eaa349611cd0fd556849 100644 (file)
@@ -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 )
index b7e8411cbdfd05f81276a51b6d98f1d7151868e6..c26e61a5977be9e9065b1ccb5148467ae5b152f3 100644 (file)
@@ -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", "" );
                        }
                }
index 7ee7b1cf5fe5c9b0871810cf089729b1541a6caa..cd32429fe5f386684e6228d8d183ce0b1b1c2fbf 100644 (file)
@@ -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 );