make sure sample length is never 0

This commit is contained in:
Bill Currie 2004-04-29 03:00:25 +00:00
parent c456eb1f80
commit c99a011f21

View file

@ -272,16 +272,16 @@ get_info (QFile *file)
info.rate = dfmt->samples_per_sec; info.rate = dfmt->samples_per_sec;
info.width = dfmt->bits_per_sample / 8; info.width = dfmt->bits_per_sample / 8;
info.channels = dfmt->channels; info.channels = dfmt->channels;
info.samples = 0;
if (cp) { if (cp) {
info.loopstart = cp->sample_offset; info.loopstart = cp->sample_offset;
if (dltxt) if (dltxt)
info.samples = info.loopstart + dltxt->len; info.samples = info.loopstart + dltxt->len;
else
info.samples = data->ck.len / (info.width * info.channels);
} else { } else {
info.loopstart = -1; info.loopstart = -1;
info.samples = data->ck.len / (info.width * info.channels);
} }
if (!info.samples)
info.samples = data->ck.len / (info.width * info.channels);
info.dataofs = *(int *)data->data; info.dataofs = *(int *)data->data;
info.datalen = data->ck.len; info.datalen = data->ck.len;