[xiph-cvs] cvs commit: ices/src input.c playlist_script.c
Michael Smith
msmith at xiph.org
Fri Aug 9 06:59:02 PDT 2002
msmith 02/08/09 09:59:02
Modified: src input.c playlist_script.c
Log:
Change timing initialisation code slightly, shouldn't have any impact.
Various bugfixes including a major fd leak to playlist_script, from
Karl Heyes
Revision Changes Path
1.15 +8 -7 ices/src/input.c
Index: input.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/input.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- input.c 4 Aug 2002 03:00:34 -0000 1.14
+++ input.c 9 Aug 2002 13:59:02 -0000 1.15
@@ -2,7 +2,7 @@
* - Main producer control loop. Fetches data from input modules, and controls
* submission of these to the instance threads. Timing control happens here.
*
- * $Id: input.c,v 1.14 2002/08/04 03:00:34 msmith Exp $
+ * $Id: input.c,v 1.15 2002/08/09 13:59:02 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -94,9 +94,6 @@
static int _calculate_pcm_sleep(ref_buffer *buf, timing_control *control)
{
- if(control->starttime == 0)
- control->starttime = timing_get_time();
-
control->senttime += ((double)buf->len * 1000000.)/((double)buf->aux_data);
return 0;
@@ -112,9 +109,6 @@
vorbis_comment vc;
int ret = 0;
- if(control->starttime == 0)
- control->starttime = timing_get_time();
-
og.header_len = buf->aux_data;
og.body_len = buf->len - buf->aux_data;
og.header = buf->buf;
@@ -336,6 +330,13 @@
free(chunk);
continue;
}
+
+ /* If this is the first time through, set initial time. This should
+ * be done before the call to inmod->getdata() below, in order to
+ * properly keep time if this input module blocks.
+ */
+ if(control->starttime == 0)
+ control->starttime = timing_get_time();
/* get a chunk of data from the input module */
ret = inmod->getdata(inmod->internal, chunk);
<p><p>1.4 +15 -2 ices/src/playlist_script.c
Index: playlist_script.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/playlist_script.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- playlist_script.c 7 Jul 2002 11:07:55 -0000 1.3
+++ playlist_script.c 9 Aug 2002 13:59:02 -0000 1.4
@@ -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.3 2002/07/07 11:07:55 msmith Exp $
+ * $Id: playlist_script.c,v 1.4 2002/08/09 13:59:02 msmith Exp $
*
* Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
*
@@ -39,6 +39,9 @@
FILE *pipe;
char *buf = calloc(1,1024);
+ if(!buf)
+ return NULL;
+
pipe = popen(prog, "r");
if(!pipe) {
@@ -48,17 +51,25 @@
if(fgets(buf, 1024, pipe) == NULL) {
LOG_ERROR1("Couldn't read filename from pipe to program \"%s\"", prog);
+ free(buf);
+ pclose(pipe);
return NULL;
}
+ pclose(pipe);
+
if(buf[0] == '\n' || (buf[0] == '\r' && buf[1] == '\n')) {
LOG_ERROR1("Got newlines instead of filename from program \"%s\"", prog);
+ free(buf);
return NULL;
}
if(buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = 0;
- /* De-fuck windows files. */
+ else
+ LOG_WARN1("Retrieved overly long filename \"%s\" from script, this may fail", buf);
+
+ /* De-fuck windows filenames. */
if(strlen(buf) > 0 && buf[strlen(buf)-1] == '\r')
buf[strlen(buf)-1] = 0;
@@ -81,6 +92,8 @@
pl->free_filename = playlist_script_free_filename;
pl->data = calloc(1, sizeof(script_playlist));
+ if(!pl->data)
+ return -1;
data = (script_playlist *)pl->data;
<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