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