Index: dvdread/dvd_reader.c =================================================================== --- dvdread/dvd_reader.c (revision 23794) +++ dvdread/dvd_reader.c (working copy) @@ -460,7 +460,7 @@ } fclose( mntfile ); } -#elif defined(__MINGW32__) +#elif defined(__MINGW32__) || defined( __OS2__ ) dev_name = strdup(path); auth_drive = DVDOpenImageFile( path, have_css ); #endif Index: libdvdcss/device.c =================================================================== --- libdvdcss/device.c (revision 23794) +++ libdvdcss/device.c (working copy) @@ -65,6 +65,11 @@ # include #endif +#ifdef __OS2__ +#define INCL_DOS +#include +#endif + #include "dvdcss/dvdcss.h" #include "common.h" @@ -93,6 +98,14 @@ static int aspi_read_internal ( int, void *, int ); #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t, char const * ); +/* just use macros for libc */ +#define os2_seek libc_seek +#define os2_read libc_read +#define os2_readv libc_readv +#endif + int _dvdcss_use_ioctls( dvdcss_t dvdcss ) { #if defined( WIN32 ) @@ -110,6 +123,10 @@ { return 1; } +#elif defined( __OS2__ ) + /* We should consider a case of file ? */ + + return 1; #else struct stat fileinfo; int ret; @@ -322,6 +339,16 @@ return aspi_open( dvdcss, psz_device ); } else +#elif defined( __OS2__ ) + if( psz_device[ 0 ] && ( psz_device[ 1 ] == ':' ) && !psz_device[ 2 ]) + { + print_debug( dvdcss, "using OS2 API for access" ); + dvdcss->pf_seek = os2_seek; + dvdcss->pf_read = os2_read; + dvdcss->pf_readv = os2_readv; + return os2_open( dvdcss, psz_device ); + } + else #endif { print_debug( dvdcss, "using libc for access" ); @@ -332,7 +359,7 @@ } } -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device ) { dvdcss->i_raw_fd = open( psz_device, 0 ); @@ -385,11 +412,13 @@ #else close( dvdcss->i_fd ); + #ifndef __OS2__ if( dvdcss->i_raw_fd >= 0 ) { close( dvdcss->i_raw_fd ); dvdcss->i_raw_fd = -1; } + #endif return 0; #endif @@ -402,7 +431,7 @@ *****************************************************************************/ static int libc_open ( dvdcss_t dvdcss, char const *psz_device ) { -#if !defined( WIN32 ) +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 ); #else dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY ); @@ -578,6 +607,32 @@ } #endif +#ifdef __OS2__ +static int os2_open ( dvdcss_t dvdcss, char const *psz_device ) +{ + HFILE hfile; + ULONG ulAction; + ULONG rc; + + rc = DosOpen( psz_device, &hfile, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD, + NULL ); + + if( rc ) + { + print_error( dvdcss, "failed to open device" ); + return -1; + } + + dvdcss->i_fd = dvdcss->i_read_fd = hfile; + + dvdcss->i_pos = 0; + + return 0; +} +#endif + /***************************************************************************** * Seek commands. *****************************************************************************/ Index: libdvdcss/libdvdcss.c =================================================================== --- libdvdcss/libdvdcss.c (revision 23794) +++ libdvdcss/libdvdcss.c (working copy) @@ -167,7 +167,7 @@ char *psz_method = getenv( "DVDCSS_METHOD" ); char *psz_verbose = getenv( "DVDCSS_VERBOSE" ); char *psz_cache = getenv( "DVDCSS_CACHE" ); -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" ); #endif @@ -185,7 +185,7 @@ /* * Initialize structure with default values */ -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) dvdcss->i_raw_fd = -1; #endif dvdcss->p_titles = NULL; @@ -536,7 +536,7 @@ } nocache: -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) if( psz_raw_device != NULL ) { _dvdcss_raw_open( dvdcss, psz_raw_device ); Index: libdvdcss/libdvdcss.h =================================================================== --- libdvdcss/libdvdcss.h (revision 23794) +++ libdvdcss/libdvdcss.h (working copy) @@ -62,7 +62,7 @@ int i_readv_buf_size; #endif -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) int i_raw_fd; #endif };