X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Favformat%2Fproducer_avformat.c;h=b589468b0239c8b6d5415cacd54d5ba23b68aefb;hb=2a04e5dceebd174e24be42da8643a815640db27d;hp=efd520615178120ffae90ffb23f18f1d9704603a;hpb=eccf04749681f70957f34fdd6742224774e72d15;p=melted diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index efd5206..b589468 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -679,18 +679,24 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) { double source_fps = 0; int norm_aspect_ratio = mlt_properties_get_int( properties, "norm_aspect_ratio" ); + double force_aspect_ratio = mlt_properties_get_double( properties, "force_aspect_ratio" ); + double aspect_ratio; // XXX: We won't know the real aspect ratio until an image is decoded // but we do need it now (to satisfy filter_resize) - take a guess based // on pal/ntsc - if ( !norm_aspect_ratio && codec_context->sample_aspect_ratio.num > 0 ) + if ( force_aspect_ratio > 0.0 ) { - mlt_properties_set_double( properties, "aspect_ratio", av_q2d( codec_context->sample_aspect_ratio ) ); + aspect_ratio = force_aspect_ratio; + } + else if ( !norm_aspect_ratio && codec_context->sample_aspect_ratio.num > 0 ) + { + aspect_ratio = av_q2d( codec_context->sample_aspect_ratio ); } else { int is_pal = mlt_properties_get_double( properties, "fps" ) == 25.0; - mlt_properties_set_double( properties, "aspect_ratio", is_pal ? 59.0/54.0 : 10.0/11.0 ); + aspect_ratio = is_pal ? 59.0/54.0 : 10.0/11.0; } // Determine the fps @@ -699,10 +705,12 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) // We'll use fps if it's available if ( source_fps > 0 && source_fps < 30 ) mlt_properties_set_double( properties, "source_fps", source_fps ); + mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio ); // Set the width and height mlt_properties_set_int( frame_properties, "width", codec_context->width ); mlt_properties_set_int( frame_properties, "height", codec_context->height ); + mlt_properties_set_double( frame_properties, "aspect_ratio", aspect_ratio ); mlt_frame_push_get_image( frame, producer_get_image ); mlt_properties_set_data( frame_properties, "avformat_producer", this, 0, NULL, NULL );