From: Dan Dennedy Date: Wed, 7 Aug 2013 14:34:39 +0000 (-0700) Subject: Move the aspect ratio for multi consumer from mlt_frame. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=45e92efd45d245cc9fb778db5a1ea340d5319336;p=mlt Move the aspect ratio for multi consumer from mlt_frame. --- diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index c9d7956d..3ad896d2 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -1043,8 +1043,6 @@ mlt_frame mlt_frame_clone( mlt_frame self, int is_deep ) mlt_frame new_frame = mlt_frame_init( NULL ); mlt_properties properties = MLT_FRAME_PROPERTIES( self ); mlt_properties new_props = MLT_FRAME_PROPERTIES( new_frame ); - int width = mlt_properties_get_int( properties, "width" ); - int height = mlt_properties_get_int( properties, "height" ); void *data, *copy; int size; @@ -1056,9 +1054,6 @@ mlt_frame mlt_frame_clone( mlt_frame self, int is_deep ) mlt_properties_set_data( new_props, "movit.convert", mlt_properties_get_data( properties, "movit.convert", NULL), 0, NULL, NULL ); - mlt_properties_set_int( new_props, "meta.media.width", width ); - mlt_properties_set_int( new_props, "meta.media.height", height ); - if ( is_deep ) { data = mlt_properties_get_data( properties, "audio", &size ); @@ -1075,6 +1070,9 @@ mlt_frame mlt_frame_clone( mlt_frame self, int is_deep ) data = mlt_properties_get_data( properties, "image", &size ); if ( data ) { + int width = mlt_properties_get_int( properties, "width" ); + int height = mlt_properties_get_int( properties, "height" ); + if ( ! size ) size = mlt_image_format_size( mlt_properties_get_int( properties, "format" ), width, height, NULL ); diff --git a/src/modules/core/consumer_multi.c b/src/modules/core/consumer_multi.c index 074196bb..ffcc6086 100644 --- a/src/modules/core/consumer_multi.c +++ b/src/modules/core/consumer_multi.c @@ -365,6 +365,7 @@ static void foreach_consumer_put( mlt_consumer consumer, mlt_frame frame ) // put ideal number of samples into cloned frame int deeply = index > 1 ? 1 : 0; mlt_frame clone_frame = mlt_frame_clone( frame, deeply ); + mlt_properties clone_props = MLT_FRAME_PROPERTIES( clone_frame ); int nested_samples = mlt_sample_calculator( nested_fps, frequency, nested_pos ); // -10 is an optimization to avoid tiny amounts of leftover samples nested_samples = nested_samples > current_samples - 10 ? current_samples : nested_samples; @@ -380,15 +381,21 @@ static void foreach_consumer_put( mlt_consumer consumer, mlt_frame frame ) nested_size = 0; } mlt_frame_set_audio( clone_frame, prev_buffer, format, nested_size, mlt_pool_release ); - mlt_properties_set_int( MLT_FRAME_PROPERTIES(clone_frame), "audio_samples", nested_samples ); - mlt_properties_set_int( MLT_FRAME_PROPERTIES(clone_frame), "audio_frequency", frequency ); - mlt_properties_set_int( MLT_FRAME_PROPERTIES(clone_frame), "audio_channels", channels ); + mlt_properties_set_int( clone_props, "audio_samples", nested_samples ); + mlt_properties_set_int( clone_props, "audio_frequency", frequency ); + mlt_properties_set_int( clone_props, "audio_channels", channels ); // chomp the audio current_samples -= nested_samples; current_size -= nested_size; buffer += nested_size; + // Fix some things + mlt_properties_set_int( clone_props, "meta.media.width", + mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "width" ) ); + mlt_properties_set_int( clone_props, "meta.media.height", + mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "height" ) ); + // send frame to nested consumer mlt_consumer_put_frame( nested, clone_frame ); mlt_properties_set_position( nested_props, "_multi_position", ++nested_pos );