Mercurial > mplayer.hg
changeset 1042:b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
author | arpi_esp |
---|---|
date | Wed, 06 Jun 2001 21:16:21 +0000 |
parents | 4b3b2bf1c82b |
children | e565d452de79 |
files | DOCS/SOLARIS Makefile configure dvdauth.c dvdauth.h mplayer.c |
diffstat | 6 files changed, 134 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/SOLARIS Wed Jun 06 19:10:47 2001 +0000 +++ b/DOCS/SOLARIS Wed Jun 06 21:16:21 2001 +0000 @@ -3,3 +3,21 @@ 1. To build the package you will need GNU make (gmake, /opt/sfw/gmake), native Solaris make will not work. + +2. Due to two bugs in solaris 8 x86, you cannot reliably play DVDs using a + capacity >4GB: + + - The sd(7D) driver on solaris 8 x86 driver has bug when accessing a + disk block >4GB on a device using a logical blocksize != DEV_BSIZE + (i.e. CDROM and DVD media). Due to a 32bit int overflow, a disk + address modulo 4GB is accessed. + (http://groups.yahoo.com/group/solarisonintel/message/22516) + + - The similar bug is present in the hsfs(7FS) filesystem code (aka ISO9660), + hsfs currently does not support partitions/disks >4GB, all data is + accessed modulo 4GB + (http://groups.yahoo.com/group/solarisonintel/message/22592) + +-- +Jürgen Keil +
--- a/Makefile Wed Jun 06 19:10:47 2001 +0000 +++ b/Makefile Wed Jun 06 21:16:21 2001 +0000 @@ -15,7 +15,7 @@ #prefix = /usr/local BINDIR = ${prefix}/bin # BINDIR = /usr/local/bin -SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c +SRCS = find_sub.c aviprint.c dll_init.c dec_audio.c aviwrite.c aviheader.c asfheader.c demux_avi.c demux_asf.c demux_mpg.c demuxer.c stream.c codec-cfg.c subreader.c linux/getch2.c linux/timer-lx.c linux/shmem.c xa/xa_gsm.c lirc_mp.c cfgparser.c mixer.c dvdauth.c spudec.c asf_streaming.c network.c url.c http.c OBJS = $(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) # -Wall A_LIBS = -Lmp3lib -lMP3 -Llibac3 -lac3 $(ALSA_LIB) $(ESD_LIB) @@ -120,3 +120,4 @@ include .depend endif +
--- a/configure Wed Jun 06 19:10:47 2001 +0000 +++ b/configure Wed Jun 06 21:16:21 2001 +0000 @@ -124,10 +124,10 @@ --enable-xmmp use XMMP audio drivers --enable-lirc enable LIRC (remote control) support - --disable-oss disable OSS sound support [autodetect] + --disable-ossaudio disable OSS sound support [autodetect] --disable-alsa disable alsa sound support [autodetect] --disable-esd disable esd sound support [autodetect] - --disable-sun disable Sun sound support [autodetect] + --disable-sunaudio disable Sun sound support [autodetect] --disable-gcc-checking disable gcc version checking @@ -630,11 +630,23 @@ # --- # try to detect type of audio supported on this machine +cat > $TMPC << EOF +#include <sys/soundcard.h> +int main( void ) { int arg = SNDCTL_DSP_SETFRAGMENT; } +EOF + _oss_audio=no -[ -c /dev/dsp ] && _oss_audio=yes +$_cc -o $TMPO $TMPC 2> /dev/null && _oss_audio=yes + + +cat > $TMPC << EOF +#include <sys/audioio.h> +int main( void ) { audio_info_t info; AUDIO_INITINFO(&info); } +EOF _sun_audio=no -[ -c /dev/audio -a -c /dev/audioctl ] && _sun_audio=yes +$_cc -o $TMPO $TMPC 2> /dev/null && _sun_audio=yes + # ---
--- a/dvdauth.c Wed Jun 06 19:10:47 2001 +0000 +++ b/dvdauth.c Wed Jun 06 21:16:21 2001 +0000 @@ -7,19 +7,56 @@ #include <stdio.h> #include <stdlib.h> -#include <linux/cdrom.h> -// FIXME #include <string.h> conflicts with #include <linux/fs.h> (below) -//#include <string.h> // FIXME this conflicts with #include <linux/fs.h> +//#include <string.h> // FIXME: conflicts with fs.h #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/ioctl.h> #include <sys/stat.h> - #include <css.h> +#if CSS_MAJOR_VERSION > 0 || (CSS_MAJOR_VERSION == 0 && CSS_MINOR_VERSION > 1) +# include <dvd.h> +# undef OLD_CSS_API +#else +# if defined(__NetBSD__) || defined(__OpenBSD__) +# include <sys/dvdio.h> +# elif defined(__linux__) +# include <linux/cdrom.h> +# elif defined(__sun) +# include <sun/dvdio.h> +# else +# error "Need the DVD ioctls" +# endif +# define OLD_CSS_API 1 +#endif #include "dvdauth.h" + +#if OLD_CSS_API +/* + * provide some backward compatibiliy macros to compile this + * code using the old libcss-0.1 + */ +#define DVDHandle int +#define DVDOpenFailed (-1) + +#define DVDAuth(hdl, s) ioctl(hdl, DVD_AUTH, s) +#define DVDOpenDevice(path) open(path, O_RDONLY) +#define DVDCloseDevice(hdl) close(hdl) +#define CSSDVDisEncrypted(hdl) CSSisEncrypted(hdl) +#define CSSDVDAuthDisc CSSAuthDisc +#define CSSDVDAuthTitlePath(hdl,key_title,path) \ + CSSAuthTitle(hdl,key_title,path_to_lba(path)) + +#else /*OLD_CSS_API*/ + +#define DVDHandle struct dvd_device * +#define DVDOpenFailed NULL + +#endif /*OLD_CSS_API*/ + + char *dvd_auth_device=NULL; unsigned char key_disc[2048]; unsigned char key_title[5]; @@ -27,28 +64,51 @@ int descrambling=0; +#if OLD_CSS_API +/* + * With the old libcss-0.1 api, we have to find out the LBA for + * a title for title authentication. + */ +#ifdef __linux__ #include <linux/fs.h> +#include <errno.h> #ifndef FIBMAP #define FIBMAP 1 #endif - -static int path_to_lba ( int fd ) +static int path_to_lba (char *path) { - int lba = 0; - if (ioctl(fd, FIBMAP, &lba) < 0) { - perror ("ioctl FIBMAP"); - fprintf(stderr,"Hint: run mplayer as root!\n"); -// close(fd); - return -1; - } - return lba; + int fd, lba = 0; + + if ((fd = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Cannot open file %s: %s", + path ? path : "(NULL)", strerror(errno)); + return -1; + } + if (ioctl(fd, FIBMAP, &lba) != 0) { + perror ("ioctl FIBMAP"); + fprintf(stderr,"Hint: run mplayer as root!\n"); + close(fd); + return -1; + } + + close(fd); + + return lba; } +#else /*linux*/ +static int path_to_lba (char *path) +{ +#warning translating pathname to iso9660 LBA is not supported on this platform + fprintf(stderr, "Translating pathname to iso9660 LBA is not supported on this platform\n"); + return -1; +} +#endif /*linux*/ +#endif /*OLD_CSS_API*/ - -static void reset_agids ( int fd ) +static void reset_agids ( DVDHandle dvd ) { dvd_authinfo ai; int i; @@ -56,7 +116,7 @@ memset(&ai, 0, sizeof(ai)); ai.type = DVD_INVALIDATE_AGID; ai.lsa.agid = i; - ioctl(fd, DVD_AUTH, &ai); + DVDAuth(dvd, &ai); } } @@ -87,49 +147,45 @@ -int dvd_auth ( char *dev , int fd ) +int dvd_auth ( char *dev , char *filename ) { - int devfd; /* FD of DVD device */ - int lba; + DVDHandle dvd; /* DVD device handle */ - - if ((devfd=open(dev,O_RDONLY))<0) { + if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev); return 1; } - if (!CSSisEncrypted(devfd)) { + if (!CSSDVDisEncrypted(dvd)) { printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n"); + DVDCloseDevice(dvd); return 0; } else printf("DVD is encrypted, issuing authentication ...\n"); /* reset AGIDs */ - reset_agids(devfd); + reset_agids(dvd); /* authenticate disc */ - if (CSSAuthDisc(devfd,key_disc)) { - fprintf(stderr,"DVD: CSSAuthDisc() failed.\n"); + if (CSSDVDAuthDisc(dvd,key_disc)) { + fprintf(stderr,"DVD: CSSDVDAuthDisc() failed.\n"); + DVDCloseDevice(dvd); return 1; } - /* authenticate title */ - lba=path_to_lba(fd); - if (lba==-1) { - fprintf(stderr,"DVD: path_to_lba() failed.\n"); - return 1; - } - if (CSSAuthTitle(devfd,key_title,lba)) { - fprintf(stderr,"DVD: CSSAuthTitle() failed.\n"); + if (CSSDVDAuthTitlePath(dvd,key_title,filename)) { + fprintf(stderr,"DVD: CSSDVDAuthTitle() failed.\n"); + DVDCloseDevice(dvd); return 1; } /* decrypting title */ if (CSSDecryptTitleKey (key_title, key_disc) < 0) { fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n"); + DVDCloseDevice(dvd); return 1; } - close(devfd); + DVDCloseDevice(dvd); printf("DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); descrambling=1; return 0;
--- a/dvdauth.h Wed Jun 06 19:10:47 2001 +0000 +++ b/dvdauth.h Wed Jun 06 21:16:21 2001 +0000 @@ -1,4 +1,4 @@ -#include "config.h" +//#include "config.h" #ifdef HAVE_LIBCSS #ifndef _MPLAYER_CSS_H #define _MPLAYER_CSS_H @@ -9,8 +9,8 @@ extern unsigned char *dvdimportkey; extern int descrambling; -int dvd_auth ( char *, int ); +int dvd_auth ( char *, char * ); int dvd_import_key ( unsigned char * ); #endif -#endif \ No newline at end of file +#endif
--- a/mplayer.c Wed Jun 06 19:10:47 2001 +0000 +++ b/mplayer.c Wed Jun 06 21:16:21 2001 +0000 @@ -70,11 +70,9 @@ #include "opendivx/decore.h" -//extern int vo_screenwidth; - -int audio_fd=-1; - +#ifdef X11_FULLSCREEN extern int vo_screenwidth; +#endif extern char* win32_codec_name; // must be set before calling DrvOpen() !!! @@ -666,8 +664,8 @@ printf("DVD command line requested key is stored for descrambling.\n"); } if (dvd_auth_device) { - if (dvd_auth(dvd_auth_device,f)) { -// if (dvd_auth(dvd_auth_device,filename)) { +// if (dvd_auth(dvd_auth_device,f)) { + if (dvd_auth(dvd_auth_device,filename)) { GUI_MSG( mplErrorDVDAuth ) exit(0); }