libavcodec/vorbis_parser.h
5602a464
 /*
  *
d814a839
  * This file is part of FFmpeg.
5602a464
  *
d814a839
  * FFmpeg is free software; you can redistribute it and/or
5602a464
  * 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.
  *
d814a839
  * FFmpeg is distributed in the hope that it will be useful,
5602a464
  * 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
d814a839
  * License along with FFmpeg; if not, write to the Free Software
5602a464
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
  * @file
5e80fb7f
  * A public API for Vorbis parsing
5602a464
  *
  * Determines the duration for each packet.
  */
 
5e80fb7f
 #ifndef AVCODEC_VORBIS_PARSE_H
 #define AVCODEC_VORBIS_PARSE_H
5602a464
 
e2e36a73
 #include <stdint.h>
 
5e80fb7f
 typedef struct AVVorbisParseContext AVVorbisParseContext;
5602a464
 
 /**
5e80fb7f
  * Allocate and initialize the Vorbis parser using headers in the extradata.
5602a464
  *
  * @param avctx codec context
  * @param s     Vorbis parser context
  */
5e80fb7f
 AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata,
                                            int extradata_size);
 
 /**
  * Free the parser and everything associated with it.
  */
 void av_vorbis_parse_free(AVVorbisParseContext **s);
5602a464
 
255302da
 #define VORBIS_FLAG_HEADER  0x00000001
 #define VORBIS_FLAG_COMMENT 0x00000002
1fe94ea7
 #define VORBIS_FLAG_SETUP   0x00000004
255302da
 
 /**
  * Get the duration for a Vorbis packet.
  *
7ffdc7be
  * If @p flags is @c NULL,
255302da
  * special frames are considered invalid.
  *
  * @param s        Vorbis parser context
  * @param buf      buffer containing a Vorbis frame
  * @param buf_size size of the buffer
  * @param flags    flags for special frames
  */
7ffdc7be
 int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf,
                                 int buf_size, int *flags);
255302da
 
5602a464
 /**
  * Get the duration for a Vorbis packet.
  *
  * @param s        Vorbis parser context
  * @param buf      buffer containing a Vorbis frame
  * @param buf_size size of the buffer
  */
5e80fb7f
 int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf,
                           int buf_size);
5602a464
 
5e80fb7f
 void av_vorbis_parse_reset(AVVorbisParseContext *s);
5602a464
 
5e80fb7f
 #endif /* AVCODEC_VORBIS_PARSE_H */