~ubuntu-branches/ubuntu/precise/flac/precise-updates

« back to all changes in this revision

Viewing changes to include/OggFLAC/stream_decoder.h

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Kwan
  • Date: 2007-05-29 22:56:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529225636-ljeff8xxip09qaap
Tags: 1.1.4-1
* New upstream release. closes: #405167, #411311
  - libOggFLAC and libOggFLAC++ have been merged into libFLAC, so
    remove their corresponding packages.
  - Because of the API changes required to effect the above, there has
    been yet another soname bump. libflac7 -> libflac8 and
    libflac++5 -> libflac++6. Emails have been dispatched to the
    maintainers of dependent packages.
* Some notes on patches that were removed:
  - 02_stdin_stdout, 06_manpage_mention_utf8_convert: merged upstream
  - 08_manpage_warnings: Upstream has changed the manpage so it defintely
    can't fit in in 80 cols, so just forget about it. We'll live.
  - 05_eof_warnings_are_errors: Upstream decided to add a -w option to
    flac to treat all warnings as errors. I am going to defer to that
    for now, but if people think it's stupid let me know and I'll port
    the patch forward.
  - 04_stack_smasher: was a backport from 1.1.3, so it's obsolete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* libOggFLAC - Free Lossless Audio Codec + Ogg library
2
 
 * Copyright (C) 2002,2003,2004,2005  Josh Coalson
3
 
 *
4
 
 * Redistribution and use in source and binary forms, with or without
5
 
 * modification, are permitted provided that the following conditions
6
 
 * are met:
7
 
 *
8
 
 * - Redistributions of source code must retain the above copyright
9
 
 * notice, this list of conditions and the following disclaimer.
10
 
 *
11
 
 * - Redistributions in binary form must reproduce the above copyright
12
 
 * notice, this list of conditions and the following disclaimer in the
13
 
 * documentation and/or other materials provided with the distribution.
14
 
 *
15
 
 * - Neither the name of the Xiph.org Foundation nor the names of its
16
 
 * contributors may be used to endorse or promote products derived from
17
 
 * this software without specific prior written permission.
18
 
 *
19
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
 
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
 
 * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
23
 
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
 
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
 
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
 
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
 
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
 
 */
31
 
 
32
 
#ifndef OggFLAC__STREAM_DECODER_H
33
 
#define OggFLAC__STREAM_DECODER_H
34
 
 
35
 
#include "export.h"
36
 
 
37
 
#include "FLAC/stream_decoder.h"
38
 
 
39
 
#ifdef __cplusplus
40
 
