2002-07-22 16:17:58 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "QF/dstring.h"
|
2003-04-10 16:52:39 +00:00
|
|
|
#include "QF/riff.h"
|
2003-04-10 05:20:59 +00:00
|
|
|
|
2002-07-22 16:17:58 +00:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2002-07-29 21:38:43 +00:00
|
|
|
|
2002-07-22 16:17:58 +00:00
|
|
|
while (*++argv) {
|
2003-04-10 16:52:39 +00:00
|
|
|
QFile *f;
|
2003-04-10 21:45:12 +00:00
|
|
|
riff_t *riff = 0;
|
|
|
|
riff_d_chunk_t **ck;
|
2002-07-29 21:38:43 +00:00
|
|
|
int sample_start, sample_count;
|
2003-04-10 21:33:43 +00:00
|
|
|
|
2003-04-10 16:52:39 +00:00
|
|
|
f = Qopen (*argv, "rbz");
|
|
|
|
if (f) {
|
|
|
|
riff = riff_read (f);
|
|
|
|
Qclose (f);
|
|
|
|
}
|
|
|
|
if (!f || !riff) {
|
2002-07-29 21:38:43 +00:00
|
|
|
fprintf (stderr, "couldn't read %s\n", *argv);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
sample_start = -1;
|
|
|
|
sample_count = -1;
|
|
|
|
for (ck = riff->chunks; *ck; ck++) {
|
2003-04-10 21:45:12 +00:00
|
|
|
RIFF_SWITCH ((*ck)->name) {
|
|
|
|
case RIFF_CASE ('c', 'u', 'e', ' '):
|
2002-07-29 21:38:43 +00:00
|
|
|
{
|
2003-04-10 21:45:12 +00:00
|
|
|
riff_cue_t *cue = (riff_cue_t *)*ck;
|
|
|
|
riff_d_cue_t *dcue = cue->cue;
|
|
|
|
riff_d_cue_point_t *cp = dcue->cue_points;
|
2002-07-29 21:38:43 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < dcue->count; i++)
|
|
|
|
sample_start = cp[i].sample_offset;
|
|
|
|
#if 0
|
|
|
|
printf ("cuepoint: %d %d %.4s %d %d %d\n",
|
|
|
|
cp[i].name,
|
|
|
|
cp[i].position,
|
|
|
|
cp[i].chunk,
|
|
|
|
cp[i].chunk_start,
|
|
|
|
cp[i].block_start,
|
|
|
|
cp[i].sample_offset);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
2003-04-10 21:45:12 +00:00
|
|
|
case RIFF_CASE ('L','I','S','T'):
|
2002-07-29 21:38:43 +00:00
|
|
|
{
|
2003-04-10 21:45:12 +00:00
|
|
|
riff_list_t *list = (riff_list_t *)*ck;
|
|
|
|
RIFF_SWITCH (list->name) {
|
|
|
|
case RIFF_CASE ('a','d','t','l'):
|
2002-07-29 21:38:43 +00:00
|
|
|
{
|
2003-04-10 21:45:12 +00:00
|
|
|
riff_d_chunk_t **ck;
|
2002-07-29 21:38:43 +00:00
|
|
|
for (ck = list->chunks; *ck; ck++) {
|
2003-04-10 21:45:12 +00:00
|
|
|
RIFF_SWITCH ((*ck)->name) {
|
|
|
|
case RIFF_CASE ('l', 't', 'x', 't'):
|
2002-07-29 21:38:43 +00:00
|
|
|
{
|
2003-04-10 21:45:12 +00:00
|
|
|
riff_ltxt_t *ltxt = (riff_ltxt_t *)*ck;
|
|
|
|
riff_d_ltxt_t *dltxt = <xt->ltxt;
|
2002-07-29 21:38:43 +00:00
|
|
|
sample_count = dltxt->len;
|
|
|
|
#if 0
|
|
|
|
printf ("ltxt: %d %d %4s %d %d %d %d\n",
|
|
|
|
dltxt->name,
|
|
|
|
dltxt->len,
|
|
|
|
dltxt->purpose,
|
|
|
|
dltxt->country,
|
|
|
|
dltxt->language,
|
|
|
|
dltxt->dialect,
|
|
|
|
dltxt->codepage);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-04-10 21:45:12 +00:00
|
|
|
case RIFF_CASE ('d','a','t','a'):
|
2002-07-29 21:38:43 +00:00
|
|
|
#if 0
|
2003-04-10 21:33:43 +00:00
|
|
|
printf ("data: %d %d\n", *(int*)((data_t*)(*ck))->data, (*ck)->len);
|
2002-07-29 21:38:43 +00:00
|
|
|
#endif
|
|
|
|
sample_count = (*ck)->len;
|
|
|
|
break;
|
2002-07-22 16:17:58 +00:00
|
|
|
}
|
|
|
|
}
|
2002-07-29 21:39:42 +00:00
|
|
|
if (sample_start!= -1)
|
|
|
|
printf ("CUEPOINT=%d %d\n", sample_start, sample_count);
|
2003-04-10 05:20:59 +00:00
|
|
|
riff_free (riff);
|
2002-07-22 16:17:58 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|