[FFmpeg-devel] [PATCH]Set sample_aspect_ratio in real demuxer
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Dec 19 10:34:36 CET 2012
On Wednesday 19 December 2012 01:53:13 am Michael Niedermayer wrote:
> On Wed, Dec 19, 2012 at 12:04:38AM +0100, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch sets the sample_aspect_ratio similar to how the mov
> > demuxer does it.
> >
> > Please comment, Carl Eugen
> >
> > rmdec.c | 3 +++
> > 1 file changed, 3 insertions(+)
> > c5d33240428571338e061bea9117c87508edeaa5 patchrealsar.diff
> > 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);
>
> w*h / (w*h) = 1
> is that intended ?
It was already too late;-)
New patch attached, I tested with several samples (with different dar), with
the patch the display aspect ratio is correctly shown (it is unknown
without).
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index a19786b..1095f8f 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -355,6 +355,8 @@ 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.num =
+ st->sample_aspect_ratio.den = 1;
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