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  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA  02111-1307, USA.
    00018  */
    00019
    00020 #ifndef FLAC__STREAM_DECODER_H
    00021 #define FLAC__STREAM_DECODER_H
    00022
    00023 #include "export.h"
    00024 #include "format.h"
    00025
    00026 #ifdef __cplusplus
    00027 extern "C" {
    00028 #endif
    00029
    00030
    00184 typedef enum {
    00185
    00186     FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
    00189     FLAC__STREAM_DECODER_READ_METADATA,
    00192     FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
    00195     FLAC__STREAM_DECODER_READ_FRAME,
    00198     FLAC__STREAM_DECODER_END_OF_STREAM,
    00201     FLAC__STREAM_DECODER_ABORTED,
    00204     FLAC__STREAM_DECODER_UNPARSEABLE_STREAM,
    00207     FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
    00210     FLAC__STREAM_DECODER_ALREADY_INITIALIZED,
    00216     FLAC__STREAM_DECODER_INVALID_CALLBACK,
    00219     FLAC__STREAM_DECODER_UNINITIALIZED
    00222 } FLAC__StreamDecoderState;
    00223
    00229 extern FLAC_API const char * const FLAC__StreamDecoderStateString[];
    00230
    00231
    00234 typedef enum {
    00235
    00236     FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
    00239     FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
    00242     FLAC__STREAM_DECODER_READ_STATUS_ABORT
    00245 } FLAC__StreamDecoderReadStatus;
    00246
    00252 extern FLAC_API const char * const FLAC__StreamDecoderReadStatusString[];
    00253
    00254
    00257 typedef enum {
    00258
    00259     FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
    00262     FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
    00265 } FLAC__StreamDecoderWriteStatus;
    00266
    00272 extern FLAC_API const char * const FLAC__StreamDecoderWriteStatusString[];
    00273
    00274
    00277 typedef enum {
    00278
    00279     FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
    00282     FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
    00285     FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
    00288 } FLAC__StreamDecoderErrorStatus;
    00289
    00295 extern FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[];
    00296
    00297
    00298 /***********************************************************************
    00299  *
    00300  * class FLAC__StreamDecoder
    00301  *
    00302  ***********************************************************************/
    00303
    00304 struct FLAC__StreamDecoderProtected;
    00305 struct FLAC__StreamDecoderPrivate;
    00310 typedef struct {
    00311     struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
    00312     struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
    00313 } FLAC__StreamDecoder;
    00314
    00331 typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
    00332
    00350 typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
    00351
    00360 typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
    00361
    00370 typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
    00371
    00372
    00373 /***********************************************************************
    00374  *
    00375  * Class constructor/destructor
    00376  *
    00377  ***********************************************************************/
    00378
    00386 FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new();
    00387
    00394 FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
    00395
    00396
    00397 /***********************************************************************
    00398  *
    00399  * Public class method prototypes
    00400  *
    00401  ***********************************************************************/
    00402
    00423 FLAC_API FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value);
    00424
    00443 FLAC_API FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value);
    00444
    00471 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value);
    00472
    00489 FLAC_API FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value);
    00490
    00503 FLAC_API FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
    00504
    00517 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
    00518
    00532 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
    00533
    00544 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
    00545
    00558 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
    00559
    00573 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
    00574
    00585 FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
    00586
    00595 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
    00596
    00607 FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
    00608
    00619 FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
    00620
    00631 FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
    00632
    00643 FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
    00644
    00655 FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
    00656
    00672 FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
    00673
    00688 FLAC_API void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
    00689
    00701 FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
    00702
    00717 FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
    00718
    00743 FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
    00744
    00768 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
    00769
    00793 FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
    00794
    00795 /* \} */
    00796
    00797 #ifdef __cplusplus
    00798 }
    00799 #endif
    00800
    00801 #endif