Skip to content
Snippets Groups Projects
Commit 9da5343f authored by Philippe Gorley's avatar Philippe Gorley Committed by Adrien Béraud
Browse files

test: write little endian wav file for decoder

RIFF identifier supposes little endian data.

Change-Id: I56aa829c49388daf04f0249151ca7ef3e35416f4
parent 042b28e7
No related branches found
No related tags found
No related merge requests found
...@@ -113,22 +113,10 @@ MediaDecoderTest::testAudioFile() ...@@ -113,22 +113,10 @@ MediaDecoderTest::testAudioFile()
template<typename Word> template<typename Word>
static std::ostream& write(std::ostream& os, Word value, unsigned size) static std::ostream& write(std::ostream& os, Word value, unsigned size)
{ {
union {
uint32_t i;
char c[4];
} big = {0x01020304};
// big endian if 0x01 is the first byte
if (big.c[0] == 1) {
while (size)
os.put(static_cast<char>((value >> (8 * --size)) & 0xFF));
return os;
} else {
for (; size; --size, value >>= 8) for (; size; --size, value >>= 8)
os.put(static_cast<char>(value & 0xFF)); os.put(static_cast<char>(value & 0xFF));
return os; return os;
} }
}
void void
MediaDecoderTest::writeWav() MediaDecoderTest::writeWav()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment