XCdplayer 2.2 port
This commit is contained in:
parent
5c92c51f6d
commit
0a3df8139d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=148
8 changed files with 1152 additions and 0 deletions
14
audio/xcdplayer/Makefile
Normal file
14
audio/xcdplayer/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
# New ports collection makefile for: xcdplayer
|
||||
# Version required: 2.2
|
||||
# Date created: 30 Sep 1994
|
||||
# Whom: swallace
|
||||
#
|
||||
# $Id: Makefile,v 1.1.1.1 1994/09/28 07:27:40 swallace Exp $
|
||||
#
|
||||
|
||||
DISTNAME= xcdplayer-2.2
|
||||
MASTER_SITES= ftp://sunsite.unc.edu/pub/X11/contrib/
|
||||
USE_IMAKE= yes
|
||||
MAN1= xcdplayer.1
|
||||
|
||||
.include <bsd.port.mk>
|
593
audio/xcdplayer/files/cdrom_freebsd.c
Normal file
593
audio/xcdplayer/files/cdrom_freebsd.c
Normal file
|
@ -0,0 +1,593 @@
|
|||
/*
|
||||
* Copyright (C) 1990 Regents of the University of California.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the University of
|
||||
* California not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. the University of California makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
static int c;
|
||||
|
||||
# include <stdio.h>
|
||||
# include <sys/file.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/param.h>
|
||||
# include <sys/stat.h>
|
||||
# include <string.h>
|
||||
# include <sys/buf.h>
|
||||
# include <sys/time.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/cdio.h>
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_freebsd.h"
|
||||
|
||||
extern char *device;
|
||||
static char cdrom[] = "/dev/rcd0a";
|
||||
|
||||
cdrom_info cdi;
|
||||
char info_filename[256];
|
||||
FILE *disc_info = NULL;
|
||||
|
||||
static int cdrom_fd = -1;
|
||||
|
||||
get_stored_info()
|
||||
{
|
||||
int i,n;
|
||||
char line[100];
|
||||
char *title;
|
||||
|
||||
if(disc_info) {
|
||||
fclose(disc_info);
|
||||
disc_info = NULL;
|
||||
}
|
||||
|
||||
if ( cdi.maxtrack == 0) {
|
||||
return(0);
|
||||
}
|
||||
for (i = 0, n = 0; i < cdi.maxtrack; i++)
|
||||
n = n + ((i+1) * cdi.times[i]);
|
||||
n = n / cdi.maxtrack;
|
||||
|
||||
disc_title = NULL;
|
||||
if (cdInfoDir != NULL)
|
||||
sprintf(info_filename, "%s/cd.%d", cdInfoDir, n);
|
||||
else
|
||||
sprintf(info_filename, "cd.%d", n);
|
||||
|
||||
if ((disc_info = fopen(info_filename, "r")) != NULL)
|
||||
{
|
||||
fgets(line, 100, disc_info);
|
||||
title = strchr(line, ':');
|
||||
if (title != NULL)
|
||||
{
|
||||
*(strchr(title, '\n')) = '\0';
|
||||
disc_title = strdup(title + 1);
|
||||
}
|
||||
fgets(line, 100, disc_info);
|
||||
sscanf(line, "Program: %s", program_str);
|
||||
}
|
||||
else {
|
||||
disc_title = strdup(NOTITLESTR);
|
||||
program_str[0] = 0;
|
||||
}
|
||||
if (disc_title == NULL) {
|
||||
disc_title = strdup(NOTITLESTR);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_open() {
|
||||
int n;
|
||||
extern void update_title();
|
||||
|
||||
if (cdrom_fd != -1)
|
||||
return(cdi.curtrack);
|
||||
|
||||
if (device != NULL) {
|
||||
if ((cdrom_fd = open(device, O_RDONLY)) == -1) {
|
||||
perror("open: ");
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
if ((cdrom_fd = open(cdrom, O_RDONLY)) == -1) {
|
||||
perror("open: ");
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (cdrom_get_times() == -1) {
|
||||
cdrom_close();
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if ((n = cdrom_get_curtrack()) == -1)
|
||||
return(-1);
|
||||
|
||||
get_stored_info();
|
||||
|
||||
update_title();
|
||||
|
||||
if (cdi.state & CDROM_STATE_PLAY)
|
||||
cdi.curtrack = n;
|
||||
|
||||
if (cdi.state & CDROM_STATE_SHUFFLE)
|
||||
shuffle_setup();
|
||||
|
||||
return(cdi.curtrack);
|
||||
}
|
||||
|
||||
void
|
||||
cdrom_close() {
|
||||
if (cdrom_fd == -1)
|
||||
return;
|
||||
|
||||
if (cdi.times != NULL) {
|
||||
free((char *) cdi.times);
|
||||
free((char *) cdi.addrs);
|
||||
cdi.times = NULL;
|
||||
cdi.addrs = NULL;
|
||||
}
|
||||
|
||||
(void) close(cdrom_fd);
|
||||
cdrom_fd = -1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
cdrom_start() {
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCSTART) == -1) {
|
||||
perror("ioctl(cdromstart)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_stop() {
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCSTOP) == -1) {
|
||||
perror("ioctl(cdromstop)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_eject() {
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCEJECT) == -1) {
|
||||
perror("ioctl(cdromeject)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_pause() {
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCPAUSE) == -1) {
|
||||
perror("ioctl(cdrompause)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_resume() {
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCRESUME) == -1) {
|
||||
perror("ioctl(cdromresume)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_volume(left_vol, right_vol)
|
||||
int left_vol;
|
||||
int right_vol;
|
||||
{
|
||||
struct ioc_vol vol;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
vol.vol[0] = left_vol;
|
||||
vol.vol[1] = right_vol;
|
||||
vol.vol[2] = 0;
|
||||
vol.vol[3] = 0;
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCSETVOL, &vol) == -1) {
|
||||
perror("ioctl(cdromvolctrl)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_times() {
|
||||
struct ioc_toc_header tochdr;
|
||||
extern unsigned short *ushort_malloc();
|
||||
extern struct msf *msf_malloc();
|
||||
unsigned long trk, trk_total, otime;
|
||||
struct msf msf;
|
||||
|
||||
if (cdrom_read_tochdr(&tochdr) == -1)
|
||||
return(-1);
|
||||
|
||||
cdi.mintrack = tochdr.starting_track;
|
||||
cdi.maxtrack = tochdr.ending_track;
|
||||
|
||||
if (cdi.times != NULL)
|
||||
{
|
||||
free((char *) cdi.times);
|
||||
free((char *) cdi.addrs);
|
||||
cdi.times = NULL;
|
||||
cdi.addrs = NULL;
|
||||
}
|
||||
|
||||
cdi.times = ushort_malloc(cdi.maxtrack - cdi.mintrack + 1);
|
||||
cdi.addrs = msf_malloc(cdi.maxtrack - cdi.mintrack + 2);
|
||||
|
||||
otime = 0;
|
||||
|
||||
for (trk = cdi.mintrack; trk <= cdi.maxtrack; trk++) {
|
||||
if (cdrom_get_msf(trk, &msf, &trk_total) == -1)
|
||||
return(-1);
|
||||
|
||||
/* record start address for each track (track 1 starts at 0)*/
|
||||
cdi.addrs[trk - cdi.mintrack] = msf;
|
||||
|
||||
trk_total -= otime;
|
||||
|
||||
/* use start time of next track as length of previous */
|
||||
if (otime != 0)
|
||||
{
|
||||
cdi.times[trk - cdi.mintrack - 1] = trk_total;
|
||||
}
|
||||
|
||||
otime += trk_total;
|
||||
|
||||
}
|
||||
|
||||
/* find start of leadout to get length of last track */
|
||||
if (cdrom_get_msf(CDROM_LEADOUT, &msf, &trk_total) == -1)
|
||||
return(-1);
|
||||
|
||||
/* recode leadout start address */
|
||||
cdi.addrs[trk - cdi.mintrack] = msf;
|
||||
trk_total -= otime;
|
||||
otime += trk_total;
|
||||
|
||||
cdi.times[trk - cdi.mintrack - 1] = trk_total;
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_curtrack() {
|
||||
struct cd_sub_channel_info data;
|
||||
|
||||
if (cdrom_read_subchannel(&data) == -1)
|
||||
return(-1);
|
||||
|
||||
switch (data.header.audio_status) {
|
||||
case CD_AS_AUDIO_INVALID:
|
||||
return(-1);
|
||||
|
||||
/* playing track subchnl.cdsc_trk */
|
||||
case CD_AS_PLAY_IN_PROGRESS:
|
||||
return((int) data.what.position.track_number);
|
||||
|
||||
/* paused on track subchnl.cdsc_trk */
|
||||
case CD_AS_PLAY_PAUSED:
|
||||
return((int) data.what.position.track_number);
|
||||
|
||||
/* punt */
|
||||
case CD_AS_PLAY_COMPLETED:
|
||||
return(0);
|
||||
|
||||
case CD_AS_PLAY_ERROR:
|
||||
return(-1);
|
||||
|
||||
/* punt */
|
||||
case CD_AS_NO_STATUS:
|
||||
debug_printf(1, "cdrom_get_curtrack: no status\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* bad value in cdsc_audiostatus */
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_msf(track, msf, length)
|
||||
unsigned long track;
|
||||
struct msf *msf;
|
||||
unsigned long *length;
|
||||
{
|
||||
struct cd_toc_entry data;
|
||||
|
||||
if (cdrom_read_tocentry(track, &data, sizeof(data)) == -1)
|
||||
return(-1);
|
||||
|
||||
msf->minute = data.addr.msf.minute;
|
||||
msf->second = data.addr.msf.second;
|
||||
msf->frame = data.addr.msf.frame;
|
||||
*length = (((unsigned int) msf->minute) * 60) + (unsigned int) msf->second;
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_get_curmsf(msf)
|
||||
struct msf *msf;
|
||||
{
|
||||
struct cd_sub_channel_info data;
|
||||
|
||||
if (cdrom_read_subchannel(&data) == -1)
|
||||
return(-1);
|
||||
|
||||
msf->minute = data.what.position.absaddr.msf.minute;
|
||||
msf->second = data.what.position.absaddr.msf.second;
|
||||
msf->frame = data.what.position.absaddr.msf.frame;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_play_track(start_track, end_track)
|
||||
unsigned char start_track;
|
||||
unsigned char end_track;
|
||||
{
|
||||
struct ioc_play_track ti;
|
||||
struct ioc_play_msf play_addr;
|
||||
char *addr;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
play_addr.start_m = cdi.addrs[start_track - cdi.mintrack].minute;
|
||||
play_addr.start_s = cdi.addrs[start_track - cdi.mintrack].second;
|
||||
play_addr.start_f = cdi.addrs[start_track - cdi.mintrack].frame;
|
||||
play_addr.end_m = cdi.addrs[end_track - cdi.mintrack + 1].minute;
|
||||
play_addr.end_s = cdi.addrs[end_track - cdi.mintrack + 1].second;
|
||||
play_addr.end_f = cdi.addrs[end_track - cdi.mintrack + 1].frame - 1;
|
||||
|
||||
if(play_addr.end_f >= 75) {
|
||||
play_addr.end_f = 74;
|
||||
play_addr.end_s--;
|
||||
}
|
||||
if(play_addr.end_s >= 60) {
|
||||
play_addr.end_s = 59;
|
||||
play_addr.end_m--;
|
||||
}
|
||||
addr = (char *)&play_addr;
|
||||
if (ioctl(cdrom_fd, CDIOCPLAYMSF, &play_addr) == -1) {
|
||||
perror("ioctl(cdromplaymsftrk)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_play_msf(start_msf, end_msf)
|
||||
struct msf *start_msf;
|
||||
struct msf *end_msf;
|
||||
{
|
||||
struct ioc_play_msf play_addr;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
play_addr.start_m = start_msf->minute;
|
||||
play_addr.start_s = start_msf->second;
|
||||
play_addr.start_f = start_msf->frame;
|
||||
play_addr.end_m = end_msf->minute;
|
||||
play_addr.end_s = end_msf->second;
|
||||
play_addr.end_f = end_msf->frame;
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCPLAYMSF, &play_addr) == -1) {
|
||||
perror("ioctl(cdromplaymsf)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
cdrom_read_subchannel(data)
|
||||
struct cd_sub_channel_info *data;
|
||||
{
|
||||
struct ioc_read_subchannel subchnl;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
subchnl.address_format = CD_MSF_FORMAT;
|
||||
subchnl.data_format = CD_CURRENT_POSITION;
|
||||
subchnl.data_len = /* sizeof(struct cd_sub_channel_info)*/ 16;
|
||||
subchnl.track = 0;
|
||||
subchnl.data = data;
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCREADSUBCHANNEL, (char *) &subchnl) == -1) {
|
||||
fprintf(stderr, "ioctl(cdromsubchnl): ");
|
||||
perror(cdrom);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_read_track(track, data)
|
||||
unsigned int track;
|
||||
struct cd_sub_channel_info *data;
|
||||
{
|
||||
struct ioc_read_subchannel subchnl;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
subchnl.address_format = CD_MSF_FORMAT;
|
||||
subchnl.data_format = CD_TRACK_INFO;
|
||||
subchnl.data_len = /* sizeof(struct cd_sub_channel_info)*/ 24;
|
||||
subchnl.track = track;
|
||||
subchnl.data = data;
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOCREADSUBCHANNEL, (char *) &subchnl) == -1) {
|
||||
fprintf(stderr, "ioctl(cdromsubchnltrk): ");
|
||||
perror(cdrom);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_read_tocentry(track, data, size)
|
||||
unsigned int track;
|
||||
struct cd_toc_entry *data;
|
||||
int size;
|
||||
{
|
||||
struct ioc_read_toc_entry tocentry;
|
||||
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
tocentry.starting_track = (unsigned char)track;
|
||||
tocentry.address_format = CD_MSF_FORMAT;
|
||||
tocentry.data_len = /* sizeof(struct cd_toc_entry)*/ size;
|
||||
tocentry.data = data;
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOREADTOCENTRYS, (char *) &tocentry) == -1) {
|
||||
perror("ioctl(cdromreadtocentry)");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_read_tochdr(tochdr)
|
||||
struct ioc_toc_header *tochdr;
|
||||
{
|
||||
if (cdrom_fd == -1)
|
||||
return(-1);
|
||||
|
||||
if (ioctl(cdrom_fd, CDIOREADTOCHEADER, (char *) tochdr) == -1) {
|
||||
perror("ioctl(cdromreadtochdr): ");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_status() {
|
||||
struct cd_sub_channel_info data;
|
||||
|
||||
if (cdrom_read_subchannel(&data) == -1)
|
||||
return(-1);
|
||||
|
||||
switch (data.header.audio_status) {
|
||||
case CD_AS_AUDIO_INVALID:
|
||||
return(CDROM_INVALID);
|
||||
|
||||
case CD_AS_PLAY_IN_PROGRESS:
|
||||
return(CDROM_PLAYING);
|
||||
|
||||
case CD_AS_PLAY_PAUSED:
|
||||
return(CDROM_PAUSED);
|
||||
|
||||
case CD_AS_PLAY_COMPLETED:
|
||||
return(CDROM_COMPLETED);
|
||||
|
||||
case CD_AS_PLAY_ERROR:
|
||||
return(CDROM_ERROR);
|
||||
|
||||
case CD_AS_NO_STATUS:
|
||||
return(CDROM_NO_STATUS);
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unsigned short *
|
||||
ushort_malloc(n)
|
||||
int n;
|
||||
{
|
||||
extern char *calloc();
|
||||
unsigned short *ptr;
|
||||
|
||||
ptr = (unsigned short *) calloc(n, sizeof(unsigned short));
|
||||
if (ptr == NULL) {
|
||||
perror("calloc");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
struct msf *
|
||||
msf_malloc(n)
|
||||
int n;
|
||||
{
|
||||
extern char *calloc();
|
||||
struct msf *ptr;
|
||||
|
||||
ptr = (struct msf *) calloc(n, sizeof(struct msf));
|
||||
if (ptr == NULL) {
|
||||
perror("calloc");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
int
|
||||
cdrom_disp_cdi() {
|
||||
int trk;
|
||||
|
||||
fprintf(stderr,"CDI structure:\n");
|
||||
fprintf(stderr,"\tcurtrack: %d\n",cdi.curtrack);
|
||||
fprintf(stderr,"\tmin: %d max: %d total: %d\n",
|
||||
cdi.mintrack, cdi.maxtrack, cdi.ntracks);
|
||||
fprintf(stderr,"\tdur: %d state: %2x\n",cdi.duration, cdi.state);
|
||||
fprintf(stderr,"\tcurrand: %d lastprog: %d\n",
|
||||
cdi.currand, cdi.lastprog);
|
||||
fprintf(stderr,"\n\tTracklist:\n");
|
||||
if (cdi.maxtrack != cdi.mintrack) {
|
||||
for (trk=0; trk<=cdi.maxtrack-cdi.mintrack+1; trk++) {
|
||||
fprintf(stderr,"\t%3d: %d %02d:%02d %d\n",trk,cdi.times[trk],
|
||||
cdi.addrs[trk].minute,cdi.addrs[trk].second,
|
||||
cdi.addrs[trk].frame);
|
||||
}
|
||||
}
|
||||
}
|
95
audio/xcdplayer/files/cdrom_freebsd.h
Normal file
95
audio/xcdplayer/files/cdrom_freebsd.h
Normal file
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (C) 1990 Regents of the University of California.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and that
|
||||
* both that copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of the University of
|
||||
* California not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. the University of California makes no representations
|
||||
* about the suitability of this software for any purpose. It is provided
|
||||
* "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
# include <X11/Intrinsic.h>
|
||||
|
||||
# define NOTITLESTR "No Title"
|
||||
# define NODISCSTR "No Disc"
|
||||
|
||||
# define bit(n) (1 << (n))
|
||||
|
||||
/* bits for cdrom_state */
|
||||
# define CDROM_STATE_PLAY bit(0)
|
||||
# define CDROM_STATE_PAUSE bit(1)
|
||||
# define CDROM_STATE_STOP bit(2)
|
||||
# define CDROM_STATE_EJECTED bit(3)
|
||||
# define CDROM_STATE_CYCLE bit(4)
|
||||
# define CDROM_STATE_SHUFFLE bit(5)
|
||||
# define CDROM_STATE_PROGRAM bit(6)
|
||||
|
||||
/* return codes from cdrom_status() */
|
||||
# define CDROM_INVALID 1
|
||||
# define CDROM_PLAYING 2
|
||||
# define CDROM_PAUSED 3
|
||||
# define CDROM_COMPLETED 4
|
||||
# define CDROM_ERROR 5
|
||||
# define CDROM_NO_STATUS 6
|
||||
|
||||
#define STILL_MOUNTED 1
|
||||
#define UNMOUNTED 0
|
||||
#define CDROM_LEADOUT 0xAA
|
||||
#define CDROM_MSF 0x02
|
||||
|
||||
struct msf {
|
||||
unsigned char minute;
|
||||
unsigned char second;
|
||||
unsigned char frame;
|
||||
};
|
||||
|
||||
struct prognode {
|
||||
unsigned char track;
|
||||
Widget button;
|
||||
struct prognode *next;
|
||||
struct prognode *prev;
|
||||
};
|
||||
|
||||
typedef struct _cdrom_info {
|
||||
unsigned char curtrack; /* current track playing */
|
||||
unsigned char mintrack; /* first audio track */
|
||||
unsigned char maxtrack; /* last audio track */
|
||||
unsigned char ntracks; /* size of random track list */
|
||||
int duration; /* seconds played so far */
|
||||
int state; /* state of cd-rom drive */
|
||||
short currand; /* index into random track list */
|
||||
short lastprog; /* number of selections in prog.*/
|
||||
unsigned short *times; /* duration of each track */
|
||||
struct msf *addrs; /* starting minute/second/frames*/
|
||||
struct prognode *selection; /* currently selected prog. trk */
|
||||
struct prognode *program; /* list of programmed tracks */
|
||||
} cdrom_info;
|
||||
|
||||
extern int cdrom_open();
|
||||
extern void cdrom_close();
|
||||
extern int cdrom_start();
|
||||
extern int cdrom_stop();
|
||||
extern int cdrom_eject();
|
||||
extern int cdrom_pause();
|
||||
extern int cdrom_resume();
|
||||
extern int cdrom_volume();
|
||||
extern int cdrom_get_times();
|
||||
extern int cdrom_get_curtrack();
|
||||
extern int cdrom_get_msf();
|
||||
extern int cdrom_get_curmsf();
|
||||
extern int cdrom_play_track();
|
||||
extern int cdrom_play_msf();
|
||||
extern int cdrom_read_tocentry();
|
||||
extern int cdrom_read_tochdr();
|
||||
extern int cdrom_status();
|
||||
|
||||
extern cdrom_info cdi;
|
||||
extern char *disc_title;
|
||||
extern char program_str[];
|
||||
extern char *cdInfoDir;
|
||||
|
171
audio/xcdplayer/files/patch-aa
Normal file
171
audio/xcdplayer/files/patch-aa
Normal file
|
@ -0,0 +1,171 @@
|
|||
*** XCdplayer.ad Tue Jan 12 10:59:41 1993
|
||||
--- /users/swallace/work/xcdplayer/XCdplayer.ad Wed Feb 23 07:36:31 1994
|
||||
***************
|
||||
*** 19,29 ****
|
||||
|
||||
XCdplayer*logoLabel.foreground: Gold
|
||||
XCdplayer*logoLabel.background: Black
|
||||
- XCdplayer*icon*foreground: Gold
|
||||
|
||||
XCdplayer*versionLabel.Font: -misc-fixed-medium-r-normal--8-*
|
||||
XCdplayer*versionLabel.foreground: Black
|
||||
! XCdplayer*versionLabel.width: 130
|
||||
XCdplayer*versionLabel.fromHoriz: logoLabel
|
||||
|
||||
! replayThreshold is the number of seconds that must be played before the
|
||||
--- 19,28 ----
|
||||
|
||||
XCdplayer*logoLabel.foreground: Gold
|
||||
XCdplayer*logoLabel.background: Black
|
||||
|
||||
XCdplayer*versionLabel.Font: -misc-fixed-medium-r-normal--8-*
|
||||
XCdplayer*versionLabel.foreground: Black
|
||||
! XCdplayer*versionLabel.width: 110
|
||||
XCdplayer*versionLabel.fromHoriz: logoLabel
|
||||
|
||||
! replayThreshold is the number of seconds that must be played before the
|
||||
***************
|
||||
*** 33,48 ****
|
||||
|
||||
! scanSkipInterval is the number of seconds skipped at each fast-forward or
|
||||
! reverse.
|
||||
! XCdplayer*scanSkipInterval: 3
|
||||
! pauseSkipInterval is the number of seconds skipped at each fast-forward or
|
||||
! reverse if the CD is paused.
|
||||
! XCdplayer*pauseSkipInterval: 15
|
||||
|
||||
! scanPauseInterval is the number of seconds between each fast_forward or
|
||||
! reverse while holding down the buttons. (Sun CDs have a dreadfully long
|
||||
! start-up time for the audio to actually become audible, so "hearing the
|
||||
! track" while scanning isn't very feasible.)
|
||||
! XCdplayer*scanPauseInterval: 0.062
|
||||
! pausePauseInterval does the same thing when the disc is paused.
|
||||
XCdplayer*pausePauseInterval: 0.5
|
||||
|
||||
--- 32,47 ----
|
||||
|
||||
! scanSkipInterval is the number of seconds skipped at each fast-forward or
|
||||
! reverse.
|
||||
! XCdplayer*scanSkipInterval: 5
|
||||
! pauseSkipInterval is the number of seconds skipped at each fast-forward or
|
||||
! reverse if the CD is paused.
|
||||
! XCdplayer*pauseSkipInterval: 20
|
||||
|
||||
! scanPauseInterval is the number of seconds between each fast_forward or
|
||||
! reverse while holding down the buttons. (Sun CDs have a dreadfully long
|
||||
! start-up time for the audio to actually become audible, so "hearing the
|
||||
! track" while scanning isn't very feasible.)
|
||||
! XCdplayer*scanPauseInterval: 0.25
|
||||
! pausePauseInterval does the same thing when the disc is paused.
|
||||
XCdplayer*pausePauseInterval: 0.5
|
||||
|
||||
***************
|
||||
*** 56,62 ****
|
||||
XCdplayer*Viewport.allowHoriz: True
|
||||
XCdplayer*Viewport.useBottom: True
|
||||
XCdplayer*Viewport.forceBars: False
|
||||
! XCdplayer*Viewport.width: 188
|
||||
XCdplayer*Viewport.height: 30
|
||||
XCdplayer*Viewport*thickness: 8
|
||||
XCdplayer*Viewport.resizable: False
|
||||
--- 55,61 ----
|
||||
XCdplayer*Viewport.allowHoriz: True
|
||||
XCdplayer*Viewport.useBottom: True
|
||||
XCdplayer*Viewport.forceBars: False
|
||||
! XCdplayer*Viewport.width: 160
|
||||
XCdplayer*Viewport.height: 30
|
||||
XCdplayer*Viewport*thickness: 8
|
||||
XCdplayer*Viewport.resizable: False
|
||||
***************
|
||||
*** 88,98 ****
|
||||
XCdplayer*Toggle.right: ChainLeft
|
||||
XCdplayer*Toggle.background: Ivory
|
||||
|
||||
! XCdplayer*ledsLabel.horizDistance: 20
|
||||
XCdplayer*ledsLabel.fromVert: versionLabel
|
||||
XCdplayer*ledsLabel.fromHoriz: logoLabel
|
||||
|
||||
! XCdplayer*trackButton.horizDistance: 8
|
||||
XCdplayer*trackButton.fromVert: versionLabel
|
||||
XCdplayer*trackButton.fromHoriz: ledsLabel
|
||||
XCdplayer*trackButton.borderWidth: 2
|
||||
--- 87,97 ----
|
||||
XCdplayer*Toggle.right: ChainLeft
|
||||
XCdplayer*Toggle.background: Ivory
|
||||
|
||||
! XCdplayer*ledsLabel.horizDistance: 4
|
||||
XCdplayer*ledsLabel.fromVert: versionLabel
|
||||
XCdplayer*ledsLabel.fromHoriz: logoLabel
|
||||
|
||||
! XCdplayer*trackButton.horizDistance: 4
|
||||
XCdplayer*trackButton.fromVert: versionLabel
|
||||
XCdplayer*trackButton.fromHoriz: ledsLabel
|
||||
XCdplayer*trackButton.borderWidth: 2
|
||||
***************
|
||||
*** 108,134 ****
|
||||
XCdplayer*timerButton.left: ChainRight
|
||||
XCdplayer*timerButton.right: ChainRight
|
||||
|
||||
! XCdplayer*volumeScrollbar.horizDistance:8
|
||||
XCdplayer*volumeScrollbar.fromHoriz: logoLabel
|
||||
XCdplayer*volumeScrollbar.fromVert: trackButton
|
||||
XCdplayer*volumeScrollbar.orientation: horizontal
|
||||
! XCdplayer*volumeScrollbar.length: 120
|
||||
XCdplayer*volumeScrollbar.right: ChainRight
|
||||
XCdplayer*volumeScrollbar.left: ChainRight
|
||||
XCdplayer*volumeScrollbar.background: green
|
||||
XCdplayer*volumeScrollbar.foreground: white
|
||||
! XCdplayer*volumeScrollbar.thumb: black
|
||||
|
||||
XCdplayer*titleBarViewport.fromVert: volumeScrollbar
|
||||
- XCdplayer*titleBarViewport.forceBars: true
|
||||
XCdplayer*titleBar.borderwidth: 0
|
||||
XCdplayer*titleBar.highlightThickness: 1
|
||||
XCdplayer*titleBar.foreground: Red
|
||||
XCdplayer*titleBar.background: Ivory
|
||||
-
|
||||
- XCdplayer*titleDialog.Text.translations:#override\
|
||||
- <Key>Return: done()
|
||||
-
|
||||
XCdplayer*buttonsForm.fromVert: logoForm
|
||||
XCdplayer*buttonsForm.borderWidth: 1
|
||||
|
||||
--- 107,128 ----
|
||||
XCdplayer*timerButton.left: ChainRight
|
||||
XCdplayer*timerButton.right: ChainRight
|
||||
|
||||
! XCdplayer*volumeScrollbar.horizDistance:4
|
||||
XCdplayer*volumeScrollbar.fromHoriz: logoLabel
|
||||
XCdplayer*volumeScrollbar.fromVert: trackButton
|
||||
XCdplayer*volumeScrollbar.orientation: horizontal
|
||||
! XCdplayer*volumeScrollbar.length: 93
|
||||
XCdplayer*volumeScrollbar.right: ChainRight
|
||||
XCdplayer*volumeScrollbar.left: ChainRight
|
||||
XCdplayer*volumeScrollbar.background: green
|
||||
XCdplayer*volumeScrollbar.foreground: white
|
||||
! XCdplayer*volumeScrollbar.thumb: black
|
||||
|
||||
XCdplayer*titleBarViewport.fromVert: volumeScrollbar
|
||||
XCdplayer*titleBar.borderwidth: 0
|
||||
XCdplayer*titleBar.highlightThickness: 1
|
||||
XCdplayer*titleBar.foreground: Red
|
||||
XCdplayer*titleBar.background: Ivory
|
||||
XCdplayer*buttonsForm.fromVert: logoForm
|
||||
XCdplayer*buttonsForm.borderWidth: 1
|
||||
|
||||
*** Imakefile Tue Jan 12 10:59:29 1993
|
||||
--- /users/swallace/work/xcdplayer/Imakefile Fri Sep 30 17:09:19 1994
|
||||
***************
|
||||
*** 15,20 ****
|
||||
--- 15,25 ----
|
||||
|
||||
LOCAL_LIBRARIES = XawClientLibs
|
||||
LINTLIBS = -lXaw -lXt -lX11
|
||||
+ SRCS = main.c top_setup.c logo_setup.c button_setup.c cdrom_callb.c\
|
||||
+ cdrom_freebsd.c internals.c shuffle.c program.c leds.c debug.c
|
||||
+
|
||||
+ OBJS = main.o top_setup.o logo_setup.o button_setup.o cdrom_callb.o\
|
||||
+ cdrom_freebsd.o internals.o shuffle.o program.o leds.o debug.o
|
||||
#ifdef SunArchitecture
|
||||
SRCS = main.c top_setup.c logo_setup.c button_setup.c cdrom_callb.c\
|
||||
cdrom_sun.c internals.c shuffle.c program.c leds.c debug.c
|
266
audio/xcdplayer/files/patch-ab
Normal file
266
audio/xcdplayer/files/patch-ab
Normal file
|
@ -0,0 +1,266 @@
|
|||
*** button_setup.c Tue Jan 12 10:59:47 1993
|
||||
--- /users/swallace/work/xcdplayer/button_setup.c Wed Feb 23 07:36:36 1994
|
||||
***************
|
||||
*** 20,25 ****
|
||||
--- 20,28 ----
|
||||
# include <X11/Xaw/Toggle.h>
|
||||
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
***************
|
||||
*** 44,49 ****
|
||||
--- 47,69 ----
|
||||
# include "ff.xbm"
|
||||
# include "pgm.xbm"
|
||||
|
||||
+ void title_dialog_setup();
|
||||
+ static void play_button_setup();
|
||||
+ static void stop_button_setup();
|
||||
+ static void pause_button_setup();
|
||||
+ static void prev_button_setup();
|
||||
+ static void next_button_setup();
|
||||
+ static void eject_button_setup();
|
||||
+ #ifdef sgi
|
||||
+ void audio_button_setup();
|
||||
+ #endif
|
||||
+ static void quit_button_setup();
|
||||
+ static void cycle_button_setup();
|
||||
+ static void shuffle_button_setup();
|
||||
+ static void rew_button_setup();
|
||||
+ static void ff_button_setup();
|
||||
+ static void pgm_button_setup();
|
||||
+ void buttons_reset();
|
||||
|
||||
static Widget buttons_form_widget;
|
||||
static Widget play_button_widget;
|
||||
***************
|
||||
*** 71,95 ****
|
||||
Widget parent_widget;
|
||||
{
|
||||
Arg args[1];
|
||||
-
|
||||
- extern void title_dialog_setup();
|
||||
- extern void play_button_setup();
|
||||
- extern void stop_button_setup();
|
||||
- extern void pause_button_setup();
|
||||
- extern void prev_button_setup();
|
||||
- extern void next_button_setup();
|
||||
- extern void eject_button_setup();
|
||||
- #ifdef sgi
|
||||
- extern void audio_button_setup();
|
||||
- #endif
|
||||
- extern void quit_button_setup();
|
||||
- extern void cycle_button_setup();
|
||||
- extern void shuffle_button_setup();
|
||||
- extern void rew_button_setup();
|
||||
- extern void ff_button_setup();
|
||||
- extern void pgm_button_setup();
|
||||
- extern void buttons_reset();
|
||||
-
|
||||
|
||||
buttons_form_widget = XtCreateManagedWidget("buttonsForm",
|
||||
formWidgetClass,
|
||||
--- 91,96 ----
|
||||
*** cdrom_callb.c Tue Jan 12 10:59:48 1993
|
||||
--- /users/swallace/work/xcdplayer/cdrom_callb.c Wed Feb 23 07:36:41 1994
|
||||
***************
|
||||
*** 22,27 ****
|
||||
--- 22,30 ----
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
*** internals.c Tue Jan 12 10:59:45 1993
|
||||
--- /users/swallace/work/xcdplayer/internals.c Wed Feb 23 07:36:47 1994
|
||||
***************
|
||||
*** 22,27 ****
|
||||
--- 22,30 ----
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
***************
|
||||
*** 29,35 ****
|
||||
# include "cdrom_sgi.h"
|
||||
#endif
|
||||
|
||||
!
|
||||
static XtIntervalId ivid = -1;
|
||||
static XtIntervalId scanivid = -1;
|
||||
static XtIntervalId stativid = -1;
|
||||
--- 32,38 ----
|
||||
# include "cdrom_sgi.h"
|
||||
#endif
|
||||
|
||||
! static void scan_update();
|
||||
static XtIntervalId ivid = -1;
|
||||
static XtIntervalId scanivid = -1;
|
||||
static XtIntervalId stativid = -1;
|
||||
***************
|
||||
*** 170,176 ****
|
||||
struct msf track_start;
|
||||
struct msf start_addr, end_addr;
|
||||
int curtrack;
|
||||
- extern void scan_update();
|
||||
|
||||
if (cdrom_get_curmsf(&start_addr) == -1) {
|
||||
debug_printf(1, "rew: error reading location\n");
|
||||
--- 173,178 ----
|
||||
***************
|
||||
*** 304,310 ****
|
||||
struct msf start_addr, end_addr, next_start;
|
||||
char t;
|
||||
int curtrack;
|
||||
- extern void scan_update();
|
||||
|
||||
if (cdrom_get_curmsf(&start_addr) == -1) {
|
||||
debug_printf(1, "ff: error reading location\n");
|
||||
--- 306,311 ----
|
||||
*** logo_setup.c Tue Jan 12 10:59:46 1993
|
||||
--- /users/swallace/work/xcdplayer/logo_setup.c Wed Feb 23 07:36:52 1994
|
||||
***************
|
||||
*** 28,33 ****
|
||||
--- 28,36 ----
|
||||
# include <stdio.h>
|
||||
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
***************
|
||||
*** 55,73 ****
|
||||
Widget title_done_widget;
|
||||
|
||||
static int vol;
|
||||
|
||||
void
|
||||
logo_setup(parent_widget)
|
||||
Widget parent_widget;
|
||||
{
|
||||
- extern void leds_label_setup();
|
||||
- extern void cb_track_button();
|
||||
- extern void cb_timer_button();
|
||||
- extern void volume_jump_proc();
|
||||
- extern void volume_scroll_proc();
|
||||
- extern void popup_title_dialog();
|
||||
- extern void popdown_title_dialog();
|
||||
-
|
||||
Widget version_label_widget;
|
||||
char version_string[80];
|
||||
|
||||
--- 58,76 ----
|
||||
Widget title_done_widget;
|
||||
|
||||
static int vol;
|
||||
+ extern void leds_label_setup();
|
||||
+ static void cb_track_button();
|
||||
+ static void cb_timer_button();
|
||||
+ static void volume_jump_proc();
|
||||
+ static void volume_scroll_proc();
|
||||
+ static void popup_title_dialog();
|
||||
+ static void popdown_title_dialog();
|
||||
+
|
||||
|
||||
void
|
||||
logo_setup(parent_widget)
|
||||
Widget parent_widget;
|
||||
{
|
||||
Widget version_label_widget;
|
||||
char version_string[80];
|
||||
|
||||
*** program.c Tue Jan 12 10:59:49 1993
|
||||
--- /users/swallace/work/xcdplayer/program.c Wed Feb 23 07:36:55 1994
|
||||
***************
|
||||
*** 27,36 ****
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
! # include <malloc.h>
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_globs.h"
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
--- 27,39 ----
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
! # include <sys/malloc.h>
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
||||
***************
|
||||
*** 52,57 ****
|
||||
--- 55,69 ----
|
||||
static Boolean adding_to_new_track = False;
|
||||
static struct prognode *current_node = NULL;
|
||||
|
||||
+ static void cb_move_program_ptr();
|
||||
+ static void cb_clear_program();
|
||||
+ static void cb_cancel_program();
|
||||
+ static void cb_save_program();
|
||||
+ static void cb_trackbuttons();
|
||||
+ static void cb_add_10();
|
||||
+ static void cb_new_track();
|
||||
+ static void cb_program_all();
|
||||
+
|
||||
void
|
||||
program_form_setup (parent_widget)
|
||||
Widget parent_widget;
|
||||
***************
|
||||
*** 66,80 ****
|
||||
Widget cancel_button;
|
||||
Widget save_button;
|
||||
Widget all_button;
|
||||
-
|
||||
- extern void cb_move_program_ptr();
|
||||
- extern void cb_clear_program();
|
||||
- extern void cb_cancel_program();
|
||||
- extern void cb_save_program();
|
||||
- extern void cb_trackbuttons();
|
||||
- extern void cb_add_10();
|
||||
- extern void cb_new_track();
|
||||
- extern void cb_program_all();
|
||||
|
||||
/*
|
||||
* create program form as a non-managed widget, because this
|
||||
--- 78,83 ----
|
||||
*** shuffle.c Tue Jan 12 10:59:38 1993
|
||||
--- /users/swallace/work/xcdplayer/shuffle.c Wed Feb 23 07:36:59 1994
|
||||
***************
|
||||
*** 18,23 ****
|
||||
--- 18,26 ----
|
||||
|
||||
# include "debug.h"
|
||||
# include "cdrom_globs.h"
|
||||
+ #ifdef __FreeBSD__
|
||||
+ # include "cdrom_freebsd.h"
|
||||
+ #endif
|
||||
#ifdef sun
|
||||
# include "cdrom_sun.h"
|
||||
#endif
|
1
audio/xcdplayer/pkg-comment
Normal file
1
audio/xcdplayer/pkg-comment
Normal file
|
@ -0,0 +1 @@
|
|||
XCdplayer 2.2
|
8
audio/xcdplayer/pkg-descr
Normal file
8
audio/xcdplayer/pkg-descr
Normal file
|
@ -0,0 +1,8 @@
|
|||
XCdplayer 2.2
|
||||
|
||||
XCdplayer is a graphical user interface for controlling the CD-ROM
|
||||
drive under the X Window System. It provides visual feedback and
|
||||
gives the user facilities for mode selection, device control,
|
||||
scanning, and programming.
|
||||
|
||||
Ported to FreeBSD by Steven Wallace, swallace@ece.uci.edu
|
4
audio/xcdplayer/pkg-plist
Normal file
4
audio/xcdplayer/pkg-plist
Normal file
|
@ -0,0 +1,4 @@
|
|||
@cwd /usr/X11R6
|
||||
bin/xcdplayer
|
||||
lib/X11/app-defaults/XCdplayer
|
||||
man/man1/xcdplayer.1x
|
Loading…
Reference in a new issue