Commit cff6378d authored by Sam Hocevar's avatar Sam Hocevar

  * Fully working Windows DVD ioctl support by Jon Lech Johansen.
  * Usual weekly ChangeLog mass-update.
parent 4b921617
......@@ -4,6 +4,44 @@
HEAD
* Fully working Windows DVD ioctl support by Jon Lech Johansen.
* DirectX enhancements by Gildas Bazin, such as software rendering.
* Merged dvdcss_init and dvdcss_open into dvdcss_open, and dvdcss_close
and dvdcss_end into dvdcss_close. libdvdcss API now has 7 functions.
* Another failed attempt at profiling vlc under Linux: ported the
threads API to GNU Pth. Activate with --enable-pth. It doesn't seem to
spawn new threads for me, maybe someone will have better luck.
* Makefile optimizations.
* Automatic build of libdvdcss if not found.
* The DVD netlist no longer stops when the fifo is empty ; it just waits
until there are free vectors again.
* Exported the CSS part of the dvd plugin into a library.
* Slight modification in input_dvd since Getiovec wasn't at the right place.
* Send escape packet when changing title, not to be stuck in some decoder.
* The position in the title is now reset when we change title to
prevent a title from being unavailable because we're stuck at the end.
* Fixed a bug with 1-chapter-long titles that displayed chapter 0.
* Added a _temporary_ field in p_main to know whether the audio stream is
AC3 (ugly). It allows a vlc launched in spdif mode to play mpeg or lpcm
audio.
* Cleaned the title property messages to get rid of the ugly stars.
* Added LPCM support. It should work with stereo LPCM.
* Fixed a warning when compiling main.c.
* Checked that OS supports SSE instructions on PIIIs (to avoid illegal
hardware instructions on Linux 2.2.x).
* Fixed a bug in synchro reinitialization: we no longer have a shift each
time we restart the synchro (for SCR discontinuity for instance)
* In DVD mode, we reinit the synchro only if the SCR are not continuous
(instead of each cell).
* Tried to improve AC3 spdif to prevent desynchronization.
* Lots of DirectX plugin fixes by Gildas Bazin.
* Compilation fix in message queue mode.
* Another FreeBSD compilation fix.
* SDL compilation fix for FreeBSD.
* Fixed compilation of motion modules as plugins.
* Applied old FreeBSD patch for dvd input by German Tischler.
* Found what was causing the slowdowns: a namespace collision. Put all
plugins into builtins again.
* Put most builtins in plugins again due to performances issues.
* Fixed the painfully slow build process (at last!).
* Added new dummy input plugin.
......
......@@ -187,7 +187,7 @@ ifneq (,$(findstring darwin,$(SYS)))
CFLAGS += -traditional-cpp
endif
ifneq (,$(findstring mingw32,$(SYS)))
ifneq (,$(findstring mingw32,$(SYS)))
CFLAGS += -fnative-struct
endif
......@@ -242,7 +242,7 @@ endif
# C compiler flags: plugin compilation
#
ifneq (,$(findstring mingw32,$(SYS)))
PCFLAGS += -fPIC -fnative-struct
PCFLAGS += -fnative-struct
else
PCFLAGS += -fPIC
endif
......
......@@ -3376,21 +3376,65 @@ else
fi
rm -f conftest*
for ac_hdr in winioctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3385: 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 3390 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3395: \"$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
LIBDVDCSS=1
else
echo "$ac_t""no" 1>&6
fi
done
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:3384: checking for $ac_hdr" >&5
echo "configure:3428: 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"
#line 3433 "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; }
{ (eval echo configure:3438: \"$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*
......@@ -3416,17 +3460,17 @@ EOF
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3420: checking for $ac_hdr" >&5
echo "configure:3464: 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 3425 "configure"
#line 3469 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3474: \"$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*
......@@ -3454,7 +3498,7 @@ done
BSD_DVD_STRUCT=0
cat > conftest.$ac_ext <<EOF
#line 3458 "configure"
#line 3502 "configure"
#include "confdefs.h"
#include <sys/dvdio.h>
EOF
......@@ -3472,7 +3516,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
#line 3476 "configure"
#line 3520 "configure"
#include "confdefs.h"
#include <sys/cdio.h>
EOF
......@@ -3496,7 +3540,7 @@ EOF
fi
cat > conftest.$ac_ext <<EOF
#line 3500 "configure"
#line 3544 "configure"
#include "confdefs.h"
#include <linux/cdrom.h>
EOF
......@@ -3524,7 +3568,7 @@ if test "${enable_pth+set}" = set; then
enableval="$enable_pth"
if test x$enableval = xyes; then
echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6
echo "configure:3528: checking for pth_init in -lpth" >&5
echo "configure:3572: checking for pth_init in -lpth" >&5
ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -3532,7 +3576,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpth $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3536 "configure"
#line 3580 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
......@@ -3543,7 +3587,7 @@ int main() {
pth_init()
; return 0; }
EOF
if { (eval echo configure:3547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3591: \"$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
......@@ -3571,7 +3615,7 @@ else
fi
cat > conftest.$ac_ext <<EOF
#line 3575 "configure"
#line 3619 "configure"
#include "confdefs.h"
#include <pth.h>
EOF
......@@ -3672,17 +3716,17 @@ for ac_hdr in videolan/dvdcss.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3676: checking for $ac_hdr" >&5
echo "configure:3720: 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 3681 "configure"
#line 3725 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3730: \"$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*
......@@ -3773,7 +3817,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:3777: checking for $ac_word" >&5
echo "configure:3821: 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
......@@ -3838,17 +3882,17 @@ else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3842: checking for $ac_hdr" >&5
echo "configure:3886: 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 3847 "configure"
#line 3891 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3896: \"$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*
......@@ -3919,17 +3963,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:3923: checking for $ac_hdr" >&5
echo "configure:3967: 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 3928 "configure"
#line 3972 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3977: \"$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*
......@@ -3967,17 +4011,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3971: checking for $ac_hdr" >&5
echo "configure:4015: 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 3976 "configure"
#line 4020 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3981: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4025: \"$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*
......@@ -4021,17 +4065,17 @@ if test "${with_directx+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:4025: checking for $ac_hdr" >&5
echo "configure:4069: 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 4030 "configure"
#line 4074 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4079: \"$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*
......@@ -4069,17 +4113,17 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4073: checking for $ac_hdr" >&5
echo "configure:4117: 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 4078 "configure"
#line 4122 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4083: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4127: \"$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*
......@@ -4179,7 +4223,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:4183: checking for $ac_word" >&5
echo "configure:4227: 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
......@@ -4239,17 +4283,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:4243: checking for $ac_hdr" >&5
echo "configure:4287: 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 4248 "configure"
#line 4292 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4253: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4297: \"$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*
......@@ -4301,17 +4345,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:4305: checking for $ac_hdr" >&5
echo "configure:4349: 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 4310 "configure"
#line 4354 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4359: \"$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*
......@@ -4349,17 +4393,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:4353: checking for sys/asoundlib.h" >&5
echo "configure:4397: 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 4358 "configure"
#line 4402 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4363: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4407: \"$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*
......@@ -4376,7 +4420,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:4380: checking for main in -lasound" >&5
echo "configure:4424: 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
......@@ -4384,14 +4428,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4388 "configure"
#line 4432 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:4395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4439: \"$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
......
......@@ -177,6 +177,13 @@ AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],,
dnl
dnl libdvdcss: check for DVD ioctls
dnl
dnl for windoze
AC_CHECK_HEADERS(winioctl.h,[
LIBDVDCSS=1
])
dnl for Un*x
AC_CHECK_HEADERS(sys/ioctl.h,[
LIBDVDCSS=1
AC_CHECK_HEADERS(sys/cdio.h sys/dvdio.h linux/cdrom.h)
......
......@@ -3,7 +3,7 @@
# (c)2001 VideoLAN
###############################################################################
include ../../Makefile.opts
-include ../../Makefile.opts
LIBDVDCSS_VERSION = 0.0.1
LIBDVDCSS_MAJOR = 0
......
......@@ -2,7 +2,7 @@
* css.c: Functions for DVD authentification and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: css.c,v 1.1 2001/06/12 22:14:44 sam Exp $
* $Id: css.c,v 1.2 2001/06/14 02:47:44 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -39,7 +39,7 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#elif defined( _MSC_VER ) && defined( _WIN32 )
#elif defined( WIN32 )
# include <io.h>
#endif
......@@ -322,7 +322,7 @@ int CSSGetKey( dvdcss_handle dvdcss )
off_t i_pos;
boolean_t b_encrypted;
boolean_t b_stop_scanning;
int i_bytes_read;
int i_blocks_read;
int i_best_plen;
int i_best_p;
int i,j;
......@@ -336,16 +336,11 @@ int CSSGetKey( dvdcss_handle dvdcss )
b_stop_scanning = 0;
/* Position of the title on the disc */
i_pos = (off_t)DVDCSS_BLOCK_SIZE * (off_t)dvdcss->css.i_title_pos;
i_pos = (off_t)dvdcss->css.i_title_pos;
do {
#if !defined( WIN32 )
i_pos = lseek( dvdcss->i_fd, i_pos, SEEK_SET );
i_bytes_read = read( dvdcss->i_fd, pi_buf, 0x800 );
#else
i_pos = SetFilePointer( (HANDLE) dvdcss->i_fd, i_pos, 0, FILE_BEGIN );
ReadFile( (HANDLE) dvdcss->i_fd, pi_buf, 0x800, &i_bytes_read, NULL );
#endif
i_pos = dvdcss_seek( dvdcss, i_pos );
i_blocks_read = dvdcss_read( dvdcss, pi_buf, 1, DVDCSS_NOFLAGS );
/* PES_scrambling_control */
if( pi_buf[0x14] & 0x30 )
......@@ -377,8 +372,8 @@ int CSSGetKey( dvdcss_handle dvdcss )
}
}
i_pos += i_bytes_read;
} while( i_bytes_read == 0x800 && !b_stop_scanning);
i_pos += i_blocks_read;
} while( i_blocks_read == 0x1 && !b_stop_scanning);
if( b_stop_scanning)
{
......
......@@ -2,7 +2,7 @@
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.c,v 1.1 2001/06/12 22:14:44 sam Exp $
* $Id: ioctl.c,v 1.2 2001/06/14 02:47:44 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
......@@ -69,6 +69,14 @@
static void BeInitRDC ( raw_device_command *, int );
#endif
/*****************************************************************************
* Local prototypes, win32 (aspi) specific
*****************************************************************************/
#if defined( WIN32 )
static void WinInitSSC ( struct SRB_ExecSCSICmd *, int );
static int WinSendSSC ( int, struct SRB_ExecSCSICmd * );
#endif
/*****************************************************************************
* ioctl_ReadCopyright: check whether the disc is encrypted or not
*****************************************************************************/
......@@ -115,7 +123,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
i_ret = 0;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 p_buffer[ 8 ];
......@@ -150,11 +158,14 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
}
else
{
/* TODO: add WNASPI support for Win9x */
_dvd_error( dvdcss, "DVD ioctls not functional yet, "
"assuming disc is unencrypted" );
*pi_copyright = 0;
i_ret = 0;
INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
ssc.CDBByte[ 6 ] = i_layer;
ssc.CDBByte[ 7 ] = DVD_STRUCT_COPYRIGHT;
i_ret = WinSendSSC( i_fd, &ssc );
*pi_copyright = p_buffer[ 4 ];
}
#else
......@@ -228,7 +239,7 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memset( p_key, 0x00, 2048 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_DISK_KEY_LENGTH];
......@@ -253,7 +264,19 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
}
else
{
i_ret = -1;
INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 2048 + 4 );
ssc.CDBByte[ 7 ] = DVD_STRUCT_DISCKEY;
ssc.CDBByte[ 10 ] = *pi_agid << 6;
i_ret = WinSendSSC( i_fd, &ssc );
if( i_ret < 0 )
{
return i_ret;
}
memcpy( p_key, p_buffer + 4, 2048 );
}
#else
......@@ -312,7 +335,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = p_buffer[ 7 ] >> 6;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
ULONG id;
DWORD tmp;
......@@ -324,7 +347,13 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
}
else
{
i_ret = -1;
INIT_SSC( GPCMD_REPORT_KEY, 8 );
ssc.CDBByte[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
i_ret = WinSendSSC( i_fd, &ssc );
*pi_agid = p_buffer[ 7 ] >> 6;
}
#else
......@@ -383,7 +412,7 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, p_buffer + 4, 12 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_CHALLENGE_KEY_LENGTH];
......@@ -408,7 +437,13 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
}
else
{
i_ret = -1;
INIT_SSC( GPCMD_REPORT_KEY, 16 );
ssc.CDBByte[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
i_ret = WinSendSSC( i_fd, &ssc );
memcpy( p_challenge, p_buffer + 4, 12 );
}
#else
......@@ -469,7 +504,7 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = p_buffer[ 7 ] & 1;
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_ASF_LENGTH];
......@@ -496,7 +531,13 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
}
else
{
i_ret = -1;
INIT_SSC( GPCMD_REPORT_KEY, 8 );
ssc.CDBByte[ 10 ] = DVD_REPORT_ASF | (*pi_agid << 6);
i_ret = WinSendSSC( i_fd, &ssc );
*pi_asf = p_buffer[ 7 ] & 1;
}
#else
......@@ -554,7 +595,7 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 8 );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_BUS_KEY_LENGTH];
......@@ -574,7 +615,13 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
}
else
{
i_ret = -1;
INIT_SSC( GPCMD_REPORT_KEY, 12 );
ssc.CDBByte[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
i_ret = WinSendSSC( i_fd, &ssc );
memcpy( p_key, p_buffer + 4, 8 );
}
#else
......@@ -628,7 +675,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
......@@ -637,7 +684,19 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
}
else
{
i_ret = -1;
#if defined( __MINGW32__ )
INIT_SSC( GPCMD_REPORT_KEY, 0 );
#else
INIT_SSC( GPCMD_REPORT_KEY, 1 );
ssc.SRB_BufLen = 0;
ssc.CDBByte[ 8 ] = 0;
ssc.CDBByte[ 9 ] = 0;
#endif
ssc.CDBByte[ 10 ] = DVD_INVALIDATE_AGID | (*pi_agid << 6);
i_ret = WinSendSSC( i_fd, &ssc );
}
#else
......@@ -695,7 +754,7 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, IODVD_SEND_KEY, &dvdioctl );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_CHALLENGE_KEY_LENGTH];
......@@ -715,7 +774,14 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
}
else
{
return -1;
INIT_SSC( GPCMD_SEND_KEY, 16 );
ssc.CDBByte[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
p_buffer[ 1 ] = 0xe;
memcpy( p_buffer + 4, p_challenge, 12 );
return WinSendSSC( i_fd, &ssc );
}
#else
......@@ -761,7 +827,7 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )