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
......
This diff is collapsed.
......@@ -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 )
return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( WIN32 )
if( GetVersion() < 0x80000000 ) /* NT/Win2000/Whistler */
if( WIN2K ) /* NT/Win2000/Whistler */
{
DWORD tmp;
u8 buffer[DVD_BUS_KEY_LENGTH];
......@@ -781,7 +847,14 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
}
else
{
return -1;
INIT_SSC( GPCMD_SEND_KEY, 12 );
ssc.CDBByte[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
p_buffer[ 1 ] = 0xa;
memcpy( p_buffer + 4, p_key, 8 );
return WinSendSSC( i_fd, &ssc );
}
#elif defined( SYS_DARWIN1_3 )
......@@ -840,3 +913,65 @@ static void BeInitRDC( raw_device_command *p_rdc, int i_type )
}
#endif
#if defined( WIN32 )
/*****************************************************************************
* WinInitSSC: initialize a ssc structure for the win32 aspi layer
*****************************************************************************
* This function initializes a ssc raw device command structure for future
* use, either a read command or a write command.
*****************************************************************************/
static void WinInitSSC( struct SRB_ExecSCSICmd *p_ssc, int i_type )
{
memset( p_ssc->SRB_BufPointer, 0, p_ssc->SRB_BufLen );
switch( i_type )
{
case GPCMD_SEND_KEY:
p_ssc->SRB_Flags = SRB_DIR_OUT;
break;
case GPCMD_READ_DVD_STRUCTURE:
case GPCMD_REPORT_KEY:
p_ssc->SRB_Flags = SRB_DIR_IN;
break;
}
p_ssc->SRB_Cmd = SC_EXEC_SCSI_CMD;
p_ssc->SRB_Flags |= SRB_EVENT_NOTIFY;
p_ssc->CDBByte[ 0 ] = i_type;
p_ssc->CDBByte[ 8 ] = (u8)(p_ssc->SRB_BufLen >> 8) & 0xff;
p_ssc->CDBByte[ 9 ] = (u8) p_ssc->SRB_BufLen & 0xff;
p_ssc->SRB_CDBLen = 12;
p_ssc->SRB_SenseLen = SENSE_LEN;
}
/*****************************************************************************
* WinSendSSC: send a ssc structure to the aspi layer
*****************************************************************************/
static int WinSendSSC( int i_fd, struct SRB_ExecSCSICmd *p_ssc )
{
HANDLE hEvent = NULL;
struct w32_aspidev *fd = (struct w32_aspidev *) i_fd;
hEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
if( hEvent == NULL )
{
return -1;
}
p_ssc->SRB_PostProc = hEvent;
p_ssc->SRB_HaId = LOBYTE( fd->i_sid );
p_ssc->SRB_Target = HIBYTE( fd->i_sid );
ResetEvent( hEvent );
if( fd->lpSendCommand( (void*) p_ssc ) == SS_PENDING )
WaitForSingleObject( hEvent, INFINITE );
CloseHandle( hEvent );
return p_ssc->SRB_Status == SS_COMP ? 0 : -1;
}
#endif
......@@ -2,7 +2,7 @@
* dvd_ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.h,v 1.1 2001/06/12 22:14:44 sam Exp $
* $Id: ioctl.h,v 1.2 2001/06/14 02:47:44 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -58,6 +58,19 @@ int ioctl_SendKey2 ( int, int *, u8 * );
memset( p_buffer, 0, (SIZE) );
#endif
/*****************************************************************************
* Common macro, win32 (ASPI) specific
*****************************************************************************/
#if defined( WIN32 )
#define INIT_SSC( TYPE, SIZE ) \
struct SRB_ExecSCSICmd ssc; \
u8 p_buffer[ (SIZE) ]; \
memset( &ssc, 0, sizeof( struct SRB_ExecSCSICmd ) ); \
ssc.SRB_BufPointer = (char *)p_buffer; \
ssc.SRB_BufLen = (SIZE); \
WinInitSSC( &ssc, (TYPE) );
#endif
/*****************************************************************************
* Various DVD I/O tables
*****************************************************************************/
......@@ -83,6 +96,10 @@ int ioctl_SendKey2 ( int, int *, u8 * );
#if defined( WIN32 )
/*****************************************************************************
* win32 ioctl specific
*****************************************************************************/
#define IOCTL_DVD_START_SESSION CTL_CODE(FILE_DEVICE_DVD, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_READ_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_DVD_SEND_KEY CTL_CODE(FILE_DEVICE_DVD, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
......@@ -90,10 +107,13 @@ int ioctl_SendKey2 ( int, int *, u8 * );
#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(FILE_DEVICE_CONTROLLER, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
#define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
#define SCSI_IOCTL_DATA_OUT 0
#define SCSI_IOCTL_DATA_IN 1
typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
......@@ -152,8 +172,73 @@ typedef struct _SCSI_PASS_THROUGH_DIRECT
UCHAR Cdb[16];
} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
#define SCSI_IOCTL_DATA_OUT 0
#define SCSI_IOCTL_DATA_IN 1
/*****************************************************************************
* win32 aspi specific
*****************************************************************************/
#define WIN2K ( GetVersion() < 0x80000000 )
#define ASPI_HAID 0
#define ASPI_TARGET 0
#define SENSE_LEN 0x0E
#define SC_EXEC_SCSI_CMD 0x02
#define SC_GET_DISK_INFO 0x06
#define SS_COMP 0x01
#define SS_PENDING 0x00
#define SS_NO_ADAPTERS 0xE8
#define SRB_DIR_IN 0x08
#define SRB_DIR_OUT 0x10
#define SRB_EVENT_NOTIFY 0x40
struct w32_aspidev
{
long hASPI;
short i_sid;
off_t i_pos;
long (*lpSendCommand)( void* );
};
#pragma pack(1)
struct SRB_GetDiskInfo
{
unsigned char SRB_Cmd;
unsigned char SRB_Status;
unsigned char SRB_HaId;
unsigned char SRB_Flags;
unsigned long SRB_Hdr_Rsvd;
unsigned char SRB_Target;
unsigned char SRB_Lun;
unsigned char SRB_DriveFlags;
unsigned char SRB_Int13HDriveInfo;
unsigned char SRB_Heads;
unsigned char SRB_Sectors;
unsigned char SRB_Rsvd1[22];
};
struct SRB_ExecSCSICmd
{
unsigned char SRB_Cmd;
unsigned char SRB_Status;
unsigned char SRB_HaId;
unsigned char SRB_Flags;
unsigned long SRB_Hdr_Rsvd;
unsigned char SRB_Target;
unsigned char SRB_Lun;
unsigned short SRB_Rsvd1;
unsigned long SRB_BufLen;
unsigned char *SRB_BufPointer;
unsigned char SRB_SenseLen;
unsigned char SRB_CDBLen;
unsigned char SRB_HaStat;
unsigned char SRB_TargStat;
unsigned long *SRB_PostProc;
unsigned char SRB_Rsvd2[20];
unsigned char CDBByte[16];
unsigned char SenseArea[SENSE_LEN+2];
};
#pragma pack()
#endif
This diff is collapsed.
......@@ -2,7 +2,7 @@
* private.h: private DVD reading library data
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: libdvdcss.h,v 1.2 2001/06/14 01:49:44 sam Exp $
* $Id: libdvdcss.h,v 1.3 2001/06/14 02:47:44 sam Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -49,8 +49,13 @@ struct dvdcss_s
/*****************************************************************************
* Error management
*****************************************************************************/
#define DVDCSS_ERROR( x... ) fprintf( stderr, "libdvdcss error: %s\n", ##x );
#define DVDCSS_DEBUG( x... ) fprintf( stderr, "libdvdcss debug: %s\n", ##x );
#if defined( _WIN32 ) && defined( _MSC_VER )
# define DVDCSS_ERROR( x ) fprintf( stderr, "libdvdcss error: %s\n", x );
# define DVDCSS_DEBUG( x ) fprintf( stderr, "libdvdcss debug: %s\n", x );
#else
# define DVDCSS_ERROR( x... ) fprintf( stderr, "libdvdcss error: %s\n", ##x );
# define DVDCSS_DEBUG( x... ) fprintf( stderr, "libdvdcss debug: %s\n", ##x );
#endif
static __inline__ void _dvdcss_error( dvdcss_handle dvdcss, char *psz_string )
{
......
......@@ -148,6 +148,9 @@
/* Define if you have the <videolan/dvdcss.h> header file. */
#undef HAVE_VIDEOLAN_DVDCSS_H
/* Define if you have the <winioctl.h> header file. */
#undef HAVE_WINIOCTL_H
/* Define if you have the pth library (-lpth). */
#undef HAVE_LIBPTH
......
......@@ -10,7 +10,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.73 2001/06/14 01:49:44 sam Exp $
* $Id: input_dvd.c,v 1.74 2001/06/14 02:47:45 sam Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -157,11 +157,8 @@ static int DVDProbe( probedata_t *p_data )
input_thread_t * p_input = (input_thread_t *)p_data;
char * psz_name = p_input->p_source;
int i_handle;
dvdcss_handle dvdhandle;
int i_score = 5;
#if defined( WIN32 )
char buf[7];
#endif
if( TestMethod( INPUT_METHOD_VAR, "dvd" ) )
{
......@@ -183,25 +180,11 @@ static int DVDProbe( probedata_t *p_data )
psz_name += 4;
}
#if !defined( WIN32 )
i_handle = open( psz_name, 0 );
if( i_handle == -1 )
dvdhandle = dvdcss_open( psz_name, DVDCSS_INIT_QUIET );
if( dvdhandle == NULL )
{
return( 0 );
}
close( i_handle );
#else
snprintf( buf, 7, "\\\\.\\%c:", psz_name[0] );
(HANDLE) i_handle = CreateFile( i_score < 90 ? psz_name : buf,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL );
if( (HANDLE) i_handle == INVALID_HANDLE_VALUE )
{
return( 0 );
}
CloseHandle( (HANDLE) i_handle );
#endif
return( i_score );
}
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.121 2001/06/14 01:49:44 sam Exp $
* $Id: input.c,v 1.122 2001/06/14 02:47:45 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -522,10 +522,6 @@ static void FileOpen( input_thread_t * p_input )
struct stat stat_info;
int i_stat;
#if defined( WIN32 )
char buf[7] = { 0 };
#endif
char *psz_name = p_input->p_source;
/* FIXME: this code ought to be in the plugin so that code can
......@@ -540,9 +536,6 @@ static void FileOpen( input_thread_t * p_input )
/* get rid of the 'dvd:' stuff and try again */
psz_name += 4;
i_stat = stat( psz_name, &stat_info );
#if defined( WIN32 )
_snprintf( buf, 7, "\\\\.\\%c:", psz_name[0] );
#endif
}
else if( ( i_size > 5 )
&& !strncasecmp( psz_name, "file:", 5 ) )
......@@ -552,11 +545,7 @@ static void FileOpen( input_thread_t * p_input )
i_stat = stat( psz_name, &stat_info );
}
if( i_stat == (-1)
#if defined( WIN32 )
&& !buf[0]
#endif
)
if( i_stat == (-1) )
{
intf_ErrMsg( "input error: cannot stat() file `%s' (%s)",
psz_name, strerror(errno));
......@@ -571,11 +560,7 @@ static void FileOpen( input_thread_t * p_input )
p_input->stream.b_pace_control = 1;
if( S_ISREG(stat_info.st_mode) || S_ISCHR(stat_info.st_mode)
|| S_ISBLK(stat_info.st_mode)
#if defined( WIN32 )
|| ( buf[0] && ( ( stat_info.st_size = 0 ) == 0 ) )
#endif
)
|| S_ISBLK(stat_info.st_mode) )
{
p_input->stream.b_seekable = 1;
p_input->stream.p_selected_area->i_size = stat_info.st_size;
......@@ -602,14 +587,11 @@ static void FileOpen( input_thread_t * p_input )
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_WarnMsg( 1, "input: opening file `%s'", p_input->p_source );
#ifndef WIN32
#if defined( WIN32 )
if( (p_input->i_handle = open( psz_name, O_BINARY ) ) == (-1) )
#else
if( (p_input->i_handle = open( psz_name,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
#else
if( ( buf[0] && ( (HANDLE) p_input->i_handle = CreateFile( buf,
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL ) ) == INVALID_HANDLE_VALUE ) ||
( !buf[0] && (p_input->i_handle = open( psz_name, O_BINARY ) ) == (-1) ) )
#endif
{
intf_ErrMsg( "input error: cannot open file (%s)", strerror(errno) );
......@@ -625,14 +607,7 @@ static void FileOpen( input_thread_t * p_input )
static void FileClose( input_thread_t * p_input )
{
intf_WarnMsg( 1, "input: closing file `%s'", p_input->p_source );
#if defined( WIN32 )
if( ( strlen( p_input->p_source ) > 4 ) &&
!strncasecmp( p_input->p_source, "dvd:", 4 ) )
{
CloseHandle( (HANDLE) p_input->i_handle );
}
else
#endif
close( p_input->i_handle );
return;
......
......@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.35 2001/06/14 01:49:44 sam Exp $
* $Id: modules.c,v 1.36 2001/06/14 02:47:45 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -45,7 +45,7 @@
#elif defined(HAVE_IMAGE_H) /* BeOS */
# include <image.h>
# define HAVE_DYNAMIC_PLUGINS
#elif defined(WIN32)
#elif defined(WIN32) && defined( __MINGW32__ )
# define HAVE_DYNAMIC_PLUGINS
#else
# undef HAVE_DYNAMIC_PLUGINS
......
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