]> git.sesse.net Git - vlc/commitdiff
* FreeBSD CSS decryption support.
authorSam Hocevar <sam@videolan.org>
Wed, 2 May 2001 20:01:44 +0000 (20:01 +0000)
committerSam Hocevar <sam@videolan.org>
Wed, 2 May 2001 20:01:44 +0000 (20:01 +0000)
ChangeLog
configure
configure.in
include/defs.h.in
plugins/dvd/dvd_css.c
plugins/dvd/dvd_ioctl.c
plugins/dvd/dvd_ioctl.h

index 6c2ed8660c82e471698c6173aabaf71cd70501c1..5567bc85b40805107ceac51ecbbfa4882dbbd5a6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
 #===================#
 
 HEAD
+  * FreeBSD CSS decryption support.
   * Fixed a segfault in TS input (psi packets with adaptation field).
   * Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale
     <arnaud@carrosse.frmug.org>.
index cfc4a763e744f4e4c18ff496d36cd1e918ec7dcc..14df89cfc76a0959707c80309bee179069341844 100755 (executable)
--- a/configure
+++ b/configure
@@ -3211,7 +3211,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
 EOF
  
   BUILTINS="${BUILTINS} dvd"
-  for ac_hdr in linux/cdrom.h
+  for ac_hdr in sys/cdio.h sys/dvdio.h linux/cdrom.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -3251,17 +3251,60 @@ else
 fi
 done
 
-  cat > conftest.$ac_ext <<EOF
-#line 3256 "configure"
+  BSD_DVD_STRUCT=0
+        cat > conftest.$ac_ext <<EOF
+#line 3257 "configure"
+#include "confdefs.h"
+#include <sys/dvdio.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "dvd_struct" >/dev/null 2>&1; then
+  rm -rf conftest*
+  
+    cat >> confdefs.h <<\EOF
+#define DVD_STRUCT_IN_SYS_DVDIO_H 1
+EOF
+
+    BSD_DVD_STRUCT=1
+  
+fi
+rm -f conftest*
+
+        cat > conftest.$ac_ext <<EOF
+#line 3275 "configure"
+#include "confdefs.h"
+#include <sys/cdio.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "dvd_struct" >/dev/null 2>&1; then
+  rm -rf conftest*
+  
+    cat >> confdefs.h <<\EOF
+#define DVD_STRUCT_IN_SYS_CDIO_H 1
+EOF
+
+    BSD_DVD_STRUCT=1
+  
+fi
+rm -f conftest*
+
+  if test x$BSD_DVD_STRUCT = x1; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_BSD_DVD_STRUCT 1
+EOF
+
+  fi
+        cat > conftest.$ac_ext <<EOF
+#line 3299 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "dvd" >/dev/null 2>&1; then
+  egrep "dvd_struct" >/dev/null 2>&1; then
   rm -rf conftest*
   
     cat >> confdefs.h <<\EOF
-#define LINUX_DVD 1
+#define DVD_STRUCT_IN_LINUX_CDROM_H 1
 EOF
 
   
@@ -3403,7 +3446,7 @@ if test "${enable_esd+set}" = set; then
      # Extract the first word of "esd-config", so it can be a program name with args.
 set dummy esd-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3407: checking for $ac_word" >&5
+echo "configure:3450: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3468,17 +3511,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3472: checking for $ac_hdr" >&5
+echo "configure:3515: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3477 "configure"
+#line 3520 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3549,17 +3592,17 @@ if test "${with_sdl+set}" = set; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3553: checking for $ac_hdr" >&5
+echo "configure:3596: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3558 "configure"
+#line 3601 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3597,17 +3640,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3601: checking for $ac_hdr" >&5
+echo "configure:3644: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3606 "configure"
+#line 3649 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3611: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3707,7 +3750,7 @@ if test x$enable_gtk != xno; then
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3711: checking for $ac_word" >&5
+echo "configure:3754: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3767,17 +3810,17 @@ if test x$enable_x11 != xno; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3771: checking for $ac_hdr" >&5
+echo "configure:3814: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3776 "configure"
+#line 3819 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3829,17 +3872,17 @@ if test x$enable_xvideo != xno; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3833: checking for $ac_hdr" >&5
+echo "configure:3876: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3838 "configure"
+#line 3881 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3877,17 +3920,17 @@ if test "${enable_alsa+set}" = set; then
   enableval="$enable_alsa"
   if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
