#ifndef WH_AAC_AC3_PARSER_H_d41c8c70_ #define WH_AAC_AC3_PARSER_H_d41c8c70_ /* * This file was stolen from ffmpeg and modified for usability here. * The original is * * Copyright (c) 2003 Fabrice Bellard * Copyright (c) 2003 Michael Niedermayer * * This version is a derivative work of that version. It is not free * software; it is licensed under the GNU Lesser General Public * License version 2.1, which places nontrivial restrictions on what * may be done with it. (I'm not terribly happy about that, but for * my purposes accepting LGPL-infected code is a lower price than * reimplementing it all myself.) * * The LGPL v2.1 as distributed with ffmpeg is in the accompanying file * `LGPL-v2.1'. */ #include #include "parser.h" typedef enum { AAC_AC3_PARSE_ERROR_SYNC = -1, AAC_AC3_PARSE_ERROR_BSID = -2, AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3, AAC_AC3_PARSE_ERROR_FRAME_SIZE = -4, AAC_AC3_PARSE_ERROR_FRAME_TYPE = -5, AAC_AC3_PARSE_ERROR_CRC = -6, AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7, } AACAC3ParseError; typedef struct AACAC3ParseContext { ParseContext pc; int frame_size; int header_size; int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start); int channels; int sample_rate; int bit_rate; int samples; uint64_t channel_layout; int service_type; int remaining_size; uint64_t state; int need_next_header; enum CodecID codec_id; } AACAC3ParseContext; int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size); #endif