yading@10
|
1 /*
|
yading@10
|
2 * Copyright (c) 2012 Justin Ruggles
|
yading@10
|
3 *
|
yading@10
|
4 * This file is part of Libav.
|
yading@10
|
5 *
|
yading@10
|
6 * Libav is free software; you can redistribute it and/or
|
yading@10
|
7 * modify it under the terms of the GNU Lesser General Public
|
yading@10
|
8 * License as published by the Free Software Foundation; either
|
yading@10
|
9 * version 2.1 of the License, or (at your option) any later version.
|
yading@10
|
10 *
|
yading@10
|
11 * Libav is distributed in the hope that it will be useful,
|
yading@10
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@10
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@10
|
14 * Lesser General Public License for more details.
|
yading@10
|
15 *
|
yading@10
|
16 * You should have received a copy of the GNU Lesser General Public
|
yading@10
|
17 * License along with Libav; if not, write to the Free Software
|
yading@10
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@10
|
19 */
|
yading@10
|
20
|
yading@10
|
21 /**
|
yading@10
|
22 * @file
|
yading@10
|
23 * Vorbis audio parser
|
yading@10
|
24 *
|
yading@10
|
25 * Determines the duration for each packet.
|
yading@10
|
26 */
|
yading@10
|
27
|
yading@10
|
28 #ifndef AVCODEC_VORBIS_PARSER_H
|
yading@10
|
29 #define AVCODEC_VORBIS_PARSER_H
|
yading@10
|
30
|
yading@10
|
31 #include "avcodec.h"
|
yading@10
|
32
|
yading@10
|
33 typedef struct VorbisParseContext {
|
yading@10
|
34 AVCodecContext *avctx; ///< codec context
|
yading@10
|
35 int extradata_parsed; ///< we have attempted to parse extradata
|
yading@10
|
36 int valid_extradata; ///< extradata is valid, so we can calculate duration
|
yading@10
|
37 int blocksize[2]; ///< short and long window sizes
|
yading@10
|
38 int previous_blocksize; ///< previous window size
|
yading@10
|
39 int mode_blocksize[64]; ///< window size mapping for each mode
|
yading@10
|
40 int mode_count; ///< number of modes
|
yading@10
|
41 int mode_mask; ///< bitmask used to get the mode in each packet
|
yading@10
|
42 int prev_mask; ///< bitmask used to get the previous mode flag in each packet
|
yading@10
|
43 } VorbisParseContext;
|
yading@10
|
44
|
yading@10
|
45 /**
|
yading@10
|
46 * Initialize the Vorbis parser using headers in the extradata.
|
yading@10
|
47 *
|
yading@10
|
48 * @param avctx codec context
|
yading@10
|
49 * @param s Vorbis parser context
|
yading@10
|
50 */
|
yading@10
|
51 int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s);
|
yading@10
|
52
|
yading@10
|
53 /**
|
yading@10
|
54 * Get the duration for a Vorbis packet.
|
yading@10
|
55 *
|
yading@10
|
56 * avpriv_vorbis_parse_extradata() must have been successfully called prior to
|
yading@10
|
57 * this in order for a correct duration to be returned.
|
yading@10
|
58 *
|
yading@10
|
59 * @param s Vorbis parser context
|
yading@10
|
60 * @param buf buffer containing a Vorbis frame
|
yading@10
|
61 * @param buf_size size of the buffer
|
yading@10
|
62 */
|
yading@10
|
63 int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
|
yading@10
|
64 int buf_size);
|
yading@10
|
65
|
yading@10
|
66 void avpriv_vorbis_parse_reset(VorbisParseContext *s);
|
yading@10
|
67
|
yading@10
|
68 #endif /* AVCODEC_VORBIS_PARSER_H */
|