cli: extra debug seek flag

This commit is contained in:
bnnm 2023-05-29 00:38:31 +02:00
parent 5978311143
commit b121c14da6

View File

@ -87,6 +87,7 @@ static void usage(const char* progname, int is_help) {
" -v: validate extensions (for extension testing)\n"
" -r: reset and output a second file (for reset testing)\n"
" -k N: kills (seeks) N samples before decoding (for seek testing)\n"
" -2 seeks to loop start, -3 seeks to loop end\n"
" -K N: kills (seeks) again to N samples before decoding (for seek testing)\n"
" -t: print !tags found in !tags.m3u (for tag testing)\n"
" -T: print title (for title testing)\n"
@ -736,15 +737,24 @@ static int convert_file(cli_config* cfg) {
/* get final play config */
len_samples = vgmstream_get_samples(vgmstream);
if (len_samples <= 0)
if (len_samples <= 0) {
fprintf(stderr, "wrong time config\n");
goto fail;
}
if (cfg->seek_samples1 < -1) /* ex value for loop testing */
/* special values for loop testing */
if (cfg->seek_samples1 == -2) { /* loop start...end */
cfg->seek_samples1 = vgmstream->loop_start_sample;
if (cfg->seek_samples1 >= len_samples)
cfg->seek_samples1 = -1;
if (cfg->seek_samples2 >= len_samples)
cfg->seek_samples2 = -1;
}
if (cfg->seek_samples1 == -3) { /* loop end..end */
cfg->seek_samples1 = vgmstream->loop_end_sample;
}
/* would be ignored by seek code though (allowed for seek_samples2 to test this) */
if (cfg->seek_samples1 < -1 || cfg->seek_samples1 >= len_samples) {
fprintf(stderr, "wrong seek config\n");
goto fail;
}
if (cfg->play_forever && !vgmstream_get_play_forever(vgmstream)) {
fprintf(stderr, "file can't be played forever");