-echo "configure:3881: checking for sys/asoundlib.h" >&5
+echo "configure:3924: checking for sys/asoundlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3886 "configure"
+#line 3929 "configure"
 #include "confdefs.h"
 #include <sys/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3904,7 +3947,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
-echo "configure:3908: checking for main in -lasound" >&5
+echo "configure:3951: checking for main in -lasound" >&5
 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3912,14 +3955,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3916 "configure"
+#line 3959 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
index 33fe2a50150e5368a51e3e6e06d1c746ae85ae35..1c228c02700a4c5b2f98b51eedf4bf91cef6cff9 100644 (file)
@@ -153,9 +153,34 @@ dnl  DVD module: check for DVD ioctls
 dnl
 AC_CHECK_HEADERS(sys/ioctl.h,[
   BUILTINS="${BUILTINS} dvd"
-  AC_CHECK_HEADERS(linux/cdrom.h)
-  AC_EGREP_HEADER(dvd,linux/cdrom.h,[
-    AC_DEFINE(LINUX_DVD,1, DVD support for linux)
+  AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h)
+  BSD_DVD_STRUCT=0
+  dnl
+  dnl Old FreeBSD: sys/cdio.h
+  dnl
+  AC_EGREP_HEADER(dvd_struct,sys/dvdio.h,[
+    AC_DEFINE(DVD_STRUCT_IN_SYS_DVDIO_H, 1,
+              Define if <sys/dvdio.h> defines dvd_struct.)
+    BSD_DVD_STRUCT=1
+  ])
+  dnl
+  dnl Newer FreeBSD: sys/dvdio.h
+  dnl
+  AC_EGREP_HEADER(dvd_struct,sys/cdio.h,[
+    AC_DEFINE(DVD_STRUCT_IN_SYS_CDIO_H, 1,
+              Define if <sys/cdio.h> defines dvd_struct.)
+    BSD_DVD_STRUCT=1
+  ])
+  if test x$BSD_DVD_STRUCT = x1; then
+    AC_DEFINE(HAVE_BSD_DVD_STRUCT, 1,
+              Define if BSD-like dvd_struct is defined.)
+  fi
+  dnl
+  dnl Linux: linux/cdrom.h
+  dnl
+  AC_EGREP_HEADER(dvd_struct,linux/cdrom.h,[
+    AC_DEFINE(DVD_STRUCT_IN_LINUX_CDROM_H, 1,
+              Define if <linux/cdrom.h> defines DVD_STRUCT.)
   ])
 ])
 
index 32fbf9cf7c7d250b0a09aa47d36d20938da412ff..47faab5501645d93f0957f6efeb7c9b26055abbb 100644 (file)
 /* Define if you have the <strings.h> header file.  */
 #undef HAVE_STRINGS_H
 
+/* Define if you have the <sys/cdio.h> header file.  */
+#undef HAVE_SYS_CDIO_H
+
+/* Define if you have the <sys/dvdio.h> header file.  */
+#undef HAVE_SYS_DVDIO_H
+
 /* Define if you have the <sys/ioctl.h> header file.  */
 #undef HAVE_SYS_IOCTL_H
 
 /* Define if <pthread.h> defines boolean_t. */
 #undef BOOLEAN_T_IN_PTHREAD_H
 
-/* DVD support for linux */
-#undef LINUX_DVD
+/* Define if <sys/dvdio.h> defines dvd_struct. */
+#undef DVD_STRUCT_IN_SYS_DVDIO_H
+
+/* Define if <sys/cdio.h> defines dvd_struct. */
+#undef DVD_STRUCT_IN_SYS_CDIO_H
+
+/* Define if BSD-like dvd_struct is defined. */
+#undef HAVE_BSD_DVD_STRUCT
+
+/* Define if <linux/cdrom.h> defines DVD_STRUCT. */
+#undef DVD_STRUCT_IN_LINUX_CDROM_H
 
 /* Define if you want DVD CSS decryption. */
 #undef HAVE_CSS
index 4a0fefb34ff86c606503bd275e2c3b20ea49182a..f7c69b7bc025c04c5ba926dc343e8371bbefc266 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_css.c: Functions for DVD authentification and unscrambling
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_css.c,v 1.26 2001/04/22 00:08:25 stef Exp $
+ * $Id: dvd_css.c,v 1.27 2001/05/02 20:01:44 sam Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -120,7 +120,7 @@ int CSSInit( int i_fd, css_t * p_css )
     {
         intf_WarnMsg( 3, "css info: requesting AGID %d", i );
 
-        i_ret = ioctl_LUSendAgid( i_fd, &i_agid );
+        i_ret = ioctl_ReportAgid( i_fd, &i_agid );
 
         if( i_ret != -1 )
         {
@@ -128,7 +128,7 @@ int CSSInit( int i_fd, css_t * p_css )
             break;
         }
 
-        intf_ErrMsg( "css error: ioctl_LUSendAgid failed, invalidating" );
+        intf_ErrMsg( "css error: ioctl_ReportAgid failed, invalidating" );
 
         i_agid = 0;
         ioctl_InvalidateAgid( i_fd, &i_agid );
@@ -137,7 +137,7 @@ int CSSInit( int i_fd, css_t * p_css )
     /* Unable to authenticate without AGID */
     if( i_ret == -1 )
     {
-        intf_ErrMsg( "css error: ioctl_LUSendAgid failed, fatal" );
+        intf_ErrMsg( "css error: ioctl_ReportAgid failed, fatal" );
         return -1;
     }
 
@@ -153,16 +153,16 @@ int CSSInit( int i_fd, css_t * p_css )
     }
 
     /* Send challenge to LU */
-    if( ioctl_HostSendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
+    if( ioctl_SendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
     {
-        intf_ErrMsg( "css error: ioctl_HostSendChallenge failed" );
+        intf_ErrMsg( "css error: ioctl_SendChallenge failed" );
         return -1;
     }
 
     /* Get key1 from LU */
-    if( ioctl_LUSendKey1( i_fd, &i_agid, p_buffer ) < 0)
+    if( ioctl_ReportKey1( i_fd, &i_agid, p_buffer ) < 0)
     {
-        intf_ErrMsg( "css error: ioctl_LUSendKey1 failed" );
+        intf_ErrMsg( "css error: ioctl_ReportKey1 failed" );
         return -1;
     }
 
@@ -193,9 +193,9 @@ int CSSInit( int i_fd, css_t * p_css )
     }
 
     /* Get challenge from LU */
-    if( ioctl_LUSendChallenge( i_fd, &i_agid, p_buffer ) < 0 )
+    if( ioctl_ReportChallenge( i_fd, &i_agid, p_buffer ) < 0 )
     {
-        intf_ErrMsg( "css error: ioctl_LUSendKeyChallenge failed" );
+        intf_ErrMsg( "css error: ioctl_ReportKeyChallenge failed" );
         return -1;
     }
 
@@ -215,9 +215,9 @@ int CSSInit( int i_fd, css_t * p_css )
     }
 
     /* Send key2 to LU */
-    if( ioctl_HostSendKey2( i_fd, &i_agid, p_buffer ) < 0 )
+    if( ioctl_SendKey2( i_fd, &i_agid, p_buffer ) < 0 )
     {
-        intf_ErrMsg( "css error: ioctl_HostSendKey2 failed" );
+        intf_ErrMsg( "css error: ioctl_SendKey2 failed" );
         return -1;
     }
 
@@ -456,7 +456,7 @@ static int CSSGetASF( int i_fd )
 
     for( i_agid = 0 ; i_agid < 4 ; i_agid++ )
     {
-        if( ioctl_LUSendASF( i_fd, &i_agid, &i_asf ) == 0 )
+        if( ioctl_ReportASF( i_fd, &i_agid, &i_asf ) == 0 )
         {
             intf_WarnMsg( 3, "css info: GetASF %sauthenticated",
                           i_asf ? "":"not " );
index 4a34f326ce2aa7671f9872f845b8b80a68d49ac7..cd0433f6455be4433c6a21b614de1384161f7f69 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ioctl.c: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ioctl.c,v 1.10 2001/04/11 04:46:18 sam Exp $
+ * $Id: dvd_ioctl.c,v 1.11 2001/05/02 20:01:44 sam Exp $
  *
  * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
  *          Samuel Hocevar <sam@zoy.org>
 #include <sys/types.h>
 #include <netinet/in.h>
 
-#ifdef HAVE_SYS_DVDIO_H
-#   include <sys/ioctl.h>
+#include <sys/ioctl.h>
+
+#ifdef DVD_STRUCT_IN_SYS_CDIO_H
+#   include <sys/cdio.h>
+#endif
+#ifdef DVD_STRUCT_IN_SYS_DVDIO_H
 #   include <sys/dvdio.h>
 #endif
-#ifdef LINUX_DVD
-#   include <sys/ioctl.h>
+#ifdef DVD_STRUCT_IN_LINUX_CDROM_H
 #   include <linux/cdrom.h>
 #endif
 #ifdef SYS_BEOS
-#   include <sys/ioctl.h>
 #   include <malloc.h>
 #   include <scsi.h>
 #endif
-#ifdef SYS_DARWIN1_3
-#   include <sys/ioctl.h>
-#endif
 
 #include "common.h"
 
@@ -77,7 +76,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_struct dvd;
 
     dvd.type = DVD_STRUCT_COPYRIGHT;
@@ -87,6 +86,16 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
 
     *pi_copyright = dvd.copyright.cpst;
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_struct dvd;
+
+    dvd.format = DVD_STRUCT_COPYRIGHT;
+    dvd.layer_num = i_layer;
+
+    i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
+
+    *pi_copyright = dvd.cpst;
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 8 );
 
@@ -120,12 +129,11 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_struct dvd;
 
     dvd.type = DVD_STRUCT_DISCKEY;
     dvd.disckey.agid = *pi_agid;
-
     memset( dvd.disckey.value, 0, 2048 );
 
     i_ret = ioctl( i_fd, DVD_READ_STRUCT, &dvd );
@@ -137,6 +145,22 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
 
     memcpy( p_key, dvd.disckey.value, 2048 );
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_struct dvd;
+
+    dvd.format = DVD_STRUCT_DISCKEY;
+    dvd.agid = *pi_agid;
+    memset( dvd.data, 0, 2048 );
+
+    i_ret = ioctl( i_fd, DVDIOCREADSTRUCTURE, &dvd );
+
+    if( i_ret < 0 )
+    {
+        return i_ret;
+    }
+
+    memcpy( p_key, dvd.data, 2048 );
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_READ_DVD_STRUCTURE, 2048 + 4 );
 
@@ -161,13 +185,13 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
 }
 
 /*****************************************************************************
- * ioctl_LUSendAgid: get AGID from the drive
+ * ioctl_ReportAgid: get AGID from the drive
  *****************************************************************************/
