Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audio - decode_int(): always use base 10, so that a ...



details:   https://anonhg.NetBSD.org/src/rev/c3298e258e6e
branches:  trunk
changeset: 540890:c3298e258e6e
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Dec 27 23:43:15 2002 +0000

description:
- decode_int(): always use base 10, so that a time of "1:09" works.
- decode_time(): 60 seconds in a minute, really.
both from tsarna%netbsd.org@localhost.

- be verbose about the time we are going to record for, if verbose.

diffstat:

 usr.bin/audio/common/audio.c  |  9 +++------
 usr.bin/audio/record/record.c |  8 ++++++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r fd992cd553ce -r c3298e258e6e usr.bin/audio/common/audio.c
--- a/usr.bin/audio/common/audio.c      Fri Dec 27 19:57:47 2002 +0000
+++ b/usr.bin/audio/common/audio.c      Fri Dec 27 23:43:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.15 2002/01/15 23:48:52 mrg Exp $   */
+/*     $NetBSD: audio.c,v 1.16 2002/12/27 23:43:15 mrg Exp $   */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -140,7 +140,7 @@
        char    *ep;
        int     ret;
 
-       ret = (int)strtoul(arg, &ep, 0);
+       ret = (int)strtoul(arg, &ep, 10);
 
        if (ep[0] == '\0') {
                *intp = ret;
@@ -174,8 +174,8 @@
                if ((colon = strchr(s, ':')) != NULL) {
                        *colon++ = '\0';
                        decode_int(s, &first);
+                       tvp->tv_sec += first;   /* minutes and hours */
                        tvp->tv_sec *= 60;
-                       tvp->tv_sec += first;   /* minutes and hours */
                        s = colon;
                }
        }
@@ -194,9 +194,6 @@
        }
        decode_int(s, &first);
        tvp->tv_sec += first;
-#if 0
-printf("tvp->tv_sec = %ld, tvp->tv_usec = %ld\n", tvp->tv_sec, tvp->tv_usec);
-#endif
 
        free(copy);
 }
diff -r fd992cd553ce -r c3298e258e6e usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c     Fri Dec 27 19:57:47 2002 +0000
+++ b/usr.bin/audio/record/record.c     Fri Dec 27 23:43:15 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: record.c,v 1.31 2002/10/13 00:56:44 mrg Exp $  */
+/*     $NetBSD: record.c,v 1.32 2002/12/27 23:43:16 mrg Exp $  */
 
 /*
  * Copyright (c) 1999, 2002 Matthew R. Green
@@ -69,7 +69,7 @@
 int    sample_rate;
 int    channels;
 struct timeval record_time;
-struct timeval start_time;     /* XXX because that's what gettimeofday returns */
+struct timeval start_time;
 
 void (*conv_func) (u_char *, size_t);
 
@@ -317,6 +317,10 @@
                   info.record.precision,
                   audio_enc_from_val(info.record.encoding));
 
+       if (!no_time_limit && verbose)
+               fprintf(stderr, "recording for %lu seconds, %lu microseconds\n",
+                   (u_long)record_time.tv_sec, (u_long)record_time.tv_usec);
+
        (void)gettimeofday(&start_time, NULL);
        while (no_time_limit || timeleft(&start_time, &record_time)) {
                if (read(audiofd, buffer, bufsize) != bufsize)



Home | Main Index | Thread Index | Old Index