vrshoot

diff libs/vorbis/vorbisfile.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/vorbis/vorbisfile.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,206 @@
     1.4 +/********************************************************************
     1.5 + *                                                                  *
     1.6 + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
     1.7 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
     1.8 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
     1.9 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
    1.10 + *                                                                  *
    1.11 + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
    1.12 + * by the Xiph.Org Foundation http://www.xiph.org/                  *
    1.13 + *                                                                  *
    1.14 + ********************************************************************
    1.15 +
    1.16 + function: stdio-based convenience library for opening/seeking/decoding
    1.17 + last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
    1.18 +
    1.19 + ********************************************************************/
    1.20 +
    1.21 +#ifndef _OV_FILE_H_
    1.22 +#define _OV_FILE_H_
    1.23 +
    1.24 +#ifdef __cplusplus
    1.25 +extern "C"
    1.26 +{
    1.27 +#endif /* __cplusplus */
    1.28 +
    1.29 +#include <stdio.h>
    1.30 +#include "codec.h"
    1.31 +
    1.32 +/* The function prototypes for the callbacks are basically the same as for
    1.33 + * the stdio functions fread, fseek, fclose, ftell.
    1.34 + * The one difference is that the FILE * arguments have been replaced with
    1.35 + * a void * - this is to be used as a pointer to whatever internal data these
    1.36 + * functions might need. In the stdio case, it's just a FILE * cast to a void *
    1.37 + *
    1.38 + * If you use other functions, check the docs for these functions and return
    1.39 + * the right values. For seek_func(), you *MUST* return -1 if the stream is
    1.40 + * unseekable
    1.41 + */
    1.42 +typedef struct {
    1.43 +  size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
    1.44 +  int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);
    1.45 +  int    (*close_func) (void *datasource);
    1.46 +  long   (*tell_func)  (void *datasource);
    1.47 +} ov_callbacks;
    1.48 +
    1.49 +#ifndef OV_EXCLUDE_STATIC_CALLBACKS
    1.50 +
    1.51 +/* a few sets of convenient callbacks, especially for use under
    1.52 + * Windows where ov_open_callbacks() should always be used instead of
    1.53 + * ov_open() to avoid problems with incompatible crt.o version linking
    1.54 + * issues. */
    1.55 +
    1.56 +static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
    1.57 +  if(f==NULL)return(-1);
    1.58 +
    1.59 +#ifdef __MINGW32__
    1.60 +  return fseeko64(f,off,whence);
    1.61 +#elif defined (_WIN32)
    1.62 +  return _fseeki64(f,off,whence);
    1.63 +#else
    1.64 +  return fseek(f,off,whence);
    1.65 +#endif
    1.66 +}
    1.67 +
    1.68 +/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
    1.69 + * static data. That means that every file which includes this header
    1.70 + * will get its own copy of these structs whether it uses them or
    1.71 + * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
    1.72 + * These static symbols are essential on platforms such as Windows on
    1.73 + * which several different versions of stdio support may be linked to
    1.74 + * by different DLLs, and we need to be certain we know which one
    1.75 + * we're using (the same one as the main application).
    1.76 + */
    1.77 +
    1.78 +static ov_callbacks OV_CALLBACKS_DEFAULT = {
    1.79 +  (size_t (*)(void *, size_t, size_t, void *))  fread,
    1.80 +  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
    1.81 +  (int (*)(void *))                             fclose,
    1.82 +  (long (*)(void *))                            ftell
    1.83 +};
    1.84 +
    1.85 +static ov_callbacks OV_CALLBACKS_NOCLOSE = {
    1.86 +  (size_t (*)(void *, size_t, size_t, void *))  fread,
    1.87 +  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
    1.88 +  (int (*)(void *))                             NULL,
    1.89 +  (long (*)(void *))                            ftell
    1.90 +};
    1.91 +
    1.92 +static ov_callbacks OV_CALLBACKS_STREAMONLY = {
    1.93 +  (size_t (*)(void *, size_t, size_t, void *))  fread,
    1.94 +  (int (*)(void *, ogg_int64_t, int))           NULL,
    1.95 +  (int (*)(void *))                             fclose,
    1.96 +  (long (*)(void *))                            NULL
    1.97 +};
    1.98 +
    1.99 +static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
   1.100 +  (size_t (*)(void *, size_t, size_t, void *))  fread,
   1.101 +  (int (*)(void *, ogg_int64_t, int))           NULL,
   1.102 +  (int (*)(void *))                             NULL,
   1.103 +  (long (*)(void *))                            NULL
   1.104 +};
   1.105 +
   1.106 +#endif
   1.107 +
   1.108 +#define  NOTOPEN   0
   1.109 +#define  PARTOPEN  1
   1.110 +#define  OPENED    2
   1.111 +#define  STREAMSET 3
   1.112 +#define  INITSET   4
   1.113 +
   1.114 +typedef struct OggVorbis_File {
   1.115 +  void            *datasource; /* Pointer to a FILE *, etc. */
   1.116 +  int              seekable;
   1.117 +  ogg_int64_t      offset;
   1.118 +  ogg_int64_t      end;
   1.119 +  ogg_sync_state   oy;
   1.120 +
   1.121 +  /* If the FILE handle isn't seekable (eg, a pipe), only the current
   1.122 +     stream appears */
   1.123 +  int              links;
   1.124 +  ogg_int64_t     *offsets;
   1.125 +  ogg_int64_t     *dataoffsets;
   1.126 +  long            *serialnos;
   1.127 +  ogg_int64_t     *pcmlengths; /* overloaded to maintain binary
   1.128 +                                  compatibility; x2 size, stores both
   1.129 +                                  beginning and end values */
   1.130 +  vorbis_info     *vi;
   1.131 +  vorbis_comment  *vc;
   1.132 +
   1.133 +  /* Decoding working state local storage */
   1.134 +  ogg_int64_t      pcm_offset;
   1.135 +  int              ready_state;
   1.136 +  long             current_serialno;
   1.137 +  int              current_link;
   1.138 +
   1.139 +  double           bittrack;
   1.140 +  double           samptrack;
   1.141 +
   1.142 +  ogg_stream_state os; /* take physical pages, weld into a logical
   1.143 +                          stream of packets */
   1.144 +  vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
   1.145 +  vorbis_block     vb; /* local working space for packet->PCM decode */
   1.146 +
   1.147 +  ov_callbacks callbacks;
   1.148 +
   1.149 +} OggVorbis_File;
   1.150 +
   1.151 +
   1.152 +extern int ov_clear(OggVorbis_File *vf);
   1.153 +extern int ov_fopen(const char *path,OggVorbis_File *vf);
   1.154 +extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
   1.155 +extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
   1.156 +                const char *initial, long ibytes, ov_callbacks callbacks);
   1.157 +
   1.158 +extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
   1.159 +extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
   1.160 +                const char *initial, long ibytes, ov_callbacks callbacks);
   1.161 +extern int ov_test_open(OggVorbis_File *vf);
   1.162 +
   1.163 +extern long ov_bitrate(OggVorbis_File *vf,int i);
   1.164 +extern long ov_bitrate_instant(OggVorbis_File *vf);
   1.165 +extern long ov_streams(OggVorbis_File *vf);
   1.166 +extern long ov_seekable(OggVorbis_File *vf);
   1.167 +extern long ov_serialnumber(OggVorbis_File *vf,int i);
   1.168 +
   1.169 +extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
   1.170 +extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
   1.171 +extern double ov_time_total(OggVorbis_File *vf,int i);
   1.172 +
   1.173 +extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
   1.174 +extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
   1.175 +extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
   1.176 +extern int ov_time_seek(OggVorbis_File *vf,double pos);
   1.177 +extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
   1.178 +
   1.179 +extern int ov_raw_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
   1.180 +extern int ov_pcm_seek_lap(OggVorbis_File *vf,ogg_int64_t pos);
   1.181 +extern int ov_pcm_seek_page_lap(OggVorbis_File *vf,ogg_int64_t pos);
   1.182 +extern int ov_time_seek_lap(OggVorbis_File *vf,double pos);
   1.183 +extern int ov_time_seek_page_lap(OggVorbis_File *vf,double pos);
   1.184 +
   1.185 +extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
   1.186 +extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
   1.187 +extern double ov_time_tell(OggVorbis_File *vf);
   1.188 +
   1.189 +extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
   1.190 +extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
   1.191 +
   1.192 +extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
   1.193 +                          int *bitstream);
   1.194 +extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
   1.195 +                          int bigendianp,int word,int sgned,int *bitstream,
   1.196 +                          void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
   1.197 +extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
   1.198 +                    int bigendianp,int word,int sgned,int *bitstream);
   1.199 +extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
   1.200 +
   1.201 +extern int ov_halfrate(OggVorbis_File *vf,int flag);
   1.202 +extern int ov_halfrate_p(OggVorbis_File *vf);
   1.203 +
   1.204 +#ifdef __cplusplus
   1.205 +}
   1.206 +#endif /* __cplusplus */
   1.207 +
   1.208 +#endif
   1.209 +