From patchwork Wed Jul 8 12:55:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zane van Iperen X-Patchwork-Id: 20876 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 241A344BC45 for ; Wed, 8 Jul 2020 15:55:11 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 09DBA68AFE6; Wed, 8 Jul 2020 15:55:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 684F268AD85 for ; Wed, 8 Jul 2020 15:55:04 +0300 (EEST) Date: Wed, 08 Jul 2020 12:55:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=protonmail; t=1594212903; bh=9nyvW2BSPiHRlhmqWZBH1r++i3CX685VfeyZBbN3J1Q=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=YzRM0s3rPC1JT4G6j5c7hqItiD/Yc3v2X/FxK7GFgAYyj5GKqQ5lqjra0GBwQZqSj E6cIwxsTC668eoFjaH9h3Kj5t1TevmjFd732lN7pntPQ5/U0oy0O6Bqvz2Ud8Fqhco IdMIM6vY/yEhrdQ7+U9//MFmvae5Hxv2dHkn+Cc8= To: ffmpeg-devel@ffmpeg.org From: Zane van Iperen Message-ID: <20200708125433.238118-3-zane@zanevaniperen.com> In-Reply-To: <20200708125433.238118-1-zane@zanevaniperen.com> References: <20200708125433.238118-1-zane@zanevaniperen.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mail.protonmail.ch Subject: [FFmpeg-devel] [PATCH v6 2/7] avformat/apm: use the entire APMState structure as extradata 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 Cc: Zane van Iperen Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Is the "actual" codec extradata instead of the hand-crafted one from the previous revision. Signed-off-by: Zane van Iperen --- libavformat/apm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libavformat/apm.c b/libavformat/apm.c index 4158b81457..8d655d0a33 100644 --- a/libavformat/apm.c +++ b/libavformat/apm.c @@ -26,6 +26,7 @@ #define APM_FILE_HEADER_SIZE 18 #define APM_FILE_EXTRADATA_SIZE 80 +#define APM_EXTRADATA_SIZE 28 #define APM_MAX_READ_SIZE 4096 @@ -160,13 +161,11 @@ static int apm_read_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } - if ((ret = ff_alloc_extradata(st->codecpar, 16)) < 0) + if ((ret = ff_alloc_extradata(st->codecpar, APM_EXTRADATA_SIZE)) < 0) return ret; - AV_WL32(st->codecpar->extradata + 0, vs12.state.predictor_l); - AV_WL32(st->codecpar->extradata + 4, vs12.state.step_index_l); - AV_WL32(st->codecpar->extradata + 8, vs12.state.predictor_r); - AV_WL32(st->codecpar->extradata + 12, vs12.state.step_index_r); + /* Use the entire state as extradata. */ + memcpy(st->codecpar->extradata, buf + 20, APM_EXTRADATA_SIZE); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); st->start_time = 0;