Commit d21f1cbe authored by Michael Smith's avatar Michael Smith

A user wanted to be able to repeat/loop playing things with ogg123. Such a

patch, it turns out, is fairly trivial. Added --repeat option.

svn path=/trunk/vorbis-tools/; revision=9838
parent 13d7d0fd
......@@ -51,6 +51,7 @@ struct option long_options[] = {
{"shuffle", no_argument, 0, 'z'},
{"list", required_argument, 0, '@'},
{"audio-buffer", required_argument, 0, 0},
{"repeat", no_argument, 0, 0},
{0, 0, 0, 0}
};
......@@ -85,6 +86,8 @@ int parse_cmdline_options (int argc, char **argv,
case 0:
if(!strcmp(long_options[option_index].name, "audio-buffer")) {
ogg123_opts->buffer_size = 1024 * atoi(optarg);
} else if(!strcmp(long_options[option_index].name, "repeat")) {
ogg123_opts->repeat = 1;
} else {
status_error(_("Internal error parsing command line options.\n"));
exit(1);
......
......@@ -153,6 +153,7 @@ void options_init (ogg123_options_t *opts)
opts->status_freq = 10.0;
opts->playlist = NULL;
opts->repeat = 0;
}
......@@ -393,6 +394,8 @@ int main(int argc, char **argv)
while (i < items && !sig_request.exit) {
play(playlist_array[i]);
i++;
if(i == items && options.repeat)
i = 0;
}
playlist_array_destroy(playlist_array, items);
......
......@@ -26,6 +26,7 @@ typedef struct ogg123_options_t {
long int verbosity; /* Verbose output if > 1, quiet if 0 */
int shuffle; /* Should we shuffle playing? */
int repeat; /* Repeat playlist indefinately? */
ogg_int64_t delay; /* delay (in millisecs) for skip to next song */
int nth; /* Play every nth chunk */
int ntimes; /* Play every chunk n times */
......@@ -44,6 +45,7 @@ typedef struct ogg123_options_t {
double status_freq; /* Number of status updates per second */
playlist_t *playlist; /* List of files to play */
} ogg123_options_t;
typedef struct signal_request_t {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment