[FFmpeg-devel] [PATCH]Set sample_aspect_ratio in real demuxer

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Dec 19 00:04:38 CET 2012


Hi!

Attached patch sets the sample_aspect_ratio similar to how the mov demuxer 
does it.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index a19786b..0b4bcae 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -355,6 +355,9 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
             goto fail1;
         st->codec->width  = avio_rb16(pb);
         st->codec->height = avio_rb16(pb);
+        st->sample_aspect_ratio = av_d2q(((double)st->codec->height * st->codec->width) /
+                                         ((double)st->codec->width * st->codec->height),
+                                         INT_MAX);
         avio_skip(pb, 2); // looks like bits per sample
         avio_skip(pb, 4); // always zero?
         st->codec->codec_type = AVMEDIA_TYPE_VIDEO;


More information about the ffmpeg-devel mailing list