examples/SFExamples/oggvorbiscodec/src/tremor/ivorbisfile.h

00001 /********************************************************************
00002  *                                                                  *
00003  * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE.   *
00004  *                                                                  *
00005  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
00006  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
00007  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
00008  *                                                                  *
00009  * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002    *
00010  * BY THE Xiph.Org FOUNDATION http://www.xiph.org/                  *
00011  *                                                                  *
00012  ********************************************************************
00013 
00014  function: stdio-based convenience library for opening/seeking/decoding
00015 
00016  ********************************************************************/
00017 
00018 #ifndef _OV_FILE_H_
00019 #define _OV_FILE_H_
00020 
00021 #ifdef __cplusplus
00022 extern "C"
00023 {
00024 #endif /* __cplusplus */
00025 
00026 #include <stdio.h>
00027 #include "ivorbiscodec.h"
00028 
00029 #define CHUNKSIZE 1024
00030 /* The function prototypes for the callbacks are basically the same as for
00031  * the stdio functions fread, fseek, fclose, ftell. 
00032  * The one difference is that the FILE * arguments have been replaced with
00033  * a void * - this is to be used as a pointer to whatever internal data these
00034  * functions might need. In the stdio case, it's just a FILE * cast to a void *
00035  * 
00036  * If you use other functions, check the docs for these functions and return
00037  * the right values. For seek_func(), you *MUST* return -1 if the stream is
00038  * unseekable
00039  */
00040 typedef struct {
00041   size_t (*read_func)  (void *ptr, size_t size, size_t nmemb, void *datasource);
00042   int    (*seek_func)  (void *datasource, ogg_int64_t offset, int whence);
00043   int    (*close_func) (void *datasource);
00044   long   (*tell_func)  (void *datasource);
00045 } ov_callbacks;
00046 
00047 #define  NOTOPEN   0
00048 #define  PARTOPEN  1
00049 #define  OPENED    2
00050 #define  STREAMSET 3
00051 #define  INITSET   4
00052 
00053 typedef struct OggVorbis_File {
00054   void            *datasource; /* Pointer to a FILE *, etc. */
00055   int              seekable;
00056   ogg_int64_t      offset;
00057   ogg_int64_t      end;
00058   ogg_sync_state   *oy; 
00059 
00060   /* If the FILE handle isn't seekable (eg, a pipe), only the current
00061      stream appears */
00062   int              links;
00063   ogg_int64_t     *offsets;
00064   ogg_int64_t     *dataoffsets;
00065   ogg_uint32_t    *serialnos;
00066   ogg_int64_t     *pcmlengths;
00067   vorbis_info     *vi;
00068   vorbis_comment  *vc;
00069 
00070   /* Decoding working state local storage */
00071   ogg_int64_t      pcm_offset;
00072   int              ready_state;
00073   ogg_uint32_t     current_serialno;
00074   int              current_link;
00075 
00076   ogg_int64_t      bittrack;
00077   ogg_int64_t      samptrack;
00078 
00079   ogg_stream_state *os; /* take physical pages, weld into a logical
00080                           stream of packets */
00081   vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
00082   vorbis_block     vb; /* local working space for packet->PCM decode */
00083 
00084   ov_callbacks callbacks;
00085 
00086 } OggVorbis_File;
00087 
00088 extern int ov_clear(OggVorbis_File *vf);
00089 extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
00090 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
00091                 char *initial, long ibytes, ov_callbacks callbacks);
00092 
00093 extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
00094 extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
00095                 char *initial, long ibytes, ov_callbacks callbacks);
00096 extern int ov_test_open(OggVorbis_File *vf);
00097 
00098 extern long ov_bitrate(OggVorbis_File *vf,int i);
00099 extern long ov_bitrate_instant(OggVorbis_File *vf);
00100 extern long ov_streams(OggVorbis_File *vf);
00101 extern long ov_seekable(OggVorbis_File *vf);
00102 extern long ov_serialnumber(OggVorbis_File *vf,int i);
00103 
00104 extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
00105 extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
00106 extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
00107 
00108 extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
00109 extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
00110 extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
00111 extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
00112 extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
00113 
00114 extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
00115 extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
00116 extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
00117 
00118 extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
00119 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
00120 
00121 extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
00122                     int *bitstream);
00123 
00124 #ifdef __cplusplus
00125 }
00126 #endif /* __cplusplus */
00127 
00128 #endif
00129 
00130 

Generated by  doxygen 1.6.2