From patchwork Fri Dec 7 20:30:56 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: 11333 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 1107B44E06F for ; Fri, 7 Dec 2018 22:31:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5641768A8E6; Fri, 7 Dec 2018 22:31:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC84968A8DC for ; Fri, 7 Dec 2018 22:30:56 +0200 (EET) Received: by mail-wr1-f54.google.com with SMTP id v13so4969475wrw.5 for ; Fri, 07 Dec 2018 12:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=4aZRKi/RcKFMTTIfiounruPdh/leVZeIZAkzZ6CSSOY=; b=YE4ngfAEktZgYcOInvdulCINhY1dckMjHbCvvcpfuWKGXz9pqrGEMNfQK5BnFt/KbR tEs5P3u+tOP7NstxI9eaH4QobLlaSQLqGw0WEO2l59CNzqGh6qPsD6ueQtf8ZnxteO1F +Fj+R2vdEkkE6ja34foUx4KzBYYBLWCbUdf7DL7n7QXBAV0dZZYiT6m4+IeeU39UsPgT NNL6tTbVijbhLg8X/wzvTDm/TOvOcTPYMLKZAMAnE+P3OT8ciAgnP9up9BtRWsLDE75d EeqFHxWWZMHO7PYAoTlQ8JKy1LMN6GYLEUbJbIonbsL+Zy310ipHmny0FByxLgcmdgNB E7jg== 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; bh=4aZRKi/RcKFMTTIfiounruPdh/leVZeIZAkzZ6CSSOY=; b=lhgbZqt4E6wn+QXOMkGBVdaDjmxclIVQJI/LytDzABUw9Sgb4KUBkPoVTFSZlN1DX1 X+gDHm/V5cg1TcmTwrI8P0fvo2TJbMojMmfKJBa7n++KV+doHMxLzcnXevofLSwO4FRs GsobcY/MF7hXv/DaRxyJdL37ALBe2U76Q9HtoSmnenm0MbU8kkcnRKQ8cVktEzmzKwgc RmfG2hCCR0/67FeR8Jz0pN/InMPOptOJM6JBm0OrZcVtdG6KMIltO6A2UFMu12IZ9oiO ePg5YgcgSWyPBBATQBKn6d8Jv3ni0DcMjOU3uOdDdmnNa9LGDC83V8PPZlDGn8UfONIk GecQ== X-Gm-Message-State: AA+aEWYDyPU9Trl4nFfBAzs/g+76355i1DQi+HZ1i9GVWDI1QROO+oNJ WZphXWsQYZrJnyDYpLfRE/X8VRij X-Google-Smtp-Source: AFSGD/Vg96xM811qf+L5+n6BukTKSOyb5p6yuqYyUjGXvNKTQz7aovd2Ika9r9uwnkUZAqyRsxOU/Q== X-Received: by 2002:adf:9484:: with SMTP id 4mr2786424wrr.98.1544214665546; Fri, 07 Dec 2018 12:31:05 -0800 (PST) Received: from localhost.localdomain ([94.250.174.60]) by smtp.gmail.com with ESMTPSA id o5sm10958248wmg.25.2018.12.07.12.31.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Dec 2018 12:31:04 -0800 (PST) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Dec 2018 21:30:56 +0100 Message-Id: <20181207203056.25613-1-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avformat/mxfenc: calculate and store DAR from user SAR 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" Fixes #5155 Signed-off-by: Paul B Mahol --- libavformat/mxfenc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 3549b4137d..8f762c7eaf 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2726,6 +2726,14 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) } } + if (st->codecpar->sample_aspect_ratio.num && st->codecpar->sample_aspect_ratio.den) { + av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den, + st->codecpar->sample_aspect_ratio.num * st->codecpar->width, + st->codecpar->sample_aspect_ratio.den * st->codecpar->height, INT_MAX); + } else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den, st->codecpar->width, st->codecpar->height, INT_MAX); + } + if (st->codecpar->codec_id == AV_CODEC_ID_MPEG2VIDEO) { if (!mxf_parse_mpeg2_frame(s, st, pkt, &ie)) { av_log(s, AV_LOG_ERROR, "could not get mpeg2 profile and level\n");