[xiph-cvs] cvs commit: vorbis-tools/ogg123 buffer.c buffer.h ogg123.c
Kenneth C. Arnold
kcarnold at xiph.org
Tue Jun 19 12:42:37 PDT 2001
kcarnold 01/06/19 12:42:36
Modified: ogg123 buffer.c buffer.h ogg123.c
Log:
Fixes to make buffering and SIGINT for next song play nice. If there's
nothing more anyone wants fixed for the day, I'll get to work on oggrip.
Revision Changes Path
1.7 +13 -0 vorbis-tools/ogg123/buffer.c
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- buffer.c 2001/06/19 16:30:18 1.6
+++ buffer.c 2001/06/19 19:42:35 1.7
@@ -15,6 +15,7 @@
#include <sys/time.h>
#include <unistd.h> /* for fork and pipe*/
#include <fcntl.h>
+#include <signal.h>
#include "ogg123.h"
#include "buffer.h"
@@ -31,6 +32,8 @@
void writer_main (volatile buf_t *buf, devices_t *d)
{
devices_t *d1;
+ signal (SIGINT, SIG_IGN);
+
while (! (buf->status & STAT_SHUTDOWN && buf->reader == buf->writer))
{
/* Writer just waits on reader to be done with buf_write.
@@ -39,6 +42,11 @@
write (buf->fds[1], "1", 1); /* This identifier could hold a lot
* more detail in the future. */
+ if (buf->status & STAT_FLUSH) {
+ buf->reader = buf->writer;
+ buf->status &= ~STAT_FLUSH;
+ }
+
while (buf->reader == buf->writer && !(buf->status & STAT_SHUTDOWN));
if (buf->reader == buf->writer) break;
@@ -177,6 +185,11 @@
buf->reader = buf->buffer;
else
buf->reader++;
+}
+
+void buffer_flush (buf_t *buf)
+{
+ buf->status |= STAT_FLUSH;
}
void buffer_shutdown (buf_t *buf)
1.2 +1 -1 vorbis-tools/ogg123/buffer.h
Index: buffer.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- buffer.h 2000/12/30 05:44:31 1.1
+++ buffer.h 2001/06/19 19:42:35 1.2
@@ -24,10 +24,10 @@
buf_t *fork_writer (long size, devices_t *d);
void submit_chunk (buf_t *buf, chunk_t chunk);
void buffer_shutdown (buf_t *buf);
+void buffer_flush (buf_t *buf);
#define STAT_FLUSH 1
#define STAT_SHUTDOWN 2
-
#endif /* !defined (__BUFFER_H) */
1.39 +4 -1 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- ogg123.c 2001/06/19 19:11:13 1.38
+++ ogg123.c 2001/06/19 19:42:35 1.39
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.38 2001/06/19 19:11:13 kcarnold Exp $
+ last mod: $Id: ogg123.c,v 1.39 2001/06/19 19:42:35 kcarnold Exp $
********************************************************************/
@@ -434,6 +434,9 @@
skipfile_requested = 0;
signal(SIGALRM,signal_activate_skipfile);
alarm(opt.delay);
+ if (buffer) {
+ buffer_flush (buffer);
+ }
break;
}
--- >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