include/FLAC/stream_decoder.h Source File

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,2004,2005  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
    00344 typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
    00345
    00363 typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
    00364
    00373 typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
    00374
    00383 typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
    00384
    00385
    00386 /***********************************************************************
    00387  *
    00388  * Class constructor/destructor
    00389  *
    00390  ***********************************************************************/
    00391
    00399 FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new();
    00400
    00407 FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
    00408
    00409
    00410 /***********************************************************************
    00411  *
    00412  * Public class method prototypes
    00413  *
    00414  ***********************************************************************/
    00415
    00436 FLAC_API FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value);
    00437
    00456 FLAC_API FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value);
    00457
    00484 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value);
    00485
    00502 FLAC_API FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value);
    00503
    00516 FLAC_API FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
    00517
    00530 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
    00531
    00545 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
    00546
    00557 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
    00558
    00571 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
    00572
    00586 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
    00587
    00598 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
    00599
    00608 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
    00609
    00618 FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
    00619
    00630 FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
    00631
    00642 FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
    00643
    00654 FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
    00655
    00666 FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
    00667
    00678 FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
    00679
    00695 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
    00696
    00711 FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
    00712
    00724 FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
    00725
    00740 FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
    00741
    00776 FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
    00777
    00799 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
    00800
    00822 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
    00823
    00865 FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder *decoder);
    00866
    00867 /* \} */
    00868
    00869 #ifdef __cplusplus
    00870 }
    00871 #endif
    00872
    00873 #endif