diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-24 21:34:15 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-24 21:34:15 +0000 |
commit | aa9ddbd8ba2259b27382d7e763c717cbbc32f884 (patch) | |
tree | 6311c5919b13969e66a17339248ec4a4668abbfb | |
parent | 64cccb0f801d2a493486a132f7af0b51e9db3a34 (diff) |
Fixed header calculation goofs that would've affected mono files and little-endian targets. A bit of general cleanup. Time for bed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11586 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/aiff_enc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/codecs/aiff_enc.c b/apps/codecs/aiff_enc.c index 50c682fa31..8b6e2217c9 100644 --- a/apps/codecs/aiff_enc.c +++ b/apps/codecs/aiff_enc.c @@ -83,8 +83,8 @@ uint32_t sample_rate; uint32_t enc_size; /* convert unsigned 32 bit value to 80-bit floating point number */ -static void uint32_to_ieee754_extended(uint8_t f[10], uint32_t l) ICODE_ATTR; -static void uint32_to_ieee754_extended(uint8_t f[10], uint32_t l) +static void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l) ICODE_ATTR; +static void uint32_h_to_ieee754_extended_be(uint8_t f[10], uint32_t l) { int32_t exp; @@ -103,7 +103,7 @@ static void uint32_to_ieee754_extended(uint8_t f[10], uint32_t l) /* mantissa is value left justified with most significant non-zero bit stored in bit 63 - bits 0-63 */ *(uint32_t *)&f[2] = htobe32(l); -} /* long_to_ieee754_extended */ +} /* uint32_h_to_ieee754_extended_be */ /* called version often - inline */ static inline bool is_file_data_ok(struct enc_file_event_data *data) ICODE_ATTR; @@ -177,12 +177,12 @@ static bool on_end_file(struct enc_file_event_data *data) data_size = data->num_pcm_samples*num_channels*PCM_DEPTH_BYTES; /* 'FORM' chunk */ - hdr.form_size = data_size + sizeof (hdr) - 8; + hdr.form_size = htobe32(data_size + sizeof (hdr) - 8); /* 'COMM' chunk */ hdr.num_channels = htobe16(num_channels); - hdr.num_sample_frames = htobe32(data->num_pcm_samples*num_channels/2); - uint32_to_ieee754_extended(hdr.sample_rate, sample_rate); + hdr.num_sample_frames = htobe32(data->num_pcm_samples); + uint32_h_to_ieee754_extended_be(hdr.sample_rate, sample_rate); /* 'SSND' chunk */ hdr.ssnd_size = htobe32(data_size + 8); |