-int ioctl_LUSendAgid( int i_fd, int *pi_agid )
+int ioctl_ReportAgid( int i_fd, int *pi_agid )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_LU_SEND_AGID;
@@ -177,6 +201,16 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid )
 
     *pi_agid = auth_info.lsa.agid;
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_REPORT_AGID;
+    auth_info.agid = *pi_agid;
+
+    i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
+
+    *pi_agid = auth_info.agid;
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_REPORT_KEY, 8 );
 
@@ -195,13 +229,13 @@ int ioctl_LUSendAgid( int i_fd, int *pi_agid )
 }
 
 /*****************************************************************************
- * ioctl_LUSendChallenge: get challenge from the drive
+ * ioctl_ReportChallenge: get challenge from the drive
  *****************************************************************************/
-int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
+int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_LU_SEND_CHALLENGE;
@@ -211,6 +245,16 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 
     memcpy( p_challenge, auth_info.lsc.chal, sizeof(dvd_challenge) );
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_REPORT_CHALLENGE;
+    auth_info.agid = *pi_agid;
+
+    i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
+
+    memcpy( p_challenge, auth_info.keychal, 10 );
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_REPORT_KEY, 16 );
 
@@ -229,13 +273,13 @@ int ioctl_LUSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 }
 
 /*****************************************************************************
- * ioctl_LUSendASF: get ASF from the drive
+ * ioctl_ReportASF: get ASF from the drive
  *****************************************************************************/