extern "C" {
41
 
#endif
42
 
 
43
 
 
44
 
/** \file include/OggFLAC/stream_decoder.h
45
 
 *
46
 
 *  \brief
47
 
 *  This module contains the functions which implement the stream
48
 
 *  decoder.
49
 
 *
50
 
 *  See the detailed documentation in the
51
 
 *  \link oggflac_stream_decoder stream decoder \endlink module.
52
 
 */
53
 
 
54
 
/** \defgroup oggflac_decoder OggFLAC/ *_decoder.h: decoder interfaces
55
 
 *  \ingroup oggflac
56
 
 *
57
 
 *  \brief
58
 
 *  This module describes the three decoder layers provided by libOggFLAC.
59
 
 *
60
 
 * libOggFLAC currently provides the same three layers of access as
61
 
 * libFLAC; the interfaces are nearly identical, with th addition of a
62
 
 * method for specifying the Ogg serial number.  See the
63
 
 * \link flac_decoder FLAC decoder module \endlink for full documentation.
64
 
 */
65
 
 
66
 
/** \defgroup oggflac_stream_decoder OggFLAC/stream_decoder.h: stream decoder interface
67
 
 *  \ingroup oggflac_decoder
68
 
 *
69
 
 *  \brief
70
 
 *  This module contains the functions which implement the stream
71
 
 *  decoder.
72
 
 *
73
 
 * The interface here is nearly identical to FLAC's stream decoder,
74
 
 * including the callbacks, with the addition of
75
 
 * OggFLAC__stream_decoder_set_serial_number().  See the
76
 
 * \link flac_stream_decoder FLAC stream decoder module \endlink
77
 
 * for full documentation.
78
 
 *
79
 
 * \{
80
 
 */
81
 
 
82
 
 
83
 
/** State values for an OggFLAC__StreamDecoder
84
 
 *
85
 
 *  The decoder's state can be obtained by calling OggFLAC__stream_decoder_get_state().
86
 
 */
87
 
typedef enum {
88
 
 
89
 
        OggFLAC__STREAM_DECODER_OK = 0,
90
 
        /**< The decoder is in the normal OK state. */
91
 
 
92
 
        OggFLAC__STREAM_DECODER_END_OF_STREAM,
93
 
        /**< The decoder has reached the end of the stream. */
94
 
 
95
 
        OggFLAC__STREAM_DECODER_OGG_ERROR,
96
 
        /**< An error occurred in the underlying Ogg layer.  */
97
 
 
98
 
        OggFLAC__STREAM_DECODER_READ_ERROR,
99
 
        /**< The read callback returned an error. */
100
 
 
101
 
        OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR,
102
 
        /**< An error occurred in the underlying FLAC stream decoder;
103
 
         * check OggFLAC__stream_decoder_get_FLAC_stream_decoder_state().
104
 
         */
105
 
 
106
 
        OggFLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
107
 
        /**< Memory allocation failed. */
108
 
 
109
 
        OggFLAC__STREAM_DECODER_ALREADY_INITIALIZED,
110
 
        /**< OggFLAC__stream_decoder_init() was called when the decoder was
111
 
         * already initialized, usually because
112
 
         * OggFLAC__stream_decoder_finish() was not called.
113
 
         */
114
 
 
115
 
        OggFLAC__STREAM_DECODER_INVALID_CALLBACK,
116
 
        /**< The decoder was initialized before setting all the required callbacks. */
117
 
 
118
 
        OggFLAC__STREAM_DECODER_UNINITIALIZED
119
 
        /**< The decoder is in the uninitialized state. */
120
 
 
121
 
} OggFLAC__StreamDecoderState;
122
 
 
123
 
/** Maps an OggFLAC__StreamDecoderState to a C string.
124
 
 *
125
 
 *  Using an OggFLAC__StreamDecoderState as the index to this array
126
 
 *  will give the string equivalent.  The contents should not be modified.
127
 
 */
128
 
extern OggFLAC_API const char * const OggFLAC__StreamDecoderStateString[];
129
 
 
130
 
 
131
 
/***********************************************************************
132
 
 *
133
 
 * class OggFLAC__StreamDecoder
134
 
 *
135
 
 ***********************************************************************/
136
 
 
137
 
struct OggFLAC__StreamDecoderProtected;
138
 
struct OggFLAC__StreamDecoderPrivate;
139
 
/** The opaque structure definition for the stream decoder type.
140
 
 *  See the \link oggflac_stream_decoder stream decoder module \endlink
141
 
 *  for a detailed description.
142
 
 */
143
 
typedef struct {
144
 
        struct OggFLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
145
 
        struct OggFLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
146
 
} OggFLAC__StreamDecoder;
147
 
 
148
 
/** Signature for the read callback.
149
 
 *  See OggFLAC__stream_decoder_set_read_callback()
150
 
 *  and FLAC__StreamDecoderReadCallback for more info.
151
 
 *
152
 
 * \param  decoder  The decoder instance calling the callback.
153
 
 * \param  buffer   A pointer to a location for the callee to store
154
 
 *                  data to be decoded.
155
 
 * \param  bytes    A pointer to the size of the buffer.  On entry
156
 
 *                  to the callback, it contains the maximum number
157
 
 *                  of bytes that may be stored in \a buffer.  The
158
 
 *                  callee must set it to the actual number of bytes
159
 
 *                  stored before returning.
160
 
 * \param  client_data  The callee's client data set through
161
 
 *                      OggFLAC__stream_decoder_set_client_data().
162
 
 * \retval FLAC__StreamDecoderReadStatus
163
 
 *    The callee's return status.
164
 
 */
165
 
typedef FLAC__StreamDecoderReadStatus (*OggFLAC__StreamDecoderReadCallback)(const OggFLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
166
 
 
167
 
/** Signature for the write callback.
168
 
 *  See OggFLAC__stream_decoder_set_write_callback()
169
 
 *  and FLAC__StreamDecoderWriteCallback for more info.
170
 
 *
171
 
 * \param  decoder  The decoder instance calling the callback.
172
 
 * \param  frame    The description of the decoded frame.  See
173
 
 *                  FLAC__Frame.
174
 
 * \param  buffer   An array of pointers to decoded channels of data.
175
 
 *                  Each pointer will point to an array of signed
176
 
 *                  samples of length \a frame->header.blocksize.
177
 
 *                  Currently, the channel order has no meaning
178
 
 *                  except for stereo streams; in this case channel
179
 
 *                  0 is left and 1 is right.
180
 
 * \param  client_data  The callee's client data set through
181
 
 *                      OggFLAC__stream_decoder_set_client_data().
182
 
 * \retval FLAC__StreamDecoderWriteStatus
183
 
 *    The callee's return status.
184
 
 */
185
 
typedef FLAC__StreamDecoderWriteStatus (*OggFLAC__StreamDecoderWriteCallback)(const OggFLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
186
 
 
187
 
/** Signature for the metadata callback.
188
 
 *  See OggFLAC__stream_decoder_set_metadata_callback()
189
 
 *  and FLAC__StreamDecoderMetadataCallback for more info.
190
 
 *
191
 
 * \param  decoder  The decoder instance calling the callback.
192
 
 * \param  metadata The decoded metadata block.
193
 
 * \param  client_data  The callee's client data set through
194
 
 *                      OggFLAC__stream_decoder_set_client_data().
195
 
 */
196
 
typedef void (*OggFLAC__StreamDecoderMetadataCallback)(const OggFLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
197
 
 
198
 
/** Signature for the error callback.
199
 
 *  See OggFLAC__stream_decoder_set_error_callback()
200
 
 *  and FLAC__StreamDecoderErrorCallback for more info.
201
 
 *
202
 
 * \param  decoder  The decoder instance calling the callback.
203
 
 * \param  status   The error encountered by the decoder.
204
 
 * \param  client_data  The callee's client data set through
205
 
 *                      OggFLAC__stream_decoder_set_client_data().
206
 
 */
207
 
typedef void (*OggFLAC__StreamDecoderErrorCallback)(const OggFLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
208
 
 
209
 
 
210
 
/***********************************************************************
211
 
 *
212
 
 * Class constructor/destructor
213
 
 *
214
 
 ***********************************************************************/
215
 
 
216
 
/** Create a new stream decoder instance.  The instance is created with
217
 
 *  default settings; see the individual OggFLAC__stream_decoder_set_*()
218
 
 *  functions for each setting's default.
219
 
 *
220
 
 * \retval OggFLAC__StreamDecoder*
221
 
 *    \c NULL if there was an error allocating memory, else the new instance.
222
 
 */
223
 
OggFLAC_API OggFLAC__StreamDecoder *OggFLAC__stream_decoder_new();
224
 
 
225
 
/** Free a decoder instance.  Deletes the object pointed to by \a decoder.
226
 
 *
227
 
 * \param decoder  A pointer to an existing decoder.
228
 
 * \assert
229
 
 *    \code decoder != NULL \endcode
230
 
 */
231
 
OggFLAC_API void OggFLAC__stream_decoder_delete(OggFLAC__StreamDecoder *decoder);
232
 
 
233
 
 
234
 
/***********************************************************************
235
 
 *
236
 
 * Public class method prototypes
237
 
 *
238
 
 ***********************************************************************/
239
 
 
240
 
/** Set the read callback.
241
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_read_callback()
242
 
 *
243
 
 * \note
244
 
 * The callback is mandatory and must be set before initialization.
245
 
 *
246
 
 * \default \c NULL
247
 
 * \param  decoder  A decoder instance to set.
248
 
 * \param  value    See above.
249
 
 * \assert
250
 
 *    \code decoder != NULL \endcode
251
 
 *    \code value != NULL \endcode
252
 
 * \retval FLAC__bool
253
 
 *    \c false if the decoder is already initialized, else \c true.
254
 
 */
255
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_read_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderReadCallback value);
256
 
 
257
 
/** Set the write callback.
258
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_write_callback()
259
 
 *
260
 
 * \note
261
 
 * The callback is mandatory and must be set before initialization.
262
 
 *
263
 
 * \default \c NULL
264
 
 * \param  decoder  A decoder instance to set.
265
 
 * \param  value    See above.
266
 
 * \assert
267
 
 *    \code decoder != NULL \endcode
268
 
 *    \code value != NULL \endcode
269
 
 * \retval FLAC__bool
270
 
 *    \c false if the decoder is already initialized, else \c true.
271
 
 */
272
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_write_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderWriteCallback value);
273
 
 
274
 
/** Set the metadata callback.
275
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_callback()
276
 
 *
277
 
 * \note
278
 
 * The callback is mandatory and must be set before initialization.
279
 
 *
280
 
 * \default \c NULL
281
 
 * \param  decoder  A decoder instance to set.
282
 
 * \param  value    See above.
283
 
 * \assert
284
 
 *    \code decoder != NULL \endcode
285
 
 *    \code value != NULL \endcode
286
 
 * \retval FLAC__bool
287
 
 *    \c false if the decoder is already initialized, else \c true.
288
 
 */
289
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderMetadataCallback value);
290
 
 
291
 
/** Set the error callback.
292
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_error_callback()
293
 
 *
294
 
 * \note
295
 
 * The callback is mandatory and must be set before initialization.
296
 
 *
297
 
 * \default \c NULL
298
 
 * \param  decoder  A decoder instance to set.
299
 
 * \param  value    See above.
300
 
 * \assert
301
 
 *    \code decoder != NULL \endcode
302
 
 *    \code value != NULL \endcode
303
 
 * \retval FLAC__bool
304
 
 *    \c false if the decoder is already initialized, else \c true.
305
 
 */
306
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_error_callback(OggFLAC__StreamDecoder *decoder, OggFLAC__StreamDecoderErrorCallback value);
307
 
 
308
 
/** Set the client data to be passed back to callbacks.
309
 
 *  This value will be supplied to callbacks in their \a client_data
310
 
 *  argument.
311
 
 *
312
 
 * \default \c NULL
313
 
 * \param  decoder  A decoder instance to set.
314
 
 * \param  value    See above.
315
 
 * \assert
316
 
 *    \code decoder != NULL \endcode
317
 
 * \retval FLAC__bool
318
 
 *    \c false if the decoder is already initialized, else \c true.
319
 
 */
320
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_client_data(OggFLAC__StreamDecoder *decoder, void *value);
321
 
 
322
 
/** Set the serial number for the Ogg stream.
323
 
 * The default behavior is to use the serial number of the first Ogg
324
 
 * page.  Setting a serial number here will explicitly specify which
325
 
 * stream is to be decoded.
326
 
 *
327
 
 * \default \c use serial number of first page
328
 
 * \param  decoder        A decoder instance to set.
329
 
 * \param  serial_number  See above.
330
 
 * \assert
331
 
 *    \code decoder != NULL \endcode
332
 
 * \retval FLAC__bool
333
 
 *    \c false if the decoder is already initialized, else \c true.
334
 
 */
335
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_serial_number(OggFLAC__StreamDecoder *decoder, long serial_number);
336
 
 
337
 
/** Direct the decoder to pass on all metadata blocks of type \a type.
338
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond()
339
 
 *
340
 
 * \default By default, only the \c STREAMINFO block is returned via the
341
 
 *          metadata callback.
342
 
 * \param  decoder  A decoder instance to set.
343
 
 * \param  type     See above.
344
 
 * \assert
345
 
 *    \code decoder != NULL \endcode
346
 
 *    \a type is valid
347
 
 * \retval FLAC__bool
348
 
 *    \c false if the decoder is already initialized, else \c true.
349
 
 */
350
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type);
351
 
 
352
 
/** Direct the decoder to pass on all APPLICATION metadata blocks of the
353
 
 *  given \a id.
354
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_application()
355
 
 *
356
 
 * \default By default, only the \c STREAMINFO block is returned via the
357
 
 *          metadata callback.
358
 
 * \param  decoder  A decoder instance to set.
359
 
 * \param  id       See above.
360
 
 * \assert
361
 
 *    \code decoder != NULL \endcode
362
 
 *    \code id != NULL \endcode
363
 
 * \retval FLAC__bool
364
 
 *    \c false if the decoder is already initialized, else \c true.
365
 
 */
366
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
367
 
 
368
 
/** Direct the decoder to pass on all metadata blocks of any type.
369
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_respond_all()
370
 
 *
371
 
 * \default By default, only the \c STREAMINFO block is returned via the
372
 
 *          metadata callback.
373
 
 * \param  decoder  A decoder instance to set.
374
 
 * \assert
375
 
 *    \code decoder != NULL \endcode
376
 
 * \retval FLAC__bool
377
 
 *    \c false if the decoder is already initialized, else \c true.
378
 
 */
379
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_respond_all(OggFLAC__StreamDecoder *decoder);
380
 
 
381
 
/** Direct the decoder to filter out all metadata blocks of type \a type.
382
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore()
383
 
 *
384
 
 * \default By default, only the \c STREAMINFO block is returned via the
385
 
 *          metadata callback.
386
 
 * \param  decoder  A decoder instance to set.
387
 
 * \param  type     See above.
388
 
 * \assert
389
 
 *    \code decoder != NULL \endcode
390
 
 *    \a type is valid
391
 
 * \retval FLAC__bool
392
 
 *    \c false if the decoder is already initialized, else \c true.
393
 
 */
394
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore(OggFLAC__StreamDecoder *decoder, FLAC__MetadataType type);
395
 
 
396
 
/** Direct the decoder to filter out all APPLICATION metadata blocks of
397
 
 *  the given \a id.
398
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_application()
399
 
 *
400
 
 * \default By default, only the \c STREAMINFO block is returned via the
401
 
 *          metadata callback.
402
 
 * \param  decoder  A decoder instance to set.
403
 
 * \param  id       See above.
404
 
 * \assert
405
 
 *    \code decoder != NULL \endcode
406
 
 *    \code id != NULL \endcode
407
 
 * \retval FLAC__bool
408
 
 *    \c false if the decoder is already initialized, else \c true.
409
 
 */
410
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_application(OggFLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
411
 
 
412
 
/** Direct the decoder to filter out all metadata blocks of any type.
413
 
 * This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_set_metadata_ignore_all()
414
 
 *
415
 
 * \default By default, only the \c STREAMINFO block is returned via the
416
 
 *          metadata callback.
417
 
 * \param  decoder  A decoder instance to set.
418
 
 * \assert
419
 
 *    \code decoder != NULL \endcode
420
 
 * \retval FLAC__bool
421
 
 *    \c false if the decoder is already initialized, else \c true.
422
 
 */
423
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_set_metadata_ignore_all(OggFLAC__StreamDecoder *decoder);
424
 
 
425
 
/** Get the current decoder state.
426
 
 *
427
 
 * \param  decoder  A decoder instance to query.
428
 
 * \assert
429
 
 *    \code decoder != NULL \endcode
430
 
 * \retval OggFLAC__StreamDecoderState
431
 
 *    The current decoder state.
432
 
 */
433
 
OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_get_state(const OggFLAC__StreamDecoder *decoder);
434
 
 
435
 
/** Get the state of the underlying FLAC stream decoder.
436
 
 *  Useful when the stream decoder state is
437
 
 *  \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR.
438
 
 *
439
 
 * \param  decoder  A decoder instance to query.
440
 
 * \assert
441
 
 *    \code decoder != NULL \endcode
442
 
 * \retval FLAC__StreamDecoderState
443
 
 *    The FLAC stream decoder state.
444
 
 */
445
 
OggFLAC_API FLAC__StreamDecoderState OggFLAC__stream_decoder_get_FLAC_stream_decoder_state(const OggFLAC__StreamDecoder *decoder);
446
 
 
447
 
/** Get the current decoder state as a C string.
448
 
 *  This version automatically resolves
449
 
 *  \c OggFLAC__STREAM_DECODER_FLAC_STREAM_DECODER_ERROR
450
 
 *  by getting the FLAC stream decoder's state.
451
 
 *
452
 
 * \param  decoder  A decoder instance to query.
453
 
 * \assert
454
 
 *    \code decoder != NULL \endcode
455
 
 * \retval const char *
456
 
 *    The decoder state as a C string.  Do not modify the contents.
457
 
 */
458
 
OggFLAC_API const char *OggFLAC__stream_decoder_get_resolved_state_string(const OggFLAC__StreamDecoder *decoder);
459
 
 
460
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channels()
461
 
 *
462
 
 * \param  decoder  A decoder instance to query.
463
 
 * \assert
464
 
 *    \code decoder != NULL \endcode
465
 
 * \retval unsigned
466
 
 *    See above.
467
 
 */
468
 
OggFLAC_API unsigned OggFLAC__stream_decoder_get_channels(const OggFLAC__StreamDecoder *decoder);
469
 
 
470
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_channel_assignment()
471
 
 *
472
 
 * \param  decoder  A decoder instance to query.
473
 
 * \assert
474
 
 *    \code decoder != NULL \endcode
475
 
 * \retval OggFLAC__ChannelAssignment
476
 
 *    See above.
477
 
 */
478
 
OggFLAC_API FLAC__ChannelAssignment OggFLAC__stream_decoder_get_channel_assignment(const OggFLAC__StreamDecoder *decoder);
479
 
 
480
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_bits_per_sample()
481
 
 *
482
 
 * \param  decoder  A decoder instance to query.
483
 
 * \assert
484
 
 *    \code decoder != NULL \endcode
485
 
 * \retval unsigned
486
 
 *    See above.
487
 
 */
488
 
OggFLAC_API unsigned OggFLAC__stream_decoder_get_bits_per_sample(const OggFLAC__StreamDecoder *decoder);
489
 
 
490
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_sample_rate()
491
 
 *
492
 
 * \param  decoder  A decoder instance to query.
493
 
 * \assert
494
 
 *    \code decoder != NULL \endcode
495
 
 * \retval unsigned
496
 
 *    See above.
497
 
 */
498
 
OggFLAC_API unsigned OggFLAC__stream_decoder_get_sample_rate(const OggFLAC__StreamDecoder *decoder);
499
 
 
500
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_get_blocksize()
501
 
 *
502
 
 * \param  decoder  A decoder instance to query.
503
 
 * \assert
504
 
 *    \code decoder != NULL \endcode
505
 
 * \retval unsigned
506
 
 *    See above.
507
 
 */
508
 
OggFLAC_API unsigned OggFLAC__stream_decoder_get_blocksize(const OggFLAC__StreamDecoder *decoder);
509
 
 
510
 
/** Initialize the decoder instance.
511
 
 *  Should be called after OggFLAC__stream_decoder_new() and
512
 
 *  OggFLAC__stream_decoder_set_*() but before any of the
513
 
 *  OggFLAC__stream_decoder_process_*() functions.  Will set and return the
514
 
 *  decoder state, which will be OggFLAC__STREAM_DECODER_OK
515
 
 *  if initialization succeeded.
516
 
 *
517
 
 * \param  decoder  An uninitialized decoder instance.
518
 
 * \assert
519
 
 *    \code decoder != NULL \endcode
520
 
 * \retval OggFLAC__StreamDecoderState
521
 
 *    \c OggFLAC__STREAM_DECODER_OK if initialization was
522
 
 *    successful; see OggFLAC__StreamDecoderState for the meanings of other
523
 
 *    return values.
524
 
 */
525
 
OggFLAC_API OggFLAC__StreamDecoderState OggFLAC__stream_decoder_init(OggFLAC__StreamDecoder *decoder);
526
 
 
527
 
/** Finish the decoding process.
528
 
 *  Flushes the decoding buffer, releases resources, resets the decoder
529
 
 *  settings to their defaults, and returns the decoder state to
530
 
 *  OggFLAC__STREAM_DECODER_UNINITIALIZED.
531
 
 *
532
 
 *  In the event of a prematurely-terminated decode, it is not strictly
533
 
 *  necessary to call this immediately before OggFLAC__stream_decoder_delete()
534
 
 *  but it is good practice to match every OggFLAC__stream_decoder_init()
535
 
 *  with an OggFLAC__stream_decoder_finish().
536
 
 *
537
 
 * \param  decoder  An uninitialized decoder instance.
538
 
 * \assert
539
 
 *    \code decoder != NULL \endcode
540
 
 */
541
 
OggFLAC_API void OggFLAC__stream_decoder_finish(OggFLAC__StreamDecoder *decoder);
542
 
 
543
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_flush()
544
 
 *
545
 
 * \param  decoder  A decoder instance.
546
 
 * \assert
547
 
 *    \code decoder != NULL \endcode
548
 
 * \retval FLAC__bool
549
 
 *    \c true if successful, else \c false if a memory allocation
550
 
 *    error occurs.
551
 
 */
552
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_flush(OggFLAC__StreamDecoder *decoder);
553
 
 
554
 
/** This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_reset()
555
 
 *
556
 
 * \param  decoder  A decoder instance.
557
 
 * \assert
558
 
 *    \code decoder != NULL \endcode
559
 
 * \retval FLAC__bool
560
 
 *    \c true if successful, else \c false if a memory allocation
561
 
 *    error occurs.
562
 
 */
563
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_reset(OggFLAC__StreamDecoder *decoder);
564
 
 
565
 
/** Decode one metadata block or audio frame.
566
 
 *  This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_single()
567
 
 *
568
 
 * \param  decoder  An initialized decoder instance in the state
569
 
 *                  \c OggFLAC__STREAM_DECODER_OK.
570
 
 * \assert
571
 
 *    \code decoder != NULL \endcode
572
 
 *    \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
573
 
 * \retval FLAC__bool
574
 
 *    \c false if any read or write error occurred (except
575
 
 *    \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true;
576
 
 *    in any case, check the decoder state with
577
 
 *    OggFLAC__stream_decoder_get_state() to see what went wrong or to
578
 
 *    check for lost synchronization (a sign of stream corruption).
579
 
 */
580
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_single(OggFLAC__StreamDecoder *decoder);
581
 
 
582
 
/** Decode until the end of the metadata.
583
 
 *  This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_metadata()
584
 
 *
585
 
 * \param  decoder  An initialized decoder instance in the state
586
 
 *                  \c OggFLAC__STREAM_DECODER_OK.
587
 
 * \assert
588
 
 *    \code decoder != NULL \endcode
589
 
 *    \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
590
 
 * \retval FLAC__bool
591
 
 *    \c false if any read or write error occurred (except
592
 
 *    \c OggFLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true;
593
 
 *    in any case, check the decoder state with
594
 
 *    OggFLAC__stream_decoder_get_state() to see what went wrong or to
595
 
 *    check for lost synchronization (a sign of stream corruption).
596
 
 */
597
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_metadata(OggFLAC__StreamDecoder *decoder);
598
 
 
599
 
/** Decode until the end of the stream.
600
 
 *  This is inherited from FLAC__StreamDecoder; see FLAC__stream_decoder_process_until_end_of_stream()
601
 
 *
602
 
 * \param  decoder  An initialized decoder instance in the state
603
 
 *                  \c OggFLAC__STREAM_DECODER_OK.
604
 
 * \assert
605
 
 *    \code decoder != NULL \endcode
606
 
 *    \code OggFLAC__stream_decoder_get_state(decoder) == OggFLAC__STREAM_DECODER_OK \endcode
607
 
 * \retval FLAC__bool
608
 
 *    \c false if any read or write error occurred (except
609
 
 *    \c OggFLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c true;
610
 
 *    in any case, check the decoder state with
611
 
 *    OggFLAC__stream_decoder_get_state() to see what went wrong or to
612
 
 *    check for lost synchronization (a sign of stream corruption).
613
 
 */
614
 
OggFLAC_API FLAC__bool OggFLAC__stream_decoder_process_until_end_of_stream(OggFLAC__StreamDecoder *decoder);
615
 
 
616
 
/* \} */
617
 
 
618
 
#ifdef __cplusplus
619
 
}
620
 
#endif
621
 
 
622
 
#endif