static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual);
static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder);
static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data);
static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual);
static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder);
static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data);
static FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes);
static FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
#endif
static FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
static void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status);
static FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
static FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes);
static FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
#endif
static FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
static void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status);
static FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
static FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
#endif
static FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
#endif
static FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
***********************************************************************/
typedef struct FLAC__StreamDecoderPrivate {
***********************************************************************/
typedef struct FLAC__StreamDecoderPrivate {
FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
FLAC__uint64 target_sample;
unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
FLAC__uint64 target_sample;
unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */
FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
#endif
} FLAC__StreamDecoderPrivate;
FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */
#endif
} FLAC__StreamDecoderPrivate;
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
decoder->private_->is_ogg = is_ogg;
if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect))
return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR;
decoder->private_->is_ogg = is_ogg;
if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect))
return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR;
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect);
#endif
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect);
#endif
FLAC__ASSERT(0 != decoder->protected_);
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return false;
FLAC__ASSERT(0 != decoder->protected_);
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return false;
/* can't check decoder->private_->is_ogg since that's not set until init time */
FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value);
return true;
/* can't check decoder->private_->is_ogg since that's not set until init time */
FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value);
return true;
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect);
#endif
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect);
#endif
/*@@@ could go in !internal_reset_hack block below */
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect);
/*@@@ could go in !internal_reset_hack block below */
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect);
decoder->private_->is_ogg?
seek_to_absolute_sample_ogg_(decoder, length, sample) :
#endif
decoder->private_->is_ogg?
seek_to_absolute_sample_ogg_(decoder, length, sample) :
#endif
decoder->private_->is_ogg?
read_callback_ogg_aspect_(decoder, buffer, bytes) :
#endif
decoder->private_->is_ogg?
read_callback_ogg_aspect_(decoder, buffer, bytes) :
#endif
FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes)
{
switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) {
FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes)
{
switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) {
FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample)
{
FLAC__uint64 left_pos = 0, right_pos = stream_length;
FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample)
{
FLAC__uint64 left_pos = 0, right_pos = stream_length;