-int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf )
+int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_LU_SEND_ASF;
@@ -246,6 +290,17 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf )
 
     *pi_asf = auth_info.lsasf.asf;
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_REPORT_ASF;
+    auth_info.agid = *pi_agid;
+    auth_info.asf = *pi_asf;
+
+    i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
+
+    *pi_asf = auth_info.asf;
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_REPORT_KEY, 8 );
 
@@ -278,13 +333,13 @@ int ioctl_LUSendASF( int i_fd, int *pi_agid, int *pi_asf )
 }
 
 /*****************************************************************************
- * ioctl_LUSendKey1: get the first key from the drive
+ * ioctl_ReportKey1: get the first key from the drive
  *****************************************************************************/
-int ioctl_LUSendKey1( int i_fd, int *pi_agid, u8 *p_key )
+int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_LU_SEND_KEY1;
@@ -294,6 +349,16 @@ int ioctl_LUSendKey1( int i_fd, int *pi_agid, u8 *p_key )
 
     memcpy( p_key, auth_info.lsk.key, sizeof(dvd_key) );
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_REPORT_KEY1;
+    auth_info.agid = *pi_agid;
+
+    i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
+
+    memcpy( p_key, auth_info.keychal, 8 );
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_REPORT_KEY, 12 );
 
@@ -318,7 +383,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
 {
     int i_ret;
 
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_INVALIDATE_AGID;
@@ -328,6 +393,16 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
 
     *pi_agid = auth_info.lsa.agid;
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_INVALIDATE_AGID;
+    auth_info.agid = *pi_agid;
+
+    i_ret = ioctl( i_fd, DVDIOCREPORTKEY, &auth_info );
+
+    *pi_agid = auth_info.agid;
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_REPORT_KEY, 0 );
 
