From 6f6fbbc03f116bde9ab3ae33a7d25b7991017e70 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Fri, 5 Oct 2001 11:31:39 +0000 Subject: =?UTF-8?q?-=20refuse=20to=20play=20encrypted=20dvds=20note:=20onl?= =?UTF-8?q?y=20tested=20on=20linux=20but=20also=20features=20bsd=20code=20?= =?UTF-8?q?(i=C2=B4m=20trying=20not=20to=20break=20builds=20on=20other=20a?= =?UTF-8?q?rchitectures,=20let=20me=20know=20if=20you=20have=20any=20probl?= =?UTF-8?q?ems)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CVS patchset: 737 CVS date: 2001/10/05 11:31:39 --- src/input/input_dvd.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 4af4a023e..4111218bf 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.25 2001/09/28 09:18:52 jkeil Exp $ + * $Id: input_dvd.c,v 1.26 2001/10/05 11:31:39 miguelfreitas Exp $ */ #ifdef HAVE_CONFIG_H @@ -136,10 +136,16 @@ static void closeDrive (dvd_input_plugin_t *this) { * * returns lbnum on success, 0 otherwise */ -static int openDVDFile (dvd_input_plugin_t *this, +static int openDVDFile (dvd_input_plugin_t *this, char *filename, off_t *size) { char str[256]; int lbnum; + int encrypted=0; +#if defined HAVE_LINUX_CDROM_H + dvd_struct dvd; +#elif defined __FreeBSD__ + struct dvd_struct dvd; +#endif xprintf (VERBOSE|INPUT, "input_dvd : openDVDFile >%s<\n", filename); @@ -148,6 +154,34 @@ static int openDVDFile (dvd_input_plugin_t *this, return 0; } +#if defined HAVE_LINUX_CDROM_H + dvd.copyright.type = DVD_STRUCT_COPYRIGHT; + dvd.copyright.layer_num=0; + if (ioctl (this->dvd_fd, DVD_READ_STRUCT, &dvd) < 0) { + printf ("input_dvd: Could not read Copyright Structure\n"); + return 0; + } + encrypted = (dvd.copyright.cpst != 0) ; + +#elif defined __FreeBSD__ + + dvd.format = DVD_STRUCT_COPYRIGHT; + dvd.layer_num = 0; + + if (ioctl(this->dvd_fd, DVDIOCREADSTRUCTURE, &dvd) < 0) { + printf ("input_dvd: Could not read Copyright Structure\n"); + return 0; + } + + encrypted = (dvd.cpst != 0); +#endif + + if( encrypted ) { + printf("\ninput_dvd: Sorry, Xine doesn't play encrypted DVDs. The legal status of CSS\n" + " decryption is unclear and we will not provide such code.\n\n"); + return 0; + } + snprintf (str, sizeof(str), "/VIDEO_TS/%s", filename); xprintf (VERBOSE|INPUT, "UDFFindFile %s\n", str); @@ -361,7 +395,7 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) { # if defined (__sun) status = 0; if ((ret = ioctl(fd, CDROMEJECT)) != 0) { - xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); + xprintf(VERBOSE|INPUT, "CDROMEJECT failed: %s\n", strerror(errno)); } # else @@ -517,7 +551,7 @@ static char **dvd_plugin_get_autoplay_list (input_plugin_t *this_gen, if (!strcasecmp (&this->filelist[i][nLen-4], ".VOB")) { - sprintf (this->filelist2[nFiles2], "dvd://%s", this->filelist[i]); + sprintf (this->filelist2[nFiles2], "dvd://%s", this->filelist[i]); nFiles2++; } -- cgit v1.2.3