Commit 0967faf5 authored by Sam Hocevar's avatar Sam Hocevar

  * Compile fix for newer versions of MacOS X by Colin Simmonds
    <colin_simmonds@Mac.lover.org>.
  * Additional MacOS X DVD ioctl work by Eugenio Jarosiewicz
    <ej0@cise.ufl.edu>.
parent 01d140d8
......@@ -111,7 +111,7 @@ D: DVD subtitles decoder
N: Eugenio Jarosiewicz
E: ej0@cise.ufl.edu
C: ej
D: MacOS X interface and fixes
D: MacOS X interface, DVD ioctls, and various fixes
N: Brieuc Jeunhomme
E: bbp@via.ecp.fr
......
This diff is collapsed.
......@@ -219,6 +219,18 @@ AC_CHECK_HEADERS(sys/ioctl.h,[
])
])
dnl
dnl Check the operating system
dnl
case ${host_os} in
darwin*)
SYS=darwin
;;
*)
SYS=${host_os}
;;
esac
dnl
dnl PentiumPro acceleration
dnl
......@@ -347,10 +359,8 @@ AC_ARG_ENABLE(rc,
if test x$enable_rc != xno; then
BUILTINS="${BUILTINS} rc"; fi
SYS=${host_os}
dnl special case for BeOS
if test x$host_os = xbeos; then
if test x$SYS = xbeos; then
BUILTINS="${BUILTINS} beos"
LIB_BEOS="-lbe -lgame -lroot -ltracker"
PLCFLAGS="${PLCFLAGS} -nostart"
......
......@@ -3,9 +3,10 @@
*****************************************************************************
* Copyright (C) 1998-2000 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2001 VideoLAN
* $Id: DVDioctl.cpp,v 1.6 2001/05/25 04:23:37 sam Exp $
* $Id: DVDioctl.cpp,v 1.7 2001/06/25 11:34:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
......@@ -53,6 +54,10 @@ extern "C"
#include <IOKit/storage/IODVDMedia.h>
#include <IOKit/storage/IODVDBlockStorageDriver.h>
#undef CONTROL //some include above #defines this and breaks the next include...grr.
#include <IOKit/scsi-commands/IOSCSIMultimediaCommandsDevice.h>
#include <IOKit/scsi-commands/IODVDServices.h>
#include "DVDioctl.h"
/*****************************************************************************
......@@ -108,6 +113,8 @@ static int i_major;
static void *p_node;
static IODVDMedia *p_dvd;
static IODVDBlockStorageDriver *p_drive;
static IODVDServices *p_services;
static IOSCSIMultimediaCommandsDevice *p_scsi_mcd;
/*****************************************************************************
* DKR_GET_DEV: borrowed from IOMediaBSDClient.cpp
......@@ -252,6 +259,8 @@ bool DVDioctl::init( OSDictionary *p_dict = 0 )
p_node = NULL;
p_dvd = NULL;
p_drive = NULL;
p_services = NULL;
p_scsi_mcd = NULL;
i_major = -1;
b_inuse = false;
......@@ -405,6 +414,10 @@ static int DVDOpen( dev_t dev, int flags, int devtype, struct proc * )
p_drive = p_dvd->getProvider();
p_services = OSDynamicCast( IODVDServices, p_drive->getProvider() );
p_scsi_mcd = OSDynamicCast( IOSCSIMultimediaCommandsDevice, p_services->getProvider() );
log( LOG_INFO, "DVD ioctl: IODVDMedia->open()\n" );
return 0;
......@@ -420,6 +433,8 @@ static int DVDClose( dev_t dev, int flags, int devtype, struct proc * )
p_dvd = NULL;
p_drive = NULL;
p_services = NULL;
p_scsi_mcd = NULL;
b_inuse = false;
log( LOG_INFO, "DVD ioctl: IODVDMedia->close()\n" );
......@@ -450,9 +465,15 @@ static void DVDStrategy( buf_t * bp )
static int DVDBlockIoctl( dev_t dev, u_long cmd, caddr_t addr, int flags,
struct proc *p )
{
dvdioctl_data_t *p_data = (dvdioctl_data_t *)addr;
IOMemoryDescriptor *p_mem;
#define p_data (((dvdioctl_data_t *)addr))
IOReturn i_ret = EINVAL;
/* Only needed for IODVD_READ_STRUCTURE */
SCSITask *p_request;
SCSIServiceResponse response;
IOMemoryDescriptor *p_mem;
p_mem = IOMemoryDescriptor::withAddress( p_data->p_buffer,
p_data->i_size,
kIODirectionOutIn );
......@@ -463,9 +484,49 @@ static int DVDBlockIoctl( dev_t dev, u_long cmd, caddr_t addr, int flags,
log( LOG_INFO, "DVD ioctl: IODVD_READ_STRUCTURE\n" );
/* We don't do anything, since I don't know what to do */
return 0;
i_ret = kIOReturnUnsupported;
response = kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE;
/* HACK! - Make GetSCSITask and friends in /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/scsi-commands/IOSCSIPrimaryCommandsDevice.h public by moving public: from line 96 to line 79 (as root). It's only a compile time check - not a link time thing, so it should be ok. */
p_request = p_scsi_mcd->GetSCSITask( );
if ( p_scsi_mcd->READ_DVD_STRUCTURE ( p_request,
p_mem,
p_data->i_lba,
0,//?LAYER_NUMBER
p_data->i_keyformat,
p_mem->getLength(),//p_data->i_size ?
p_data->i_agid,
0x00 //?CONTROL
) == true )
{
/* The command was successfully built, now send it */
response = p_scsi_mcd->SendCommand( p_request );
}
else
{
#if 0
exit -1;
PANIC_NOW(( "IOSCSIMultimediaCommandsDevice:: "
"readDVDstruct malformed command" ));
#endif
}
if( ( response == kSCSIServiceResponse_TASK_COMPLETE ) &&
( p_request->GetTaskStatus ( ) == kSCSITaskStatus_GOOD ) )
{
i_ret = kIOReturnSuccess;
}
else
{
i_ret = kIOReturnError;
}
p_scsi_mcd->ReleaseSCSITask( p_request );
}
break;
case IODVD_SEND_KEY:
......@@ -475,9 +536,11 @@ static int DVDBlockIoctl( dev_t dev, u_long cmd, caddr_t addr, int flags,
(int)p_data->p_buffer, p_data->i_keyclass,
p_data->i_agid, p_data->i_keyformat );
return p_drive->sendKey( p_mem, (DVDKeyClass)p_data->i_keyclass,
p_data->i_agid,
(DVDKeyFormat)p_data->i_keyformat );
i_ret = p_drive->sendKey( p_mem, (DVDKeyClass)p_data->i_keyclass,
p_data->i_agid,
(DVDKeyFormat)p_data->i_keyformat );
break;
case IODVD_REPORT_KEY:
......@@ -487,16 +550,23 @@ static int DVDBlockIoctl( dev_t dev, u_long cmd, caddr_t addr, int flags,
(int)p_data->p_buffer, p_data->i_keyclass, p_data->i_lba,
p_data->i_agid, p_data->i_keyformat );
return p_drive->reportKey( p_mem, (DVDKeyClass)p_data->i_keyclass,
p_data->i_lba, p_data->i_agid,
(DVDKeyFormat)p_data->i_keyformat );
i_ret = p_drive->reportKey( p_mem, (DVDKeyClass)p_data->i_keyclass,
p_data->i_lba, p_data->i_agid,
(DVDKeyFormat)p_data->i_keyformat );
break;
default:
log( LOG_INFO, "DVD ioctl: unknown ioctl\n" );
return EINVAL;
i_ret = EINVAL;
break;
}
return i_ret;
#undef p_data
}
/*****************************************************************************
......
......@@ -2,9 +2,10 @@
* DVDioctl.h: Linux-like DVD driver for Darwin and MacOS X
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: DVDioctl.h,v 1.3 2001/05/25 04:23:37 sam Exp $
* $Id: DVDioctl.h,v 1.4 2001/06/25 11:34:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Eugenio Jarosiewicz <ej0@cise.ufl.edu>
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
......
......@@ -2,7 +2,7 @@
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.c,v 1.2 2001/06/14 02:47:44 sam Exp $
* $Id: ioctl.c,v 1.3 2001/06/25 11:34:08 sam Exp $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Samuel Hocevar <sam@zoy.org>
......@@ -56,7 +56,7 @@
#include "config.h"
#include "common.h"
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
# include "DVDioctl/DVDioctl.h"
#endif
......@@ -114,7 +114,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
*pi_copyright = p_buffer[ 4 ];
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
_dvd_error( dvdcss, "DVD ioctls not fully functional yet, "
"assuming disc is encrypted" );
......@@ -230,7 +230,7 @@ int ioctl_ReadKey( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 2048 );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
_dvd_error( dvdcss, "DVD ioctls not fully functional yet, "
"sending an empty key" );
......@@ -323,7 +323,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
*pi_agid = p_buffer[ 7 ] >> 6;
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 8 );
dvdioctl.i_keyformat = kCSSAGID;
......@@ -400,7 +400,7 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
memcpy( p_challenge, p_buffer + 4, 12 );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 16 );
dvdioctl.i_keyformat = kChallengeKey;
......@@ -492,7 +492,7 @@ int ioctl_ReportASF( int i_fd, int *pi_agid, int *pi_asf )
*pi_asf = p_buffer[ 7 ] & 1;
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 8 );
dvdioctl.i_keyformat = kASF;
......@@ -584,7 +584,7 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, u8 *p_key )
memcpy( p_key, p_buffer + 4, 8 );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 12 );
dvdioctl.i_keyformat = kKey1;
......@@ -666,7 +666,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 0 );
dvdioctl.i_keyformat = kInvalidateAGID;
......@@ -742,7 +742,7 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, u8 *p_challenge )
return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 16 );
dvdioctl.i_keyformat = kChallengeKey;
......@@ -857,7 +857,7 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, u8 *p_key )
return WinSendSSC( i_fd, &ssc );
}
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
INIT_DVDIOCTL( 12 );
dvdioctl.i_keyformat = kKey2;
......
......@@ -2,7 +2,7 @@
* ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ioctl.h,v 1.3 2001/06/20 07:43:48 sam Exp $
* $Id: ioctl.h,v 1.4 2001/06/25 11:34:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -48,7 +48,7 @@ int ioctl_SendKey2 ( int, int *, u8 * );
/*****************************************************************************
* Common macro, Darwin specific
*****************************************************************************/
#if defined( SYS_DARWIN1_3 )
#if defined( SYS_DARWIN )
#define INIT_DVDIOCTL( SIZE ) \
dvdioctl_data_t dvdioctl; \
u8 p_buffer[ (SIZE) ]; \
......
......@@ -2,7 +2,7 @@
* vout_x11.c: X11 video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vout_x11.c,v 1.27 2001/06/19 05:51:57 sam Exp $
* $Id: vout_x11.c,v 1.28 2001/06/25 11:34:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -262,7 +262,7 @@ static int vout_Init( vout_thread_t *p_vout )
{
int i_err;
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
/* FIXME : As of 2001-03-16, XFree4 for MacOS X does not support Xshm. */
p_vout->p_sys->b_shm = 0;
#endif
......
......@@ -2,7 +2,7 @@
* vout_xvideo.c: Xvideo video output display method
*****************************************************************************
* Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
* $Id: vout_xvideo.c,v 1.19 2001/06/19 05:51:57 sam Exp $
* $Id: vout_xvideo.c,v 1.20 2001/06/25 11:34:08 sam Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -288,7 +288,7 @@ static int vout_Create( vout_thread_t *p_vout )
*****************************************************************************/
static int vout_Init( vout_thread_t *p_vout )
{
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
/* FIXME : As of 2001-03-16, XFree4 for MacOS X does not support Xshm. */
p_vout->p_sys->b_shm = 0;
#endif
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.104 2001/06/14 20:21:04 sam Exp $
* $Id: main.c,v 1.105 2001/06/25 11:34:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -41,7 +41,7 @@
# include "GNUgetopt/getopt.h"
#endif
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
# include <mach/mach.h> /* Altivec detection */
# include <mach/mach_error.h> /* some day the header files||compiler *
will define it for us */
......@@ -84,7 +84,7 @@
# include "beos_specific.h"
#endif
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
# include "darwin_specific.h"
#endif
......@@ -273,7 +273,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/*
* System specific initialization code
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
system_Init( &i_argc, ppsz_argv, ppsz_env );
#endif
......@@ -386,7 +386,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/*
* System specific cleaning code
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
system_End();
#endif
......@@ -529,7 +529,7 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
}
}
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
/* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
* is the PSN - process serial number (a unique PID-ish thingie)
* still ok for real Darwin & when run from command line */
......@@ -959,7 +959,7 @@ static int CPUCapabilities( void )
return( i_capabilities );
#elif defined( SYS_DARWIN1_3 )
#elif defined( SYS_DARWIN )
struct host_basic_info hi;
kern_return_t ret;
host_name_port_t host;
......
......@@ -2,7 +2,7 @@
* modules.c : Built-in and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.36 2001/06/14 02:47:45 sam Exp $
* $Id: modules.c,v 1.37 2001/06/25 11:34:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -55,7 +55,7 @@
# include "beos_specific.h"
#endif
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
# include "darwin_specific.h"
#endif
......@@ -125,7 +125,7 @@ void module_InitBank( void )
char ** ppsz_path = path;
char * psz_fullpath;
char * psz_file;
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
char * psz_vlcpath = system_GetProgramPath();
int i_vlclen = strlen( psz_vlcpath );
boolean_t b_notinroot;
......@@ -162,7 +162,7 @@ void module_InitBank( void )
/* Store strlen(*ppsz_path) for later use. */
int i_dirlen = strlen( *ppsz_path );
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
b_notinroot = 0;
/* Under BeOS, we need to add beos_GetProgramPath() to access
* files under the current directory */
......@@ -217,7 +217,7 @@ void module_InitBank( void )
closedir( dir );
}
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
if( b_notinroot )
{
free( psz_fullpath );
......
......@@ -2,7 +2,7 @@
* modules_core.h : Module management functions used by the core application.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules_core.h,v 1.2 2001/06/14 01:49:44 sam Exp $
* $Id: modules_core.h,v 1.3 2001/06/25 11:34:08 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -98,7 +98,7 @@ module_getsymbol( module_handle_t handle, char * psz_function )
return( NULL );
}
#elif defined(SYS_DARWIN1_3)
#elif defined( SYS_DARWIN )
/* MacOS X dl library expects symbols to begin with "_". That's
* really lame, but hey, what can we do ? */
char * psz_call = malloc( strlen( psz_function ) + 2 );
......
......@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_text.c,v 1.28 2001/05/31 03:12:49 sam Exp $
* $Id: video_text.c,v 1.29 2001/06/25 11:34:08 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -43,7 +43,7 @@
# include "beos_specific.h"
#endif
#ifdef SYS_DARWIN1_3
#ifdef SYS_DARWIN
# include "darwin_specific.h"
#endif
......@@ -227,7 +227,7 @@ vout_font_t *vout_LoadFont( const char *psz_name )
char ** ppsz_path = path;
char * psz_file;
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
char * psz_vlcpath = system_GetProgramPath();
int i_vlclen = strlen( psz_vlcpath );
#endif
......@@ -238,7 +238,7 @@ vout_font_t *vout_LoadFont( const char *psz_name )
for( ; *ppsz_path != NULL ; ppsz_path++ )
{
#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
/* Under BeOS, we need to add beos_GetProgramPath() to access
* files under the current directory */
if( strncmp( *ppsz_path, "/", 1 ) )
......
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