summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mpv.rst1
-rwxr-xr-xold-configure3
-rw-r--r--old-makefile1
-rw-r--r--stream/stream.c4
-rw-r--r--stream/stream_vcd.c178
-rw-r--r--stream/vcd_read.h226
-rw-r--r--stream/vcd_read_darwin.h210
-rw-r--r--stream/vcd_read_fbsd.h239
-rw-r--r--stream/vcd_read_win32.h132
-rw-r--r--waftools/fragments/vcd_windows.c7
-rw-r--r--wscript11
-rw-r--r--wscript_build.py1
12 files changed, 0 insertions, 1013 deletions
diff --git a/DOCS/man/en/mpv.rst b/DOCS/man/en/mpv.rst
index ba3de127ea..984e6b4d7c 100644
--- a/DOCS/man/en/mpv.rst
+++ b/DOCS/man/en/mpv.rst
@@ -19,7 +19,6 @@ SYNOPSIS
| **mpv** bdnav://[title][/device] [options]
| **mpv** dvd://[title|[start\_title]-end\_title][/device] [options]
| **mpv** dvdnav://[longest|menu|title][/device] [options]
-| **mpv** \vcd://[/device]
| **mpv** \tv://[channel][/input_id] [options]
| **mpv** \pvr:// [options]
| **mpv** \dvb://[card\_number@]channel [options]
diff --git a/old-configure b/old-configure
index 6a8d9533aa..21db04c224 100755
--- a/old-configure
+++ b/old-configure
@@ -179,7 +179,6 @@ options_state_machine() {
opt_yes_no _libquvi4 "libquvi 0.4.x"
opt_yes_no _libquvi9 "libquvi 0.9.x"
opt_yes_no _lcms2 "LCMS2 support"
- opt_yes_no _vcd "VCD support" yes
opt_yes_no _bluray "Blu-ray support"
opt_yes_no _dvdread "libdvdread"
opt_yes_no _dvdnav "libdvdnav"
@@ -730,8 +729,6 @@ check_pkg_config "OpenAL" $_openal OPENAL 'openal >= 1.13'
check_pkg_config "ALSA audio" $_alsa ALSA 'alsa >= 1.0.9'
-check_trivial "VCD support" $_vcd VCD
-
check_pkg_config "Blu-ray support" $_bluray LIBBLURAY 'libbluray >= 0.2.1'
check_pkg_config "dvdread" $_dvdread DVDREAD 'dvdread >= 4.1.0'
diff --git a/old-makefile b/old-makefile
index 7a9193c34d..c4a4e76ba7 100644
--- a/old-makefile
+++ b/old-makefile
@@ -53,7 +53,6 @@ SOURCES-$(TV) += stream/stream_tv.c stream/tv.c \
stream/frequencies.c stream/tvi_dummy.c
SOURCES-$(TV_V4L2) += stream/tvi_v4l2.c stream/audio_in.c
-SOURCES-$(VCD) += stream/stream_vcd.c
SOURCES-$(DUMMY_OSD) += sub/osd_dummy.c
SOURCES-$(LIBASS_OSD) += sub/osd_libass.c
diff --git a/stream/stream.c b/stream/stream.c
index e2d49564be..773f8662c4 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -57,7 +57,6 @@ char *cdrom_device = NULL;
char *dvd_device = NULL;
int dvd_title = 0;
-extern const stream_info_t stream_info_vcd;
extern const stream_info_t stream_info_cdda;
extern const stream_info_t stream_info_dvb;
extern const stream_info_t stream_info_tv;
@@ -79,9 +78,6 @@ extern const stream_info_t stream_info_rar_entry;
extern const stream_info_t stream_info_edl;
static const stream_info_t *const stream_list[] = {
-#if HAVE_VCD
- &stream_info_vcd,
-#endif
#if HAVE_CDDA
&stream_info_cdda,
#endif
diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c
deleted file mode 100644
index 0ea8f7dabe..0000000000
--- a/stream/stream_vcd.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * Original author: Albeu
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#if defined(__MINGW32__) || defined(__CYGWIN__)
-#include <windows.h>
-#endif
-
-#include "common/msg.h"
-#include "stream.h"
-#include "options/m_option.h"
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
-#include <sys/ioctl.h>
-#endif
-#include <errno.h>
-
-#include "talloc.h"
-
-#define VCD_SECTOR_SIZE 2352
-#define VCD_SECTOR_OFFS 24
-#define VCD_SECTOR_DATA 2324
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
-#include "vcd_read_fbsd.h"
-#elif defined(__APPLE__)
-#include "vcd_read_darwin.h"
-#elif defined(__MINGW32__) || defined(__CYGWIN__)
-#include "vcd_read_win32.h"
-#else
-#include "vcd_read.h"
-#endif
-
-#ifndef vcd_close
-#define vcd_close(priv) (close(((mp_vcd_priv_t*)priv)->fd))
-#endif
-
-#include "osdep/io.h"
-
-static int fill_buffer(stream_t *s, char* buffer, int max_len){
- if(s->pos > s->end_pos) /// don't read past end of current track
- return 0;
- if (max_len < VCD_SECTOR_DATA)
- return -1;
- return vcd_read(s->priv,buffer);
-}
-
-static int seek(stream_t *s,int64_t newpos) {
- mp_vcd_priv_t *vcd = s->priv;
- newpos += vcd->start;
- vcd_set_msf(vcd,newpos/VCD_SECTOR_DATA);
- return 1;
-}
-
-static void close_s(stream_t *stream) {
- vcd_close(stream->priv);
- free(stream->priv);
-}
-
-static int open_s(stream_t *stream)
-{
- int ret,ret2,f,sect,tmp;
- mp_vcd_priv_t* vcd;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- int bsize = VCD_SECTOR_SIZE;
-#endif
-#if defined(__MINGW32__) || defined(__CYGWIN__)
- HANDLE hd;
- char device[20] = "\\\\.\\?:";
-#endif
-
- char *dev = stream->url;
- if (strncmp("vcd://", dev, 6) != 0)
- return STREAM_UNSUPPORTED;
- dev += 6;
- if (!dev[0]) {
- if(cdrom_device)
- dev = cdrom_device;
- else
- dev = DEFAULT_CDROM_DEVICE;
- }
-
-#if defined(__MINGW32__) || defined(__CYGWIN__)
- device[4] = dev ? dev[0] : 0;
- /* open() can't be used for devices so do it the complicated way */
- hd = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- f = _open_osfhandle((intptr_t)hd, _O_RDONLY);
-#else
- f=open(dev,O_RDONLY | O_CLOEXEC);
-#endif
- if(f<0){
- MP_ERR(stream, "CD-ROM Device '%s' not found.\n",dev);
- return STREAM_ERROR;
- }
-
- vcd = vcd_read_toc(stream, f);
- if(!vcd) {
- MP_ERR(stream, "Failed to get cd toc\n");
- close(f);
- return STREAM_ERROR;
- }
- ret2=vcd_get_track_end(vcd,1);
- if(ret2<0){
- MP_ERR(stream, "%s (get)\n", "Error selecting VCD track.");
- close(f);
- free(vcd);
- return STREAM_ERROR;
- }
- ret=vcd_seek_to_track(vcd,1);
- if(ret<0){
- MP_ERR(stream, "%s (seek)\n", "Error selecting VCD track.");
- close(f);
- free(vcd);
- return STREAM_ERROR;
- }
- /* search forward up to at most 3 seconds to skip leading margin */
- sect = ret / VCD_SECTOR_DATA;
- for (tmp = sect; tmp < sect + 3 * 75; tmp++) {
- char mem[VCD_SECTOR_DATA];
- //since MPEG packs are block-aligned we stop discarding sectors if they are non-null
- if (vcd_read(vcd, mem) != VCD_SECTOR_DATA || mem[2] || mem[3])
- break;
- }
- MP_DBG(stream, "%d leading sectors skipped\n", tmp - sect);
- vcd_set_msf(vcd, tmp);
- ret = tmp * VCD_SECTOR_DATA;
-
- MP_VERBOSE(stream, "VCD start byte position: 0x%X end: 0x%X\n",ret,ret2);
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- if (ioctl (f, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
- MP_WARN(stream, "Error in CDRIOCSETBLOCKSIZE");
- }
-#endif
-
- stream->sector_size = VCD_SECTOR_DATA;
- stream->end_pos=ret2-ret;
- stream->priv = vcd;
-
- stream->fill_buffer = fill_buffer;
- stream->seek = seek;
- stream->seekable = true;
- stream->close = close_s;
- stream->demuxer = "lavf"; // mpegps ( or "vcd"?)
-
- vcd->start = ret;
- seek(stream, 0);
-
- return STREAM_OK;
-}
-
-const stream_info_t stream_info_vcd = {
- .name = "vcd",
- .open = open_s,
- .protocols = (const char*[]){ "vcd", NULL },
-};
diff --git a/stream/vcd_read.h b/stream/vcd_read.h
deleted file mode 100644
index 5a5d033f4b..0000000000
--- a/stream/vcd_read.h
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VCD_READ_H
-#define MPLAYER_VCD_READ_H
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-
-#include <libavutil/intreadwrite.h>
-
-#include "common/msg.h"
-#include "stream.h"
-//=================== VideoCD ==========================
-
-typedef struct mp_vcd_priv_st mp_vcd_priv_t;
-
-#ifdef sun
-#include <sys/cdio.h>
-static int sun_vcd_read(mp_vcd_priv_t*, int*);
-#elif defined(__bsdi__)
-#include <dvd.h>
-#else
-#include <linux/cdrom.h>
-#endif
-
-struct mp_vcd_priv_st {
- int start;
- stream_t *stream;
- int fd;
- struct cdrom_tocentry entry;
- char buf[VCD_SECTOR_SIZE];
- struct cdrom_tochdr tochdr;
-};
-
-static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect){
- sect += 150;
- vcd->entry.cdte_addr.msf.frame=sect%75;
- sect=sect/75;
- vcd->entry.cdte_addr.msf.second=sect%60;
- sect=sect/60;
- vcd->entry.cdte_addr.msf.minute=sect;
-}
-
-static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd){
- return vcd->entry.cdte_addr.msf.frame +
- (vcd->entry.cdte_addr.msf.second+
- vcd->entry.cdte_addr.msf.minute*60)*75 - 150;
-}
-
-static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
-{
- vcd->entry.cdte_format = CDROM_MSF;
- vcd->entry.cdte_track = track;
- if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) {
- MP_ERR(vcd->stream, "ioctl dif1: %s\n",strerror(errno));
- return -1;
- }
- return VCD_SECTOR_DATA*vcd_get_msf(vcd);
-}
-
-static int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){
- vcd->entry.cdte_format = CDROM_MSF;
- vcd->entry.cdte_track = track<vcd->tochdr.cdth_trk1?(track+1):CDROM_LEADOUT;
- if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) {
- MP_ERR(vcd->stream, "ioctl dif2: %s\n",strerror(errno));
- return -1;
- }
- return VCD_SECTOR_DATA*vcd_get_msf(vcd);
-}
-
-static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd){
- struct cdrom_tochdr tochdr;
- mp_vcd_priv_t* vcd;
- int i;
- if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) {
- MP_ERR(stream, "read CDROM toc header: %s\n",strerror(errno));
- return NULL;
- }
- for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 + 1; i++){
- struct cdrom_tocentry tocentry;
-
- tocentry.cdte_track = i<=tochdr.cdth_trk1 ? i : CDROM_LEADOUT;
- tocentry.cdte_format = CDROM_MSF;
-
- if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) {
- MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
- return NULL;
- }
-
- if (i<=tochdr.cdth_trk1)
- MP_INFO(stream, "track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d mode: %d\n",
- (int)tocentry.cdte_track,
- (int)tocentry.cdte_adr,
- (int)tocentry.cdte_ctrl,
- (int)tocentry.cdte_format,
- (int)tocentry.cdte_addr.msf.minute,
- (int)tocentry.cdte_addr.msf.second,
- (int)tocentry.cdte_addr.msf.frame,
- (int)tocentry.cdte_datamode
- );
-
- }
- vcd = malloc(sizeof(mp_vcd_priv_t));
- vcd->stream = stream;
- vcd->fd = fd;
- vcd->tochdr = tochdr;
- return vcd;
-}
-
-static int vcd_read(mp_vcd_priv_t* vcd,char *mem){
-#ifndef sun
- memcpy(vcd->buf,&vcd->entry.cdte_addr.msf,sizeof(vcd->entry.cdte_addr.msf));
- if(ioctl(vcd->fd,CDROMREADRAW,vcd->buf)==-1) return 0; // EOF?
- memcpy(mem,&vcd->buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA);
-#else
- {
- int offset;
- if (sun_vcd_read(vcd, &offset) <= 0) return 0;
- memcpy(mem,&vcd->buf[offset],VCD_SECTOR_DATA);
- }
-#endif
-
- vcd->entry.cdte_addr.msf.frame++;
- if (vcd->entry.cdte_addr.msf.frame==75){
- vcd->entry.cdte_addr.msf.frame=0;
- vcd->entry.cdte_addr.msf.second++;
- if (vcd->entry.cdte_addr.msf.second==60){
- vcd->entry.cdte_addr.msf.second=0;
- vcd->entry.cdte_addr.msf.minute++;
- }
- }
-
- return VCD_SECTOR_DATA;
-}
-
-
-#ifdef sun
-#include <sys/scsi/generic/commands.h>
-#include <sys/scsi/impl/uscsi.h>
-
-#define SUN_XAREAD 1 /*fails on atapi drives*/
-#define SUN_MODE2READ 2 /*fails on atapi drives*/
-#define SUN_SCSIREAD 3
-#define SUN_VCDREAD SUN_SCSIREAD
-
-static int sun_vcd_read(mp_vcd_priv_t* vcd, int *offset)
-{
-#if SUN_VCDREAD == SUN_XAREAD
- struct cdrom_cdxa cdxa;
- cdxa.cdxa_addr = vcd_get_msf(vcd);
- cdxa.cdxa_length = 1;
- cdxa.cdxa_data = vcd->buf;
- cdxa.cdxa_format = CDROM_XA_SECTOR_DATA;
-
- if(ioctl(vcd->fd,CDROMCDXA,&cdxa)==-1) {
- MP_ERR(vcd->stream, "CDROMCDXA: %s\n",strerror(errno));
- return 0;
- }
- *offset = 0;
-#elif SUN_VCDREAD == SUN_MODE2READ
- struct cdrom_read cdread;
- cdread.cdread_lba = 4*vcd_get_msf(vcd);
- cdread.cdread_bufaddr = vcd->buf;
- cdread.cdread_buflen = 2336;
-
- if(ioctl(vcd->fd,CDROMREADMODE2,&cdread)==-1) {
- MP_ERR(vcd->stream, "CDROMREADMODE2: %s\n",strerror(errno));
- return 0;
- }
- *offset = 8;
-#elif SUN_VCDREAD == SUN_SCSIREAD
- struct uscsi_cmd sc;
- union scsi_cdb cdb;
- int lba = vcd_get_msf(vcd);
- int blocks = 1;
-
- memset(&cdb, 0, sizeof(cdb));
- memset(&sc, 0, sizeof(sc));
- cdb.scc_cmd = 0xBE;
- cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2
- AV_WB32(&cdb.cdb_opaque[2], lba);
- AV_WB24(&cdb.cdb_opaque[6], blocks);
- cdb.cdb_opaque[9] = 1 << 4; // user data only
- cdb.cdb_opaque[10] = 0; // subchannel
-
- sc.uscsi_cdb = (caddr_t)&cdb;
- sc.uscsi_cdblen = 12;
- sc.uscsi_bufaddr = vcd->buf;
- sc.uscsi_buflen = 2336;
- sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ;
- sc.uscsi_timeout = 20;
- if (ioctl(vcd->fd, USCSICMD, &sc)) {
- MP_ERR(vcd->stream, "USCSICMD: READ CD: %s\n",strerror(errno));
- return -1;
- }
- if (sc.uscsi_status) {
- MP_ERR(vcd->stream, "scsi command failed with status %d\n", sc.uscsi_status);
- return -1;
- }
- *offset = 0;
- return 1;
-#else
-#error SUN_VCDREAD
-#endif
-}
-#endif /*sun*/
-
-#endif /* MPLAYER_VCD_READ_H */
diff --git a/stream/vcd_read_darwin.h b/stream/vcd_read_darwin.h
deleted file mode 100644
index f35717856a..0000000000
--- a/stream/vcd_read_darwin.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VCD_READ_DARWIN_H
-#define MPLAYER_VCD_READ_DARWIN_H
-
-#define _XOPEN_SOURCE 500
-
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <CoreFoundation/CFBase.h>
-#include <IOKit/IOKitLib.h>
-#include <IOKit/storage/IOCDTypes.h>
-#include <IOKit/storage/IOCDMedia.h>
-#include <IOKit/storage/IOCDMediaBSDClient.h>
-#include "compat/mpbswap.h"
-#include "common/msg.h"
-#include "stream.h"
-
-//=================== VideoCD ==========================
-#define CDROM_LEADOUT 0xAA
-
-typedef struct
-{
- uint8_t sync [12];
- uint8_t header [4];
- uint8_t subheader [8];
- uint8_t data [2324];
- uint8_t spare [4];
-} cdsector_t;
-
-typedef struct mp_vcd_priv_st
-{
- int start;
- stream_t *stream;
- int fd;
- cdsector_t buf;
- dk_cd_read_track_info_t entry;
- struct CDDiscInfo hdr;
- CDMSF msf;
-} mp_vcd_priv_t;
-
-static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
-{
- vcd->msf = CDConvertLBAToMSF(sect);
-}
-
-static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd)
-{
- return CDConvertMSFToLBA(vcd->msf);
-}
-
-static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
-{
- struct CDTrackInfo entry;
-
- memset( &vcd->entry, 0, sizeof(vcd->entry));
- vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
- vcd->entry.address = track;
- vcd->entry.bufferLength = sizeof(entry);
- vcd->entry.buffer = &entry;
-
- if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
- {
- MP_ERR(vcd->stream, "ioctl dif1: %s\n",strerror(errno));
- return -1;
- }
- vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
- return VCD_SECTOR_DATA*vcd_get_msf(vcd);
-}
-
-static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
-{
- struct CDTrackInfo entry;
-
- if (track > vcd->hdr.lastTrackNumberInLastSessionLSB) {
- MP_ERR(vcd->stream, "track number %d greater than last track number %d\n",
- track, vcd->hdr.lastTrackNumberInLastSessionLSB);
- return -1;
- }
-
- //read track info
- memset( &vcd->entry, 0, sizeof(vcd->entry));
- vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
- vcd->entry.address = track<vcd->hdr.lastTrackNumberInLastSessionLSB?track+1:vcd->hdr.lastTrackNumberInLastSessionLSB;
- vcd->entry.bufferLength = sizeof(entry);
- vcd->entry.buffer = &entry;
-
- if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
- {
- MP_ERR(vcd->stream, "ioctl dif2: %s\n",strerror(errno));
- return -1;
- }
- if (track == vcd->hdr.lastTrackNumberInLastSessionLSB)
- vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress) +
- be2me_32(entry.trackSize));
- else
- vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
- return VCD_SECTOR_DATA*vcd_get_msf(vcd);
-}
-
-static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
-{
- dk_cd_read_disc_info_t tochdr;
- struct CDDiscInfo hdr;
-
- dk_cd_read_track_info_t tocentry;
- struct CDTrackInfo entry;
- CDMSF trackMSF;
-
- mp_vcd_priv_t* vcd;
- int i;
-
- //read toc header
- memset(&tochdr, 0, sizeof(tochdr));
- tochdr.buffer = &hdr;
- tochdr.bufferLength = sizeof(hdr);
-
- if (ioctl(fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
- {
- MP_ERR(stream, "read CDROM toc header: %s\n",strerror(errno));
- return NULL;
- }
-
- //print all track info
- for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
- {
- if (i <= hdr.lastTrackNumberInLastSessionLSB) {
- memset( &tocentry, 0, sizeof(tocentry));
- tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
- tocentry.address = i;
- tocentry.bufferLength = sizeof(entry);
- tocentry.buffer = &entry;
-
- if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
- {
- MP_ERR(stream, "read CDROM toc entry: %s\n",strerror(errno));
- return NULL;
- }
-
- trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
- }
- else
- trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress)
- + be2me_32(entry.trackSize));
-
- //MP_INFO(vcd->stream, "track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
- if (i<=hdr.lastTrackNumberInLastSessionLSB)
- MP_INFO(stream, "track %02d: format=%d %02d:%02d:%02d\n",
- (int)tocentry.address,
- //(int)tocentry.entry.addr_type,
- //(int)tocentry.entry.control,
- (int)tocentry.addressType,
- (int)trackMSF.minute,
- (int)trackMSF.second,
- (int)trackMSF.frame
- );
-
- }
-
- vcd = malloc(sizeof(mp_vcd_priv_t));
- vcd->stream = stream;
- vcd->fd = fd;
- vcd->hdr = hdr;
- vcd->msf = trackMSF;
- return vcd;
-}
-
-static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
-{
- if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE)
- return 0; // EOF?
-
- vcd->msf.frame++;
- if (vcd->msf.frame==75)
- {
- vcd->msf.frame=0;
- vcd->msf.second++;
-
- if (vcd->msf.second==60)
- {
- vcd->msf.second=0;
- vcd->msf.minute++;
- }
- }
-
- memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
- return VCD_SECTOR_DATA;
-}
-
-#endif /* MPLAYER_VCD_READ_DARWIN_H */
diff --git a/stream/vcd_read_fbsd.h b/stream/vcd_read_fbsd.h
deleted file mode 100644
index 8f7f2a585a..0000000000
--- a/stream/vcd_read_fbsd.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VCD_READ_FBSD_H
-#define MPLAYER_VCD_READ_FBSD_H
-
-#define _XOPEN_SOURCE 500
-
-#include <sys/types.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <sys/cdio.h>
-#include <sys/ioctl.h>
-
-#include <libavutil/intreadwrite.h>
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-#define VCD_NETBSD 1
-#endif
-#ifdef VCD_NETBSD
-#include <sys/scsiio.h>
-#define TOCADDR(te) ((te).data->addr)
-#define READ_TOC CDIOREADTOCENTRYS
-#else
-#include <sys/cdrio.h>
-#define TOCADDR(te) ((te).entry.addr)
-#define READ_TOC CDIOREADTOCENTRY
-#endif
-#include "common/msg.h"
-
-//=================== VideoCD ==========================
-#define CDROM_LEADOUT 0xAA
-
-typedef struct {
- uint8_t sync [12];
- uint8_t header [4];
- uint8_t subheader [8];
- uint8_t data [2324];
- uint8_t spare [4];
-} cdsector_t;
-
-#ifdef VCD_NETBSD
-typedef struct ioc_read_toc_entry vcd_tocentry;
-#else
-typedef struct ioc_read_toc_single_entry vcd_tocentry;
-#endif
-
-typedef struct mp_vcd_priv_st {
- int start;
- int fd;
- vcd_tocentry entry;
-#ifdef VCD_NETBSD
- struct cd_toc_entry entry_data;
-#else
- cdsector_t buf;
-#endif
- struct ioc_toc_header tochdr;
-} mp_vcd_priv_t;
-
-static inline void
-vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
-{
-#ifdef VCD_NETBSD
- vcd->entry.data = &vcd->entry_data;
-#endif
- sect += 150;
- TOCADDR(vcd->entry).msf.frame = sect % 75;
- sect = sect / 75;
- TOCADDR(vcd->entry).msf.second = sect % 60;
- sect = sect / 60;
- TOCADDR(vcd->entry).msf.minute = sect;
-}
-
-static inline void
-vcd_inc_msf(mp_vcd_priv_t* vcd)
-{
-#ifdef VCD_NETBSD
- vcd->entry.data = &vcd->entry_data;
-#endif
- TOCADDR(vcd->entry).msf.frame++;
- if (TOCADDR(vcd->entry).msf.frame==75){
- TOCADDR(vcd->entry).msf.frame=0;
- TOCADDR(vcd->entry).msf.second++;
- if (TOCADDR(vcd->entry).msf.second==60){
- TOCADDR(vcd->entry).msf.second=0;
- TOCADDR(vcd->entry).msf.minute++;
- }
- }
-}
-
-static inline unsigned int
-vcd_get_msf(mp_vcd_priv_t* vcd)
-{
-#ifdef VCD_NETBSD
- vcd->entry.data = &vcd->entry_data;
-#endif
- return TOCADDR(vcd->entry).msf.frame +
- (TOCADDR(vcd->entry).msf.second +
- TOCADDR(vcd->entry).msf.minute * 60) * 75 - 150;
-}
-
-/**
- * \brief read a TOC entry
- * \param fd device to read from
- * \param dst buffer to read data into
- * \param nr track number to read info for
- * \return 1 on success, 0 on failure
- */
-static int
-read_toc_entry(mp_vcd_priv_t *vcd, int nr)
-{
- vcd->entry.address_format = CD_MSF_FORMAT;
-#ifdef VCD_NETBSD
- vcd->entry.data_len = sizeof(struct cd_toc_entry);
- vcd->entry.data = &vcd->entry_data;
- vcd->entry.starting_track = nr;
-#else
- vcd->entry.track = nr;
-#endif
- if (ioctl(vcd->fd, READ_TOC, &vcd->entry) == -1) {
- return 0;
- }
- return 1;
-}
-
-static int
-vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
-{
- if (!read_toc_entry(vcd, track))
- return -1;
- return VCD_SECTOR_DATA * vcd_get_msf(vcd);
-}
-
-static int
-vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
-{
- if (!read_toc_entry(vcd,
- track < vcd->tochdr.ending_track ? track + 1 : CDROM_LEADOUT))
- return -1;
- return VCD_SECTOR_DATA * vcd_get_msf(vcd);
-}
-
-static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
-{
- struct ioc_toc_header tochdr;
- mp_vcd_priv_t* vcd;
- int i, last_startsect;
- if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) {
- MP_ERR(stream, "read CDROM toc header: %s\n",strerror(errno));
- return NULL;
- }
- vcd = malloc(sizeof(mp_vcd_priv_t));
- vcd->fd = fd;
- vcd->tochdr = tochdr;
- for (i = tochdr.starting_track; i <= tochdr.ending_track + 1; i++) {
- if (!read_toc_entry(vcd,
- i <= tochdr.ending_track ? i : CDROM_LEADOUT)) {
- free(vcd);
- return NULL;
- }
-
- if (i <= tochdr.ending_track)
- MP_INFO(stream, "track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
-#ifdef VCD_NETBSD
- (int)vcd->entry.starting_track,
- (int)vcd->entry.data->addr_type,
- (int)vcd->entry.data->control,
-#else
- (int)vcd->entry.track,
- (int)vcd->entry.entry.addr_type,
- (int)vcd->entry.entry.control,
-#endif
- (int)vcd->entry.address_format,
- (int)TOCADDR(vcd->entry).msf.minute,
- (int)TOCADDR(vcd->entry).msf.second,
- (int)TOCADDR(vcd->entry).msf.frame
- );
-
- }
- return vcd;
-}
-
-static int
-vcd_read(mp_vcd_priv_t* vcd, char *mem)
-{
-#ifdef VCD_NETBSD
- struct scsireq sc;
- int lba = vcd_get_msf(vcd);
- int blocks;
- int rc;
-
- blocks = 1;
-
- memset(&sc, 0, sizeof(sc));
- sc.cmd[0] = 0xBE;
- sc.cmd[1] = 5 << 2; // mode2/form2
- AV_WB32(&sc.cmd[2], lba);
- AV_WB24(&sc.cmd[6], blocks);
- sc.cmd[9] = 1 << 4; // user data only
- sc.cmd[10] = 0; // no subchannel
- sc.cmdlen = 12;
- sc.databuf = (caddr_t) mem;
- sc.datalen = VCD_SECTOR_DATA;
- sc.senselen = sizeof(sc.sense);
- sc.flags = SCCMD_READ;
- sc.timeout = 10000;
- rc = ioctl(vcd->fd, SCIOCCOMMAND, &sc);
- if (rc == -1) {
- return -1;
- }
- if (sc.retsts || sc.error) {
- return -1;
- }
-#else
- if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE)
- != VCD_SECTOR_SIZE) return 0; // EOF?
-
- memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
-#endif
- vcd_inc_msf(vcd);
- return VCD_SECTOR_DATA;
-}
-
-#endif /* MPLAYER_VCD_READ_FBSD_H */
diff --git a/stream/vcd_read_win32.h b/stream/vcd_read_win32.h
deleted file mode 100644
index a01290eeb9..0000000000
--- a/stream/vcd_read_win32.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VCD_READ_WIN32_H
-#define MPLAYER_VCD_READ_WIN32_H
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ntddcdrm.h>
-#include "common/msg.h"
-
-typedef struct mp_vcd_priv_st mp_vcd_priv_t;
-
-/*
- Unlike Unices, upon reading TOC, Windows will retrieve information for
- all tracks, so we don't need to call DeviceIoControl() in functions
- like vcd_seek_to_track() and vcd_get_track_end() for each track. Instead
- we cache the information in mp_vcd_priv_st.
-*/
-struct mp_vcd_priv_st {
- int start;
- HANDLE hd;
- CDROM_TOC toc;
- unsigned sect;
- char buf[VCD_SECTOR_SIZE];
-};
-
-static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned sect)
-{
- vcd->sect = sect;
-}
-
-static inline unsigned vcd_get_msf(mp_vcd_priv_t* vcd, int track){
- int index = track - vcd->toc.FirstTrack;
- /* -150 to compensate the 2-second pregap */
- return vcd->toc.TrackData[index].Address[3] +
- (vcd->toc.TrackData[index].Address[2] +
- vcd->toc.TrackData[index].Address[1] * 60) * 75 - 150;
-}
-
-static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
-{
- unsigned sect;
- if (track < vcd->toc.FirstTrack || track > vcd->toc.LastTrack)
- return -1;
- sect = vcd_get_msf(vcd, track);
- vcd_set_msf(vcd, sect);
- return VCD_SECTOR_DATA * (sect + 2);
-}
-
-static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
-{
- if (track < vcd->toc.FirstTrack || track > vcd->toc.LastTrack)
- return -1;
- return VCD_SECTOR_DATA * (vcd_get_msf(vcd, track + 1));
-}
-
-static mp_vcd_priv_t* vcd_read_toc(stream_t *stream, int fd)
-{
- DWORD dwBytesReturned;
- HANDLE hd;
- int i;
- mp_vcd_priv_t* vcd = mallo