mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
read fmt chunks properly
This commit is contained in:
parent
5e98c762ed
commit
722c55391e
3 changed files with 28 additions and 2 deletions
|
@ -56,8 +56,8 @@ typedef struct riff_d_cue_s {
|
|||
typedef struct riff_d_format_s {
|
||||
unsigned short format_tag;
|
||||
unsigned short channels;
|
||||
unsigned samples_pre_sec;
|
||||
unsigned byte_per_sec;
|
||||
unsigned samples_per_sec;
|
||||
unsigned bytes_per_sec;
|
||||
unsigned short align;
|
||||
} riff_d_format_t;
|
||||
|
||||
|
|
|
@ -312,6 +312,18 @@ riff_read (QFile *f)
|
|||
chunk = &list->ck;
|
||||
}
|
||||
break;
|
||||
case RIFF_CASE ('f','m','t',' '):
|
||||
{
|
||||
riff_format_t *fmt;
|
||||
fmt = malloc (sizeof (riff_format_t) + ck.len);
|
||||
fmt->ck = ck;
|
||||
if (!Rread (f, fmt->fdata, ck.len)) {
|
||||
free (fmt);
|
||||
} else {
|
||||
chunk = &fmt->ck;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RIFF_CASE ('d','a','t','a'):
|
||||
{
|
||||
riff_data_t *data = malloc (sizeof (riff_data_t));
|
||||
|
@ -455,6 +467,9 @@ riff_free (riff_t *riff)
|
|||
list = (riff_list_t *) *ck;
|
||||
free_list (list);
|
||||
break;
|
||||
case RIFF_CASE ('f','m','t',' '):
|
||||
free (*ck);
|
||||
break;
|
||||
default:
|
||||
data = (riff_data_t *) *ck;
|
||||
if (data->data)
|
||||
|
|
|
@ -27,6 +27,17 @@ main (int argc, char **argv)
|
|||
sample_count = -1;
|
||||
for (ck = riff->chunks; *ck; ck++) {
|
||||
RIFF_SWITCH ((*ck)->name) {
|
||||
case RIFF_CASE ('f', 'm', 't', ' '):
|
||||
/*{
|
||||
riff_format_t *_fmt = (riff_format_t *) *ck;
|
||||
riff_d_format_t *fmt = (riff_d_format_t *) _fmt->fdata;
|
||||
printf ("fmt.format_tag = %d\n", fmt->format_tag);
|
||||
printf ("fmt.channels = %d\n", fmt->channels);
|
||||
printf ("fmt.samples_per_sec = %d\n", fmt->samples_per_sec);
|
||||
printf ("fmt.bytes_per_sec = %d\n", fmt->bytes_per_sec);
|
||||
printf ("fmt.align = %d\n", fmt->align);
|
||||
}*/
|
||||
break;
|
||||
case RIFF_CASE ('c', 'u', 'e', ' '):
|
||||
{
|
||||
riff_cue_t *cue = (riff_cue_t *)*ck;
|
||||
|
|
Loading…
Reference in a new issue