summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pdbox
diff options
context:
space:
mode:
authorWincent Balin <wincent@rockbox.org>2011-11-08 23:48:24 +0000
committerWincent Balin <wincent@rockbox.org>2011-11-08 23:48:24 +0000
commitd01954cad2a8b6de0faadec599a24bac14350043 (patch)
tree49e789f327a440878ccbb3365e23f5b978cb03db /apps/plugins/pdbox
parent32eb8275f4d1e2f0f7442113ffafdb5c8eedd7c3 (diff)
downloadrockbox-d01954cad2a8b6de0faadec599a24bac14350043.tar.gz
rockbox-d01954cad2a8b6de0faadec599a24bac14350043.tar.bz2
rockbox-d01954cad2a8b6de0faadec599a24bac14350043.zip
Committing fix for FS#12249. Patch by Buschel. Further fixes for AIFF loader in PDBox in the future.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30944 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox')
-rw-r--r--apps/plugins/pdbox/PDa/src/d_soundfile.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/plugins/pdbox/PDa/src/d_soundfile.c b/apps/plugins/pdbox/PDa/src/d_soundfile.c
index 9aea9ca8f4..81e2d4008e 100644
--- a/apps/plugins/pdbox/PDa/src/d_soundfile.c
+++ b/apps/plugins/pdbox/PDa/src/d_soundfile.c
@@ -682,25 +682,27 @@ static int create_soundfile(t_canvas *canvas, const char *filename,
else if (filetype == FORMAT_AIFF)
{
long datasize = nframes * nchannels * bytespersamp;
- long longtmp;
- static unsigned char dogdoo[] =
- {0x40, 0x0e, 0xac, 0x44, 0, 0, 0, 0, 0, 0, 'S', 'S', 'N', 'D'};
+ long longtmp;
+ t_datachunk *aiffdc = (t_datachunk *)headerbuf + sizeof(t_aiff);
+ static unsigned char AIFF_splrate[] = {0x40, 0x0e, 0xac, 0x44, 0, 0, 0, 0, 0, 0};
+ static unsigned char datachunk_ID[] = {'S', 'S', 'N', 'D'};
if (strcmp(filenamebuf + strlen(filenamebuf)-4, ".aif") &&
- strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff"))
- strcat(filenamebuf, ".aif");
+ strcmp(filenamebuf + strlen(filenamebuf)-5, ".aiff"))
+ strcat(filenamebuf, ".aif");
strncpy(aiffhdr->a_fileid, "FORM", 4);
aiffhdr->a_chunksize = swap4(datasize + sizeof(*aiffhdr) + 4, swap);
strncpy(aiffhdr->a_aiffid, "AIFF", 4);
strncpy(aiffhdr->a_fmtid, "COMM", 4);
aiffhdr->a_fmtchunksize = swap4(18, swap);
aiffhdr->a_nchannels = swap2(nchannels, swap);
- longtmp = swap4(nframes, swap);
- memcpy(&aiffhdr->a_nframeshi, &longtmp, 4);
+ longtmp = swap4(nframes, swap);
+ memcpy(&aiffhdr->a_nframeshi, &longtmp, 4);
aiffhdr->a_bitspersamp = swap2(8 * bytespersamp, swap);
- memcpy(aiffhdr->a_samprate, dogdoo, sizeof(dogdoo));
- longtmp = swap4(datasize, swap);
- memcpy(aiffhdr->a_samprate + sizeof(dogdoo), &longtmp, 4);
- headersize = AIFFPLUS;
+ memcpy(aiffhdr->a_samprate, AIFF_splrate, sizeof(AIFF_splrate));
+ memcpy(aiffdc->dc_id, datachunk_ID, sizeof(datachunk_ID));
+ longtmp = swap4(datasize, swap);
+ memcpy(&aiffdc->dc_size, &longtmp, 4);
+ headersize = AIFFPLUS;
}
else /* WAVE format */
{