Source-Changes-HG archive

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

[src/trunk]: src/usr.bin 'cdplay', a simple utility for playing compact disks...



details:   https://anonhg.NetBSD.org/src/rev/80b4d2a56796
branches:  trunk
changeset: 473480:80b4d2a56796
user:      ad <ad%NetBSD.org@localhost>
date:      Sat Jun 05 13:21:59 1999 +0000

description:
'cdplay', a simple utility for playing compact disks with both a command line
and an interactive mode.

diffstat:

 usr.bin/Makefile        |     6 +-
 usr.bin/cdplay/Makefile |     6 +
 usr.bin/cdplay/cdplay.1 |   149 ++++++
 usr.bin/cdplay/cdplay.c |  1045 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1203 insertions(+), 3 deletions(-)

diffs (truncated from 1231 to 300 lines):

diff -r a6dc6e5c7158 -r 80b4d2a56796 usr.bin/Makefile
--- a/usr.bin/Makefile  Sat Jun 05 12:56:28 1999 +0000
+++ b/usr.bin/Makefile  Sat Jun 05 13:21:59 1999 +0000
@@ -1,12 +1,12 @@
-#      $NetBSD: Makefile,v 1.101 1999/03/26 16:53:29 tron Exp $
+#      $NetBSD: Makefile,v 1.102 1999/06/05 13:21:59 ad Exp $
 #      from: @(#)Makefile      8.3 (Berkeley) 1/7/94
 
 .include <bsd.own.mk>                  # for EXPORTABLE_SYSTEM definition
 #                                      # and OBJECT_FMT definition
 
 SUBDIR=        apply apropos asa at audio banner basename bdes biff \
-       bzip2 bzip2recover cal calendar cap_mkdb checknr chflags chpass \
-       cksum cmp col colcrt colrm column comm compress \
+       bzip2 bzip2recover cal calendar cap_mkdb cdplay checknr chflags \
+       chpass cksum cmp col colcrt colrm column comm compress \
        crontab crunch ctags cut dirname du eject env \
        error expand false fdformat fgen file find finger fmt fold fpr \
        from fsplit fstat ftp gencat getconf getopt gprof head hesinfo \