@@ -344,11 +419,11 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
 }
 
 /*****************************************************************************
- * ioctl_HostSendChallenge: send challenge to the drive
+ * ioctl_SendChallenge: send challenge to the drive
  *****************************************************************************/
-int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
+int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 {
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_HOST_SEND_CHALLENGE;
@@ -358,6 +433,16 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 
     return ioctl( i_fd, DVD_AUTH, &auth_info );
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_SEND_CHALLENGE;
+    auth_info.agid = *pi_agid;
+
+    memcpy( auth_info.keychal, p_challenge, 12 );
+
+    return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_SEND_KEY, 16 );
 
@@ -376,11 +461,11 @@ int ioctl_HostSendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
 }
 
 /*****************************************************************************
- * ioctl_HostSendKey2: send the second key to the drive
+ * ioctl_SendKey2: send the second key to the drive
  *****************************************************************************/
-int ioctl_HostSendKey2( int i_fd, int *pi_agid, u8 *p_key )
+int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
 {
-#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
+#if defined( DVD_STRUCT_IN_LINUX_CDROM_H )
     dvd_authinfo auth_info;
 
     auth_info.type = DVD_HOST_SEND_KEY2;
@@ -390,6 +475,16 @@ int ioctl_HostSendKey2( int i_fd, int *pi_agid, u8 *p_key )
 
     return ioctl( i_fd, DVD_AUTH, &auth_info );
 
+#elif defined( HAVE_BSD_DVD_STRUCT )
+    struct dvd_authinfo auth_info;
+
+    auth_info.format = DVD_SEND_KEY2;
+    auth_info.agid = *pi_agid;
+
+    memcpy( auth_info.keychal, p_key, 8 );
+
+    return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
+
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_SEND_KEY, 12 );
 
index 3449ea1f83b2968aaa293d9b62fd38b1182e6433..76721b26a7ed449bfca0679d9023c8b8f633da0b 100644 (file)
@@ -2,7 +2,7 @@
  * dvd_ioctl.h: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: dvd_ioctl.h,v 1.6 2001/04/11 04:31:59 sam Exp $
+ * $Id: dvd_ioctl.h,v 1.7 2001/05/02 20:01:44 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 int ioctl_ReadCopyright     ( int, int, int * );
 int ioctl_ReadKey           ( int, int *, u8 * );
 
-int ioctl_LUSendAgid        ( int, int * );
-int ioctl_LUSendChallenge   ( int, int *, u8 * );
-int ioctl_LUSendKey1        ( int, int *, u8 * );
-int ioctl_LUSendASF         ( int, int *, int * );
+int ioctl_ReportAgid        ( int, int * );
+int ioctl_ReportChallenge   ( int, int *, u8 * );
+int ioctl_ReportKey1        ( int, int *, u8 * );
+int ioctl_ReportASF         ( int, int *, int * );
 int ioctl_InvalidateAgid    ( int, int * );
-int ioctl_HostSendChallenge ( int, int *, u8 * );
-int ioctl_HostSendKey2      ( int, int *, u8 * );
+int ioctl_SendChallenge     ( int, int *, u8 * );
+int ioctl_SendKey2          ( int, int *, u8 * );
 
 #ifdef SYS_BEOS