#===================#
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>.
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
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
# 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
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*
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*
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*
# 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
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*
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*
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*
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
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
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.)
])
])
/* 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
* 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>
*
{
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 )
{
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 );
/* 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;
}
}
/* 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;
}
}
/* 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;
}
}
/* 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;
}
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 " );
* 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"
{
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;
*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 );
{
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 );
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 );
}
/*****************************************************************************
- * 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;
*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 );
}
/*****************************************************************************
- * 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;
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 );
}
/*****************************************************************************
- * 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;
*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 );
}
/*****************************************************************************
- * 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;
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 );
{
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;
*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 );
}
/*****************************************************************************
- * 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;
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 );
}
/*****************************************************************************
- * 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;
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 );
* 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