annotate win64-mingw/include/vorbis/vorbisfile.h @ 132:42a73082be24

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