summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-06-01 02:25:36 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-06-01 02:25:36 +0000
commit763e2bc5216c85a4087797da5eb3534d5ade5657 (patch)
treedcfa247e151dfa132af70cdd339b1fa70299382f
parentbb71a2f5edd080de06db93c0d03f495fb24b1ec4 (diff)
downloadxine-lib-763e2bc5216c85a4087797da5eb3534d5ade5657.tar.gz
xine-lib-763e2bc5216c85a4087797da5eb3534d5ade5657.tar.bz2
ok, i can't get flac into an useable state after a read abort but it doesn't freeze anymore.
CVS patchset: 6620 CVS date: 2004/06/01 02:25:36
-rw-r--r--src/libflac/decoder_flac.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c
index 66179f9f3..631c5a294 100644
--- a/src/libflac/decoder_flac.c
+++ b/src/libflac/decoder_flac.c
@@ -32,6 +32,7 @@
#define LOG_MODULE "flac_decoder"
#define LOG_VERBOSE
+
/*
#define LOG
*/
@@ -186,9 +187,9 @@ flac_error_callback (const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status,
void *client_data)
{
- /* This will be called if there is an error in the flac stream */
+ /* This will be called if there is an error in the flac stream */
lprintf("flac_error_callback\n");
-
+
#ifdef LOG
if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC)
printf("libflac: Decoder lost synchronization.\n");
@@ -204,8 +205,6 @@ flac_error_callback (const FLAC__StreamDecoder *decoder,
}
-
-
/*
* FLAC plugin decoder
*/
@@ -237,7 +236,7 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
{
flac_decoder_t *this = (flac_decoder_t *) this_gen;
int ret = 1;
-
+
/* We are getting the stream header, open up the audio
* device, and collect information about the stream
*/
@@ -303,14 +302,19 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
/* We have enough to decode a frame */
while( ret && this->buf_pos > this->min_size ) {
- if( FLAC__stream_decoder_get_state(this->flac_decoder) ==
- FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) {
+ FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(this->flac_decoder);
+
+ if( state == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) {
lprintf("process_until_end_of_metadata\n");
-
ret = FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder);
- } else {
+ } else if ( state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ||
+ state == FLAC__STREAM_DECODER_READ_FRAME ) {
lprintf("process_single\n");
ret = FLAC__stream_decoder_process_single (this->flac_decoder);
+ } else {
+ lprintf("aborted.\n");
+ FLAC__stream_decoder_flush (this->flac_decoder);
+ break;
}
}
} else
@@ -330,6 +334,9 @@ flac_dispose (audio_decoder_t *this_gen) {
if (this->output_open)
this->stream->audio_out->close (this->stream->audio_out, this->stream);
+ if (this->buf)
+ free(this->buf);
+
free (this_gen);
}