summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libtremor/ivorbisfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libtremor/ivorbisfile.h')
-rw-r--r--lib/rbcodec/codecs/libtremor/ivorbisfile.h131
1 files changed, 131 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libtremor/ivorbisfile.h b/lib/rbcodec/codecs/libtremor/ivorbisfile.h
new file mode 100644
index 0000000000..076783514e
--- /dev/null
+++ b/lib/rbcodec/codecs/libtremor/ivorbisfile.h
@@ -0,0 +1,131 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: stdio-based convenience library for opening/seeking/decoding
15
16 ********************************************************************/
17
18#ifndef _OV_FILE_H_
19#define _OV_FILE_H_
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif /* __cplusplus */
25
26#include <stdio.h>
27#include "ivorbiscodec.h"
28
29
30#define CHUNKSIZE 1024
31/* The function prototypes for the callbacks are basically the same as for
32 * the stdio functions fread, fseek, fclose, ftell.
33 * The one difference is that the FILE * arguments have been replaced with
34 * a void * - this is to be used as a pointer to whatever internal data these
35 * functions might need. In the stdio case, it's just a FILE * cast to a void *
36 *
37 * If you use other functions, check the docs for these functions and return
38 * the right values. For seek_func(), you *MUST* return -1 if the stream is
39 * unseekable
40 */
41typedef struct {
42 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
43 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
44 int (*close_func) (void *datasource);
45 long (*tell_func) (void *datasource);
46} ov_callbacks;
47
48#define NOTOPEN 0
49#define PARTOPEN 1
50#define OPENED 2
51#define STREAMSET 3
52#define INITSET 4
53
54typedef struct OggVorbis_File {
55 void *datasource; /* Pointer to a FILE *, etc. */
56 int seekable;
57 ogg_int64_t offset;
58 ogg_int64_t end;
59 ogg_sync_state oy;
60
61 /* If the FILE handle isn't seekable (eg, a pipe), only the current
62 stream appears */
63 int links;
64 ogg_int64_t *offsets;
65 ogg_int64_t *dataoffsets;
66 ogg_uint32_t *serialnos;
67 ogg_int64_t *pcmlengths;
68 vorbis_info *vi;
69/* vorbis_comment *vc; */
70
71 /* Decoding working state local storage */
72 ogg_int64_t pcm_offset;
73 int ready_state;
74 ogg_uint32_t current_serialno;
75 int current_link;
76
77 ogg_int64_t bittrack;
78 ogg_int64_t samptrack;
79
80 ogg_stream_state os; /* take physical pages, weld into a logical
81 stream of packets */
82 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
83 vorbis_block vb; /* local working space for packet->PCM decode */
84
85 ov_callbacks callbacks;
86
87} OggVorbis_File;
88
89extern int ov_clear(OggVorbis_File *vf);
90extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
91 const char *initial, long ibytes, ov_callbacks callbacks);
92
93extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
94 const char *initial, long ibytes, ov_callbacks callbacks);
95extern int ov_test_open(OggVorbis_File *vf);
96
97extern long ov_bitrate(OggVorbis_File *vf,int i);
98extern long ov_bitrate_instant(OggVorbis_File *vf);
99extern long ov_streams(OggVorbis_File *vf);
100extern long ov_seekable(OggVorbis_File *vf);
101extern long ov_serialnumber(OggVorbis_File *vf,int i);
102
103extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
104extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
105extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
106
107extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
108extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
109extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
110extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
111extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
112
113extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
114extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
115extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
116
117extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
118extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
119
120extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
121 int *bitstream);
122extern long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels,
123 int length,int *bitstream);
124
125#ifdef __cplusplus
126}
127#endif /* __cplusplus */
128
129#endif
130
131