mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Tweaks
This commit is contained in:
parent
122622252a
commit
15aa8652c6
@ -509,6 +509,7 @@ static int play_compressed_file(const char *filename, struct params *par, const
|
||||
|
||||
if (!mkdtemp(temp_dir)) {
|
||||
fprintf(stderr, "%s: error creating temp dir for decompression\n", temp_dir);
|
||||
ret = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -567,8 +568,7 @@ static int play_compressed_file(const char *filename, struct params *par, const
|
||||
remove(temp_file);
|
||||
remove(temp_dir);
|
||||
|
||||
fail:
|
||||
|
||||
fail:
|
||||
free(cmd);
|
||||
free(temp_file);
|
||||
|
||||
|
@ -1124,11 +1124,14 @@ size_t ms_ima_bytes_to_samples(size_t bytes, int block_align, int channels) {
|
||||
}
|
||||
|
||||
size_t xbox_ima_bytes_to_samples(size_t bytes, int channels) {
|
||||
int mod;
|
||||
int block_align = 0x24 * channels;
|
||||
if (channels <= 0) return 0;
|
||||
|
||||
mod = bytes % block_align;
|
||||
/* XBOX IMA blocks have a 4 byte header per channel; 2 samples per byte (2 nibbles) */
|
||||
return (bytes / block_align) * (block_align - 4 * channels) * 2 / channels
|
||||
+ ((bytes % block_align) ? ((bytes % block_align) - 4 * channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
|
||||
+ ((mod > 0 && mod > 0x04*channels) ? (mod - 0x04*channels) * 2 / channels : 0); /* unlikely (encoder aligns) */
|
||||
}
|
||||
|
||||
size_t dat4_ima_bytes_to_samples(size_t bytes, int channels) {
|
||||
|
@ -902,7 +902,7 @@ static void add_extension(int length, char * dst, const char * ext) {
|
||||
|
||||
/* copy new extension + double null terminate */
|
||||
/* ex: "vgmstream\0vgmstream Audio File (*.VGMSTREAM)\0" */
|
||||
written = sprintf(buf, "%s%c%s Audio File (*.%s)%c", ext,'\0',ext_upp,ext_upp,'\0');
|
||||
written = snprintf(buf,sizeof(buf)-1, "%s%c%s Audio File (*.%s)%c", ext,'\0',ext_upp,ext_upp,'\0');
|
||||
for (j = 0; j < written; i++,j++)
|
||||
dst[i] = buf[j];
|
||||
dst[i] = '\0';
|
||||
|
Loading…
x
Reference in New Issue
Block a user