From aeb866fcf751e19def7e1f11b0e1a07692eeee29 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 26 Jul 2020 11:20:49 +0200 Subject: [PATCH] Adjust check --- cli/vgmstream_cli.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/vgmstream_cli.c b/cli/vgmstream_cli.c index 532b5d5d..7327360f 100644 --- a/cli/vgmstream_cli.c +++ b/cli/vgmstream_cli.c @@ -36,7 +36,7 @@ static void usage(const char* name, int is_full) { fprintf(stderr,"vgmstream CLI decoder " VERSION " " __DATE__ "\n" "Usage: %s [-o outfile.wav] [options] infile\n" "Options:\n" - " -o outfile.wav: name of output .wav file, default infile.wav\n" + " -o : name of output .wav file, default .wav\n" " -l loop count: loop count, default 2.0\n" " -f fade time: fade time in seconds after N loops, default 10.0\n" " -d fade delay: fade delay in seconds, default 0.0\n" @@ -418,6 +418,12 @@ int main(int argc, char** argv) { /* enable after config but before outbuf */ vgmstream_mixing_enable(vgmstream, SAMPLE_BUFFER_SIZE, &input_channels, &channels); + /* get final play config */ + len_samples = vgmstream_get_samples(vgmstream); + if (len_samples <= 0) + goto fail; + + if (cfg.play_forever && !vgmstream_get_play_forever(vgmstream)) { fprintf(stderr,"File can't be played forever"); goto fail; @@ -467,9 +473,6 @@ int main(int argc, char** argv) { } - /* get final play config */ - len_samples = vgmstream_get_samples(vgmstream); - if (cfg.seek_samples >= len_samples) cfg.seek_samples = 0; len_samples -= cfg.seek_samples;