Update of /cvsroot/mplayer/main In directory usw-pr-cvs1:/tmp/cvs-serv15547 Modified Files: Makefile configure dvdauth.c dvdauth.h mplayer.c Log Message: Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de> Index: Makefile =================================================================== RCS file: /cvsroot/mplayer/main/Makefile,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** Makefile 2001/06/05 10:59:38 1.42 --- Makefile 2001/06/06 21:16:21 1.43 *************** *** 16,20 **** 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 OBJS = $(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) # -Wall --- 16,20 ---- 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 asf_streaming.c network.c url.c http.c OBJS = $(SRCS:.c=.o) CFLAGS = $(OPTFLAGS) -Iloader -Ilibvo $(CSS_INC) # -Wall *************** *** 120,122 **** --- 120,123 ---- include .depend endif + Index: configure =================================================================== RCS file: /cvsroot/mplayer/main/configure,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -r1.76 -r1.77 *** configure 2001/06/05 18:40:44 1.76 --- configure 2001/06/06 21:16:21 1.77 *************** *** 125,132 **** --enable-lirc enable LIRC (remote control) support ! --disable-oss 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-gcc-checking disable gcc version checking --- 125,132 ---- --enable-lirc enable LIRC (remote control) support ! --disable-ossaudio disable OSS sound support [autodetect] --disable-alsa disable alsa sound support [autodetect] --disable-esd disable esd sound support [autodetect] ! --disable-sunaudio disable Sun sound support [autodetect] --disable-gcc-checking disable gcc version checking *************** *** 631,639 **** # try to detect type of audio supported on this machine _oss_audio=no ! [ -c /dev/dsp ] && _oss_audio=yes _sun_audio=no ! [ -c /dev/audio -a -c /dev/audioctl ] && _sun_audio=yes # --- --- 631,651 ---- # 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 ! $_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 ! $_cc -o $TMPO $TMPC 2> /dev/null && _sun_audio=yes ! # --- Index: dvdauth.c =================================================================== RCS file: /cvsroot/mplayer/main/dvdauth.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dvdauth.c 2001/06/05 02:13:31 1.4 --- dvdauth.c 2001/06/06 21:16:21 1.5 *************** *** 8,14 **** #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 <unistd.h> #include <fcntl.h> --- 8,12 ---- #include <stdio.h> #include <stdlib.h> ! //#include <string.h> // FIXME: conflicts with fs.h #include <unistd.h> #include <fcntl.h> *************** *** 16,24 **** #include <sys/ioctl.h> #include <sys/stat.h> - #include <css.h> #include "dvdauth.h" char *dvd_auth_device=NULL; unsigned char key_disc[2048]; --- 14,61 ---- #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]; *************** *** 28,32 **** --- 65,76 ---- + #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 *************** *** 34,53 **** #endif ! static int path_to_lba ( int fd ) { ! 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; } ! ! static void reset_agids ( int fd ) { dvd_authinfo ai; --- 78,113 ---- #endif + static int path_to_lba (char *path) + { + 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 ( DVDHandle dvd ) { dvd_authinfo ai; *************** *** 57,61 **** ai.type = DVD_INVALIDATE_AGID; ai.lsa.agid = i; ! ioctl(fd, DVD_AUTH, &ai); } } --- 117,121 ---- ai.type = DVD_INVALIDATE_AGID; ai.lsa.agid = i; ! DVDAuth(dvd, &ai); } } *************** *** 88,124 **** ! int dvd_auth ( char *dev , int fd ) { ! int devfd; /* FD of DVD device */ ! int lba; ! ! if ((devfd=open(dev,O_RDONLY))<0) { fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev); return 1; } ! if (!CSSisEncrypted(devfd)) { printf("DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n"); return 0; } else printf("DVD is encrypted, issuing authentication ...\n"); /* reset AGIDs */ ! reset_agids(devfd); /* authenticate disc */ ! if (CSSAuthDisc(devfd,key_disc)) { ! fprintf(stderr,"DVD: CSSAuthDisc() failed.\n"); 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"); return 1; } --- 148,179 ---- ! int dvd_auth ( char *dev , char *filename ) { ! DVDHandle dvd; /* DVD device handle */ ! if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { fprintf(stderr,"DVD: cannot open DVD device \"%s\".\n",dev); return 1; } ! 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(dvd); /* authenticate disc */ ! if (CSSDVDAuthDisc(dvd,key_disc)) { ! fprintf(stderr,"DVD: CSSDVDAuthDisc() failed.\n"); ! DVDCloseDevice(dvd); return 1; } ! if (CSSDVDAuthTitlePath(dvd,key_title,filename)) { ! fprintf(stderr,"DVD: CSSDVDAuthTitle() failed.\n"); ! DVDCloseDevice(dvd); return 1; } *************** *** 127,134 **** if (CSSDecryptTitleKey (key_title, key_disc) < 0) { fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n"); return 1; } ! close(devfd); 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; --- 182,190 ---- if (CSSDecryptTitleKey (key_title, key_disc) < 0) { fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n"); + DVDCloseDevice(dvd); return 1; } ! 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; Index: dvdauth.h =================================================================== RCS file: /cvsroot/mplayer/main/dvdauth.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** dvdauth.h 2001/06/05 02:13:31 1.3 --- dvdauth.h 2001/06/06 21:16:21 1.4 *************** *** 1,3 **** ! #include "config.h" #ifdef HAVE_LIBCSS #ifndef _MPLAYER_CSS_H --- 1,3 ---- ! //#include "config.h" #ifdef HAVE_LIBCSS #ifndef _MPLAYER_CSS_H *************** *** 10,16 **** extern int descrambling; ! int dvd_auth ( char *, int ); int dvd_import_key ( unsigned char * ); #endif ! #endif \ No newline at end of file --- 10,16 ---- extern int descrambling; ! int dvd_auth ( char *, char * ); int dvd_import_key ( unsigned char * ); #endif ! #endif Index: mplayer.c =================================================================== RCS file: /cvsroot/mplayer/main/mplayer.c,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -r1.155 -r1.156 *** mplayer.c 2001/06/06 01:39:39 1.155 --- mplayer.c 2001/06/06 21:16:21 1.156 *************** *** 71,79 **** ! //extern int vo_screenwidth; ! ! int audio_fd=-1; ! extern int vo_screenwidth; extern char* win32_codec_name; // must be set before calling DrvOpen() !!! --- 71,77 ---- ! #ifdef X11_FULLSCREEN extern int vo_screenwidth; + #endif extern char* win32_codec_name; // must be set before calling DrvOpen() !!! *************** *** 667,672 **** } if (dvd_auth_device) { ! if (dvd_auth(dvd_auth_device,f)) { ! // if (dvd_auth(dvd_auth_device,filename)) { GUI_MSG( mplErrorDVDAuth ) exit(0); --- 665,670 ---- } if (dvd_auth_device) { ! // if (dvd_auth(dvd_auth_device,f)) { ! if (dvd_auth(dvd_auth_device,filename)) { GUI_MSG( mplErrorDVDAuth ) exit(0); _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog