Erik de Castro Lopo
2007-Jul-14 02:19 UTC
[Flac-dev] FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM
Hi all,
If I have code that does this:
while (FLAC__stream_decoder_process_single (decoder))
/* Do something. */ ;
I get an infinite loop. Shouldn't FLAC__stream_decoder_process_single
return false if it gets to FLAC__STREAM_DECODER_END_OF_STREAM?
If so, here's a patch.
Cheers,
Erik
------------------8<------------------8<------------------8<------------------
diff -u -r1.140 stream_decoder.c
--- src/libFLAC/stream_decoder.c 10 Jul 2007 02:08:51 -0000 1.140
+++ src/libFLAC/stream_decoder.c 14 Jul 2007 09:15:01 -0000
@@ -1060,6 +1060,7 @@
return true; /* above function sets the
status for us */
break;
case FLAC__STREAM_DECODER_END_OF_STREAM:
+ return false;
case FLAC__STREAM_DECODER_ABORTED:
return true;
default:
------------------8<------------------8<------------------8<------------------
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Python addresses true pseudocode's two major failings: that it
isn't standardized, and it isn't executable."
- Grant R. Griffin in comp.dsp
Josh Coalson
2007-Jul-24 20:17 UTC
[Flac-dev] FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM
--- Erik de Castro Lopo <erikd-flac@mega-nerd.com> wrote:> Hi all, > > If I have code that does this: > > while (FLAC__stream_decoder_process_single (decoder)) > /* Do something. */ ; > > I get an infinite loop. Shouldn't FLAC__stream_decoder_process_single > return false if it gets to FLAC__STREAM_DECODER_END_OF_STREAM?it supposed to be like that actually, there's a little explanation here: http://flac.sourceforge.net/api/group__flac__stream__decoder.html#ga45 Josh ____________________________________________________________________________________ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/
Erik de Castro Lopo
2007-Jul-25 01:42 UTC
[Flac-dev] FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM
Josh Coalson wrote:> > I get an infinite loop. Shouldn't FLAC__stream_decoder_process_single > > return false if it gets to FLAC__STREAM_DECODER_END_OF_STREAM? > > it supposed to be like that actually, there's a little explanation > here: > > http://flac.sourceforge.net/api/group__flac__stream__decoder.html#ga45Ok, I've read that and I agree that the behaviour I'm seeing matches that documentation However, I still don't understand why FLAC__stream_decoder_process_single() returns false when an error has occurred, but true when the read callback returns FLAC__STREAM_DECODER_END_OF_STREAM? Why isn't end of stream treated like any other error? Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "If you have one apple and I have one apple, if we exchange, each will have one apple. If you have one idea and i have one idea, if we exchange them, each will have two ideas!" -- Attributed the George Bernard Shaw
Reasonably Related Threads
- FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM
- FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM
- flac alpha with RIFF/AIFF metadata support
- Problem Hangup Help
- [Asterisk]Asterisk's behavior of a simple call