From patchwork Wed Dec 12 16:32:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 11388 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 478EE44DB0E for ; Wed, 12 Dec 2018 18:40:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 94B1B68A868; Wed, 12 Dec 2018 18:40:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4863768A868 for ; Wed, 12 Dec 2018 18:39:57 +0200 (EET) Received: by mail-wm1-f46.google.com with SMTP id c126so6656103wmh.0 for ; Wed, 12 Dec 2018 08:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=d2vmwUDcdgIja2Rs2kkcagpIH6+c3yBgpyIYijqqb4w=; b=B33C7EYL7VXjIaknXjlEcZRbh2Rb9O12gGQHmXlKON6kX6icVgvcz6pwHzvqv9L35P JVO920kUUYFC+JnPGkjyH2hDIULq56e2IhU5BCnYNRlFdeSoloXzLClI7OPm4i9eMWYk VJuy+77eIggqvnF+yZk6qzMTWcaugIuxUQzz8otRSkbDB0WL7SogLWMbHA1mw1M8cf3T 8AoBrpP4tQv2k9FHFqSUrfpcUnlxlp0DrgKG3W4nUKYCVznMk5QIQYwUmYGy205kZe7K crpfG8TPj9nSUqyUMBuYq6BPGKbFNdcEd1NbHT45dBCXmsQI6GxWWdUniNBrm3E2PyaV M2ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=d2vmwUDcdgIja2Rs2kkcagpIH6+c3yBgpyIYijqqb4w=; b=QUpRrMHmdR5+MzbFZ0fbLfmt9zPZMgIq5qoLT9NdK7E10vkFlQU8ohe2J8tc8ScSAo nCJDLvSdeJjy+hw7YEELKwZ6R8HeDloN/f8A72WqHBUvMyNq5daNzAM5DoUjCR+li8YA bsVE31tYKuEPIf0DmlXRiy8KcW191cYHPIkSYeswAcyE6DAf5pOX9i8UtPaVrGQyuKv1 vEXOPkERnvVK2JSnJ+6pk2eellwTylqE3kPn+cLGSrTqfPcc7W3CTVIiferTmWKqxFId AhGnCSnnj6olFvVUd2wQPBUwiIpIdiusSYO0lyRoByhmBGmY1nJlLyMuSfiY0cSgsk7f lkTQ== X-Gm-Message-State: AA+aEWbnDk/gA1gwefJ6BjeVXzeGU0qMEWLd0vLOEAxSAaKUGW+XPTUe Tczq/GDOphh3bA+5umSZYwELq7Q2 X-Google-Smtp-Source: AFSGD/W0kggT5inUR+C0jF61KpYC2bwU0dDCpuGIioSKoAEDrYkOfLFvphrY/yu6nDnNvfjLCtIJjg== X-Received: by 2002:a1c:5f8a:: with SMTP id t132mr7248177wmb.40.1544632392284; Wed, 12 Dec 2018 08:33:12 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id g129sm3165446wmf.39.2018.12.12.08.33.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 08:33:11 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Dec 2018 17:32:54 +0100 Message-Id: <20181212163257.9109-3-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181212163257.9109-1-onemda@gmail.com> References: <20181212163257.9109-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/6] avformat/gifdec: export sample aspect ratio X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Paul B Mahol --- libavformat/gifdec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)