annotate DEPENDENCIES/mingw32/include/vorbis/vorbisfile.h @ 120:4729c8589274 emscripten-piper

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