On Mon, Nov 06, 2006 at 08:50:44AM -0800, Josh Coalson wrote:
> ok, tried it out... passes test/test_seeking.sh and my
> "xmms twitch" test, checked in to CVS.  thanks!

Thanks!

I see you have changed the channels and bps setting, this doesn't work
when the decoder hasn't decoded a frame. There should be a fallback
for this case.

-- 
Miroslav Lichvar
Index: stream_decoder.c
===================================================================
RCS file: /cvsroot/flac/flac/src/libFLAC/stream_decoder.c,v
retrieving revision 1.119
diff -u -r1.119 stream_decoder.c
--- stream_decoder.c    6 Nov 2006 16:48:33 -0000       1.119
+++ stream_decoder.c    7 Nov 2006 09:13:30 -0000
@@ -2935,10 +2935,16 @@
        const unsigned max_framesize = 
decoder->private_->stream_info.data.stream_info.max_framesize;
        const unsigned min_framesize = 
decoder->private_->stream_info.data.stream_info.min_framesize;
        /* take these from the current frame in case they've changed mid-stream 
*/
-       const unsigned channels = FLAC__stream_decoder_get_channels(decoder);
-       const unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
+       unsigned channels = FLAC__stream_decoder_get_channels(decoder);
+       unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder);
        const FLAC__StreamMetadata_SeekTable *seek_table = 
decoder->private_->has_seek_table? 
&decoder->private_->seek_table.data.seek_table : 0;
 
+       /* use values from stream info if we didn't decode a frame */
+       if (channels == 0)
+               channels = 
decoder->private_->stream_info.data.stream_info.channels;
+       if (bps == 0)
+               bps = 
decoder->private_->stream_info.data.stream_info.bits_per_sample;
+
        /* we are just guessing here */
        if(max_framesize > 0)
                approx_bytes_per_frame = (max_framesize + min_framesize) / 2 + 
1;
_______________________________________________
Flac-dev mailing list
Flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to