1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
6 * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: stdio-based convenience library for opening/seeking/decoding
14 last mod: $Id: vorbisfile.h,v 1.12 2001/02/02 03:51:54 xiphmont Exp $
16 ********************************************************************/
24 #endif /* __cplusplus */
29 /* The function prototypes for the callbacks are basically the same as for
30 * the stdio functions fread, fseek, fclose, ftell.
31 * The one difference is that the FILE * arguments have been replaced with
32 * a void * - this is to be used as a pointer to whatever internal data these
33 * functions might need. In the stdio case, it's just a FILE * cast to a void *
35 * If you use other functions, check the docs for these functions and return
36 * the right values. For seek_func(), you *MUST* return -1 if the stream is
40 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
41 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
42 int (*close_func) (void *datasource);
43 long (*tell_func) (void *datasource);
47 typedef struct OggVorbis_File {
48 void *datasource; /* Pointer to a FILE *, etc. */
54 /* If the FILE handle isn't seekable (eg, a pipe), only the current
58 ogg_int64_t *dataoffsets;
60 ogg_int64_t *pcmlengths;
64 /* Decoding working state local storage */
65 ogg_int64_t pcm_offset;
67 long current_serialno;
73 ogg_stream_state os; /* take physical pages, weld into a logical
75 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
76 vorbis_block vb; /* local working space for packet->PCM decode */
78 ov_callbacks callbacks;
82 extern int ov_clear(OggVorbis_File *vf);
83 extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
84 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
85 char *initial, long ibytes, ov_callbacks callbacks);
87 extern long ov_bitrate(OggVorbis_File *vf,int i);
88 extern long ov_bitrate_instant(OggVorbis_File *vf);
89 extern long ov_streams(OggVorbis_File *vf);
90 extern long ov_seekable(OggVorbis_File *vf);
91 extern long ov_serialnumber(OggVorbis_File *vf,int i);
93 extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
94 extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
95 extern double ov_time_total(OggVorbis_File *vf,int i);
97 extern int ov_raw_seek(OggVorbis_File *vf,long pos);
98 extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
99 extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
100 extern int ov_time_seek(OggVorbis_File *vf,double pos);
101 extern int ov_time_seek_page(OggVorbis_File *vf,double pos);
103 extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
104 extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
105 extern double ov_time_tell(OggVorbis_File *vf);
107 extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
108 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
110 extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
111 int bigendianp,int word,int sgned,int *bitstream);
115 #endif /* __cplusplus */