diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2003-04-06 00:51:29 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2003-04-06 00:51:29 +0000 |
commit | bb653b8883c232f5a215b8a108f1c7fc4c92f1b3 (patch) | |
tree | 7cc74078894da35f1a84a2c02e67367670706dae /src/input/input_vcd.c | |
parent | 52868140ed8175b91fb0e85e5d85684c1228b1e9 (diff) | |
download | xine-lib-bb653b8883c232f5a215b8a108f1c7fc4c92f1b3.tar.gz xine-lib-bb653b8883c232f5a215b8a108f1c7fc4c92f1b3.tar.bz2 |
- shared eject implementation taken from the DVD input, eject doesn't work if the CD/DVD isn't mounted, which definitely breaks the CDDA plugin... better than nothing
CVS patchset: 4542
CVS date: 2003/04/06 00:51:29
Diffstat (limited to 'src/input/input_vcd.c')
-rw-r--r-- | src/input/input_vcd.c | 66 |
1 files changed, 4 insertions, 62 deletions
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 980f3a4bf..7a297e453 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * 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.64 2003/02/14 18:11:47 heikos Exp $ + * $Id: input_vcd.c,v 1.65 2003/04/06 00:51:29 hadess Exp $ * */ @@ -50,6 +50,7 @@ #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" +#include "media_helper.h" #if defined(__sun) #define CDROM "/vol/dev/aliases/cdrom0" @@ -928,71 +929,12 @@ static void vcd_class_dispose (input_class_t *this_gen) { free (this); } -#if defined (__linux__) static int vcd_class_eject_media (input_class_t *this_gen) { - vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - int ret, status, fd; - - if ((fd = open (this->device, O_RDONLY|O_NONBLOCK)) > -1) { - if((status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)) > 0) { - switch(status) { - case CDS_TRAY_OPEN: - if((ret = ioctl(fd, CDROMCLOSETRAY)) != 0) { - printf ("input_vcd: CDROMCLOSETRAY failed: %s\n", strerror(errno)); - } - break; - case CDS_DISC_OK: - if((ret = ioctl(fd, CDROMEJECT)) != 0) { - printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno)); - } - break; - } - } - else { - printf ("input_vcd: CDROM_DRIVE_STATUS failed: %s\n", - strerror(errno)); - close(fd); - return 0; - } - } - close(fd); - - return 1; -} -#elif defined (__FreeBSD__) -static int vcd_class_eject_media (input_class_t *this_gen) { - vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - int fd; - - if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { - if (ioctl(fd, CDIOCALLOW) == -1) { - perror("ioctl(cdromallow)"); - } else { - if (ioctl(fd, CDIOCEJECT) == -1) { - perror("ioctl(cdromeject)"); - } - } - close(fd); - } - - return 1; -} -#elif defined (__sun) -static int vcd_class_eject_media (input_class_t *this_gen) { - vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - int fd, ret; - - if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) { - if ((ret = ioctl(fd, CDROMEJECT)) != 0) { - printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno)); - } - close(fd); - } + vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - return 1; + return media_eject_media (this->device); } -#endif static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *filename, int *num_files) { |