Commit 419eb2fe authored by Stéphane Borel's avatar Stéphane Borel

*Check for the needed headers for DVD ioctls

I have only tested it on my computer ; so I don't know if it work
elsewhere, particularly on BSD and BeOS.
parent 32e82c69
......@@ -3296,6 +3296,142 @@ EOF
fi
for ac_hdr in sys/ioctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3304: 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 3309 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3314: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
for ac_hdr in sys/dvdio.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3344: 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 3349 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3354: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
for ac_hdr in linux/cdrom.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3384: 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 3389 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3394: \"$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*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
cat > conftest.$ac_ext <<EOF
#line 3421 "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
rm -rf conftest*
cat >> confdefs.h <<\EOF
#define LINUX_DVD 1
EOF
fi
rm -f conftest*
PLUGINS=${PLUGINS}"yuv idct idctclassic motion ";
ARCH=${host_cpu}
......@@ -3431,17 +3567,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:3435: checking for sys/asoundlib.h" >&5
echo "configure:3571: 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 3440 "configure"
#line 3576 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3581: \"$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*
......@@ -3458,7 +3594,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:3462: checking for main in -lasound" >&5
echo "configure:3598: 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
......@@ -3466,14 +3602,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3470 "configure"
#line 3606 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3613: \"$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
......@@ -3501,7 +3637,6 @@ fi
if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi
fi
fi
......
......@@ -107,6 +107,12 @@ AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
dnl Checks for DVD ioctls
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/dvdio.h)
AC_CHECK_HEADERS(linux/cdrom.h)
AC_EGREP_HEADER(dvd,linux/cdrom.h,AC_DEFINE(LINUX_DVD,1,DVD support for linux))
dnl default plugins
PLUGINS=${PLUGINS}"yuv idct idctclassic motion ";
......@@ -190,7 +196,6 @@ if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
AC_ARG_ENABLE(alsa,
[ --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)],
[if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi])
fi
AC_SUBST(SYS)
......
......@@ -76,6 +76,9 @@
/* Define if you have the <kernel/scheduler.h> header file. */
#undef HAVE_KERNEL_SCHEDULER_H
/* Define if you have the <linux/cdrom.h> header file. */
#undef HAVE_LINUX_CDROM_H
/* Define if you have the <machine/param.h> header file. */
#undef HAVE_MACHINE_PARAM_H
......@@ -94,6 +97,9 @@
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_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
......@@ -157,3 +163,6 @@
/* Define if <sys/types.h> defines boolean_t. */
#undef BOOLEAN_T_IN_SYS_TYPES_H
/* DVD support for linux */
#undef LINUX_DVD
......@@ -23,6 +23,10 @@
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
#include <stdio.h>
#include <unistd.h>
#include <string.h>
......@@ -30,13 +34,12 @@
#include <malloc.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
//#if defined(__NetBSD__) || defined(__OpenBSD__)
//# include <sys/dvdio.h>
//#elif defined(__linux__)
#include <linux/cdrom.h>
//#else
//# error "Need the DVD ioctls"
//#endif
#ifdef HAVE_SYS_DVDIO_H
# include <sys/dvdio.h>
#endif
#ifdef LINUX_DVD
# include <linux/cdrom.h>
#endif
#include "common.h"
......@@ -1127,3 +1130,4 @@ int CSSDescrambleSector( DVD_key_t* key, u8* pi_sec )
return(0);
}
#endif
......@@ -19,6 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
#define KEY_SIZE 5
typedef u8 DVD_key_t[KEY_SIZE];
......@@ -57,3 +58,4 @@ typedef struct css_s
*****************************************************************************/
struct css_s CSSInit ( int );
int CSSGetKeys ( struct css_s* );
#endif
......@@ -2,7 +2,7 @@
* input_dvd.c: DVD reading
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.5 2001/01/21 09:20:27 stef Exp $
* $Id: input_dvd.c,v 1.6 2001/01/22 05:20:44 stef Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -39,13 +39,12 @@
#include <malloc.h>
#include <sys/ioctl.h>
//#if defined(__NetBSD__) || defined(__OpenBSD__)
//# include <sys/dvdio.h>
//#elif defined(__linux__)
#ifdef HAVE_SYS_DVDIO_H
# include <sys/dvdio.h>
#endif
#ifdef LINUX_DVD
#include <linux/cdrom.h>
//#else
//# error "Need the DVD ioctls"
//#endif
#endif
#include "config.h"
#include "common.h"
......@@ -93,6 +92,7 @@ static void DeletePES ( void *, struct pes_packet_s * );
*****************************************************************************/
static int DVDProbe( input_thread_t * p_input )
{
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
dvd_struct dvd;
dvd.type = DVD_STRUCT_COPYRIGHT;
......@@ -105,6 +105,9 @@ static int DVDProbe( input_thread_t * p_input )
}
return dvd.copyright.cpst;
#else
return 0;
#endif
}
/*****************************************************************************
......@@ -114,7 +117,6 @@ static void DVDInit( input_thread_t * p_input )
{
thread_dvd_data_t * p_method;
off64_t i_start;
int i;
if( (p_method = malloc( sizeof(thread_dvd_data_t) )) == NULL )
{
......@@ -135,9 +137,12 @@ static void DVDInit( input_thread_t * p_input )
p_method->ifo = IfoInit( p_input->i_handle );
IfoRead( &(p_method->ifo) );
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
/* CSS authentication and keys */
if( ( p_method->b_encrypted = DVDProbe( p_input ) ) )
{
int i;
fprintf(stderr, " CSS Init start\n" );
p_method->css = CSSInit( p_input->i_handle );
fprintf(stderr, " CSS Init end\n" );
......@@ -160,6 +165,7 @@ fprintf(stderr, " CSS Get start\n" );
CSSGetKeys( &(p_method->css) );
fprintf(stderr, " CSS Get end\n" );
}
#endif
i_start = p_method->ifo.p_vts[0].i_pos +
p_method->ifo.p_vts[0].mat.i_tt_vobs_ssector *DVD_LB_SIZE;
......
......@@ -27,8 +27,10 @@ typedef struct thread_dvd_data_s
{
int i_fd;
boolean_t b_encrypted;
#if defined( HAVE_SYS_DVDIO_H ) || defined( LINUX_DVD )
/* Scrambling Information */
struct css_s css;
#endif
/* Structure that contains all information of the DVD */
struct ifo_s ifo;
} thread_dvd_data_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment