annotate win64-mingw/include/vorbis/vorbisfile.h @ 34:05254799ed10

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