]> git.sesse.net Git - mlt/commitdiff
change producers to use mlt_frame_original_position()
authorDan Dennedy <dan@dennedy.org>
Sun, 9 Sep 2012 05:05:35 +0000 (22:05 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 9 Sep 2012 05:09:01 +0000 (22:09 -0700)
src/modules/avformat/producer_avformat.c
src/modules/gtk2/producer_pango.c
src/modules/gtk2/producer_pixbuf.c
src/modules/qimage/producer_qimage.c
src/modules/qimage/qimage_wrapper.cpp
src/modules/swfdec/producer_swfdec.c
src/modules/vorbis/producer_vorbis.c

index eeab67e4081e9e1b33c99de2c31df8e18b05fcab..0d7c5c1b828381a2ba89302d288880536f94cb00 100644 (file)
@@ -1393,7 +1393,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
 
        // Obtain the frame number of this frame
-       mlt_position position = mlt_properties_get_position( frame_properties, "avformat_position" );
+       mlt_position position = mlt_frame_original_position( frame );
 
        // Get the producer properties
        mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
@@ -1437,7 +1437,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        }
        if ( self->image_cache )
        {
-               mlt_frame original = mlt_cache_get_frame( self->image_cache, mlt_frame_get_position( frame ) );
+               mlt_frame original = mlt_cache_get_frame( self->image_cache, position );
                if ( original )
                {
                        mlt_properties orig_props = MLT_FRAME_PROPERTIES( original );
@@ -2240,7 +2240,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format
        pthread_mutex_lock( &self->audio_mutex );
        
        // Obtain the frame number of this frame
-       mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( frame ), "avformat_position" );
+       mlt_position position = mlt_frame_original_position( frame );
 
        // Calculate the real time code
        double real_timecode = producer_time_of_frame( self->parent, position );
@@ -2669,7 +2669,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
        // Set the position of this producer
        mlt_position position = self->seekable ? mlt_producer_frame( producer ) : self->nonseek_position++;
-       mlt_properties_set_position( MLT_FRAME_PROPERTIES( *frame ), "avformat_position", position );
+       mlt_properties_set_position( MLT_FRAME_PROPERTIES( *frame ), "original_position", position );
 
        // Calculate the next timecode
        mlt_producer_prepare_next( producer );
index 49a9a7a186fb2eab29af973223c37511e03cc204..be9c3c967c9d8e806ab48da851253b6f8c556baa 100644 (file)
@@ -369,14 +369,13 @@ static void refresh_image( mlt_frame frame, int width, int height )
        if ( pixbuf == NULL )
        {
                // Check for file support
-               int position = mlt_properties_get_position( properties, "pango_position" );
                mlt_properties contents = mlt_properties_get_data( producer_props, "contents", NULL );
                mlt_geometry key_frames = mlt_properties_get_data( producer_props, "key_frames", NULL );
                struct mlt_geometry_item_s item;
                if ( contents != NULL )
                {
                        char temp[ 20 ];
-                       mlt_geometry_prev_key( key_frames, &item, position );
+                       mlt_geometry_prev_key( key_frames, &item, mlt_frame_original_position( frame ) );
                        sprintf( temp, "%d", item.frame );
                        markup = mlt_properties_get( contents, temp );
                }
@@ -553,7 +552,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
 
        // Update timecode on the frame we're creating
        mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
-       mlt_properties_set_position( properties, "pango_position", mlt_producer_frame( producer ) );
 
        // Refresh the pango image
        pthread_mutex_lock( &pango_mutex );
index d1e15eaf2b562e74e4526e58ba2f80b60149e638..1bbd317aece3981b5abe83031a2e8845ca0caee6 100644 (file)
@@ -103,7 +103,6 @@ mlt_producer producer_pixbuf_init( char *filename )
                                mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
                                mlt_properties_set_data( frame_properties, "producer_pixbuf", self, 0, NULL, NULL );
                                mlt_frame_set_position( frame, mlt_producer_position( producer ) );
-                               mlt_properties_set_position( frame_properties, "pixbuf_position", mlt_producer_position( producer ) );
                                refresh_pixbuf( self, frame );
                                mlt_cache_item_close( self->pixbuf_cache );
                                mlt_frame_close( frame );
@@ -342,7 +341,7 @@ static int refresh_pixbuf( producer_pixbuf self, mlt_frame 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" );
+       mlt_position position = mlt_frame_original_position( frame );
        position += mlt_producer_get_in( producer );
 
        // Image index
@@ -599,9 +598,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                // Update timecode on the frame we're creating
                mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
 
-               // 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 ) );
-
                // Refresh the pixbuf
                self->pixbuf_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "pixbuf.pixbuf" );
                self->pixbuf = mlt_cache_item_data( self->pixbuf_cache, NULL );
index 76b96893ef42169df58098709a2ae2a5bdcf3590..8f31af2a69b4951f1fcb9072b8c309ba04359e4f 100644 (file)
@@ -73,7 +73,6 @@ mlt_producer producer_qimage_init( mlt_profile profile, mlt_service_type type, c
                                mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
                                mlt_properties_set_data( frame_properties, "producer_qimage", self, 0, NULL, NULL );
                                mlt_frame_set_position( frame, mlt_producer_position( producer ) );
-                               mlt_properties_set_position( frame_properties, "qimage_position", mlt_producer_position( producer ) );
                                refresh_qimage( self, frame );
                                mlt_cache_item_close( self->qimage_cache );
                                mlt_frame_close( frame );
@@ -294,9 +293,6 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i
                // Update timecode on the frame we're creating
                mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
 
-               // Ensure that we have a way to obtain the position in the get_image
-               mlt_properties_set_position( properties, "qimage_position", mlt_producer_position( producer ) );
-
                // Refresh the image
                self->qimage_cache = mlt_service_cache_get( MLT_PRODUCER_SERVICE( producer ), "qimage.qimage" );
                self->qimage = mlt_cache_item_data( self->qimage_cache, NULL );
index 3c866d1e2fb37ed17afc02ea1f05fd7e6dbd4740..13aafbf609d6f78a78d467bfc48a134d7cc8bbf0 100644 (file)
@@ -157,7 +157,7 @@ int refresh_qimage( producer_qimage self, mlt_frame 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, "qimage_position" );
+       mlt_position position = mlt_frame_original_position( frame );
        position += mlt_producer_get_in( producer );
 
        // Image index
index 88d338f955bad8c34102f27b4bd774b0d5cc63b0..83640fbf4ff8b812a352b4b3ddb1fa8937aeff34 100644 (file)
@@ -113,7 +113,6 @@ static int get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *forma
        producer_swfdec swfdec = mlt_frame_pop_service( frame );
        mlt_service service = MLT_PRODUCER_SERVICE( &swfdec->parent );
        mlt_profile profile = mlt_service_profile( service );
-       mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
 
        mlt_service_lock( service );
        
@@ -129,7 +128,7 @@ static int get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *forma
        mlt_frame_set_image( frame, *buffer, *width * ( *height + 1 ) * 4, mlt_pool_release );
 
        // Seek
-       mlt_position pos = mlt_properties_get_position( properties, "swfdec.position" );
+       mlt_position pos = mlt_frame_original_position( frame );
        if ( pos > swfdec->last_position )
        {
                gulong msec = 1000UL * ( pos - swfdec->last_position ) * profile->frame_rate_den / profile->frame_rate_num;
@@ -182,7 +181,6 @@ static int get_frame( mlt_producer producer, mlt_frame_ptr frame, int index )
        mlt_properties_set_int( properties, "height", swfdec->height );
        mlt_properties_set_int( properties, "progressive", 1 );
        mlt_properties_set_double( properties, "aspect_ratio", 1.0 );
-       mlt_properties_set_position( properties, "swfdec.position", mlt_producer_frame( producer ) );
 
        // Push the get_image method on to the stack
        mlt_frame_push_service( *frame, swfdec );
index 479e721771ab5102f86dd099c37b000bb1e2cc1c..920108627f500d495535dadf00d1080b17e61a0e 100644 (file)
@@ -214,11 +214,8 @@ static double producer_time_of_frame( mlt_producer this, mlt_position position )
 
 static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
 {
-       // Get the properties from the frame
-       mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
-
        // Obtain the frame number of this frame
-       mlt_position position = mlt_properties_get_position( frame_properties, "vorbis_position" );
+       mlt_position position = mlt_frame_original_position( frame );
 
        // Get the producer 
        mlt_producer this = mlt_frame_pop_audio( frame );
@@ -366,16 +363,12 @@ static int producer_get_frame( mlt_producer this, mlt_frame_ptr frame, int index
        // Update timecode on the frame we're creating
        mlt_frame_set_position( *frame, mlt_producer_position( this ) );
 
-       // Set the position of this producer
-       mlt_properties frame_properties = MLT_FRAME_PROPERTIES( *frame );
-       mlt_properties_set_position( frame_properties, "vorbis_position", mlt_producer_frame( this ) );
-
        // Set up the audio
        mlt_frame_push_audio( *frame, this );
        mlt_frame_push_audio( *frame, producer_get_audio );
 
        // Pass audio properties to the frame
-       mlt_properties_pass_list( frame_properties, MLT_PRODUCER_PROPERTIES( this ), "frequency, channels" );
+       mlt_properties_pass_list( MLT_FRAME_PROPERTIES(*frame), MLT_PRODUCER_PROPERTIES( this ), "frequency, channels" );
 
        // Calculate the next timecode
        mlt_producer_prepare_next( this );