[xiph-cvs] cvs commit: vorbis-tools/ogg123 ogg123.c ogg123.h
Kenneth C. Arnold
kcarnold at xiph.org
Tue Jun 19 10:15:33 PDT 2001
kcarnold 01/06/19 10:15:33
Modified: ogg123 ogg123.c ogg123.h
Log:
SIGINT is configurable now.
Revision Changes Path
1.36 +18 -11 vorbis-tools/ogg123/ogg123.c
Index: ogg123.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ogg123.c 2001/06/19 16:47:42 1.35
+++ ogg123.c 2001/06/19 17:15:32 1.36
@@ -14,7 +14,7 @@
* *
********************************************************************
- last mod: $Id: ogg123.c,v 1.35 2001/06/19 16:47:42 kcarnold Exp $
+ last mod: $Id: ogg123.c,v 1.36 2001/06/19 17:15:32 kcarnold Exp $
********************************************************************/
@@ -69,6 +69,7 @@
{"quiet", no_argument, 0, 'q'},
{"shuffle", no_argument, 0, 'z'},
{"buffer", required_argument, 0, 'b'},
+ {"delay", required_argument, 0, 'l'},
{0, 0, 0, 0}
};
@@ -94,7 +95,11 @@
" -b n, --buffer n use a buffer of 'n' chunks (4096 bytes)\n"
" -v, --verbose display progress and other useful stuff\n"
" -q, --quiet don't display anything (no title)\n"
- " -z, --shuffle shuffle play\n");
+ " -z, --shuffle shuffle play\n"
+ "\n"
+ "ogg123 will skip to the next song on SIGINT (Ctrl-C) after s seconds after\n"
+ "song start."
+ " -l, --delay=s set s (default 1). If s=-1, disable song skip.\n");
}
int main(int argc, char **argv)
@@ -115,10 +120,11 @@
opt.instream = NULL;
opt.outdevices = NULL;
opt.buffer_size = 0;
+ opt.delay = 1;
ao_initialize();
- while (-1 != (ret = getopt_long(argc, argv, "b:d:hk:o:qvVz",
+ while (-1 != (ret = getopt_long(argc, argv, "b:d:hl:k:o:qvVz",
long_options, &option_index))) {
switch (ret) {
case 0:
@@ -142,6 +148,9 @@
case 'k':
opt.seekpos = atof(optarg);
break;
+ case 'l':
+ opt.delay = atoi(optarg);
+ break;
case 'o':
if (optarg && !add_option(current_options, optarg)) {
fprintf(stderr, "Incorrect option format: %s.\n", optarg);
@@ -359,17 +368,15 @@
return;
}
- /* Throw the comments plus a few lines about the bitstream we're
- * decoding */
-
-
/* Setup so that pressing ^C in the first second of playback
* interrupts the program, but after the first second, skips
* the song. This functionality is similar to mpg123's abilities. */
- skipfile_requested = 0;
- signal(SIGALRM,signal_activate_skipfile);
- alarm(1);
+ if (opt.delay > 0) {
+ skipfile_requested = 0;
+ signal(SIGALRM,signal_activate_skipfile);
+ alarm(opt.delay);
+ }
while (!eof) {
int i;
@@ -424,7 +431,7 @@
eof = eos = 1;
skipfile_requested = 0;
signal(SIGALRM,signal_activate_skipfile);
- alarm(1);
+ alarm(opt.delay);
break;
}
1.7 +1 -0 vorbis-tools/ogg123/ogg123.h
Index: ogg123.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/ogg123.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ogg123.h 2001/02/22 02:49:12 1.6
+++ ogg123.h 2001/06/19 17:15:32 1.7
@@ -31,6 +31,7 @@
devices_t *outdevices; /* Streams to write to. */
int buffer_size; /* Size of the buffer in chunks. */
int rate, channels; /* playback params for opening audio devices */
+ int delay; /* delay for skip to next song */
} ogg123_options_t; /* Changed in 0.6 to be non-static */
/* This goes here because it relies on some of the above. */
--- >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