Mercurial > mplayer.hg
changeset 11592:bbf3898360e7
removed the historic libcss support
author | alex |
---|---|
date | Mon, 08 Dec 2003 21:34:05 +0000 |
parents | 96206a53e2c5 |
children | ac69b16fed52 |
files | Makefile cfg-common.h configure fibmap_mplayer.c help/help_mp-en.h libmpdemux/Makefile libmpdemux/demux_mpg.c libmpdemux/dvdauth.c libmpdemux/dvdauth.h mencoder.c mplayer.c |
diffstat | 11 files changed, 13 insertions(+), 533 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Mon Dec 08 20:53:40 2003 +0000 +++ b/Makefile Mon Dec 08 21:34:05 2003 +0000 @@ -7,7 +7,6 @@ include config.mak PRG = mplayer -PRG_FIBMAP = fibmap_mplayer PRG_CFG = codec-cfg PRG_MENCODER = mencoder @@ -36,7 +35,7 @@ VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB) CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB) -COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FLAC_LIB) $(FONTCONFIG_LIB) +COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(DVDREAD_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FLAC_LIB) $(FONTCONFIG_LIB) CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) # -Wall @@ -75,9 +74,6 @@ ifeq ($(MENCODER),yes) ALL_PRG += $(PRG_MENCODER) endif -ifeq ($(CSS_USE),yes) -ALL_PRG += $(PRG_FIBMAP) -endif COMMON_DEPS = $(W32_DEP) $(DS_DEP) $(MP1E_DEP) $(AV_DEP) libmpdemux/libmpdemux.a libmpcodecs/libmpcodecs.a libao2/libao2.a liba52/liba52.a mp3lib/libMP3.a libmpeg2/libmpeg2.a osdep/libosdep.a postproc/libswscale.a input/libinput.a libvo/libvo.a libaf/libaf.a @@ -230,9 +226,6 @@ ./darwinfixlib.sh $(MPLAYER_DEP) $(CC) $(CFLAGS) -shared -Wl,-Bsymbolic -o mplayer_wine.so mplayer_wine.spec.c $(OBJS_MPLAYER) libvo/libvo.a libao2/libao2.a $(MENU_LIBS) $(VIDIX_LIBS) $(GUI_LIBS) $(COMMON_LIBS) $(GTK_LIBS) $(VO_LIBS) $(AO_LIBS) $(EXTRA_LIB) $(LIRC_LIB) $(LIRCC_LIB) $(STATIC_LIB) -lwine $(ARCH_LIB) -lm -$(PRG_FIBMAP): fibmap_mplayer.o mp_msg.o - $(CC) -o $(PRG_FIBMAP) fibmap_mplayer.o mp_msg.o - ifeq ($(MENCODER),yes) $(PRG_MENCODER): $(MENCODER_DEP) ./darwinfixlib.sh $(MENCODER_DEP) libmpcodecs/libmpencoders.a @@ -307,17 +300,9 @@ endif endif endif -ifeq ($(CSS_USE),yes) - @echo "The following task requires root privileges. If it fails don't panic," - @echo "however it means you can't use fibmap_mplayer." - @echo "Without this (or without running mplayer as root) you won't be" - @echo "able to play encrypted DVDs." - -$(INSTALL) -o 0 -g 0 -m 4755 $(INSTALLSTRIP) $(PRG_FIBMAP) $(BINDIR)/$(PRG_FIBMAP) -endif uninstall: -rm -f $(BINDIR)/$(PRG) $(BINDIR)/gmplayer $(MANDIR)/man1/mplayer.1 - -rm -f $(BINDIR)/$(PRG_FIBMAP) -rm -f $(BINDIR)/$(PRG_MENCODER) $(MANDIR)/man1/mencoder.1 @echo "Uninstall completed" @@ -325,7 +310,7 @@ -rm -f *.o *~ $(OBJS) codecs.conf.h distclean: - -rm -f *~ $(PRG) $(PRG_FIBMAP) $(PRG_MENCODER) $(PRG_CFG) $(OBJS) + -rm -f *~ $(PRG) $(PRG_MENCODER) $(PRG_CFG) $(OBJS) -rm -f *.o *.a .depend configure.log codecs.conf.h @for a in $(PARTS); do $(MAKE) -C $$a distclean; done -$(MAKE) -C libavcodec distclean LIBPREF=lib LIBSUF=.a
--- a/cfg-common.h Mon Dec 08 20:53:40 2003 +0000 +++ b/cfg-common.h Mon Dec 08 21:34:05 2003 +0000 @@ -27,15 +27,9 @@ #endif {"slang", &dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#ifdef HAVE_LIBCSS - {"dvdauth", &dvd_auth_device, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"dvdkey", &dvdimportkey, CONF_TYPE_STRING, 0, 0, 0, NULL}, - {"csslib", &css_so, CONF_TYPE_STRING, 0, 0, 0, NULL}, -#else - {"dvdauth", "MPlayer was compiled WITHOUT libcss support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {"dvdkey", "MPlayer was compiled WITHOUT libcss support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, - {"csslib", "MPlayer was compiled WITHOUT libcss support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, -#endif + {"dvdauth", "libcss support is OBSOLETED! RTFM!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, + {"dvdkey", "libcss support is OBSOLETED! RTFM!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, + {"csslib", "libcss support is OBSOLETED! RTFM!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, #ifdef MPLAYER_NETWORK {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL},
--- a/configure Mon Dec 08 20:53:40 2003 +0000 +++ b/configure Mon Dec 08 21:34:05 2003 +0000 @@ -172,7 +172,6 @@ --enable-live enable LIVE.COM Streaming Media support [disable] --disable-dvdread Disable libdvdread support [autodetect] --disable-mpdvdkit Disable mpdvdkit/mpdvdkit2 support [autodetect] - --disable-css Disable old-style libcss DVD support [autodetect] --disable-cdparanoia Disable cdparanoia support [autodetect] --disable-freetype Disable freetype2 font rendering support [autodetect] --disable-fontconfig Disable fontconfig font lookup support [autodetect] @@ -296,13 +295,12 @@ --disable-gcc-checking disable gcc version checking [enable] Use these options if autodetection fails: - --with-extraincdir=DIR extra headers (png, mad, sdl, css, ...) in DIR - --with-extralibdir=DIR extra library files (png, SDL, ...) in DIR + --with-extraincdir=DIR extra headers (png, mad, sdl, ...) in DIR + --with-extralibdir=DIR extra library files (png, mad, sdl, ...) in DIR --with-x11incdir=DIR X headers in DIR --with-x11libdir=DIR X library files in DIR --with-dxr2incdir=DIR DXR2 headers in DIR --with-dvbincdir=DIR DVB headers in DIR - --with-csslibdir=DIR libcss in DIR --with-madlibdir=DIR libmad (libmad shared library) in DIR --with-mlibdir=DIR libmlib (MLIB support) in DIR (Solaris only) --with-codecsdir=DIR Binary codec files in DIR @@ -1128,7 +1126,6 @@ _xmms=no _flac=auto _external_flac=auto -_css=auto # dvdnav disabled, it does not work #_dvdnav=no _dvdread=auto @@ -1299,8 +1296,6 @@ --disable-flac) _flac=no ;; --enable-external-flac) _external_flac=yes ;; --disable-external-flac) _external_flac=no ;; - --enable-css) _css=yes ;; - --disable-css) _css=no ;; --enable-dvdread) _dvdread=yes ;; --disable-dvdread) _dvdread=no ;; --enable-mpdvdkit) _dvdkit=yes ;; @@ -1467,10 +1462,6 @@ _livelibdir=`echo $ac_option | cut -d '=' -f 2` _live=yes ;; - --with-csslibdir=*) - _csslibdir=`echo $ac_option | cut -d '=' -f 2` - _css=yes - ;; --with-mlibdir=*) _mlibdir=`echo $ac_option | cut -d '=' -f 2` _mlib=yes @@ -4088,29 +4079,7 @@ echores "no" fi -echocheck "DVD support (libcss - old style)" -if test "$_css" = auto ; then - cat > $TMPC <<EOF -#include <sys/types.h> -#include <css.h> -int main(void) { (void) CSSisEncrypted(0); return 0; } -EOF - _css=no - cc_check -lcss $_ld_dl && _css=yes -fi -if test "$_css" = yes ; then - _def_css='#define HAVE_LIBCSS 1' - test "$_csslibdir" && _ld_css="-L${_csslibdir} $_ld_css" - _inputmodules="dvdcss $_inputmodules" - _largefiles=yes - echores "yes" -else - _def_css='#undef HAVE_LIBCSS' - _noinputmodules="dvdcss $_noinputmodules" - echores "no" -fi - -echocheck "DVD support (libdvdread - new style)" +echocheck "DVD support (libdvdread)" if test "$_dvdread" = auto ; then cat > $TMPC << EOF #include <inttypes.h> @@ -4132,7 +4101,7 @@ yes) _largefiles=yes _def_dvdread='#define USE_DVDREAD 1' - _ld_css='-ldvdread' + _ld_dvdread='-ldvdread' _inputmodules="dvdread $_inputmodules" echores "yes" ;; @@ -4144,7 +4113,7 @@ libmpdvdkit) _largefiles=yes _def_dvdread='#define USE_DVDREAD 1' - _ld_css='-Llibmpdvdkit -lmpdvdkit' + _ld_dvdread='-Llibmpdvdkit -lmpdvdkit' _noinputmodules="dvdread $_noinputmodules" _def_mpdvdkit="#define USE_MPDVDKIT 1" echores "disabled by libmpdvdkit" @@ -4152,7 +4121,7 @@ libmpdvdkit2) _largefiles=yes _def_dvdread='#define USE_DVDREAD 1' - _ld_css='-Llibmpdvdkit2 -lmpdvdkit' + _ld_dvdread='-Llibmpdvdkit2 -lmpdvdkit' _noinputmodules="dvdread $_noinputmodules" _def_mpdvdkit="#define USE_MPDVDKIT 2" echores "disabled by libmpdvdkit2" @@ -5896,8 +5865,7 @@ TERMCAP_LIB = $_ld_termcap LIRC_LIB = $_ld_lirc LIRCC_LIB = $_ld_lircc -CSS_USE = $_css -CSS_LIB = $_ld_css +DVDREAD_LIB = $_ld_dvdread DVDKIT = $_dvdkit DVDKIT2 = $_dvdkit2 DVDKIT_SHARED = no @@ -6177,9 +6145,6 @@ $_def_flac $_def_mpflac -/* DeCSS support using libcss */ -$_def_css - /* DVD navigation support using libdvdnav */ $_def_dvdnav $_def_dvdnav_version
--- a/fibmap_mplayer.c Mon Dec 08 20:53:40 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* (C)2001,2002 by LGB (Gábor Lénárt), lgb@lgb.hu - Part of MPlayer project, this source is copyrighted according to GNU/GPL. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> - -#include "mp_msg.h" - -#ifndef FIBMAP -#define FIBMAP 1 -#endif - -int main ( int argc , char ** argv ) -{ - int fd,ret,lba=0; - if (geteuid()!=0) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL, "%s must be setuid root to work\n", - argv[0]); - return 1; - } - if (seteuid(getuid()) == -1) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL, "Couldn't drop privileges: %s\n", - strerror(errno)); - return 1; - } - if (argc!=2 || argv[1]==NULL) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Usage: %s <filename>\n", argv[0]); - return 1; - } - if ((fd = open(argv[1], O_RDONLY)) == -1) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open file %s: %s\n", - argv[1], strerror(errno)); - return 1; - } - if (seteuid(0) == -1) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL, "Couldn't restore root privileges: %s\n", - strerror(errno)); - return 1; - } - ret = ioctl(fd, FIBMAP, &lba); - if (seteuid(getuid()) == -1) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL, "Couldn't re-drop privileges: %s\n", - strerror(errno)); - return 1; - } - close(fd); - if (ret != 0) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,"fibmap ioctl failed: %s\n", - strerror(errno)); - return 1; - } - printf("%d\n",lba); - return 0; -}
--- a/help/help_mp-en.h Mon Dec 08 20:53:40 2003 +0000 +++ b/help/help_mp-en.h Mon Dec 08 21:34:05 2003 +0000 @@ -21,9 +21,6 @@ #ifdef HAVE_VCD " vcd://<trackno> play VCD (Video CD) track from device instead of plain file\n" #endif -#ifdef HAVE_LIBCSS -" -dvdauth <dev> specify DVD device for authentication (for encrypted discs)\n" -#endif #ifdef USE_DVDREAD " dvd://<titleno> play DVD title from device instead of plain file\n" " -alang/-slang select DVD audio/subtitle language (by 2-char country code)\n"
--- a/libmpdemux/Makefile Mon Dec 08 20:53:40 2003 +0000 +++ b/libmpdemux/Makefile Mon Dec 08 21:34:05 2003 +0000 @@ -3,7 +3,7 @@ include ../config.mak -SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c stream_ftp.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c +SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_ty.c demux_ty_osd.c demux_pva.c demux_viv.c demuxer.c dvdnav_stream.c open.c parse_es.c stream.c stream_file.c stream_netstream.c stream_vcd.c stream_null.c stream_ftp.c tv.c tvi_dummy.c tvi_v4l.c tvi_v4l2.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c demux_lmlm4.c cue_read.c extension.c demux_gif.c demux_ts.c demux_realaud.c url.c ifeq ($(XMMS_PLUGINS),yes) SRCS += demux_xmms.c endif
--- a/libmpdemux/demux_mpg.c Mon Dec 08 20:53:40 2003 +0000 +++ b/libmpdemux/demux_mpg.c Mon Dec 08 21:34:05 2003 +0000 @@ -14,8 +14,6 @@ #include "stheader.h" #include "mp3_hdr.h" -#include "dvdauth.h" - //#define MAX_PS_PACKETSIZE 2048 #define MAX_PS_PACKETSIZE (224*1024) @@ -38,9 +36,6 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){ int d; int len; -#ifdef HAVE_LIBCSS - int css=0; -#endif unsigned char c=0; unsigned int pts=0; unsigned int dts=0; @@ -96,11 +91,7 @@ int hdrlen; // System-2 (.VOB) stream: if((c>>4)&3) { -#ifdef HAVE_LIBCSS - css=1; -#else mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_EncryptedVOB); -#endif } c=stream_read_char(demux->stream); pts_flags=c>>6; c=stream_read_char(demux->stream); hdrlen=c; @@ -230,12 +221,6 @@ if(ds){ mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id); // printf("packet start = 0x%X \n",stream_tell(demux->stream)-packet_start_pos); -#ifdef HAVE_LIBCSS - if (css) { - if (descrambling) dvd_css_descramble(demux->stream->buffer,key_title); else - mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_EncryptedVOBauth); - } -#endif ds_read_packet(ds,demux->stream,len,pts/90000.0f,demux->filepos,0); // if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len); return 1;
--- a/libmpdemux/dvdauth.c Mon Dec 08 20:53:40 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,323 +0,0 @@ -/* (C)2001,2002 by LGB (Gabor Lenart), based on example programs in libcss - lgb@lgb.hu - - This source is part of MPlayer project. This source is copyrighted by - the author according to rules declared in GNU/GPL license. - - 2001 Inital version (LGB) - 2001 fibmap_mplayer to avoid uid=0 mplayer need (LGB) - 2001 Support for libcss with the new API (by ???) - 2002/Jan/04 Use dlopen to access libcss.so to avoid conflict with - libdvdread [now with only libcss with old API (LGB) - 2002/Sep/21 Fix a bug which caused segmentation fault when using - -dvdkey option, since css.so was only loaded by -dvdauth. - (LGB, reported and suggested by sbmpost <wortelsapje@hotmail.com>) - Also some cosmetic fix with return value of dvd_css_descramble(). - 2002/Sep/21 Try to load css syms with AND without underscore at their - names, probably not only OpenBSD requires this so it's a - better solution (LGB). - - TODO: - support for libcss libraries with new API */ - -/* don't do anything with this source if css support was not requested */ -#include "config.h" -#ifdef HAVE_LIBCSS - -#warning FIXME: Dynamic loading of libcss.so with newer (ver>0.1) libcss API is not supported in this version! - -#include <stdio.h> -#include <stdlib.h> -//#include <string.h> // FIXME: conflicts with fs.h -#include <errno.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/wait.h> -// #include <css.h> - -#if defined(__FreeBSD__) || defined(__NetBSD__) -# include <sys/dvdio.h> -#elif defined(__OpenBSD__) -# include <sys/cdio.h> -# define RTLD_NOW RTLD_LAZY -#elif defined(__linux__) -# include <linux/cdrom.h> -#elif defined(__sun) -# include <sun/dvdio.h> -#elif defined(hpux) -# include <sun/scsi.h> -#elif defined(__bsdi__) -# include <dvd.h> -#else -# error "Need the DVD ioctls" -#endif - -#include <dlfcn.h> -#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 - - -char *dvd_auth_device=NULL; -extern char *dvd_device; -char *dvd_raw_device=NULL; -char *css_so=NULL; -unsigned char key_disc[2048]; -unsigned char key_title[5]; -unsigned char *dvdimportkey=NULL; -int descrambling=0; - - -static int css_so_is_loaded=0; - -static void *dlid; -static int (*dl_CSSisEncrypted)(int); -static int (*dl_CSSAuthDisc)(int,char *); -static int (*dl_CSSAuthTitle)(int, char *,int); -static int (*dl_CSSGetASF)(int); -static int (*dl_CSSDecryptTitleKey)(char *, char *); -static void (*dl_CSSDescramble)(u_char *, u_char *); - - -void dvd_css_descramble ( u_char *sec , u_char *key ) -{ - (*dl_CSSDescramble)(sec,key); -} - - -#ifdef __linux__ -#include <linux/fs.h> - -#ifndef FIBMAP -#define FIBMAP 1 -#endif - - -static int path_to_lba (char *path) -{ - int lba = 0; - char cmd[100]; - FILE *fp; - - snprintf(cmd,sizeof(cmd),"fibmap_mplayer %s",path); - fp=popen(cmd,"r"); - if (fp) { - int ret; - memset(cmd,0,sizeof(cmd)); - fgets(cmd,99,fp); -// printf("DVD: cmd: %s\n",cmd); - if ((ret=pclose(fp))) - fprintf(stderr,"DVD: fibmap_mplayer: %s\n",*cmd?cmd:"no error info"); - if (cmd[0]<'0'||cmd[0]>'9') fp=NULL; else { - if(WIFEXITED(ret) && !WEXITSTATUS(ret)) { - lba=atoi(cmd); - printf("DVD: fibmap_mplayer is being used\n"); - } else - fp=NULL; - } - } - if (!fp) { - int fd; - printf("DVD: fibmap_mplayer could not run, trying with ioctl() ...\n"); - if ((fd = open(path, O_RDONLY)) == -1) { - fprintf(stderr, "DVD: Cannot open file %s: %s", - path ? path : "(NULL)", strerror(errno)); - return -1; - } - if (ioctl(fd, FIBMAP, &lba) != 0) { - perror("DVD: ioctl FIBMAP"); - fprintf(stderr," Hint: run mplayer as root (or better to install fibmap_mplayer as suid root)!\n"); - close(fd); - return -1; - } - close(fd); - } - printf("DVD: LBA: %d\n",lba); - 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, "DVD: Translating pathname to iso9660 LBA is not supported on this platform\n"); - return -1; -} - -#endif /*linux*/ - - -static int CSSDVDAuthTitlePath(DVDHandle hdl,unsigned char *key_title,char *path) -{ - int lba=path_to_lba(path); - if (lba==-1) return -1; - return (*dl_CSSAuthTitle)(hdl,key_title,lba); -} - - - -static void reset_agids ( DVDHandle dvd ) -{ -#if !defined(DVD_AUTH) && defined(DVDIOCREPORTKEY) - struct dvd_authinfo ai; - int i; - for (i = 0; i < 4; i++) { - memset(&ai, 0, sizeof(ai)); - ai.format = DVD_INVALIDATE_AGID; - ai.agid = i; - ioctl(dvd, DVDIOCREPORTKEY, &ai); - } -#else -#if defined(__OpenBSD__) - union -#endif - dvd_authinfo ai; - int i; - for (i = 0; i < 4; i++) { - memset(&ai, 0, sizeof(ai)); - ai.type = DVD_INVALIDATE_AGID; - ai.lsa.agid = i; - DVDAuth(dvd, &ai); - } -#endif -} - - -static int dvd_load_css_so ( void ) -{ - if (css_so_is_loaded) { - printf("DVD: warning: attempt to load css.so twice, ignoring.\n"); - return 0; - } - if (!css_so) css_so=strdup("libcss.so"); - printf("DVD: opening libcss.so as %s ...\n",css_so); - dlid=dlopen(css_so,RTLD_NOW); - if (!dlid) { - printf("DVD: dlopen: %s\n",dlerror()); - return 1; - } printf("DVD: dlopen OK!\n"); - -/* #ifdef __OpenBSD__ -#define CSS_DLSYM(v,s) if (!(v=dlsym(dlid,"_" s))) {\ -fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ -return 1; } -#else -#define CSS_DLSYM(v,s) if (!(v=dlsym(dlid,s))) {\ -fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ -return 1; } -#endif */ - -#define CSS_DLSYM(v,s) \ -if (!(v=dlsym(dlid,s))) {\ - if (!(v=dlsym(dlid,"_" s))) {\ - fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ - return 1;\ - }\ -} - - - CSS_DLSYM(dl_CSSisEncrypted,"CSSisEncrypted"); - CSS_DLSYM(dl_CSSAuthDisc,"CSSAuthDisc"); - CSS_DLSYM(dl_CSSAuthTitle,"CSSAuthTitle"); - CSS_DLSYM(dl_CSSGetASF,"CSSGetASF"); - CSS_DLSYM(dl_CSSDecryptTitleKey,"CSSDecryptTitleKey"); - CSS_DLSYM(dl_CSSDescramble,"CSSDescramble"); - -#undef CSS_DLSYM - - css_so_is_loaded=1; - printf("DVD: shared object %s is loaded normally.\n",css_so); - return 0; -} - - -int dvd_import_key ( unsigned char *hexkey ) -{ - unsigned char *t=key_title; - int digit=4,len; - memset(key_title,0,sizeof(key_title)); -// printf("DVD key: %s\n",hexkey); - for (len=0;len<10;len++) { -// printf("-> %c\n",*hexkey); - if (!*hexkey) return 1; - if (*hexkey>='A'&&*hexkey<='F') *t|=(*hexkey-'A'+10)<<digit; - else if (*hexkey>='0'&&*hexkey<='9') *t|=(*hexkey-'0')<<digit; - else return 1; - if (digit) digit=0; else { - digit=4; - t++; - } - hexkey++; - } - if (*hexkey) return 1; - printf("DVD: DVD key (requested): %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); - if (dvd_load_css_so()) return 1; - descrambling=1; - return 0; -} - - - -int dvd_auth ( char *dev , char *filename ) -{ - DVDHandle dvd; /* DVD device handle */ - - if (dvd_load_css_so()) return 1; - - if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { - fprintf(stderr,"DVD: cannot open DVD device \"%s\": %s.\n", - dev, strerror(errno)); - return 1; - } - - if (!(*dl_CSSisEncrypted)(dvd)) { - printf("DVD: DVD is not encrypted! Skipping authentication!\n(Note: You should not use the -dvdauth switch for discs without encryption!)\n"); - DVDCloseDevice(dvd); - return 0; - } else printf("DVD: DVD is encrypted, issuing authentication ...\n"); - /* reset AGIDs */ - reset_agids(dvd); - /* authenticate disc */ - if ((*dl_CSSAuthDisc)(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; - } - - /* decrypting title */ - if ((*dl_CSSDecryptTitleKey)(key_title, key_disc) < 0) { - fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n"); - DVDCloseDevice(dvd); - return 1; - } - - DVDCloseDevice(dvd); - printf("DVD: 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; -} - - -#endif
--- a/libmpdemux/dvdauth.h Mon Dec 08 20:53:40 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -#ifdef HAVE_LIBCSS -#ifndef _MPLAYER_CSS_H -#define _MPLAYER_CSS_H - -extern char *dvd_auth_device; -extern unsigned char key_disc[]; -extern unsigned char key_title[]; -extern unsigned char *dvdimportkey; -extern int descrambling; -extern char *css_so; - -int dvd_auth ( char *, char * ); -int dvd_import_key ( unsigned char * ); -void dvd_css_descramble ( u_char *, u_char * ); - -#endif -#endif
--- a/mencoder.c Mon Dec 08 20:53:40 2003 +0000 +++ b/mencoder.c Mon Dec 08 21:34:05 2003 +0000 @@ -63,10 +63,6 @@ #include <lame/lame.h> #endif -#ifdef HAVE_LIBCSS -#include "libmpdemux/dvdauth.h" -#endif - #include <inttypes.h> #include "libvo/fastmemcpy.h" @@ -486,25 +482,6 @@ stream->start_pos+=seek_to_byte; -#ifdef HAVE_LIBCSS -// current_module="libcss"; - if (dvdimportkey) { - if (dvd_import_key(dvdimportkey)) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); - mencoder_exit(1,NULL); - } - mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); - } - if (dvd_auth_device) { - // if (dvd_auth(dvd_auth_device,f)) { - if (dvd_auth(dvd_auth_device,filename)) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDAuth); - mencoder_exit(1,NULL); - } - mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); - } -#endif - if(stream_cache_size>0) stream_enable_cache(stream,stream_cache_size*1024,0,0); if(demuxer2) audio_id=-2; /* do NOT read audio packets... */
--- a/mplayer.c Mon Dec 08 20:53:40 2003 +0000 +++ b/mplayer.c Mon Dec 08 21:34:05 2003 +0000 @@ -57,10 +57,6 @@ #include "codec-cfg.h" -#ifdef HAVE_LIBCSS -#include "libmpdemux/dvdauth.h" -#endif - #ifdef USE_DVDNAV #include <dvdnav.h> #endif @@ -1317,24 +1313,6 @@ } stream->start_pos+=seek_to_byte; -#ifdef HAVE_LIBCSS - current_module="libcss"; - if (dvdimportkey) { - if (dvd_import_key(dvdimportkey)) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); - exit_player(MSGTR_Exit_error); - } - mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); - } - if (dvd_auth_device) { - if (dvd_auth(dvd_auth_device,filename)) { - mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error in DVD auth...\n"); - exit_player(MSGTR_Exit_error); - } - mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); - } -#endif - if(stream_dump_type==5){ unsigned char buf[4096]; int len;