[Mlt-devel] mlt/src/framework mlt_frame.c,1.84,1.85 mlt_playlist.c,1.64,1.65 mlt_producer.c,1.59,1.6
Brought to you by:
ddennedy,
lilo_booter
From: Charles Y. <lil...@us...> - 2005-07-16 13:36:33
|
Update of /cvsroot/mlt/mlt/src/framework In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24537/src/framework Modified Files: mlt_frame.c mlt_playlist.c mlt_producer.c mlt_service.c mlt_tractor.c Log Message: rc/framework/mlt_frame.c + image_count added to assist the 'transition filter' in knowing when to act... src/framework/mlt_playlist.c + Complete rework of fx cuts - now only the fx are output on a frame src/framework/mlt_producer.c + Aspect ratio of cuts inherited from parent src/framework/mlt_service.c + Get frame reworked and cleaned up src/framework/mlt_tractor.c - Removed erroneous width/height pass down prior to image fetching + Corrected types on other properties for pass down + Complete rework of fx cuts - they're now received as producer-less frames from a track + Added image_count logic for transition filter assistance src/modules/core/filter_resize.c + Added state retention of aspect ratio (may withdraw this later - it assumes producer knows a/r on frame creation/prior to image fetch) src/modules/core/filter_transition.c + Checks that two images are available before processing + Checks test image/audio cases src/modules/core/transition_composite.c + Major correction in aspect ratio handling (the b frame image is 'distorted' to the consumers aspect ratio) + Minor clean up of silly and/or/xor - now have 'operator=[and/or/xor]' (more clean up to follow) src/modules/dv/producer_libdv.c + Frame stored width and height are no longer assumed to be 'safe' here (investigating) Index: mlt_tractor.c =================================================================== RCS file: /cvsroot/mlt/mlt/src/framework/mlt_tractor.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- mlt_tractor.c 27 Jun 2005 07:47:07 -0000 1.44 +++ mlt_tractor.c 16 Jul 2005 13:36:23 -0000 1.45 @@ -204,15 +204,13 @@ mlt_properties properties = MLT_FRAME_PROPERTIES( this ); mlt_frame frame = mlt_frame_pop_service( this ); mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame ); - 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" ) ); 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, "consumer_deinterlace", mlt_properties_get_int( properties, "consumer_deinterlace" ) ); mlt_properties_set( frame_properties, "deinterlace_method", mlt_properties_get( properties, "deinterlace_method" ) ); - mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_double( properties, "normalised_width" ) ); - mlt_properties_set_int( frame_properties, "normalised_height", mlt_properties_get_double( properties, "normalised_height" ) ); + mlt_properties_set_int( frame_properties, "normalised_width", mlt_properties_get_int( properties, "normalised_width" ) ); + mlt_properties_set_int( frame_properties, "normalised_height", mlt_properties_get_int( properties, "normalised_height" ) ); mlt_frame_get_image( frame, buffer, format, width, height, writable ); mlt_properties_set_data( properties, "image", *buffer, *width * *height * 2, NULL, NULL ); mlt_properties_set_int( properties, "width", *width ); @@ -268,6 +266,7 @@ int done = 0; mlt_frame temp = NULL; int count = 0; + int image_count = 0; // Get the properties of the parent producer mlt_properties properties = MLT_PRODUCER_PROPERTIES( parent ); @@ -327,50 +326,10 @@ done = mlt_properties_get_int( temp_properties, "last_track" ); // Handle fx only tracks - if ( mlt_properties_get_int( temp_properties, "meta.fx_cut" ) ) + if ( mlt_properties_get_int( temp_properties, "fx_cut" ) ) { - mlt_properties copy = video == NULL ? frame_properties : MLT_FRAME_PROPERTIES( video ); - int i = 0; - - for ( i = 0; i < mlt_properties_count( temp_properties ); i ++ ) - { - char *name = mlt_properties_get_name( temp_properties, i ); - char *value = mlt_properties_get_value( temp_properties, i ); - // For animated filters - if ( isdigit( name[ 0 ] ) && value != NULL ) - mlt_properties_set( copy, name, value ); - } - - if ( video ) - { - // Take all but the first placeholding producer and dump on to the image stack - void *p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) ); - while ( ( p = mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( temp ) ) ) != NULL ) - mlt_deque_push_back( MLT_FRAME_IMAGE_STACK( video ), p ); - } - else - { - mlt_frame_push_service( *frame, temp ); - mlt_frame_push_service( *frame, producer_get_image ); - mlt_properties_set_int( frame_properties, "meta.fx_cut", 1 ); - } - - if ( audio ) - { - // Take all but the first placeholding producer and dump on to the audio stack - void *p = !mlt_frame_is_test_audio( temp ) ? mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) ) : NULL; - while ( ( p = mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( temp ) ) ) != NULL ) - mlt_deque_push_back( MLT_FRAME_AUDIO_STACK( audio ), p ); - } - else - { - mlt_frame_push_audio( *frame, temp ); - mlt_frame_push_audio( *frame, producer_get_audio ); - mlt_properties_set_int( frame_properties, "meta.fx_cut", 1 ); - } - - // Ensure everything is hidden - mlt_properties_set_int( temp_properties, "hide", 3 ); + int hide = ( video == NULL ? 1 : 0 ) | ( audio == NULL ? 2 : 0 ); + mlt_properties_set_int( temp_properties, "hide", hide ); } // We store all frames with a destructor on the output frame @@ -426,6 +385,8 @@ mlt_deque_push_front( MLT_FRAME_IMAGE_STACK( temp ), video ); } video = temp; + mlt_properties_set_int( MLT_FRAME_PROPERTIES( temp ), "image_count", ++ image_count ); + image_count = 1; } } @@ -450,6 +411,7 @@ mlt_properties_set_int( frame_properties, "real_height", mlt_properties_get_int( video_properties, "real_height" ) ); mlt_properties_set_int( frame_properties, "progressive", mlt_properties_get_int( video_properties, "progressive" ) ); mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_properties_get_double( video_properties, "aspect_ratio" ) ); + mlt_properties_set_int( frame_properties, "image_count", image_count ); } else { Index: mlt_frame.c =================================================================== RCS file: /cvsroot/mlt/mlt/src/framework/mlt_frame.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- mlt_frame.c 10 Jul 2005 04:39:56 -0000 1.84 +++ mlt_frame.c 16 Jul 2005 13:36:23 -0000 1.85 @@ -267,6 +267,7 @@ if ( get_image != NULL ) { + mlt_properties_set_int( properties, "image_count", mlt_properties_get_int( properties, "image_count" ) - 1 ); mlt_position position = mlt_frame_get_position( this ); error = get_image( this, buffer, format, width, height, writable ); mlt_frame_set_position( this, position ); Index: mlt_producer.c =================================================================== RCS file: /cvsroot/mlt/mlt/src/framework/mlt_producer.c,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- mlt_producer.c 21 Jun 2005 20:59:37 -0000 1.59 +++ mlt_producer.c 16 Jul 2005 13:36:23 -0000 1.60 @@ -205,6 +205,7 @@ mlt_properties_set_int( properties, "_cut", 1 ); mlt_properties_set_data( properties, "_cut_parent", parent, 0, ( mlt_destructor )mlt_producer_close, NULL ); mlt_properties_set_position( properties, "length", mlt_properties_get_position( parent_props, "length" ) ); + mlt_properties_set_double( properties, "aspect_ratio", mlt_properties_get_double( parent_props, "aspect_ratio" ) ); mlt_producer_set_in_and_out( result, in, out ); // Mini fezzik :-/ Index: mlt_playlist.c =================================================================== RCS file: /cvsroot/mlt/mlt/src/framework/mlt_playlist.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- mlt_playlist.c 5 Jul 2005 09:31:07 -0000 1.64 +++ mlt_playlist.c 16 Jul 2005 13:36:23 -0000 1.65 @@ -273,6 +273,7 @@ mlt_service_detach( service, filter ); filter = mlt_service_filter( service, 0 ); } + mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( producer ), "meta.fx_cut", 1 ); } // Check that we have room @@ -1450,7 +1451,22 @@ } // Get the frame - mlt_service_get_frame( real, frame, index ); + if ( !mlt_properties_get_int( MLT_SERVICE_PROPERTIES( real ), "meta.fx_cut" ) ) + { + mlt_service_get_frame( real, frame, index ); + } + else + { + mlt_producer parent = mlt_producer_cut_parent( ( mlt_producer )real ); + *frame = mlt_frame_init( ); + mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "fx_cut", 1 ); + mlt_frame_push_service( *frame, NULL ); + mlt_frame_push_audio( *frame, NULL ); + mlt_service_apply_filters( parent, *frame, 0 ); + mlt_service_apply_filters( real, *frame, 0 ); + mlt_deque_pop_front( MLT_FRAME_IMAGE_STACK( *frame ) ); + mlt_deque_pop_front( MLT_FRAME_AUDIO_STACK( *frame ) ); + } // Check if we're at the end of the clip mlt_properties properties = MLT_FRAME_PROPERTIES( *frame ); Index: mlt_service.c =================================================================== RCS file: /cvsroot/mlt/mlt/src/framework/mlt_service.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- mlt_service.c 31 Jan 2005 14:16:02 -0000 1.27 +++ mlt_service.c 16 Jul 2005 13:36:23 -0000 1.28 @@ -355,17 +355,26 @@ int mlt_service_get_frame( mlt_service this, mlt_frame_ptr frame, int index ) { + int result = 0; + + // Lock the service mlt_service_lock( this ); + + // Ensure that the frame is NULL + *frame = NULL; + + // Only process if we have a valid service if ( this != NULL && this->get_frame != NULL ) { - int result = 0; mlt_properties properties = MLT_SERVICE_PROPERTIES( this ); mlt_position in = mlt_properties_get_position( properties, "in" ); mlt_position out = mlt_properties_get_position( properties, "out" ); - mlt_properties_inc_ref( properties ); + result = this->get_frame( this, frame, index ); + if ( result == 0 ) { + mlt_properties_inc_ref( properties ); properties = MLT_FRAME_PROPERTIES( *frame ); if ( in >=0 && out > 0 ) { @@ -374,18 +383,17 @@ } mlt_service_apply_filters( this, *frame, 1 ); mlt_deque_push_back( MLT_FRAME_SERVICE_STACK( *frame ), this ); - mlt_service_unlock( this ); - } - else - { - mlt_service_unlock( this ); - mlt_service_close( this ); } - return result; } + + // Make sure we return a frame + if ( *frame == NULL ) + *frame = mlt_frame_init( ); + + // Unlock the service mlt_service_unlock( this ); - *frame = mlt_frame_init( ); - return 0; + + return result; } static void mlt_service_filter_changed( mlt_service owner, mlt_service this ) |