* commit '5e80fb7ff226f136dbcf3fed00a2966bf8e9bd70': lavc: add a public API for parsing vorbis packets. Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/version.h libavcodec/vorbis_parser.c
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2014-08-09 · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | API changes, most recent first: | 16 | API changes, most recent first: |
| 17 | 17 | ||
| 18 | 2014-11-xx - xxxxxxx - lavc 56.6.0 - vorbis_parser.h | ||
| 19 | Add a public API for parsing vorbis packets. | ||
| 20 | |||
| 18 | 2014-10-xx - xxxxxxx - lavc 56.5.0 - avcodec.h | 21 | 2014-10-xx - xxxxxxx - lavc 56.5.0 - avcodec.h |
| 19 | Replace AVCodecContext.time_base used for decoding | 22 | Replace AVCodecContext.time_base used for decoding |
| 20 | with AVCodecContext.framerate. | 23 | with AVCodecContext.framerate. |
| @@ -11,6 +11,7 @@ HEADERS = avcodec.h \ · 10 unmodified lines | |||
| 11 | vda.h \ | 11 | vda.h \ |
| 12 | vdpau.h \ | 12 | vdpau.h \ |
| 13 | version.h \ | 13 | version.h \ |
| 14 | vorbis_parser.h \ | ||
| 14 | xvmc.h \ | 15 | xvmc.h \ |
| 15 | 16 | ||
| 16 | OBJS = allcodecs.o \ | 17 | OBJS = allcodecs.o \ |
| @@ -31,6 +32,7 @@ OBJS = allcodecs.o \ · 14 unmodified lines | |||
| 31 | resample.o \ | 32 | resample.o \ |
| 32 | resample2.o \ | 33 | resample2.o \ |
| 33 | utils.o \ | 34 | utils.o \ |
| 35 | vorbis_parser.o \ | ||
| 34 | 36 | ||
| 35 | # subsystems | 37 | # subsystems |
| 36 | OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o | 38 | OBJS-$(CONFIG_AANDCTTABLES) += aandcttab.o |
| @@ -677,7 +679,7 @@ OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o · 640 unmodified lines | |||
| 677 | OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \ | 679 | OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \ |
| 678 | ac3tab.o | 680 | ac3tab.o |
| 679 | OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o vorbis_data.o \ | 681 | OBJS-$(CONFIG_FLAC_DEMUXER) += flac.o flacdata.o vorbis_data.o \ |
| 680 | vorbis_parser.o xiph.o | 682 | xiph.o |
| 681 | OBJS-$(CONFIG_FLAC_MUXER) += flac.o flacdata.o vorbis_data.o | 683 | OBJS-$(CONFIG_FLAC_MUXER) += flac.o flacdata.o vorbis_data.o |
| 682 | OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o | 684 | OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o |
| 683 | OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o | 685 | OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o |
| @@ -687,7 +689,7 @@ OBJS-$(CONFIG_LATM_MUXER) += mpeg4audio.o · 3 unmodified lines | |||
| 687 | OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o vorbis_data.o \ | 689 | OBJS-$(CONFIG_MATROSKA_AUDIO_MUXER) += xiph.o mpeg4audio.o vorbis_data.o \ |
| 688 | flac.o flacdata.o | 690 | flac.o flacdata.o |
| 689 | OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o \ | 691 | OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o \ |
| 690 | vorbis_parser.o xiph.o | 692 | xiph.o |
| 691 | OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o mpegaudiodata.o \ | 693 | OBJS-$(CONFIG_MATROSKA_MUXER) += mpeg4audio.o mpegaudiodata.o \ |
| 692 | flac.o flacdata.o vorbis_data.o xiph.o | 694 | flac.o flacdata.o vorbis_data.o xiph.o |
| 693 | OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o | 695 | OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o |
| @@ -700,7 +702,7 @@ OBJS-$(CONFIG_MXF_MUXER) += dnxhddata.o · 6 unmodified lines | |||
| 700 | OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o | 702 | OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o |
| 701 | OBJS-$(CONFIG_OGA_MUXER) += xiph.o flac.o flacdata.o | 703 | OBJS-$(CONFIG_OGA_MUXER) += xiph.o flac.o flacdata.o |
| 702 | OBJS-$(CONFIG_OGG_DEMUXER) += xiph.o flac.o flacdata.o \ | 704 | OBJS-$(CONFIG_OGG_DEMUXER) += xiph.o flac.o flacdata.o \ |
| 703 | mpeg12data.o vorbis_parser.o \ | 705 | mpeg12data.o \ |
| 704 | dirac.o vorbis_data.o | 706 | dirac.o vorbis_data.o |
| 705 | OBJS-$(CONFIG_OGG_MUXER) += xiph.o flac.o flacdata.o \ | 707 | OBJS-$(CONFIG_OGG_MUXER) += xiph.o flac.o flacdata.o \ |
| 706 | vorbis_data.o | 708 | vorbis_data.o |
| @@ -712,7 +714,7 @@ OBJS-$(CONFIG_TAK_DEMUXER) += tak.o · 5 unmodified lines | |||
| 712 | OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o mpegaudiodata.o \ | 714 | OBJS-$(CONFIG_WEBM_MUXER) += mpeg4audio.o mpegaudiodata.o \ |
| 713 | xiph.o flac.o flacdata.o \ | 715 | xiph.o flac.o flacdata.o \ |
| 714 | vorbis_data.o | 716 | vorbis_data.o |
| 715 | OBJS-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += vorbis_parser.o xiph.o | 717 | OBJS-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += xiph.o |
| 716 | OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o | 718 | OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o |
| 717 | 719 | ||
| 718 | # libavfilter dependencies | 720 | # libavfilter dependencies |
| @@ -756,7 +758,7 @@ OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o · 37 unmodified lines | |||
| 756 | OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o | 758 | OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o |
| 757 | OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o | 759 | OBJS-$(CONFIG_LIBVORBIS_DECODER) += libvorbisdec.o |
| 758 | OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \ | 760 | OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbisenc.o \ |
| 759 | vorbis_data.o vorbis_parser.o xiph.o | 761 | vorbis_data.o xiph.o |
| 760 | OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o | 762 | OBJS-$(CONFIG_LIBVPX_VP8_DECODER) += libvpxdec.o |
| 761 | OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o | 763 | OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o |
| 762 | OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o | 764 | OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o |
| @@ -812,7 +814,7 @@ OBJS-$(CONFIG_TAK_PARSER) += tak_parser.o tak.o · 49 unmodified lines | |||
| 812 | OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o vc1dsp.o \ | 814 | OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o vc1dsp.o \ |
| 813 | msmpeg4.o msmpeg4data.o mpeg4video.o \ | 815 | msmpeg4.o msmpeg4data.o mpeg4video.o \ |
| 814 | h263.o | 816 | h263.o |
| 815 | OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o | 817 | OBJS-$(CONFIG_VORBIS_PARSER) += xiph.o |
| 816 | OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o | 818 | OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o |
| 817 | OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o | 819 | OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o |
| 818 | OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o | 820 | OBJS-$(CONFIG_VP9_PARSER) += vp9_parser.o |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | #include "audio_frame_queue.h" | 27 | #include "audio_frame_queue.h" |
| 28 | #include "internal.h" | 28 | #include "internal.h" |
| 29 | #include "vorbis.h" | 29 | #include "vorbis.h" |
| 30 | #include "vorbis_parser.h" | 30 | #include "vorbis_parser_internal.h" |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | /* Number of samples the user should send in each call. | 33 | /* Number of samples the user should send in each call. |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | |||
| 29 | #include "libavutil/version.h" | 29 | #include "libavutil/version.h" |
| 30 | 30 | ||
| 31 | #define LIBAVCODEC_VERSION_MAJOR 56 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | #define LIBAVCODEC_VERSION_MINOR 10 | 32 | #define LIBAVCODEC_VERSION_MINOR 11 |
| 33 | #define LIBAVCODEC_VERSION_MICRO 102 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | ||
| 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| 36 | LIBAVCODEC_VERSION_MINOR, \ | 36 | LIBAVCODEC_VERSION_MINOR, \ |
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "get_bits.h" | 30 | #include "get_bits.h" |
| 31 | #include "parser.h" | 31 | #include "parser.h" |
| 32 | #include "xiph.h" | 32 | #include "xiph.h" |
| 33 | #include "vorbis_parser.h" | 33 | #include "vorbis_parser_internal.h" |
| 34 | 34 | ||
| 35 | static const AVClass vorbis_parser_class = { | 35 | static const AVClass vorbis_parser_class = { |
| 36 | .class_name = "Vorbis parser", | 36 | .class_name = "Vorbis parser", |
| @@ -181,7 +181,8 @@ bad_header: · 144 unmodified lines | |||
| 181 | return ret; | 181 | return ret; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, AVVorbisParseContext *s) | 184 | static int vorbis_parse_init(AVVorbisParseContext *s, |
| 185 | const uint8_t *extradata, int extradata_size) | ||
| 185 | { | 186 | { |
| 186 | uint8_t *header_start[3]; | 187 | uint8_t *header_start[3]; |
| 187 | int header_len[3]; | 188 | int header_len[3]; |
| @@ -190,8 +191,8 @@ int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, AVVorbisParseContext *s · 2 unmodified lines | |||
| 190 | s->class = &vorbis_parser_class; | 191 | s->class = &vorbis_parser_class; |
| 191 | s->extradata_parsed = 1; | 192 | s->extradata_parsed = 1; |
| 192 | 193 | ||
| 193 | if ((ret = avpriv_split_xiph_headers(avctx->extradata, | 194 | if ((ret = avpriv_split_xiph_headers(extradata, |
| 194 | avctx->extradata_size, 30, | 195 | extradata_size, 30, |
| 195 | header_start, header_len)) < 0) { | 196 | header_start, header_len)) < 0) { |
| 196 | av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n"); | 197 | av_log(s, AV_LOG_ERROR, "Extradata corrupt.\n"); |
| 197 | return ret; | 198 | return ret; |
| @@ -258,18 +259,57 @@ bad_packet: · 60 unmodified lines | |||
| 258 | return duration; | 259 | return duration; |
| 259 | } | 260 | } |
| 260 | 261 | ||
| 261 | int avpriv_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, | 262 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, |
| 262 | int buf_size) | 263 | int buf_size) |
| 263 | { | 264 | { |
| 264 | return avpriv_vorbis_parse_frame_flags(s, buf, buf_size, NULL); | 265 | return avpriv_vorbis_parse_frame_flags(s, buf, buf_size, NULL); |
| 265 | } | 266 | } |
| 266 | 267 | ||
| 267 | void avpriv_vorbis_parse_reset(AVVorbisParseContext *s) | 268 | void av_vorbis_parse_reset(AVVorbisParseContext *s) |
| 268 | { | 269 | { |
| 269 | if (s->valid_extradata) | 270 | if (s->valid_extradata) |
| 270 | s->previous_blocksize = s->blocksize[0]; | 271 | s->previous_blocksize = s->blocksize[0]; |
| 271 | } | 272 | } |
| 272 | 273 | ||
| 274 | void av_vorbis_parse_free(AVVorbisParseContext **s) | ||
| 275 | { | ||
| 276 | av_freep(s); | ||
| 277 | } | ||
| 278 | |||
| 279 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, | ||
| 280 | int extradata_size) | ||
| 281 | { | ||
| 282 | AVVorbisParseContext *s = av_mallocz(sizeof(*s)); | ||
| 283 | int ret; | ||
| 284 | |||
| 285 | if (!s) | ||
| 286 | return NULL; | ||
| 287 | |||
| 288 | ret = vorbis_parse_init(s, extradata, extradata_size); | ||
| 289 | if (ret < 0) { | ||
| 290 | av_vorbis_parse_free(&s); | ||
| 291 | return NULL; | ||
| 292 | } | ||
| 293 | |||
| 294 | return s; | ||
| 295 | } | ||
| 296 | |||
| 297 | #if LIBAVCODEC_VERSION_MAJOR < 57 | ||
| 298 | int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, AVVorbisParseContext *s) | ||
| 299 | { | ||
| 300 | return vorbis_parse_init(s, avctx->extradata, avctx->extradata_size); | ||
| 301 | } | ||
| 302 | void avpriv_vorbis_parse_reset(AVVorbisParseContext *s) | ||
| 303 | { | ||
| 304 | av_vorbis_parse_reset(s); | ||
| 305 | } | ||
| 306 | int avpriv_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, | ||
| 307 | int buf_size) | ||
| 308 | { | ||
| 309 | return av_vorbis_parse_frame(s, buf, buf_size); | ||
| 310 | } | ||
| 311 | #endif | ||
| 312 | |||
| 273 | #if CONFIG_VORBIS_PARSER | 313 | #if CONFIG_VORBIS_PARSER |
| 274 | static int vorbis_parse(AVCodecParserContext *s1, AVCodecContext *avctx, | 314 | static int vorbis_parse(AVCodecParserContext *s1, AVCodecContext *avctx, |
| 275 | const uint8_t **poutbuf, int *poutbuf_size, | 315 | const uint8_t **poutbuf, int *poutbuf_size, |
| @@ -1,5 +1,4 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2012 Justin Ruggles | ||
| 3 | * | 2 | * |
| 4 | * This file is part of FFmpeg. | 3 | * This file is part of FFmpeg. |
| 5 | * | 4 | * |
| @@ -20,35 +19,29 @@ · 14 unmodified lines | |||
| 20 | 19 | ||
| 21 | /** | 20 | /** |
| 22 | * @file | 21 | * @file |
| 23 | * Vorbis audio parser | 22 | * A public API for Vorbis parsing |
| 24 | * | 23 | * |
| 25 | * Determines the duration for each packet. | 24 | * Determines the duration for each packet. |
| 26 | */ | 25 | */ |
| 27 | 26 | ||
| 28 | #ifndef AVCODEC_VORBIS_PARSER_H | 27 | #ifndef AVCODEC_VORBIS_PARSE_H |
| 29 | #define AVCODEC_VORBIS_PARSER_H | 28 | #define AVCODEC_VORBIS_PARSE_H |
| 30 | 29 | ||
| 31 | #include "avcodec.h" | 30 | typedef struct AVVorbisParseContext AVVorbisParseContext; |
| 32 | |||
| 33 | typedef struct AVVorbisParseContext { | ||
| 34 | const AVClass *class; | ||
| 35 | int extradata_parsed; ///< we have attempted to parse extradata | ||
| 36 | int valid_extradata; ///< extradata is valid, so we can calculate duration | ||
| 37 | int blocksize[2]; ///< short and long window sizes | ||
| 38 | int previous_blocksize; ///< previous window size | ||
| 39 | int mode_blocksize[64]; ///< window size mapping for each mode | ||
| 40 | int mode_count; ///< number of modes | ||
| 41 | int mode_mask; ///< bitmask used to get the mode in each packet | ||
| 42 | int prev_mask; ///< bitmask used to get the previous mode flag in each packet | ||
| 43 | } AVVorbisParseContext; | ||
| 44 | 31 | ||
| 45 | /** | 32 | /** |
| 46 | * Initialize the Vorbis parser using headers in the extradata. | 33 | * Allocate and initialize the Vorbis parser using headers in the extradata. |
| 47 | * | 34 | * |
| 48 | * @param avctx codec context | 35 | * @param avctx codec context |
| 49 | * @param s Vorbis parser context | 36 | * @param s Vorbis parser context |
| 50 | */ | 37 | */ |
| 51 | int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, AVVorbisParseContext *s); | 38 | AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, |
| 39 | int extradata_size); | ||
| 40 | |||
| 41 | /** | ||
| 42 | * Free the parser and everything associated with it. | ||
| 43 | */ | ||
| 44 | void av_vorbis_parse_free(AVVorbisParseContext **s); | ||
| 52 | 45 | ||
| 53 | #define VORBIS_FLAG_HEADER 0x00000001 | 46 | #define VORBIS_FLAG_HEADER 0x00000001 |
| 54 | #define VORBIS_FLAG_COMMENT 0x00000002 | 47 | #define VORBIS_FLAG_COMMENT 0x00000002 |
| @@ -71,16 +64,13 @@ int avpriv_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, · 16 unmodified lines | |||
| 71 | /** | 64 | /** |
| 72 | * Get the duration for a Vorbis packet. | 65 | * Get the duration for a Vorbis packet. |
| 73 | * | 66 | * |
| 74 | * avpriv_vorbis_parse_extradata() must have been successfully called prior to | ||
| 75 | * this in order for a correct duration to be returned. | ||
| 76 | * | ||
| 77 | * @param s Vorbis parser context | 67 | * @param s Vorbis parser context |
| 78 | * @param buf buffer containing a Vorbis frame | 68 | * @param buf buffer containing a Vorbis frame |
| 79 | * @param buf_size size of the buffer | 69 | * @param buf_size size of the buffer |
| 80 | */ | 70 | */ |
| 81 | int avpriv_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, | 71 | int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, |
| 82 | int buf_size); | 72 | int buf_size); |
| 83 | 73 | ||
| 84 | void avpriv_vorbis_parse_reset(AVVorbisParseContext *s); | 74 | void av_vorbis_parse_reset(AVVorbisParseContext *s); |
| 85 | 75 | ||
| 86 | #endif /* AVCODEC_VORBIS_PARSER_H */ | 76 | #endif /* AVCODEC_VORBIS_PARSE_H */ |
| @@ -0,0 +1,71 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2012 Justin Ruggles | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @file | ||
| 23 | * Vorbis audio parser | ||
| 24 | * | ||
| 25 | * Determines the duration for each packet. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #ifndef AVCODEC_VORBIS_PARSER_H | ||
| 29 | #define AVCODEC_VORBIS_PARSER_H | ||
| 30 | |||
| 31 | #include "avcodec.h" | ||
| 32 | #include "vorbis_parser.h" | ||
| 33 | |||
| 34 | struct AVVorbisParseContext { | ||
| 35 | const AVClass *class; | ||
| 36 | int extradata_parsed; ///< we have attempted to parse extradata | ||
| 37 | int valid_extradata; ///< extradata is valid, so we can calculate duration | ||
| 38 | int blocksize[2]; ///< short and long window sizes | ||
| 39 | int previous_blocksize; ///< previous window size | ||
| 40 | int mode_blocksize[64]; ///< window size mapping for each mode | ||
| 41 | int mode_count; ///< number of modes | ||
| 42 | int mode_mask; ///< bitmask used to get the mode in each packet | ||
| 43 | int prev_mask; ///< bitmask used to get the previous mode flag in each packet | ||
| 44 | }; | ||
| 45 | |||
| 46 | #if LIBAVCODEC_VERSION_MAJOR < 57 | ||
| 47 | /** | ||
| 48 | * Initialize the Vorbis parser using headers in the extradata. | ||
| 49 | * | ||
| 50 | * @param avctx codec context | ||
| 51 | * @param s Vorbis parser context | ||
| 52 | */ | ||
| 53 | int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, AVVorbisParseContext *s); | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Get the duration for a Vorbis packet. | ||
| 57 | * | ||
| 58 | * avpriv_vorbis_parse_extradata() must have been successfully called prior to | ||
| 59 | * this in order for a correct duration to be returned. | ||
| 60 | * | ||
| 61 | * @param s Vorbis parser context | ||
| 62 | * @param buf buffer containing a Vorbis frame | ||
| 63 | * @param buf_size size of the buffer | ||
| 64 | */ | ||
| 65 | int avpriv_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, | ||
| 66 | int buf_size); | ||
| 67 | |||
| 68 | void avpriv_vorbis_parse_reset(AVVorbisParseContext *s); | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #endif /* AVCODEC_VORBIS_PARSER_H */ | ||
| @@ -30,7 +30,7 @@ · 29 unmodified lines | |||
| 30 | #include "libavutil/dict.h" | 30 | #include "libavutil/dict.h" |
| 31 | #include "libavcodec/bytestream.h" | 31 | #include "libavcodec/bytestream.h" |
| 32 | #include "libavcodec/get_bits.h" | 32 | #include "libavcodec/get_bits.h" |
| 33 | #include "libavcodec/vorbis_parser.h" | 33 | #include "libavcodec/vorbis_parser_internal.h" |
| 34 | #include "avformat.h" | 34 | #include "avformat.h" |
| 35 | #include "flac_picture.h" | 35 | #include "flac_picture.h" |
| 36 | #include "internal.h" | 36 | #include "internal.h" |