diff -r a6dc6e5c7158 -r 80b4d2a56796 usr.bin/cdplay/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/cdplay/Makefile   Sat Jun 05 13:21:59 1999 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 1999/06/05 13:22:00 ad Exp $
+
+PROG=  cdplay
+SRCS=  cdplay.c
+
+.include <bsd.prog.mk>
diff -r a6dc6e5c7158 -r 80b4d2a56796 usr.bin/cdplay/cdplay.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/cdplay/cdplay.1   Sat Jun 05 13:21:59 1999 +0000
@@ -0,0 +1,149 @@
+.\"    $NetBSD: cdplay.1,v 1.1 1999/06/05 13:22:00 ad Exp $
+.\"
+.\" From: Id: cdcontrol.1,v 1.16.2.2 1999/01/31 15:36:01 billf Exp
+.\"
+.Dd June 4, 1998
+.Dt CDPLAY 1
+.Os
+.Sh NAME
+.Nm cdplay
+.Nd compact disc player
+.Sh SYNOPSIS
+.Nm cdplay
+.Op Fl f Ar device
+.Op Ar command ...
+.Sh DESCRIPTION
+.Nm Cdplay
+is a program to control audio features of a CD drive.
+If the device not specified, the environment variables 
+.Ev MUSIC_CD ,
+.Ev CD_DRIVE ,
+.Ev DISC
+and
+.Ev CDPLAY
+will be tried (in this order) to find the cd device.
+.Pp
+If no command is given, then
+.Nm
+enters an interactive mode, reading commands from the standard input.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl f Ar device
+Specify a device, such as
+.Pa /dev/cd0c
+(or
+.Pa /dev/cd0d 
+on the i386 architecture).
+Both absolute path and relative to
+.Pa /dev
+filename are possible.
+Suffix `c' (or 'd' on the i386 architecture) is added to the device name if needed.
+.El
+.Pp
+The available commands are listed below.  Only as many
+characters as are required to uniquely identify a command
+need be specified. Word
+.Em play
+can be omitted.
+.Bl -tag -width Cm
+.It Cm play Ar first_track Op Ar last_track
+Play from track 
+.Ar first_track
+to track
+.Ar last_track .
+The first track has number 1.
+Can be omitted in all cases.
+.It Cm play Ar start_m:start_s.start_f Op Ar end_m:end_s.end_f
+Play from the absolute address
+(MSF) defined by 
+.Ar start_m
+in minutes, 
+.Ar start_s ,
+in seconds and 
+.Ar start_f
+(frame number) to the absolute address defined by
+.Ar end_m
+in minutes, 
+.Ar end_s ,
+in seconds and 
+.Ar end_f
+(frame number). Minutes are in the range 0-99. Seconds are in the range 0-59.
+Frame numbers are in the range 0-74.
+.It Cm play Op Ar #start_block Op length
+Play starting from the logical block
+.Ar start_block
+using
+.Ar length
+logical blocks.
+.It Cm pause
+Stop playing. Do not stop the disc.
+.It Cm resume
+Resume playing. Used after the 
+.Em pause
+command.
+.It Cm stop
+Stop the disc.
+.It Cm eject
+Eject the disc.
+.It Cm close
+Inject the disc.
+.It Cm volume Ar left_channel Ar right_channel
+Set the volume of left channel to 
+.Ar left_channel
+and the volume of right channel to 
+.Ar right_channel . 
+Allowed values are in the range 0-255. 
+.It Cm volume Ar mute
+Turn the sound off.
+.It Cm volume Ar mono
+Set the mono mode.
+.It Cm volume Ar stereo
+Set the stereo mode.
+.It Cm volume Ar left
+Play the left subtrack on both left and right channels.
+.It Cm volume Ar right
+Play the right subtrack on both left and right channels.
+.It Cm info
+Print the table of contents.
+.It Cm status 
+.Op Ar audio | media | volume
+
+Print the information about the disc:
+
+.Nm audio
+the current playing status and position,
+
+.Nm media
+the current media catalog status,
+
+.Nm volume
+the current values of the volume for left and right channels.
+.It Cm help
+Print the list of available commands.
+.It Cm reset
+Perform the hardware reset of the device.
+.It Cm set Ar msf
+Set minute-second-frame ioctl mode (default).
+.It Cm set Ar lba
+Set LBA ioctl mode.
+.It Cm quit
+Quit the program.
+.El
+.Sh FILES
+.Bl -tag -width /dev/rmcd0c -compact
+.It Pa /dev/cd??
+.It Pa /dev/mcd??
+.El
+.Sh AUTHORS
+.An Jean-Marc Zucconi ,
+.An Andrey A.\ Chernov ,
+.An Serge V.\ Vakulenko ,
+.An Andy Doran
+.Sh HISTORY
+The
+.Nm
+command first appeared in
+.Fx 2.1 
+as
+.Nm cdcontrol .
diff -r a6dc6e5c7158 -r 80b4d2a56796 usr.bin/cdplay/cdplay.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/cdplay/cdplay.c   Sat Jun 05 13:21:59 1999 +0000
@@ -0,0 +1,1045 @@
+/*     $NetBSD: cdplay.c,v 1.1 1999/06/05 13:22:00 ad Exp $ */
+
+/*
+ * Copyright (c) 1999 Andy Doran <ad%NetBSD.org@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Compact Disc Control Utility by Serge V. Vakulenko <vak%cronyx.ru@localhost>.
+ * Based on the non-X based CD player by Jean-Marc Zucconi and
+ * Andrey A. Chernov.
+ *
+ * Fixed and further modified on 5-Sep-1995 by Jukka Ukkonen <jau%funet.fi@localhost>.
+ *
+ * 11-Sep-1995: Jukka A. Ukkonen <jau%funet.fi@localhost>
+ *              A couple of further fixes to my own earlier "fixes".
+ *
+ * 18-Sep-1995: Jukka A. Ukkonen <jau%funet.fi@localhost>
+ *              Added an ability to specify addresses relative to the
+ *              beginning of a track. This is in fact a variation of
+ *              doing the simple play_msf() call.
+ *
+ * 11-Oct-1995: Serge V.Vakulenko <vak%cronyx.ru@localhost>
+ *              New eject algorithm.
+ *              Some code style reformatting.
+ *
+ * From: Id: cdcontrol.c,v 1.17.2.1 1999/01/31 15:36:01 billf Exp
+ */
+
+/*
+ * XXX there are too many oppertunities to trash the stack from the command
+ * line - ad
+ */
+ 
+#include <sys/cdefs.h>
+#ifndef lint
+__RCSID("$NetBSD: cdplay.c,v 1.1 1999/06/05 13:22:00 ad Exp $");
+#endif /* not lint */
+
+#include <ctype.h>
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/file.h>
+#include <sys/cdio.h>
+#include <sys/ioctl.h>
+
+#include <machine/disklabel.h>
+
+#define ASTS_INVALID    0x00   /* Audio status byte not valid */
+#define ASTS_PLAYING    0x11   /* Audio play operation in progress */
+#define ASTS_PAUSED     0x12   /* Audio play operation paused */
+#define ASTS_COMPLETED  0x13   /* Audio play operation successfully completed */
+#define ASTS_ERROR      0x14   /* Audio play operation stopped due to error */
+#define ASTS_VOID       0x15   /* No current audio status to return */
+
+#define CMD_DEBUG       1
+#define CMD_EJECT       2
+#define CMD_HELP        3
+#define CMD_INFO        4
+#define CMD_PAUSE       5
+#define CMD_PLAY        6
+#define CMD_QUIT        7
+#define CMD_RESUME      8
+#define CMD_STOP        9
+#define CMD_VOLUME      10
+#define CMD_CLOSE       11
+#define CMD_RESET       12
+#define CMD_SET         13
+#define CMD_STATUS      14
+#define STATUS_AUDIO    0x1
+#define STATUS_MEDIA    0x2
+#define STATUS_VOLUME   0x4
+
+struct cmdtab {
+       int command;
+       char *name;
+       unsigned  min;
+       char *args;
+} cmdtab[] = {
+{ CMD_CLOSE,    "close",        1, "" },
+{ CMD_EJECT,    "eject",        1, "" },
+{ CMD_HELP,     "?",            1, 0 },
+{ CMD_HELP,     "help",         1, "" },
+{ CMD_INFO,     "info",         1, "" },
+{ CMD_PAUSE,    "pause",        2, "" },
+{ CMD_PLAY,     "play",         1, "min1:sec1[.fram1] [min2:sec2[.fram2]]" },
+{ CMD_PLAY,     "play",         1, "track1[.index1] [track2[.index2]]" },



Home | Main Index | Thread Index | Old Index