1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

command line requested DVD key support for Arpi :)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@547 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
lgb 2001-04-20 14:32:09 +00:00
parent ea0d313e21
commit cd663cd2f2
5 changed files with 43 additions and 2 deletions

View File

@ -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},

View File

@ -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;

View File

@ -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 <linux/fs.h>
@ -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)<<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 key (requested): %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;
}
int dvd_auth ( char *dev , int fd )
{
@ -99,6 +125,8 @@ int dvd_auth ( char *dev , int fd )
}
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;
return 0;
}

View File

@ -6,9 +6,11 @@
extern char *dvd_device;
extern unsigned char key_disc[];
extern unsigned char key_title[];
extern unsigned char *dvdimportkey;
extern int descrambling;
int dvd_auth ( char *, int );
int dvd_import_key ( unsigned char * );
#endif
#endif

View File

@ -613,6 +613,13 @@ if(vcd_track){
f=open(filename,O_RDONLY);
if(f<0){ printf("File not found: '%s'\n",filename);return 1; }
#ifdef HAVE_LIBCSS
if (dvdimportkey) {
if (dvd_import_key(dvdimportkey)) {
fprintf(stderr,"Error processing DVD KEY.\n");
exit(1);
}
printf("DVD command line requested key is stored for descrambling.\n");
}
if (dvd_device) {
if (dvd_auth(dvd_device,f)) exit(0);
printf("DVD auth sequence seems to be OK.\n");