annotate osx/include/vorbis/vorbisfile.h @ 169:223a55898ab9 tip default

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