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 A0C5249439 for ; Sat, 11 May 2024 13:44:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E26E668D476; Sat, 11 May 2024 16:44:25 +0300 (EEST) Received: from b-painless.mh.aa.net.uk (b-painless.mh.aa.net.uk [81.187.30.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4B4B868D2A5 for ; Sat, 11 May 2024 16:44:19 +0300 (EEST) Received: from 7.5.0.5.5.a.f.3.4.1.7.9.3.6.9.9.0.5.8.0.9.1.8.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:819:850:9963:9714:3fa5:5057] helo=andrews-2024-laptop.sayers) by painless-b.tch.aa.net.uk with smtp (Exim 4.96) (envelope-from ) id 1s5n1O-008s90-2R for ffmpeg-devel@ffmpeg.org; Sat, 11 May 2024 14:44:18 +0100 Date: Sat, 11 May 2024 14:44:11 +0100 From: Andrew Sayers To: FFmpeg development discussions and patches Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 2/4] avcodec/aac_ac3_parser: Untangle AAC and AC3 parsing error codes 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 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: On Fri, May 10, 2024 at 06:56:25PM +0200, Andreas Rheinhardt wrote: > Also remove the (unused) AAC_AC3_PARSE_ERROR_CHANNEL_CFG while at it; > furthermore, fix the documentation of ff_ac3_parse_header() > and (ff|avpriv)_adts_header_parse(). > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/aac_ac3_parser.h | 10 ---------- > libavcodec/ac3_parser.c | 14 +++++++------- > libavcodec/ac3_parser_internal.h | 13 ++++++++++--- > libavcodec/ac3dec.c | 18 ++++++++---------- > libavcodec/adts_header.c | 7 +++---- > libavcodec/adts_header.h | 16 ++++++++++------ > libavcodec/eac3dec.c | 6 +++--- > 7 files changed, 41 insertions(+), 43 deletions(-) > > diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h > index bc16181a19..e3259d1841 100644 > --- a/libavcodec/aac_ac3_parser.h > +++ b/libavcodec/aac_ac3_parser.h > @@ -28,16 +28,6 @@ > #include "avcodec.h" > #include "parser.h" > > -typedef enum { > - AAC_AC3_PARSE_ERROR_SYNC = -0x1030c0a, > - AAC_AC3_PARSE_ERROR_BSID = -0x2030c0a, > - AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a, > - AAC_AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a, > - AAC_AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a, > - AAC_AC3_PARSE_ERROR_CRC = -0x6030c0a, > - AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -0x7030c0a, > -} AACAC3ParseError; > - > typedef struct AACAC3ParseContext { > ParseContext pc; > int header_size; > diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c > index 4e0ba73481..69989690dd 100644 > --- a/libavcodec/ac3_parser.c > +++ b/libavcodec/ac3_parser.c > @@ -81,12 +81,12 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) > > hdr->sync_word = get_bits(gbc, 16); > if(hdr->sync_word != 0x0B77) > - return AAC_AC3_PARSE_ERROR_SYNC; > + return AC3_PARSE_ERROR_SYNC; > > /* read ahead to bsid to distinguish between AC-3 and E-AC-3 */ > hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F; > if(hdr->bitstream_id > 16) > - return AAC_AC3_PARSE_ERROR_BSID; > + return AC3_PARSE_ERROR_BSID; > > hdr->num_blocks = 6; > hdr->ac3_bit_rate_code = -1; > @@ -103,11 +103,11 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) > hdr->crc1 = get_bits(gbc, 16); > hdr->sr_code = get_bits(gbc, 2); > if(hdr->sr_code == 3) > - return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; > + return AC3_PARSE_ERROR_SAMPLE_RATE; > > frame_size_code = get_bits(gbc, 6); > if(frame_size_code > 37) > - return AAC_AC3_PARSE_ERROR_FRAME_SIZE; > + return AC3_PARSE_ERROR_FRAME_SIZE; > > hdr->ac3_bit_rate_code = (frame_size_code >> 1); > > @@ -138,19 +138,19 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) > hdr->crc1 = 0; > hdr->frame_type = get_bits(gbc, 2); > if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED) > - return AAC_AC3_PARSE_ERROR_FRAME_TYPE; > + return AC3_PARSE_ERROR_FRAME_TYPE; > > hdr->substreamid = get_bits(gbc, 3); > > hdr->frame_size = (get_bits(gbc, 11) + 1) << 1; > if(hdr->frame_size < AC3_HEADER_SIZE) > - return AAC_AC3_PARSE_ERROR_FRAME_SIZE; > + return AC3_PARSE_ERROR_FRAME_SIZE; > > hdr->sr_code = get_bits(gbc, 2); > if (hdr->sr_code == 3) { > int sr_code2 = get_bits(gbc, 2); > if(sr_code2 == 3) > - return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; > + return AC3_PARSE_ERROR_SAMPLE_RATE; > hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2; > hdr->sr_shift = 1; > } else { > diff --git a/libavcodec/ac3_parser_internal.h b/libavcodec/ac3_parser_internal.h > index 2ac0e67ec2..2c4eb546e5 100644 > --- a/libavcodec/ac3_parser_internal.h > +++ b/libavcodec/ac3_parser_internal.h > @@ -64,15 +64,22 @@ typedef struct AC3HeaderInfo { > /** @} */ > } AC3HeaderInfo; > > +typedef enum { > + AC3_PARSE_ERROR_SYNC = -0x1030c0a, > + AC3_PARSE_ERROR_BSID = -0x2030c0a, > + AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a, > + AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a, > + AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a, > + AC3_PARSE_ERROR_CRC = -0x6030c0a, > +} AC3ParseError; > + > /** > * Parse AC-3 frame header. > * Parse the header up to the lfeon element, which is the first 52 or 54 bits > * depending on the audio coding mode. > * @param[in] gbc BitContext containing the first 54 bits of the frame. > * @param[out] hdr Pointer to struct where header info is written. > - * @return Returns 0 on success, -1 if there is a sync word mismatch, > - * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate) > - * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid. > + * @return Returns 0 on success and AC3_PARSE_ERROR_* values otherwise. "@return Returns" is redundant - can this (and similar below) just be "@return 0 on success ..."? _______________________________________________ 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".