[xiph-cvs] cvs commit: ices/src im_playlist.c playlist_basic.c playlist_script.c im_playlist.h

Karl Heyes karl at xiph.org
Tue Aug 12 17:58:02 PDT 2003



karl        03/08/12 20:58:02

  Modified:    src      im_playlist.c playlist_basic.c playlist_script.c
                        im_playlist.h
  Log:
  random playlist wasn't good enough, some files at the beginning were
  staying at the beginning of the playlist.
  
  Provide playlist param "allow-repeats" (default 0) to allow for the
  same file to be played again.

Revision  Changes    Path
1.13      +2 -2      ices/src/im_playlist.c

Index: im_playlist.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/im_playlist.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- im_playlist.c	9 Jul 2003 23:47:01 -0000	1.12
+++ im_playlist.c	13 Aug 2003 00:58:01 -0000	1.13
@@ -1,7 +1,7 @@
 /* playlist.c
  * - Basic playlist functionality
  *
- * $Id: im_playlist.c,v 1.12 2003/07/09 23:47:01 karl Exp $
+ * $Id: im_playlist.c,v 1.13 2003/08/13 00:58:01 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -124,7 +124,7 @@
 
         if (strcmp (newfn, "-"))
         {
-            if (pl->filename && !strcmp(pl->filename, newfn))
+            if (!pl->allow_repeat && pl->filename && !strcmp(pl->filename, newfn))
             {
                 LOG_ERROR0("Cannot play same file twice in a row, skipping");
                 pl->errors++;

<p><p>1.13      +4 -2      ices/src/playlist_basic.c

Index: playlist_basic.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/playlist_basic.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- playlist_basic.c	9 Jul 2003 23:47:01 -0000	1.12
+++ playlist_basic.c	13 Aug 2003 00:58:02 -0000	1.13
@@ -1,7 +1,7 @@
 /* playlist_basic.c
  * - Simple built-in unscripted playlist
  *
- * $Id: playlist_basic.c,v 1.12 2003/07/09 23:47:01 karl Exp $
+ * $Id: playlist_basic.c,v 1.13 2003/08/13 00:58:02 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -40,7 +40,7 @@
     n = len;
     while(n > 1)
     {
-        d = (int)(((double) rand() / RAND_MAX) * n);
+        d = (int) ((double)len * rand()/(RAND_MAX+1.0));
         temp = buf[d];
         buf[d] = buf[n-1];
         buf[n-1] = temp;
@@ -203,6 +203,8 @@
             data->random = atoi(params->value);
         else if(!strcmp(params->name, "once"))
             data->once = atoi(params->value);
+        else if(!strcmp(params->name, "allow-repeats"))
+            pl->allow_repeat = atoi(params->value);
         else if(!strcmp(params->name, "restart-after-reread"))
             data->restartafterreread = atoi(params->value);
         else if(!strcmp(params->name, "type"))

<p><p>1.7       +3 -1      ices/src/playlist_script.c

Index: playlist_script.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/playlist_script.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- playlist_script.c	22 Mar 2003 02:27:55 -0000	1.6
+++ playlist_script.c	13 Aug 2003 00:58:02 -0000	1.7
@@ -2,7 +2,7 @@
  * - Gets a filename to play back based on output from a program/shell script
  *   run each time.
  *
- * $Id: playlist_script.c,v 1.6 2003/03/22 02:27:55 karl Exp $
+ * $Id: playlist_script.c,v 1.7 2003/08/13 00:58:02 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -106,6 +106,8 @@
             if(data->program) free(data->program);
             data->program = params->value;
         }
+        else if(!strcmp(params->name, "allow-repeats"))
+            pl->allow_repeat = atoi(params->value);
         else if(!strcmp(params->name, "type")) {
             /* We ignore this one */
         }

<p><p>1.5       +2 -1      ices/src/im_playlist.h

Index: im_playlist.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/im_playlist.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- im_playlist.h	16 Mar 2003 14:21:48 -0000	1.4
+++ im_playlist.h	13 Aug 2003 00:58:02 -0000	1.5
@@ -1,7 +1,7 @@
 /* im_playlist.h
  * - Basic playlist functionality
  *
- * $Id: im_playlist.h,v 1.4 2003/03/16 14:21:48 msmith Exp $
+ * $Id: im_playlist.h,v 1.5 2003/08/13 00:58:02 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -23,6 +23,7 @@
     char *filename; /* Currently streaming file */
     int errors; /* Consecutive errors */
     int nexttrack;
+    int allow_repeat;
     ogg_sync_state oy;
     
     char *(*get_filename)(void *data); /* returns the next desired filename */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list