Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

include/FLAC/stream_decoder.h

Go to the documentation of this file.
00001 /* libFLAC - Free Lossless Audio Codec library
00002  * Copyright (C) 2000,2001,2002,2003  Josh Coalson
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  *
00008  * - Redistributions of source code must retain the above copyright
00009  * notice, this list of conditions and the following disclaimer.
00010  *
00011  * - Redistributions in binary form must reproduce the above copyright
00012  * notice, this list of conditions and the following disclaimer in the
00013  * documentation and/or other materials provided with the distribution.
00014  *
00015  * - Neither the name of the Xiph.org Foundation nor the names of its
00016  * contributors may be used to endorse or promote products derived from
00017  * this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00020  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00021  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00022  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
00023  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00024  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00025  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00026  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00027  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00028  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00029  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030  */
00031 
00032 #ifndef FLAC__STREAM_DECODER_H
00033 #define FLAC__STREAM_DECODER_H
00034 
00035 #include "export.h"
00036 #include "format.h"
00037 
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 
00196 typedef enum {
00197 
00198     FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
00201     FLAC__STREAM_DECODER_READ_METADATA,
00204     FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
00207     FLAC__STREAM_DECODER_READ_FRAME,
00210     FLAC__STREAM_DECODER_END_OF_STREAM,
00213     FLAC__STREAM_DECODER_ABORTED,
00216     FLAC__STREAM_DECODER_UNPARSEABLE_STREAM,
00219     FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
00222     FLAC__STREAM_DECODER_ALREADY_INITIALIZED,
00228     FLAC__STREAM_DECODER_INVALID_CALLBACK,
00231     FLAC__STREAM_DECODER_UNINITIALIZED
00234 } FLAC__StreamDecoderState;
00235 
00241 extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
00242 
00243 
00246 typedef enum {
00247 
00248     FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
00251     FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
00254     FLAC__STREAM_DECODER_READ_STATUS_ABORT
00257 } FLAC__StreamDecoderReadStatus;
00258 
00264 extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
00265 
00266 
00269 typedef enum {
00270 
00271     FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
00274     FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
00277 } FLAC__StreamDecoderWriteStatus;
00278 
00284 extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
00285 
00286 
00289 typedef enum {
00290 
00291     FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
00294     FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
00297     FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
00300 } FLAC__StreamDecoderErrorStatus;
00301 
00307 extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
00308 
00309 
00310 /***********************************************************************
00311  *
00312  * class FLAC__StreamDecoder
00313  *
00314  ***********************************************************************/
00315 
00316 struct FLAC__StreamDecoderProtected;
00317 struct FLAC__StreamDecoderPrivate;
00322 typedef struct {
00323     struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
00324     struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
00325 } FLAC__StreamDecoder;
00326 
00343 typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
00344 
00362 typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
00363 
00372 typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
00373 
00382 typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
00383 
00384 
00385 /***********************************************************************
00386  *
00387  * Class constructor/destructor
00388  *
00389  ***********************************************************************/
00390 
00398 FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new();
00399 
00406 FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
00407 
00408 
00409 /***********************************************************************
00410  *
00411  * Public class method prototypes
00412  *
00413  ***********************************************************************/
00414 
00435 FLAC_API FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value);
00436 
00455 FLAC_API FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value);
00456 
00483 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value);
00484 
00501 FLAC_API FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value);
00502 
00515 FLAC_API FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
00516 
00529 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
00530 
00544 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
00545 
00556 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
00557 
00570 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
00571 
00585 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
00586 
00597 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
00598 
00607 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
00608 
00617 FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
00618 
00629 FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
00630 
00641 FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
00642 
00653 FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
00654 
00665 FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
00666 
00677 FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
00678 
00694 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
00695 
00710 FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
00711 
00723 FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
00724 
00739 FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
00740 
00765 FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
00766 
00790 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
00791 
00815 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
00816 
00817 /* \} */
00818 
00819 #ifdef __cplusplus
00820 }
00821 #endif
00822 
00823 #endif

Generated on Fri Oct 3 00:07:11 2003 for FLAC by doxygen1.3