On Tue, 11 Oct 2005, bn wrote:
> Below is a patch to fix this (excuse the word-wrap,
> courtesy of yahoo mail; I'll attach it separately as
> well), by adding a 'whole_unit' variable to class
The attached patch worked fine.
Not necessary to include both a yahoo version and an attachment
(the attachment would have been sufficient) ;)
I extended the check to include 20 bit samples since those are also
permitted for DVD-Video (not sure about DVD-Audio).
> + whole_unit = 2 * (bits_per_sample == 24 ? 3 : 1)
Became
> + whole_unit = 2 * ((bits_per_sample == 24 || bits_per_sample == 20) ? 3 :
> 1)
Thanks for the patch - it's in CVS and should be available for
anonymous update in a few hours.
Cheers,
Steven Schultz
*** audiostrm0.hpp Mon Mar 15 13:47:43 2004
--- audiostrm.hpp Tue Oct 11 13:45:11 2005
*************** private:
*** 172,177 ****
--- 172,178 ----
unsigned int samples_per_second;
unsigned int channels;
unsigned int bits_per_sample;
+ unsigned int whole_unit;
unsigned int bytes_per_frame;
unsigned int frame_index;
unsigned int dynamic_range_code;
--- lpcmstrm_in0.cpp 2005-05-30 14:20:09.000000000 -0400
+++ lpcmstrm_in.cpp 2005-10-11 13:44:50.138500000 -0400
@@ -103,6 +103,7 @@ void LPCMStream::Init ( const int _strea
samples_per_second * channels * bits_per_sample / 8
* ticks_per_frame_90kHz
/ 90000;
+ whole_unit = 2 * (bits_per_sample == 24 ? 3 : 1) * channels;
frame_index = 0;
dynamic_range_code = 0x80;
@@ -212,8 +213,8 @@ LPCMStream::ReadPacketPayload(uint8_t *d
{
unsigned int header_size = LPCMStream::StreamHeaderSize();
bitcount_t read_start = bs.GetBytePos();
- unsigned int bytes_read = bs.GetBytes( dst+header_size,
- to_read-header_size );
+ unsigned int bytes_read = bs.GetBytes( dst + header_size,
+ (( to_read - header_size ) / whole_unit ) * whole_unit );
bs.Flush( read_start );
clockticks decode_time;