X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ffilter_data_show.c;h=fc9fb3ecb7ac18b3e0d2928dfb36b44b4063bf96;hb=982cce93f18192cdc05fbddcb209ac3950b64318;hp=b16f8fe40c33effe306e1ff0da7fe05c57789345;hpb=702e73b84d90830062ebe07ba01b72ad59d48d93;p=melted diff --git a/src/modules/core/filter_data_show.c b/src/modules/core/filter_data_show.c index b16f8fe..fc9fb3e 100644 --- a/src/modules/core/filter_data_show.c +++ b/src/modules/core/filter_data_show.c @@ -100,9 +100,6 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame // Fetch the filter associated to this type mlt_filter requested = mlt_properties_get_data( filter_properties, type, NULL ); - // Calculate the length of the feed - int length = mlt_properties_get_int( feed, "out" ) - mlt_properties_get_int( feed, "in" ) + 1; - // If it doesn't exist, then create it now if ( requested == NULL ) { @@ -121,6 +118,18 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame static char *prefix = "properties."; int len = strlen( prefix ); + // Determine if this is an absolute or relative feed + int absolute = mlt_properties_get_int( feed, "absolute" ); + + // Make do with what we have + int length = !absolute ? + mlt_properties_get_int( feed, "out" ) - mlt_properties_get_int( feed, "in" ) + 1 : + mlt_properties_get_int( feed, "out" ) + 1; + + // Repeat period + int period = mlt_properties_get_int( properties, "period" ); + period = period == 0 ? 1 : period; + // Pass properties from feed into requested for ( i = 0; i < mlt_properties_count( properties ); i ++ ) { @@ -130,9 +139,7 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame { if ( !strncmp( name + len, "length[", 7 ) ) { - int period = mlt_properties_get_int( properties, "period" ); - period = period == 0 ? 1 : period; - mlt_properties_set_position( properties, key, length / period ); + mlt_properties_set_position( properties, key, ( length - period ) / period ); } else { @@ -144,7 +151,10 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame } // Set the original position on the frame - mlt_frame_set_position( frame, mlt_properties_get_int( feed, "position" ) - mlt_properties_get_int( feed, "in" ) ); + if ( absolute == 0 ) + mlt_frame_set_position( frame, mlt_properties_get_int( feed, "position" ) - mlt_properties_get_int( feed, "in" ) ); + else + mlt_frame_set_position( frame, mlt_properties_get_int( feed, "position" ) ); // Process the filter mlt_filter_process( requested, frame ); @@ -156,6 +166,44 @@ static int process_feed( mlt_properties feed, mlt_filter filter, mlt_frame frame return error; } +void process_queue( mlt_deque data_queue, mlt_frame frame, mlt_filter filter ) +{ + if ( data_queue != NULL ) + { + // Create a new queue for those that we can't handle + mlt_deque temp_queue = mlt_deque_init( ); + + // Iterate through each entry on the queue + while ( mlt_deque_peek_front( data_queue ) != NULL ) + { + // Get the data feed + mlt_properties feed = mlt_deque_pop_front( data_queue ); + + if ( mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "debug" ) != NULL ) + mlt_properties_debug( feed, mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "debug" ), stderr ); + + // Process the data feed... + if ( process_feed( feed, filter, frame ) == 0 ) + mlt_properties_close( feed ); + else + mlt_deque_push_back( temp_queue, feed ); + } + + // Now put the unprocessed feeds back on the stack + while ( mlt_deque_peek_front( temp_queue ) ) + { + // Get the data feed + mlt_properties feed = mlt_deque_pop_front( temp_queue ); + + // Put it back on the data queue + mlt_deque_push_back( data_queue, feed ); + } + + // Close the temporary queue + mlt_deque_close( temp_queue ); + } +} + /** Get the image. */ @@ -167,37 +215,11 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format // Get the frame properties mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); - // Fetch the data queue - mlt_deque data_queue = mlt_properties_get_data( frame_properties, "data_queue", NULL ); - - // Create a new queue for those that we can't handle - mlt_deque temp_queue = mlt_deque_init( ); - - // Iterate through each entry on the queue - while ( data_queue != NULL && mlt_deque_peek_front( data_queue ) != NULL ) - { - // Get the data feed - mlt_properties feed = mlt_deque_pop_front( data_queue ); - - // Process the data feed... - if ( process_feed( feed, filter, frame ) == 0 ) - mlt_properties_close( feed ); - else - mlt_deque_push_back( temp_queue, feed ); - } - - // Now put the unprocessed feeds back on the stack - while ( data_queue != NULL && mlt_deque_peek_front( temp_queue ) ) - { - // Get the data feed - mlt_properties feed = mlt_deque_pop_front( temp_queue ); - - // Put it back on the data queue - mlt_deque_push_back( data_queue, feed ); - } + // Track specific + process_queue( mlt_properties_get_data( frame_properties, "data_queue", NULL ), frame, filter ); - // Close the temporary queue - mlt_deque_close( temp_queue ); + // Global + process_queue( mlt_properties_get_data( frame_properties, "global_queue", NULL ), frame, filter ); // Need to get the image return mlt_frame_get_image( frame, image, format, width, height, 1 );