annotate osx/include/vorbis/vorbisfile.h @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents cc5d363db385
children
rev   line source
Chris@2 1 /********************************************************************
Chris@2 2 * *
Chris@2 3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
Chris@2 4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
Chris@2 5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
Chris@2 6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
Chris@2 7 * *
Chris@2 8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
Chris@2 9 * by the Xiph.Org Foundation http://www.xiph.org/ *
Chris@2 10 * *
Chris@2 11 ********************************************************************
Chris@2 12
Chris@2 13 function: stdio-based convenience library for opening/seeking/decoding
Chris@2 14 last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
Chris@2 15
Chris@2 16 ********************************************************************/
Chris@2 17
Chris@2 18 #ifndef _OV_FILE_H_
Chris@2 19 #define _OV_FILE_H_
Chris@2 20
Chris@2 21 #ifdef __cplusplus
Chris@2 22 extern "C"
Chris@2 23 {
Chris@2 24 #endif /* __cplusplus */
Chris@2 25
Chris@2 26 #include <stdio.h>
Chris@2 27 #include "codec.h"
Chris@2 28
Chris@2 29 /* The function prototypes for the callbacks are basically the same as for
Chris@2 30 * the stdio functions fread, fseek, fclose, ftell.
Chris@2 31 * The one difference is that the FILE * arguments have been replaced with
Chris@2 32 * a void * - this is to be used as a pointer to whatever internal data these
Chris@2 33 * functions might need. In the stdio case, it's just a FILE * cast to a void *
Chris@2 34 *
Chris@2 35 * If you use other functions, check the docs for these functions and return
Chris@2 36 * the right values. For seek_func(), you *MUST* return -1 if the stream is
Chris@2 37 * unseekable
Chris@2 38 */
Chris@2 39 typedef struct {
Chris@2 40 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
Chris@2 41 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
Chris@2 42 int (*close_func) (void *datasource);
Chris@2 43 long (*tell_func) (void *datasource);
Chris@2 44 } ov_callbacks;
Chris@2 45
Chris@2 46 #ifndef OV_EXCLUDE_STATIC_CALLBACKS
Chris@2 47
Chris@2 48 /* a few sets of convenient callbacks, especially for use under
Chris@2 49 * Windows where ov_open_callbacks() should always be used instead of
Chris@2 50 * ov_open() to avoid problems with incompatible crt.o version linking
Chris@2 51 * issues. */
Chris@2 52
Chris@2 53 static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
Chris@2 54 if(f==NULL)return(-1);
Chris@2 55
Chris@2 56 #ifdef __MINGW32__
Chris@2 57 return fseeko64(f,off,whence);
Chris@2 58 #elif defined (_WIN32)
Chris@2 59 return _fseeki64(f,off,whence);
Chris@2 60 #else
Chris@2 61 return fseek(f,off,whence);
Chris@2 62 #endif
Chris@2 63 }
Chris@2 64
Chris@2 65 /* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
Chris@2 66 * static data. That means that every file which includes this header
Chris@2 67 * will get its own copy of these structs whether it uses them or
Chris@2 68 * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
Chris@2 69 * These static symbols are essential on platforms such as Windows on
Chris@2 70 * which several different versions of stdio support may be linked to
Chris@2 71 * by different DLLs, and we need to be certain we know which one
Chris@2 72 * we're using (the same one as the main application).
Chris@2 73 */
Chris@2 74
Chris@2 75 static ov_callbacks OV_CALLBACKS_DEFAULT = {
Chris@2 76 (size_t (*)(void *, size_t, size_t, void *)) fread,
Chris@2 77 (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
Chris@2 78 (int (*)(void *)) fclose,
Chris@2 79 (long (*)(void *)) ftell
Chris@2 80 };
Chris@2 81
Chris@2 82 static ov_callbacks OV_CALLBACKS_NOCLOSE = {
Chris@2 83 (size_t (*)(void *, size_t, size_t, void *)) fread,
Chris@2 84 (int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
Chris@2 85 (int (*)(void *)) NULL,
Chris@2 86 (long (*)(void *)) ftell
Chris@2 87 };
Chris@2 88
Chris@2 89 static ov_callbacks OV_CALLBACKS_STREAMONLY = {
Chris@2 90 (size_t (*)(void *, size_t, size_t, void *)) fread,
Chris@2 91 (int (*)(void *, ogg_int64_t, int)) NULL,
Chris@2 92 (int (*)(void *)) fclose,
Chris@2 93 (long (*)(void *)) NULL
Chris@2 94 };
Chris@2 95
Chris@2 96 static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
Chris@2 97 (size_t (*)(void *, size_t, size_t, void *)) fread,
Chris@2 98 (int (*)(void *, ogg_int64_t, int)) NULL,
Chris@2 99 (int (*)(void *)) NULL,
Chris@2 100 (long (*)(void *)) NULL
Chris@2 101 };
Chris@2 102
Chris@2 103 #endif
Chris@2 104
Chris@2 105 #define NOTOPEN 0
Chris@2 106 #define PARTOPEN 1
Chris@2 107 #define OPENED 2
Chris@2 108 #define STREAMSET 3
Chris@2 109 #define INITSET 4
Chris@2 110
Chris@2 111 typedef struct OggVorbis_File {
Chris@2 112 void *datasource; /* Pointer to a FILE *, etc. */
Chris@2 113 int seekable;
Chris@2 114 ogg_int64_t offset;
Chris@2 115 ogg_int64_t end;
Chris@2 116 ogg_sync_state oy;
Chris@2 117
Chris@2 118 /* If the FILE handle isn't seekable (eg, a pipe), only the current
Chris@2 119 stream appears */
Chris@2 120 int links;
Chris@2 121 ogg_int64_t *offsets;
Chris@2 122 ogg_int64_t *dataoffsets;
Chris@2 123 long *serialnos;
Chris@2 124 ogg_int64_t *pcmlengths; /* overloaded to maintain binary
Chris@2 125 compatibility; x2 size, stores both
Chris@2 126 beginning and end values */
Chris@2 127 vorbis_info *vi;
Chris@2 128 vorbis_comment *vc;
Chris@2 129
Chris@2 130 /* Decoding working state local storage */
Chris@2 131 ogg_int64_t pcm_offset;
Chris@2 132 int ready_state;
Chris@2 133 long current_serialno;
Chris@2 134 int current_link;
Chris@2 135
Chris@2 136 double bittrack;
Chris@2 137 double samptrack;
Chris@2 138
Chris@2 139 ogg_stream_state os; /* take physical pages, weld into a logical
Chris@2 140 stream of packets */
Chris@2 141 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
Chris@2 142 vorbis_block vb; /* local working space for packet->PCM decode */
Chris@2 143
Chris@2 144 ov_callbacks callbacks;
Chris@2 145
Chris@2 146 } OggVorbis_File;
Chris@2 147
Chris@2 148
Chris@2 149 extern int ov_clear(OggVorbis_File *vf);
Chris@2 150 extern int ov_fopen(const char *path,OggVorbis_File *vf);
Chris@2 151 extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
Chris@2 152 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
Chris@2 153 const char *initial, long ibytes, ov_callbacks callbacks);
Chris@2 154
Chris@2 155 extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
Chris@2 156 extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
Chris@2 157 const char *initial, long ibytes, ov_callbacks callbacks);
Chris@2 158 extern int ov_test_open(OggVorbis_File *vf);
Chris@2 159
Chris@2 160 extern long ov_bitrate(OggVorbis_File *vf,int i);
Chris@2 161 extern long ov_bitrate_instant(OggVorbis_File *vf);
Chris@2 162 extern long ov_streams(OggVorbis_File *vf);
Chris@2 163 extern long ov_seekable(OggVorbis_File *vf);
Chris@2 164 extern long ov_serialnumber(OggVorbis_File *vf,int i);
Chris@2 165
Chris@2 166 extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
Chris@2 167 extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
Chris@2 168 extern double ov_time_total(OggVorbis_File *vf,int i);
Chris@2 169
Chris@2 170 extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 171 extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 172 extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 173 extern int ov_time_seek(OggVorbis_File *vf,double pos);
Chris@2 174 extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
Chris@2 175
Chris@2 176 extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 177 extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 178 extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
Chris@2 179 extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
Chris@2 180 extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
Chris@2 181
Chris@2 182 extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
Chris@2 183 extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
Chris@2 184 extern double ov_time_tell(OggVorbis_File *vf);
Chris@2 185
Chris@2 186 extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
Chris@2 187 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
Chris@2 188
Chris@2 189 extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
Chris@2 190 int *bitstream);
Chris@2 191 extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
Chris@2 192 int bigendianp,int word,int sgned,int *bitstream,
Chris@2 193 void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
Chris@2 194 extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
Chris@2 195 int bigendianp,int word,int sgned,int *bitstream);
Chris@2 196 extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
Chris@2 197
Chris@2 198 extern int ov_halfrate(OggVorbis_File *vf,int flag);
Chris@2 199 extern int ov_halfrate_p(OggVorbis_File *vf);
Chris@2 200
Chris@2 201 #ifdef __cplusplus
Chris@2 202 }
Chris@2 203 #endif /* __cplusplus */
Chris@2 204
Chris@2 205 #endif
Chris@2 206