/********************************************************************1* *2* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *3* *4* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *5* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *6* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *7* *8* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *9* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *10* *11********************************************************************1213function: libvorbis codec headers1415********************************************************************/1617#ifndef _vorbis_codec_h_18#define _vorbis_codec_h_1920#ifdef __cplusplus21extern "C"22{23#endif /* __cplusplus */2425#include "ogg.h"2627typedef struct vorbis_info{28int version;29int channels;30long rate;3132/* The below bitrate declarations are *hints*.33Combinations of the three values carry the following implications:3435all three set to the same value:36implies a fixed rate bitstream37only nominal set:38implies a VBR stream that averages the nominal bitrate. No hard39upper/lower limit40upper and or lower set:41implies a VBR bitstream that obeys the bitrate limits. nominal42may also be set to give a nominal rate.43none set:44the coder does not care to speculate.45*/4647long bitrate_upper;48long bitrate_nominal;49long bitrate_lower;50long bitrate_window;5152void *codec_setup;53} vorbis_info;5455/* vorbis_dsp_state buffers the current vorbis audio56analysis/synthesis state. The DSP state belongs to a specific57logical bitstream ****************************************************/58typedef struct vorbis_dsp_state{59int analysisp;60vorbis_info *vi;6162ogg_int32_t **pcm;63ogg_int32_t **pcmret;64int pcm_storage;65int pcm_current;66int pcm_returned;6768int preextrapolate;69int eofflag;7071long lW;72long W;73long nW;74long centerW;7576ogg_int64_t granulepos;77ogg_int64_t sequence;7879void *backend_state;80} vorbis_dsp_state;8182typedef struct vorbis_block{83/* necessary stream state for linking to the framing abstraction */84ogg_int32_t **pcm; /* this is a pointer into local storage */85oggpack_buffer opb;8687long lW;88long W;89long nW;90int pcmend;91int mode;9293int eofflag;94ogg_int64_t granulepos;95ogg_int64_t sequence;96vorbis_dsp_state *vd; /* For read-only access of configuration */9798/* local storage to avoid remallocing; it's up to the mapping to99structure it */100void *localstore;101long localtop;102long localalloc;103long totaluse;104struct alloc_chain *reap;105106} vorbis_block;107108/* vorbis_block is a single block of data to be processed as part of109the analysis/synthesis stream; it belongs to a specific logical110bitstream, but is independant from other vorbis_blocks belonging to111that logical bitstream. *************************************************/112113struct alloc_chain{114void *ptr;115struct alloc_chain *next;116};117118/* vorbis_info contains all the setup information specific to the119specific compression/decompression mode in progress (eg,120psychoacoustic settings, channel setup, options, codebook121etc). vorbis_info and substructures are in backends.h.122*********************************************************************/123124/* the comments are not part of vorbis_info so that vorbis_info can be125static storage */126typedef struct vorbis_comment{127/* unlimited user comment fields. libvorbis writes 'libvorbis'128whatever vendor is set to in encode */129char **user_comments;130int *comment_lengths;131int comments;132char *vendor;133134} vorbis_comment;135136137/* libvorbis encodes in two abstraction layers; first we perform DSP138and produce a packet (see docs/analysis.txt). The packet is then139coded into a framed OggSquish bitstream by the second layer (see140docs/framing.txt). Decode is the reverse process; we sync/frame141the bitstream and extract individual packets, then decode the142packet back into PCM audio.143144The extra framing/packetizing is used in streaming formats, such as145files. Over the net (such as with UDP), the framing and146packetization aren't necessary as they're provided by the transport147and the streaming layer is not used */148149/* Vorbis PRIMITIVES: general ***************************************/150151extern void vorbis_info_init(vorbis_info *vi);152extern void vorbis_info_clear(vorbis_info *vi);153extern int vorbis_info_blocksize(vorbis_info *vi,int zo);154extern void vorbis_comment_init(vorbis_comment *vc);155extern void vorbis_comment_add(vorbis_comment *vc, char *comment);156extern void vorbis_comment_add_tag(vorbis_comment *vc,157char *tag, char *contents);158extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);159extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);160extern void vorbis_comment_clear(vorbis_comment *vc);161162extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);163extern int vorbis_block_clear(vorbis_block *vb);164extern void vorbis_dsp_clear(vorbis_dsp_state *v);165166/* Vorbis PRIMITIVES: synthesis layer *******************************/167extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,168ogg_packet *op);169170extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);171extern int vorbis_synthesis_restart(vorbis_dsp_state *v);172extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);173extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);174extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);175extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);176extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);177178/* Vorbis ERRORS and return codes ***********************************/179180#define OV_FALSE -1181#define OV_EOF -2182#define OV_HOLE -3183184#define OV_EREAD -128185#define OV_EFAULT -129186#define OV_EIMPL -130187#define OV_EINVAL -131188#define OV_ENOTVORBIS -132189#define OV_EBADHEADER -133190#define OV_EVERSION -134191#define OV_ENOTAUDIO -135192#define OV_EBADPACKET -136193#define OV_EBADLINK -137194#define OV_ENOSEEK -138195196#ifdef __cplusplus197}198#endif /* __cplusplus */199200#endif201202203204