[xiph-commits] r9838 - trunk/vorbis-tools/ogg123

msmith at svn.xiph.org msmith at svn.xiph.org
Wed Aug 24 04:56:40 PDT 2005


Author: msmith
Date: 2005-08-24 04:56:30 -0700 (Wed, 24 Aug 2005)
New Revision: 9838

Modified:
   trunk/vorbis-tools/ogg123/cmdline_options.c
   trunk/vorbis-tools/ogg123/ogg123.c
   trunk/vorbis-tools/ogg123/ogg123.h
Log:
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.


Modified: trunk/vorbis-tools/ogg123/cmdline_options.c
===================================================================
--- trunk/vorbis-tools/ogg123/cmdline_options.c	2005-08-24 09:55:54 UTC (rev 9837)
+++ trunk/vorbis-tools/ogg123/cmdline_options.c	2005-08-24 11:56:30 UTC (rev 9838)
@@ -51,6 +51,7 @@
     {"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 @@
       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);

Modified: trunk/vorbis-tools/ogg123/ogg123.c
===================================================================
--- trunk/vorbis-tools/ogg123/ogg123.c	2005-08-24 09:55:54 UTC (rev 9837)
+++ trunk/vorbis-tools/ogg123/ogg123.c	2005-08-24 11:56:30 UTC (rev 9838)
@@ -153,6 +153,7 @@
 
   opts->status_freq = 10.0;
   opts->playlist = NULL;
+  opts->repeat = 0;
 
 }
 
@@ -393,6 +394,8 @@
   while (i < items && !sig_request.exit) {
     play(playlist_array[i]);
     i++;
+    if(i == items && options.repeat)
+      i = 0;
   }
 
   playlist_array_destroy(playlist_array, items);

Modified: trunk/vorbis-tools/ogg123/ogg123.h
===================================================================
--- trunk/vorbis-tools/ogg123/ogg123.h	2005-08-24 09:55:54 UTC (rev 9837)
+++ trunk/vorbis-tools/ogg123/ogg123.h	2005-08-24 11:56:30 UTC (rev 9838)
@@ -26,6 +26,7 @@
   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 @@
   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 {



More information about the commits mailing list