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  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 "format.h"
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 
00183 typedef enum {
00184 
00185     FLAC__STREAM_DECODER_SEARCH_FOR_METADATA = 0,
00188     FLAC__STREAM_DECODER_READ_METADATA,
00191     FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC,
00194     FLAC__STREAM_DECODER_READ_FRAME,
00197     FLAC__STREAM_DECODER_END_OF_STREAM,
00200     FLAC__STREAM_DECODER_ABORTED,
00203     FLAC__STREAM_DECODER_UNPARSEABLE_STREAM,
00206     FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
00209     FLAC__STREAM_DECODER_ALREADY_INITIALIZED,
00215     FLAC__STREAM_DECODER_INVALID_CALLBACK,
00218     FLAC__STREAM_DECODER_UNINITIALIZED
00221 } FLAC__StreamDecoderState;
00222 
00228 extern const char * const FLAC__StreamDecoderStateString[];
00229 
00230 
00233 typedef enum {
00234 
00235     FLAC__STREAM_DECODER_READ_STATUS_CONTINUE,
00238     FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM,
00241     FLAC__STREAM_DECODER_READ_STATUS_ABORT
00244 } FLAC__StreamDecoderReadStatus;
00245 
00251 extern const char * const FLAC__StreamDecoderReadStatusString[];
00252 
00253 
00256 typedef enum {
00257 
00258     FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE,
00261     FLAC__STREAM_DECODER_WRITE_STATUS_ABORT
00264 } FLAC__StreamDecoderWriteStatus;
00265 
00271 extern const char * const FLAC__StreamDecoderWriteStatusString[];
00272 
00273 
00276 typedef enum {
00277 
00278     FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC,
00281     FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER,
00284     FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
00287 } FLAC__StreamDecoderErrorStatus;
00288 
00294 extern const char * const FLAC__StreamDecoderErrorStatusString[];
00295 
00296 
00297 /***********************************************************************
00298  *
00299  * class FLAC__StreamDecoder
00300  *
00301  ***********************************************************************/
00302 
00303 struct FLAC__StreamDecoderProtected;
00304 struct FLAC__StreamDecoderPrivate;
00309 typedef struct {
00310     struct FLAC__StreamDecoderProtected *protected_; /* avoid the C++ keyword 'protected' */
00311     struct FLAC__StreamDecoderPrivate *private_; /* avoid the C++ keyword 'private' */
00312 } FLAC__StreamDecoder;
00313 
00330 typedef FLAC__StreamDecoderReadStatus (*FLAC__StreamDecoderReadCallback)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
00331 
00349 typedef FLAC__StreamDecoderWriteStatus (*FLAC__StreamDecoderWriteCallback)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
00350 
00359 typedef void (*FLAC__StreamDecoderMetadataCallback)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
00360 
00369 typedef void (*FLAC__StreamDecoderErrorCallback)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
00370 
00371 
00372 /***********************************************************************
00373  *
00374  * Class constructor/destructor
00375  *
00376  ***********************************************************************/
00377 
00385 FLAC__StreamDecoder *FLAC__stream_decoder_new();
00386 
00393 void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder);
00394 
00395 
00396 /***********************************************************************
00397  *
00398  * Public class method prototypes
00399  *
00400  ***********************************************************************/
00401 
00422 FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback value);
00423 
00442 FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteCallback value);
00443 
00470 FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderMetadataCallback value);
00471 
00488 FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorCallback value);
00489 
00502 FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
00503 
00516 FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
00517 
00531 FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
00532 
00543 FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
00544 
00557 FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetadataType type);
00558 
00572 FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
00573 
00584 FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
00585 
00594 FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
00595 
00606 unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
00607 
00618 FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
00619 
00630 unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
00631 
00642 unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
00643 
00654 unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
00655 
00671 FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
00672 
00687 void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
00688 
00700 FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
00701 
00716 FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
00717 
00742 FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
00743 
00767 FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
00768 
00792 FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
00793 
00794 /* \} */
00795 
00796 #ifdef __cplusplus
00797 }
00798 #endif
00799 
00800 #endif

Generated on Tue Sep 24 21:17:41 2002 for FLAC by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002