]> git.sesse.net Git - mlt/blobdiff - src/modules/core/producer_consumer.c
Remove unused string.h include
[mlt] / src / modules / core / producer_consumer.c
index 99831ee952b342dc0399bada157a6a4ff674ed0a..d777e949bb756f7c4b70f94683e721c32314ccb4 100644 (file)
@@ -89,13 +89,14 @@ static int get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format,
                mlt_frame_set_audio( frame, new_buffer, *format, size, mlt_pool_release );
                memcpy( new_buffer, *buffer, size );
                *buffer = new_buffer;
+               cx->audio_position = mlt_frame_get_position( nested_frame );
        }
        else
        {
                // otherwise return no samples
                *samples = 0;
+               *buffer = NULL;
        }
-       cx->audio_position = mlt_frame_get_position( nested_frame );
 
        return result;
 }
@@ -113,6 +114,8 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
                mlt_properties_set_data( properties, "context", cx, 0, mlt_pool_release, NULL );
                cx->this = this;
                char *profile_name = mlt_properties_get( properties, "profile" );
+               if ( !profile_name )
+                       profile_name = mlt_properties_get( properties, "mlt_profile" );
                mlt_profile profile = mlt_service_profile( MLT_PRODUCER_SERVICE( this ) );
 
                if ( profile_name )
@@ -139,6 +142,7 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
 
                // Since we control the seeking, prevent it from seeking on its own
                mlt_producer_set_speed( cx->producer, 0 );
+               cx->audio_position = -1;
 
                // We will encapsulate a consumer
                cx->consumer = mlt_consumer_new( cx->profile );
@@ -156,7 +160,7 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
 
        // Generate a frame
        *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( this ) );
-       if ( frame )
+       if ( *frame )
        {
                // Seek the producer to the correct place
                // Calculate our positions
@@ -164,8 +168,8 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
                if ( mlt_producer_get_speed( this ) != 0 )
                        actual_position *= mlt_producer_get_speed( this );
                mlt_position need_first = floor( actual_position );
-               mlt_producer_seek( cx->producer, need_first * mlt_profile_fps( cx->profile )
-                       / mlt_producer_get_fps( this ) );
+               mlt_producer_seek( cx->producer,
+                       lrint( need_first * mlt_profile_fps( cx->profile ) / mlt_producer_get_fps( this ) ) );
 
                // Get the nested frame
                mlt_frame nested_frame = mlt_consumer_rt_frame( cx->consumer );
@@ -189,8 +193,8 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index )
                mlt_properties_set_double( frame_props, "aspect_ratio", mlt_profile_sar( cx->profile ) );
                mlt_properties_set_int( frame_props, "width", cx->profile->width );
                mlt_properties_set_int( frame_props, "height", cx->profile->height );
-               mlt_properties_set_int( frame_props, "real_width", cx->profile->width );
-               mlt_properties_set_int( frame_props, "real_height", cx->profile->height );
+               mlt_properties_set_int( frame_props, "meta.media.width", cx->profile->width );
+               mlt_properties_set_int( frame_props, "meta.media.height", cx->profile->height );
                mlt_properties_set_int( frame_props, "progressive", cx->profile->progressive );
        }
 
@@ -224,6 +228,7 @@ mlt_producer producer_consumer_init( mlt_profile profile, mlt_service_type type,
 
        // Encapsulate the real producer
        mlt_profile temp_profile = mlt_profile_clone( profile );
+       temp_profile->is_explicit = 0;
        mlt_producer real_producer = mlt_factory_producer( temp_profile, NULL, arg );
 
        if ( this && real_producer )