diff options
author | Paul B Mahol <onemda@gmail.com> | 2018-12-12 11:12:32 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2018-12-13 18:58:48 +0100 |
commit | 80f0f8660c8febab6c79bd6d4799bffb0b9802e5 (patch) | |
tree | 6ff64598326c7791ef4933c09e97c1bcd9fe1eed | |
parent | 3f8cdd4ee3fa86228c5d6f7490d06301baf6b712 (diff) | |
download | ffmpeg-80f0f8660c8febab6c79bd6d4799bffb0b9802e5.tar.gz |
avformat/gifdec: export sample aspect ratio
-rw-r--r-- | libavformat/gifdec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index 8993ca615c..1f3ac8d8d9 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -99,7 +99,7 @@ static int gif_read_header(AVFormatContext *s) GIFDemuxContext *gdc = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; - int width, height, ret; + int width, height, ret, n; if ((ret = resync(pb)) < 0) return ret; @@ -107,6 +107,8 @@ static int gif_read_header(AVFormatContext *s) gdc->delay = gdc->default_delay; width = avio_rl16(pb); height = avio_rl16(pb); + avio_skip(pb, 2); + n = avio_r8(pb); if (width == 0 || height == 0) return AVERROR_INVALIDDATA; @@ -122,6 +124,10 @@ static int gif_read_header(AVFormatContext *s) st->codecpar->codec_id = AV_CODEC_ID_GIF; st->codecpar->width = width; st->codecpar->height = height; + if (n) { + st->codecpar->sample_aspect_ratio.num = n + 15; + st->codecpar->sample_aspect_ratio.den = 64; + } /* jump to start because gif decoder needs header data too */ if (avio_seek(pb, 0, SEEK_SET) != 0) |