From d136f913d0b86928ba4a47e49901912a312048b0 Mon Sep 17 00:00:00 2001 From: Guenter Bartsch Date: Sun, 7 Oct 2001 22:31:20 +0000 Subject: configurable VCD device - patch provided by Chris Rankin CVS patchset: 762 CVS date: 2001/10/07 22:31:20 --- AUTHORS | 3 +++ src/input/input_vcd.c | 36 +++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/AUTHORS b/AUTHORS index 230937c9e..eb5b0ebee 100644 --- a/AUTHORS +++ b/AUTHORS @@ -138,6 +138,9 @@ Contributions Harm van der Heijden libdivx4 plugin + Chris Rankin + configurable VCD device patch + (let us know if we've forgotten anyone) diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 616449d8c..aeb2118f0 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.25 2001/10/07 15:13:09 guenter Exp $ + * $Id: input_vcd.c,v 1.26 2001/10/07 22:31:20 guenter Exp $ + * */ #ifdef HAVE_CONFIG_H @@ -33,7 +34,6 @@ #include #include #ifdef HAVE_LINUX_CDROM_H -# include /* Check for DEVFS */ # include #endif #ifdef HAVE_SYS_CDIO_H @@ -57,12 +57,8 @@ static uint32_t xine_debug; #define CDROM "/vol/dev/aliases/cdrom0" #else /* for FreeBSD make a link to the right devnode, like /dev/acd0c */ -#if defined(CONFIG_DEVFS_FS) -#define CDROM "/dev/cdroms/cdrom" -#else #define CDROM "/dev/cdrom" #endif -#endif #define VCDSECTORSIZE 2324 #if defined (__sun) @@ -105,6 +101,8 @@ typedef struct { uint8_t cur_min, cur_sec, cur_frame; #endif + const char *device; + char *filelist[100]; int mrls_allocated_entries; @@ -320,7 +318,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) { if (strncasecmp (mrl, "vcd://",6)) return 0; - this->fd = open (CDROM, O_RDONLY); + this->fd = open (this->device, O_RDONLY); if (this->fd == -1) { return 0; @@ -664,8 +662,8 @@ static off_t vcd_time_to_offset (int min, int sec, int frame) { return min * 60 * 75 + sec * 75 + frame; } -static void vcd_offset_to_time (off_t offset, int *min, int *sec, - int *frame) { +static void vcd_offset_to_time (off_t offset, uint8_t *min, uint8_t *sec, + uint8_t *frame) { *min = offset / (60*75); offset %= (60*75); @@ -680,7 +678,6 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; struct cdrom_msf0 *start_msf; - uint32_t dist ; off_t sector_pos; start_msf = &this->tocent[this->cur_track].cdte_addr.msf; @@ -851,7 +848,7 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int ret, status; - if((this->fd = open(CDROM, O_RDONLY|O_NONBLOCK)) > -1) { + if((this->fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { if((status = ioctl(this->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)) > 0) { switch(status) { case CDS_TRAY_OPEN: @@ -880,9 +877,10 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { } #elif defined (__FreeBSD__) static int vcd_plugin_eject_media (input_plugin_t *this_gen) { + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int fd; - if ((fd = open(CDROM, O_RDONLY|O_NONBLOCK)) > -1) { + if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { if (ioctl(fd, CDIOCALLOW) == -1) { perror("ioctl(cdromallow)"); } else { @@ -897,9 +895,10 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) { } #elif defined (__sun) static int vcd_plugin_eject_media (input_plugin_t *this_gen) { + vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int fd, ret; - if ((fd = open(CDROM, O_RDONLY|O_NONBLOCK)) > -1) { + if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { if ((ret = ioctl(fd, CDROMEJECT)) != 0) { xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); } @@ -958,10 +957,11 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen, return NULL; - this->fd = open (CDROM, O_RDONLY); + this->fd = open (this->device, O_RDONLY); if (this->fd == -1) { - perror ("unable to open " CDROM); + fprintf(stderr, "unable to open %s: ", this->device); + perror (""); return NULL; } @@ -1040,10 +1040,11 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen, vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int i; - this->fd = open (CDROM, O_RDONLY); + this->fd = open (this->device, O_RDONLY); if (this->fd == -1) { - perror ("unable to open " CDROM); + fprintf(stderr, "unable to open %s: ", this->device); + perror (""); return NULL; } @@ -1137,6 +1138,7 @@ input_plugin_t *init_input_plugin (int iface, config_values_t *config) { this->input_plugin.handle_input_event= NULL; this->input_plugin.is_branch_possible= NULL; + this->device = config->lookup_str(config, "vcd_device", CDROM); this->mrls = (mrl_t **) xmalloc(sizeof(mrl_t)); this->mrls_allocated_entries = 0; -- cgit v1.2.3