00001 /* 00002 * AC3 parser prototypes 00003 * Copyright (c) 2003 Fabrice Bellard. 00004 * Copyright (c) 2003 Michael Niedermayer. 00005 * 00006 * This file is part of FFmpeg. 00007 * 00008 * FFmpeg is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * FFmpeg is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with FFmpeg; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef FFMPEG_AC3_PARSER_H 00024 #define FFMPEG_AC3_PARSER_H 00025 00026 #include "ac3.h" 00027 #include "bitstream.h" 00028 00029 typedef enum { 00030 AC3_PARSE_ERROR_SYNC = -1, 00031 AC3_PARSE_ERROR_BSID = -2, 00032 AC3_PARSE_ERROR_SAMPLE_RATE = -3, 00033 AC3_PARSE_ERROR_FRAME_SIZE = -4, 00034 AC3_PARSE_ERROR_FRAME_TYPE = -5, 00035 AC3_PARSE_ERROR_CRC = -6, 00036 } AC3ParseError; 00037 00038 /** 00039 * Parses AC-3 frame header. 00040 * Parses the header up to the lfeon element, which is the first 52 or 54 bits 00041 * depending on the audio coding mode. 00042 * @param gbc[in] BitContext containing the first 54 bits of the frame. 00043 * @param hdr[out] Pointer to struct where header info is written. 00044 * @return Returns 0 on success, -1 if there is a sync word mismatch, 00045 * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate) 00046 * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid. 00047 */ 00048 int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr); 00049 00050 /** 00051 * Parses AC-3 frame header and sets channel_map 00052 * Parses the header up to the lfeon (channel_map in E-AC-3) 00053 * element, which is the first 52, 54 or 104 bits depending 00054 * on the audio coding mode. 00055 * @param gbc[in] BitContext containing the first 54 bits of the frame. 00056 * @param hdr[out] Pointer to struct where header info is written. 00057 * @return value returned by ff_ac3_parse_header 00058 */ 00059 int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr); 00060 00061 #endif /* FFMPEG_AC3_PARSER_H */
1.5.1