[xiph-cvs] cvs commit: ices/src playlist_basic.c playlist_script.c im_playlist.c im_playlist.h
Michael Smith
msmith at xiph.org
Sun Jul 7 04:07:56 PDT 2002
msmith 02/07/07 04:07:56
Modified: src playlist_basic.c playlist_script.c im_playlist.c
im_playlist.h
Log:
Fix playlist script module to work for more than one file. Clean up some
of the internal interfaces to make this neater.
Revision Changes Path
1.6 +6 -1 ices/src/playlist_basic.c
Index: playlist_basic.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/playlist_basic.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- playlist_basic.c 2001/11/10 05:07:17 1.5
+++ playlist_basic.c 2002/07/07 11:07:55 1.6
@@ -1,7 +1,7 @@
/* playlist_basic.c
* - Simple built-in unscripted playlist
*
- * $Id: playlist_basic.c,v 1.5 2001/11/10 05:07:17 msmith Exp $
+ * $Id: playlist_basic.c,v 1.6 2002/07/07 11:07:55 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -161,12 +161,17 @@
return NULL; /* Once-through mode, at end */
}
+void playlist_basic_free_filename(void *data, char *fn)
+{
+}
+
int playlist_basic_initialise(module_param_t *params, playlist_state_t *pl)
{
basic_playlist *data;
pl->get_filename = playlist_basic_get_next_filename;
pl->clear = playlist_basic_clear;
+ pl->free_filename = playlist_basic_free_filename;
pl->data = calloc(1, sizeof(basic_playlist));
data = (basic_playlist *)pl->data;
<p><p>1.3 +13 -4 ices/src/playlist_script.c
Index: playlist_script.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/playlist_script.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- playlist_script.c 2002/06/29 15:34:50 1.2
+++ playlist_script.c 2002/07/07 11:07:55 1.3
@@ -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.2 2002/06/29 15:34:50 msmith Exp $
+ * $Id: playlist_script.c,v 1.3 2002/07/07 11:07:55 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -26,7 +26,6 @@
typedef struct {
char *program;
- char fn[1024];
} script_playlist;
void playlist_script_clear(void *data) {
@@ -38,11 +37,15 @@
script_playlist *pl = data;
char *prog = pl->program;
FILE *pipe;
- char *buf = pl->fn;
+ char *buf = calloc(1,1024);
-
pipe = popen(prog, "r");
+ if(!pipe) {
+ LOG_ERROR1("Couldn't open pipe to program \"%s\"", prog);
+ return NULL;
+ }
+
if(fgets(buf, 1024, pipe) == NULL) {
LOG_ERROR1("Couldn't read filename from pipe to program \"%s\"", prog);
return NULL;
@@ -64,12 +67,18 @@
return buf;
}
+void playlist_script_free_filename(void *data, char *fn)
+{
+ free(fn);
+}
+
int playlist_script_initialise(module_param_t *params, playlist_state_t *pl)
{
script_playlist *data;
pl->get_filename = playlist_script_get_filename;
pl->clear = playlist_script_clear;
+ pl->free_filename = playlist_script_free_filename;
pl->data = calloc(1, sizeof(script_playlist));
<p><p>1.5 +2 -1 ices/src/im_playlist.c
Index: im_playlist.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/im_playlist.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- im_playlist.c 2002/06/29 15:19:18 1.4
+++ im_playlist.c 2002/07/07 11:07:55 1.5
@@ -1,7 +1,7 @@
/* playlist.c
* - Basic playlist functionality
*
- * $Id: im_playlist.c,v 1.4 2002/06/29 15:19:18 msmith Exp $
+ * $Id: im_playlist.c,v 1.5 2002/07/07 11:07:55 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -119,6 +119,7 @@
return 0;
}
+ pl->free_filename(pl->data, pl->filename);
pl->filename = newfn;
if(!pl->filename)
<p><p>1.3 +3 -1 ices/src/im_playlist.h
Index: im_playlist.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/im_playlist.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- im_playlist.h 2001/09/25 12:04:21 1.2
+++ im_playlist.h 2002/07/07 11:07:55 1.3
@@ -1,7 +1,7 @@
/* im_playlist.h
* - Basic playlist functionality
*
- * $Id: im_playlist.h,v 1.2 2001/09/25 12:04:21 msmith Exp $
+ * $Id: im_playlist.h,v 1.3 2002/07/07 11:07:55 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -26,6 +26,8 @@
ogg_sync_state oy;
char *(*get_filename)(void *data); /* returns the next desired filename */
+ void (*free_filename)(void *data, char *fn); /* Called when im_playlist is
+ done with this filename */
void (*clear)(void *data); /* module clears self here */
void *data; /* Internal data for this particular playlist module */
<p><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