yading@10: /* yading@10: * Copyright (c) 2012 Justin Ruggles yading@10: * yading@10: * This file is part of Libav. yading@10: * yading@10: * Libav is free software; you can redistribute it and/or yading@10: * modify it under the terms of the GNU Lesser General Public yading@10: * License as published by the Free Software Foundation; either yading@10: * version 2.1 of the License, or (at your option) any later version. yading@10: * yading@10: * Libav is distributed in the hope that it will be useful, yading@10: * but WITHOUT ANY WARRANTY; without even the implied warranty of yading@10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yading@10: * Lesser General Public License for more details. yading@10: * yading@10: * You should have received a copy of the GNU Lesser General Public yading@10: * License along with Libav; if not, write to the Free Software yading@10: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA yading@10: */ yading@10: yading@10: /** yading@10: * @file yading@10: * Vorbis audio parser yading@10: * yading@10: * Determines the duration for each packet. yading@10: */ yading@10: yading@10: #ifndef AVCODEC_VORBIS_PARSER_H yading@10: #define AVCODEC_VORBIS_PARSER_H yading@10: yading@10: #include "avcodec.h" yading@10: yading@10: typedef struct VorbisParseContext { yading@10: AVCodecContext *avctx; ///< codec context yading@10: int extradata_parsed; ///< we have attempted to parse extradata yading@10: int valid_extradata; ///< extradata is valid, so we can calculate duration yading@10: int blocksize[2]; ///< short and long window sizes yading@10: int previous_blocksize; ///< previous window size yading@10: int mode_blocksize[64]; ///< window size mapping for each mode yading@10: int mode_count; ///< number of modes yading@10: int mode_mask; ///< bitmask used to get the mode in each packet yading@10: int prev_mask; ///< bitmask used to get the previous mode flag in each packet yading@10: } VorbisParseContext; yading@10: yading@10: /** yading@10: * Initialize the Vorbis parser using headers in the extradata. yading@10: * yading@10: * @param avctx codec context yading@10: * @param s Vorbis parser context yading@10: */ yading@10: int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s); yading@10: yading@10: /** yading@10: * Get the duration for a Vorbis packet. yading@10: * yading@10: * avpriv_vorbis_parse_extradata() must have been successfully called prior to yading@10: * this in order for a correct duration to be returned. yading@10: * yading@10: * @param s Vorbis parser context yading@10: * @param buf buffer containing a Vorbis frame yading@10: * @param buf_size size of the buffer yading@10: */ yading@10: int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf, yading@10: int buf_size); yading@10: yading@10: void avpriv_vorbis_parse_reset(VorbisParseContext *s); yading@10: yading@10: #endif /* AVCODEC_VORBIS_PARSER_H */