Transitions reworked (always_active capabilities); remaining audio handling switched...
[melted] / src / framework / mlt_tractor.c
index 8494089..d41eba1 100644 (file)
@@ -206,8 +206,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_int( frame_properties, "width", mlt_properties_get_int( properties, "width" ) );
        mlt_properties_set_int( frame_properties, "height", mlt_properties_get_int( properties, "height" ) );
        mlt_properties_set( frame_properties, "rescale.interp", mlt_properties_get( properties, "rescale.interp" ) );
-       if ( mlt_properties_get( properties, "distort" ) )
-               mlt_properties_set( frame_properties, "distort", mlt_properties_get( properties, "distort" ) );
+       mlt_properties_set_int( frame_properties, "distort", mlt_properties_get_int( properties, "distort" ) );
        mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "consumer_aspect_ratio" ) );
        mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_double( properties, "consumer_deinterlace" ) );
        mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_double( properties, "normalised_width" ) );
@@ -218,8 +217,7 @@ static int producer_get_image( mlt_frame this, uint8_t **buffer, mlt_image_forma
        mlt_properties_set_int( properties, "height", *height );
        mlt_properties_set_double( properties, "aspect_ratio", mlt_frame_get_aspect_ratio( frame ) );
        mlt_properties_set_int( properties, "progressive", mlt_properties_get_int( frame_properties, "progressive" ) );
-       if ( mlt_properties_get( frame_properties, "distort" ) )
-               mlt_properties_set( properties, "distort", mlt_properties_get( frame_properties, "distort" ) );
+       mlt_properties_set_int( properties, "distort", mlt_properties_get_int( frame_properties, "distort" ) );
        data = mlt_frame_get_alpha_mask( frame );
        mlt_properties_set_data( properties, "alpha", data, 0, NULL, NULL );
        return 0;
@@ -309,10 +307,31 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                                sprintf( label, "_%s_%d", id, count ++ );
                                mlt_properties_set_data( frame_properties, label, temp, 0, ( mlt_destructor )mlt_frame_close, NULL );
 
-                               // We want the last data_queue 
-                               if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL && 
-                                    mlt_deque_count( mlt_properties_get_data( temp_properties, "data_queue", NULL ) ) != 0 )
-                                       data_queue = mlt_properties_get_data( MLT_FRAME_PROPERTIES( temp ), "data_queue", NULL );
+                               // We want the first data_queue, but after that, all queues are appended
+                               if ( !done && mlt_properties_get_data( temp_properties, "data_queue", NULL ) != NULL )
+                               {
+                                       if ( data_queue == NULL )
+                                       {
+                                               data_queue = mlt_properties_get_data( MLT_FRAME_PROPERTIES( temp ), "data_queue", NULL );
+                                       }
+                                       else
+                                       {
+                                               // Move the contents of this queue on to the output frames data queue
+                                               mlt_deque sub_queue = mlt_properties_get_data( MLT_FRAME_PROPERTIES( temp ), "data_queue", NULL );
+                                               mlt_deque temp = mlt_deque_init( );
+                                               while ( mlt_deque_count( sub_queue ) )
+                                               {
+                                                       mlt_properties p = mlt_deque_pop_back( sub_queue );
+                                                       if ( mlt_properties_get_int( p, "frame_lock" ) == 0 )
+                                                               mlt_deque_push_back( data_queue, p );
+                                                       else
+                                                               mlt_deque_push_back( temp, p );
+                                               }
+                                               while( mlt_deque_count( temp ) )
+                                                       mlt_deque_push_front( sub_queue, mlt_deque_pop_back( temp ) );
+                                               mlt_deque_close( temp );
+                                       }
+                               }
 
                                // Pick up first video and audio frames
                                if ( !done && !mlt_frame_is_test_audio( temp ) && !( mlt_properties_get_int( temp_properties, "hide" ) & 2 ) )
@@ -325,7 +344,7 @@ static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int tra
                        if ( audio != NULL )
                        {
                                mlt_frame_push_audio( *frame, audio );
-                               ( *frame )->get_audio = producer_get_audio;
+                               mlt_frame_push_audio( *frame, producer_get_audio );
                        }
 
                        if ( video != NULL )