[FFmpeg-devel] [PATCH/RFC] honor DAR aspect ratio in nuv files.

elupus elupus
Thu Jun 5 02:43:07 CEST 2008


On Thu, 05 Jun 2008 00:32:15 +0100, M?ns Rullg?rd wrote:

> elupus <elupus at ecce.se> writes:
> 
>> Index: libavformat/nuv.c
>> ===================================================================
>> --- libavformat/nuv.c	(revision 13656)
>> +++ libavformat/nuv.c	(working copy)
>> @@ -137,6 +137,8 @@
>>      get_byte(pb); // 'P' == progressive, 'I' == interlaced
>>      url_fskip(pb, 3); // padding
>>      aspect = av_int2dbl(get_le64(pb));
>> +    if(aspect < 0.9999 && aspect > 1.0001)
> 
> That condition can never be true.

Yea, should be if(aspect > 0.9999 && aspect < 1.0001). 

> 
>> +        aspect = 4.0 / 3.0;
>>      fps = av_int2dbl(get_le64(pb));
>>
>>      // number of packets per stream type, -1 means unknown, e.g. streaming
>> @@ -156,7 +158,10 @@
>>          vst->codec->width = width;
>>          vst->codec->height = height;
>>          vst->codec->bits_per_sample = 10;
>> -        vst->codec->sample_aspect_ratio = av_d2q(aspect, 10000);
>> +        av_reduce(&vst->codec->sample_aspect_ratio.num,
>> +                  &vst->codec->sample_aspect_ratio.den,
>> +                  height * aspect
>> +                  width, 255);
>>          vst->r_frame_rate = av_d2q(fps, 60000);
>>          av_set_pts_info(vst, 32, 1, 1000);
>>      } else
> 
> Was the old code valid for some files?  If yes, this change is wrong
> for those files.

Don't think so. It was always hardcoded to be 1.0 in the muxer. And this is
the way myth's own player parses the value. 

However i'm leaning at not even setting sample_aspect_ratio when aspect is
1.0, since apperently they never set any proper value for this. And by not
setting it, player will respect any aspect that can be deduced from the
contained mpeg2/4 stream. What do you think?

Joakim





More information about the ffmpeg-devel mailing list