From patchwork Sun Mar 17 19:57:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 47128 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:958e:b0:1a3:31a3:7958 with SMTP id iu14csp654760pzb; Sun, 17 Mar 2024 12:57:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWAQ2Fz8zsSXED9rVOb1u9E3EplkGw4LqRTJtnDQZDZCir77FSo4Fief/XOpX5hDK0GAuFlTTWN4WVp8bZPQxBkRF0pBt4ioBEd3w== X-Google-Smtp-Source: AGHT+IH3SFObmOhWR1ivfWfDLxfg0gJM4adPL92sLr8DlXE0poHzKtegJae63zJKp2UXAll2h0US X-Received: by 2002:a2e:9396:0:b0:2d2:e784:abc2 with SMTP id g22-20020a2e9396000000b002d2e784abc2mr8106208ljh.33.1710705462894; Sun, 17 Mar 2024 12:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710705462; cv=none; d=google.com; s=arc-20160816; b=xTBLST1ANAgW3c4ZsE4G9tqLy6m5OnixhSIGoswhrVYJtwVWBdO/hPm3FSiwiRP26d nA2Ex+DaoLGcd0q4MfysCtIwMW3p3/Bo9VZEvoLL8Zws7/f59gHRC1mziea8MAC4eZv4 R+9sjHazBww1nTRH7SszD2uX0uS8cuuNlsUkKWdloKzEf/nO0JIqaWY1145y0sS+Tknf eqEBaSP9pFwl09oMkGVZdCE/37eEOAQfJxnP5SCfzppT6R+g8+T+7jaqI1AM1fOqHp+v ol98l2s1Vjv0DgOYDsofC8GZ1qKNZUgKe4Ci61vj20zhL50YBzPfdoTvgzBW3DscYkfT vqig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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; bh=6qc972YAUZqJ9K+K2PQR0yNnVUL1bVfXJDlF1LL9sFQ=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=RHLVkduPHqXYWJgF/ZCbMgQ0oPYiV5yxsjyVHKa7vQQAE9lNpJBu52w1ExhlWYN1qX pG+tSMdbju38XRNT3qUGZYtxtZ0aiK//aFCAOOBmwuhvGsu8LZt8SJak0YLyVVQHwXje 0Ldtp0DV2JeUppCL3CMZcjwkdJFBYgBV+9ZekJlgF7SoxIDEiX9BvKtJiu00edwhAnAG qxiGU+fPKWDwHt5JlKKf/HUEocp8BuUJYeJH9B0SWCupthqq7uAXrYTVV0hd7itXRUiM iWL8OzrBUDeREI3/2Co0EmiaKTw4K71RxXHzqOhDNi3YdDsio30zVdupMtvy2hpIH8Ec suMQ==; dara=google.com 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 em2-20020a056402364200b00568a2f5d5fesi3382286edb.182.2024.03.17.12.57.42; Sun, 17 Mar 2024 12:57:42 -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 5442E68D1AC; Sun, 17 Mar 2024 21:57:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C2F1F68D0C5 for ; Sun, 17 Mar 2024 21:57:33 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 8F379E9A28; Sun, 17 Mar 2024 20:57:33 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id brxOco_5w6Ll; Sun, 17 Mar 2024 20:57:31 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id AE1C1E9A22; Sun, 17 Mar 2024 20:57:31 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 17 Mar 2024 20:57:28 +0100 Message-Id: <20240317195729.11755-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/riff: pass an AVFormatContext explicitly to ff_get_wav_header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zwtiHICHy/tL Will be useful later. --- libavformat/riff.h | 2 +- libavformat/riffdec.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libavformat/riff.h b/libavformat/riff.h index a93eadfeca..719fd7a17d 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -67,7 +67,7 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags); enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps); -int ff_get_wav_header(void *logctx, AVIOContext *pb, AVCodecParameters *par, +int ff_get_wav_header(AVFormatContext *ctx, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian); extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through avformat_get_riff_video_tags() diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c index 0fe4e02b7b..6cc912133c 100644 --- a/libavformat/riffdec.c +++ b/libavformat/riffdec.c @@ -58,7 +58,7 @@ enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid) * an openended structure. */ -static void parse_waveformatex(void *logctx, AVIOContext *pb, AVCodecParameters *par) +static void parse_waveformatex(AVFormatContext *ctx, AVIOContext *pb, AVCodecParameters *par) { ff_asf_guid subformat; int bps; @@ -84,21 +84,21 @@ static void parse_waveformatex(void *logctx, AVIOContext *pb, AVCodecParameters } else { par->codec_id = ff_codec_guid_get_id(ff_codec_wav_guids, subformat); if (!par->codec_id) - av_log(logctx, AV_LOG_WARNING, + av_log(ctx, AV_LOG_WARNING, "unknown subformat:"FF_PRI_GUID"\n", FF_ARG_GUID(subformat)); } } /* "big_endian" values are needed for RIFX file format */ -int ff_get_wav_header(void *logctx, AVIOContext *pb, +int ff_get_wav_header(AVFormatContext *ctx, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian) { int id, channels = 0, ret; uint64_t bitrate = 0; if (size < 14) { - avpriv_request_sample(logctx, "wav header size < 14"); + avpriv_request_sample(ctx, "wav header size < 14"); return AVERROR_INVALIDDATA; } @@ -139,18 +139,18 @@ int ff_get_wav_header(void *logctx, AVIOContext *pb, if (size >= 18 && id != 0x0165) { /* We're obviously dealing with WAVEFORMATEX */ int cbSize = avio_rl16(pb); /* cbSize */ if (big_endian) { - avpriv_report_missing_feature(logctx, "WAVEFORMATEX support for RIFX files"); + avpriv_report_missing_feature(ctx, "WAVEFORMATEX support for RIFX files"); return AVERROR_PATCHWELCOME; } size -= 18; cbSize = FFMIN(size, cbSize); if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ - parse_waveformatex(logctx, pb, par); + parse_waveformatex(ctx, pb, par); cbSize -= 22; size -= 22; } if (cbSize > 0) { - ret = ff_get_extradata(logctx, par, pb, cbSize); + ret = ff_get_extradata(ctx, par, pb, cbSize); if (ret < 0) return ret; size -= cbSize; @@ -163,7 +163,7 @@ int ff_get_wav_header(void *logctx, AVIOContext *pb, int nb_streams, i; size -= 4; - ret = ff_get_extradata(logctx, par, pb, size); + ret = ff_get_extradata(ctx, par, pb, size); if (ret < 0) return ret; nb_streams = AV_RL16(par->extradata + 4); @@ -179,7 +179,7 @@ int ff_get_wav_header(void *logctx, AVIOContext *pb, par->bit_rate = bitrate; if (par->sample_rate <= 0) { - av_log(logctx, AV_LOG_ERROR, + av_log(ctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", par->sample_rate); return AVERROR_INVALIDDATA; }