/* (C)2001 by LGB (Gabor Lenart), based on example programs in libcss lgb@lgb.hu */ /* don't do anything with this source if css support was not requested */ #include "config.h" #ifdef HAVE_LIBCSS #include #include #include // FIXME #include conflicts with #include (below) //#include // FIXME this conflicts with #include #include #include #include #include #include #include #include "dvdauth.h" char *dvd_auth_device=NULL; unsigned char key_disc[2048]; unsigned char key_title[5]; unsigned char *dvdimportkey=NULL; int descrambling=0; #include #ifndef FIBMAP #define FIBMAP 1 #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; int i; for (i = 0; i < 4; i++) { memset(&ai, 0, sizeof(ai)); ai.type = DVD_INVALIDATE_AGID; ai.lsa.agid = i; ioctl(fd, DVD_AUTH, &ai); } } 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')<