Summary: | akodelib incorrectly decodes ogg vorbis on ppc (plays noise) | ||
---|---|---|---|
Product: | akodelib | Reporter: | toojays |
Component: | general | Assignee: | Allan Sandfeld <kde> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
Patch for xiph_decoder
fix for akodelib vorbis decoding on big-endian archs |
Description
toojays
2004-09-07 13:01:33 UTC
If possible send the file to me (kde@carewolf.com), and I will test if it behaves differently here. The fact that it starts correctly and then changes, could mean that it changes format, or has a data error that puts akodelib in an odd state. Created attachment 7454 [details]
Patch for xiph_decoder
Someone ought to teach the xiph-developers about a little thing called "native
endian".
Please try the patch and see if it helps.
Yeah, nice one. The actual patch you supplied causes a segfault: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 16384 (LWP 22937)] 0x0efa7bb0 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:98 98 ((unsigned char*)xiph_developers_suck)[1] = 1; (gdb) bt #0 0x0efa7bb0 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:98 #1 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #2 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #3 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #4 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #5 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #6 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #7 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #8 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #9 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #10 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #11 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #12 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #13 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #14 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #15 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #16 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #17 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #18 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 #19 0x0efa7ba8 in VorbisDecoder (this=0x100a8a38, src=0x100a61b0) at vorbis_decoder.cpp:95 Previous frame inner to this frame (corrupt stack?) But, I understood the idea of what you were doing, so replaced the endianness check with one from the bottom of this page: http://www.unixpapa.com/incnote/byteorder.html I'll attach the resulting patch. It works fine now. Thanks. Created attachment 7455 [details]
fix for akodelib vorbis decoding on big-endian archs
CVS commit by carewolf: Fix big-endian decoding, since libvorbis do not respect native endian. CCMAIL:88992-done@bugs.kde.org M +7 -2 vorbis_decoder.cpp 1.5.2.2 --- kdemultimedia/akode/plugins/xiph_decoder/vorbis_decoder.cpp #1.5.2.1:1.5.2.2 @@ -71,5 +71,5 @@ extern "C" { VorbisDecoderPlugin vorbis_ struct VorbisDecoder::private_data { - private_data() : bitstream(0), eof(false), error(false), initialized(false) {}; + private_data() : bitstream(0), eof(false), error(false), initialized(false), big_endian(0) {}; OggVorbis_File *vf; vorbis_comment *vc; @@ -83,4 +83,6 @@ struct VorbisDecoder::private_data char buffer[8192]; bool initialized; + + int big_endian; }; @@ -92,4 +94,7 @@ VorbisDecoder::VorbisDecoder(File *src) m_data->src->openRO(); m_data->src->fadvise(); + + unsigned short endian_test = 1; + m_data->big_endian = 1 - (*((char *)(&endian_test))); }; @@ -177,5 +182,5 @@ bool VorbisDecoder::readFrame(AudioFrame int old_bitstream = m_data->bitstream; - long v = ov_read(m_data->vf, (char*)m_data->buffer, 8192,0,2,1, &m_data->bitstream); + long v = ov_read(m_data->vf, (char*)m_data->buffer, 8192, m_data->big_endian, 2, 1, &m_data->bitstream); if (v == 0 || v == OV_EOF ) m_data->eof = true; |