From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 041ED49FA8 for ; Sun, 17 Mar 2024 19:57:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D3B868D1A6; Sun, 17 Mar 2024 21:57:40 +0200 (EET) 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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; } -- 2.35.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".