From cd663cd2f2ce800ad12918a33f030b85574bdfb8 Mon Sep 17 00:00:00 2001 From: lgb Date: Fri, 20 Apr 2001 14:32:09 +0000 Subject: [PATCH] command line requested DVD key support for Arpi :) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@547 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cfg-mplayer.h | 1 + demux_mpg.c | 5 ++++- dvdauth.c | 28 ++++++++++++++++++++++++++++ dvdauth.h | 4 +++- mplayer.c | 7 +++++++ 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/cfg-mplayer.h b/cfg-mplayer.h index c52bd9772d..2f6fccd2a1 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -25,6 +25,7 @@ struct config conf[]={ {"master", &mixer_usemaster, CONF_TYPE_FLAG, 0, 0, 1}, #ifdef HAVE_LIBCSS {"dvd", &dvd_device, CONF_TYPE_STRING, 0, 0, 0}, + {"dvdkey", &dvdimportkey, CONF_TYPE_STRING, 0, 0, 0}, #else {"dvd", "DVD support was not compiled in. See file DOCS/DVD.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0 , 0}, diff --git a/demux_mpg.c b/demux_mpg.c index 7c0018c848..c3745539dc 100644 --- a/demux_mpg.c +++ b/demux_mpg.c @@ -180,7 +180,10 @@ static int demux_mpg_read_packet(demuxer_t *demux,int id){ if(verbose>=2) printf("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) CSSDescramble(demux->stream->buffer,key_title); + if (css) { + if (descrambling) CSSDescramble(demux->stream->buffer,key_title); else + printf("Encrypted stream but authentication was not requested by you!!\n"); + } #endif ds_read_packet(ds,demux->stream,len,pts/90000.0f,0); return 1; diff --git a/dvdauth.c b/dvdauth.c index da6832c58a..cd3dcb94aa 100644 --- a/dvdauth.c +++ b/dvdauth.c @@ -23,6 +23,8 @@ char *dvd_device=NULL; unsigned char key_disc[2048]; unsigned char key_title[5]; +unsigned char *dvdimportkey=NULL; +int descrambling=0; #include @@ -59,6 +61,30 @@ static void reset_agids ( int fd ) } +int dvd_import_key ( unsigned char *hexkey ) +{ + unsigned char *t=key_title; + int digit=4,len; + bzero(key_title,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)<='0'&&*hexkey<='9') *t|=(*hexkey-'0')<