summaryrefslogtreecommitdiffstats
path: root/libavcodec/vorbis_parser.h
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2012-03-04 02:03:25 +0100
committerMichael Niedermayer <[email protected]>2012-03-04 04:26:04 +0100
commit15c6be8c7da7b94b5e131396e9a82ab6fe4a6b64 (patch)
tree84db7f4851faba26561f846b4f112ef64d01b3ad /libavcodec/vorbis_parser.h
parentf972193a15026a99eb2b08e7913a03f2123663da (diff)
parentb7beabab4b78cc253d06c0a33f15b8ff79866e85 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: tiertexseq: set correct block_align for audio tiertexseq: set audio stream start time to 0 voc/avs: Do not change the sample rate mid-stream. segafilm: use the sample rate as the time base for audio streams ea: fix audio pts psx-str: fix audio pts vqf: set packet duration tta demuxer: set packet duration mpegaudio_parser: do not ignore information from the first parsed frame mpegaudio_parser: be less picky about the start position thp: set audio packet durations avcodec: add a Vorbis parser to get packet duration vorbisdec: read the previous window flag for long windows lavc: free the output packet when encoding failed or produced no output. lavc: preserve avpkt->destruct in ff_alloc_packet(). lavc: clarify the meaning of AVCodecContext.frame_number. mpegts: Pad the packet buffer in handle_packet(). mpegts: Do not call read_sl_header() when no bytes remain in the buffer. Conflicts: libavcodec/mpegaudio_parser.c libavcodec/version.h libavformat/mpegts.c tests/ref/fate/pva-demux Merged-by: Michael Niedermayer <[email protected]>
Diffstat (limited to 'libavcodec/vorbis_parser.h')
-rw-r--r--libavcodec/vorbis_parser.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/libavcodec/vorbis_parser.h b/libavcodec/vorbis_parser.h
new file mode 100644
index 0000000000..480a918f7b
--- /dev/null
+++ b/libavcodec/vorbis_parser.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Vorbis audio parser
+ *
+ * Determines the duration for each packet.
+ */
+
+#ifndef AVCODEC_VORBIS_PARSER_H
+#define AVCODEC_VORBIS_PARSER_H
+
+#include "avcodec.h"
+
+typedef struct VorbisParseContext {
+ AVCodecContext *avctx; ///< codec context
+ int extradata_parsed; ///< we have attempted to parse extradata
+ int valid_extradata; ///< extradata is valid, so we can calculate duration
+ int blocksize[2]; ///< short and long window sizes
+ int previous_blocksize; ///< previous window size
+ int mode_blocksize[64]; ///< window size mapping for each mode
+ int mode_count; ///< number of modes
+ int mode_mask; ///< bitmask used to get the mode in each packet
+ int prev_mask; ///< bitmask used to get the previous mode flag in each packet
+} VorbisParseContext;
+
+/**
+ * Initialize the Vorbis parser using headers in the extradata.
+ *
+ * @param avctx codec context
+ * @param s Vorbis parser context
+ */
+int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s);
+
+/**
+ * Get the duration for a Vorbis packet.
+ *
+ * avpriv_vorbis_parse_extradata() must have been successfully called prior to
+ * this in order for a correct duration to be returned.
+ *
+ * @param s Vorbis parser context
+ * @param buf buffer containing a Vorbis frame
+ * @param buf_size size of the buffer
+ */
+int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
+ int buf_size);
+
+void avpriv_vorbis_parse_reset(VorbisParseContext *s);
+
+#endif /* AVCODEC_VORBIS_PARSER_H */