From patchwork Mon Aug 27 19:59:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stebbins X-Patchwork-Id: 10154 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp6811122jap; Mon, 27 Aug 2018 12:59:40 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb3kN3P01K/Mzh3CMcU354Jv7STNR4xuEXKx7cd2Ur6MAJpuc8/+gDrAeL6SJto8E6xdPH2 X-Received: by 2002:a1c:9c56:: with SMTP id f83-v6mr6133661wme.135.1535399980172; Mon, 27 Aug 2018 12:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399980; cv=none; d=google.com; s=arc-20160816; b=ot6Ym1AgVZnOxpCdJbTjyHTyL+cixgu+n9x2gMbjlvz3+7IYHG1WvOcjuAjhG3oatw IdRRclz8CDcAqIM8Bja3dvh32Ha9nLDXhdnAwNirGzmdTe3rSP2djNZWd0VEJYkFNbIk Wag9dLjTiwRYsVY8wZ5tDCJ4HTphgTHVaSdGsc06qq8RRGmEwTmVxs1d//qtr7S84K/a mwHVTPkuB6wwywN7j4fkSzMAIofD/oW+fBloGYre3m404gYKIVHG/D2tDbXnfJ7Z5Prg h73cxqgJUkj2bJTo2pZFe3Wh+IaKL1lSMEuWXLM0w8PNfyuTnIIpAVZ1OW7uk+nZyDPt 1hJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to:arc-authentication-results; bh=YpAXVjKU2JqiNLvGTtcGjWfOgJMvlyOAjS8gAccpz4Y=; b=eSypsaTUoUBLUKPQGPBJc94pjvPNWO8DvP4zcJTtr52pFrVu9A4zFLbl0CUCmOokXl KRCs+dy23fha0txnA4X34zpN5Axzty4kqk6OWv+3GCmBD89i5izI1+MsHyTrrg+0F25b TuyHeetXNbtqnR8UqVGSLDIwyD+j3AlAnDbb/qjMHi9IJEcYNPvcpsGXu8L/Xp35sREi 9abf5kS+LRO6f9ZycYc272isUz66e18XXAgWjtUTw8VwDJ6O9SRVZDnMCa/wXTT1gpA8 vYr/eD83gzRLefWAAM49KIJKDtvz2EwbTKZkl8pOPGyrFn02A/rZ+Nx2viPXlF/HPHPk RO4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id v6-v6si158904wrf.74.2018.08.27.12.59.39; Mon, 27 Aug 2018 12:59:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 601D168990F; Mon, 27 Aug 2018 22:59:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.jetheaddev.com (mail.jetheaddev.com [70.164.99.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6CDA168061D for ; Mon, 27 Aug 2018 22:59:28 +0300 (EEST) Received: from dionysus.jetheaddev.com (10.13.12.63) by cas.jetheaddev.com (192.168.13.27) with Microsoft SMTP Server (TLS) id 14.3.351.0; Mon, 27 Aug 2018 12:59:30 -0700 Received: from dionysus.jetheaddev.com (localhost [127.0.0.1]) by dionysus.jetheaddev.com (8.15.2/8.14.7) with ESMTP id w7RJxUwr025605 for ; Mon, 27 Aug 2018 12:59:30 -0700 Received: (from jstebbins@localhost) by dionysus.jetheaddev.com (8.15.2/8.15.2/Submit) id w7RJxUu4025604 for ffmpeg-devel@ffmpeg.org; Mon, 27 Aug 2018 12:59:30 -0700 From: John Stebbins To: Date: Mon, 27 Aug 2018 12:59:28 -0700 Message-ID: <20180827195928.25540-1-jstebbins@jetheaddev.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.13.12.63] Subject: [FFmpeg-devel] [PATCH] lavf/mov: Fix PCM audio w/ bit depth > 16 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This type of audio is defined by the QT spec, but can be found in non-QT branded files in the wild. Fixes ticket #7376 --- libavformat/mov.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 8915e3b9e0..3d4f6bcb21 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2100,6 +2100,18 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, } } +static int mov_pcm_gt16(enum AVCodecID codec_id) +{ + return codec_id == AV_CODEC_ID_PCM_S24LE || + codec_id == AV_CODEC_ID_PCM_S32LE || + codec_id == AV_CODEC_ID_PCM_F32LE || + codec_id == AV_CODEC_ID_PCM_F64LE || + codec_id == AV_CODEC_ID_PCM_S24BE || + codec_id == AV_CODEC_ID_PCM_S32BE || + codec_id == AV_CODEC_ID_PCM_F32BE || + codec_id == AV_CODEC_ID_PCM_F64BE; +} + static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc) { @@ -2120,8 +2132,10 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, st->codecpar->sample_rate = ((avio_rb32(pb) >> 16)); // Read QT version 1 fields. In version 0 these do not exist. + // PCM with bitdepth > 16 is only defined by QT version 1. av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom); if (!c->isom || + mov_pcm_gt16(st->codecpar->codec_id) || (compatible_brands && strstr(compatible_brands->value, "qt "))) { if (version == 1) {