diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-11-16 06:54:22 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-11-16 07:01:46 +0200 |
commit | 287b62163eed8811b6cd33716c0691d328947d48 (patch) | |
tree | 3143d2cb17b32a19e3e7e0aa428210d1bba3eb0b /stream/stream_dvd.c | |
parent | 507f4fe6c7811558b1367e4b64855ae7f9bc8da8 (diff) | |
parent | b411278fbb00767b8013604157a43e0203f66f4c (diff) | |
download | mpv-287b62163eed8811b6cd33716c0691d328947d48.tar.bz2 mpv-287b62163eed8811b6cd33716c0691d328947d48.tar.xz |
Merge svn changes up to r29912
Diffstat (limited to 'stream/stream_dvd.c')
-rw-r--r-- | stream/stream_dvd.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 8dc73b96b3..36a8b07d05 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -5,25 +5,12 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <fcntl.h> #include <string.h> #include "config.h" #include "mp_msg.h" #include "help_mp.h" -#ifdef __FreeBSD__ -#include <sys/cdrio.h> -#endif - -#ifdef __linux__ -#include <linux/cdrom.h> -#include <scsi/sg.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#endif - #include <libgen.h> #include <errno.h> @@ -39,84 +26,9 @@ #include "stream_dvd.h" #include "stream_dvd_common.h" #include "libmpdemux/demuxer.h" -#include "ffmpeg_files/intreadwrite.h" -extern char* dvd_device; static char* dvd_device_current; int dvd_angle=1; -int dvd_speed=0; /* 0 => don't touch speed */ - -static void dvd_set_speed(char *device, unsigned speed) -{ -#if defined(__linux__) && defined(SG_IO) && defined(GPCMD_SET_STREAMING) - int fd; - unsigned char buffer[28]; - unsigned char cmd[12]; - struct sg_io_hdr sghdr; - struct stat st; - - memset(&st, 0, sizeof(st)); - - if (stat(device, &st) == -1) return; - - if (!S_ISBLK(st.st_mode)) return; /* not a block device */ - - switch (speed) { - case 0: /* don't touch speed setting */ - return; - case -1: /* restore default value */ - if (dvd_speed == 0) return; /* we haven't touched the speed setting */ - mp_tmsg(MSGT_OPEN, MSGL_INFO, "Restoring DVD speed... "); - break; - default: /* limit to <speed> KB/s */ - // speed < 100 is multiple of DVD single speed (1350KB/s) - if (speed < 100) - speed *= 1350; - mp_tmsg(MSGT_OPEN, MSGL_INFO, "Limiting DVD speed to %dKB/s... ", speed); - break; - } - - memset(&sghdr, 0, sizeof(sghdr)); - sghdr.interface_id = 'S'; - sghdr.timeout = 5000; - sghdr.dxfer_direction = SG_DXFER_TO_DEV; - sghdr.dxfer_len = sizeof(buffer); - sghdr.dxferp = buffer; - sghdr.cmd_len = sizeof(cmd); - sghdr.cmdp = cmd; - - memset(cmd, 0, sizeof(cmd)); - cmd[0] = GPCMD_SET_STREAMING; - cmd[10] = sizeof(buffer); - - memset(buffer, 0, sizeof(buffer)); - /* first sector 0, last sector 0xffffffff */ - AV_WB32(buffer + 8, 0xffffffff); - if (speed == -1) - buffer[0] = 4; /* restore default */ - else { - /* <speed> kilobyte */ - AV_WB32(buffer + 12, speed); - AV_WB32(buffer + 20, speed); - } - /* 1 second */ - AV_WB16(buffer + 18, 1000); - AV_WB16(buffer + 26, 1000); - - fd = open(device, O_RDWR | O_NONBLOCK); - if (fd == -1) { - mp_tmsg(MSGT_OPEN, MSGL_INFO, "Couldn't open DVD device for writing, changing DVD speed needs write access.\n"); - return; - } - - if (ioctl(fd, SG_IO, &sghdr) < 0) - mp_tmsg(MSGT_OPEN, MSGL_INFO, "failed\n"); - else - mp_tmsg(MSGT_OPEN, MSGL_INFO, "successful\n"); - - close(fd); -#endif -} #define LIBDVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro)) /* @@ -133,9 +45,6 @@ static void dvd_set_speed(char *device, unsigned speed) #endif #endif -const char * const dvd_audio_stream_types[8] = { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" }; -const char * const dvd_audio_stream_channels[6] = { "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" }; - static struct stream_priv_s { int title; |