Hi/2.

I've attached patches for OS/2 support for libdvdread and libdvdnav.

And I modifed 'examples/menus.c' to allow to specify DVD device as a
argument.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 1.1.11
Under OS/2 Warp 4 for Korean with FixPak #15
On AMD ThunderBird 1 GHz with 512 MB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr


Index: src/dvd_reader.c
===================================================================
--- src/dvd_reader.c    (revision 1153)
+++ src/dvd_reader.c    (working copy)
@@ -508,11 +508,11 @@
       }
       fclose( mntfile );
     }
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) || defined(__OS2__)
     auth_drive = DVDOpenImageFile( path, have_css );
 #endif
 
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__OS2__)
     if( !dev_name ) {
       fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
     } else if( !auth_drive ) {
Index: src/bswap.h
===================================================================
--- src/bswap.h (revision 1153)
+++ src/bswap.h (working copy)
@@ -73,7 +73,7 @@
  * functionality!
  */
 
-#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || 
defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__)
+#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || 
defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__) || defined(__OS2__)
 #define B2N_16(x)                             \
  x = ((((x) & 0xff00) >> 8) |                 \
       (((x) & 0x00ff) << 8))
Index: src/dvd_input.c
===================================================================
--- src/dvd_input.c     (revision 1153)
+++ src/dvd_input.c     (working copy)
@@ -288,13 +288,15 @@
   #define CSS_LIB "libdvdcss.2.dylib"
 #elif defined(WIN32)
   #define CSS_LIB "libdvdcss.dll"
+#elif defined(__OS2__)
+  #define CSS_LIB "dvdcss.dll"
 #else
   #define CSS_LIB "libdvdcss.so.2"
 #endif
   dvdcss_library = dlopen(CSS_LIB, RTLD_LAZY);
 
   if(dvdcss_library != NULL) {
-#if defined(__OpenBSD__) && !defined(__ELF__)
+#if defined(__OpenBSD__) && !defined(__ELF__) || defined(__OS2__)
 #define U_S "_"
 #else
 #define U_S
Index: configure.ac
===================================================================
--- configure.ac        (revision 1153)
+++ configure.ac        (working copy)
@@ -145,6 +145,9 @@
   *cygwin*)
     LDFLAGS="-no-undefined $LDFLAGS"
     ;;
+  *os2*)
+    LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
+    ;;
   *)
     AC_CHECK_LIB(c, dlopen,
                  DYNAMIC_LD_LIBS="",
Index: src/vm/vm.c
===================================================================
--- src/vm/vm.c (revision 1153)
+++ src/vm/vm.c (working copy)
@@ -52,6 +52,11 @@
 #include <io.h>   /* read() */
 #endif /* _MSC_VER */
 
+#ifdef __OS2__
+#define INCL_DOS
+#include <os2.h>
+#endif
+
 /*
 #define STRICT
 */
@@ -131,6 +136,27 @@
 }
 #endif
 
+#ifdef __OS2__
+#define open os2_open
+
+static int os2_open(const char *name, int oflag)
+{
+    HFILE hfile;
+    ULONG ulAction;
+    ULONG rc;
+
+    rc = DosOpen( name, &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 )
+        return -1;
+
+    return ( int )hfile;
+}
+#endif
+
 static void dvd_read_name(char *name, const char *device) {
     /* Because we are compiling with _FILE_OFFSET_BITS=64
      * all off_t are 64bit.
Index: configure.ac
===================================================================
--- configure.ac        (revision 1153)
+++ configure.ac        (working copy)
@@ -165,6 +165,9 @@
   *cygwin*)
     LDFLAGS="-no-undefined $LDFLAGS"
     ;;
+  *os2*)
+    LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
+    ;;
   *)
     AC_CHECK_LIB(c, dlopen,
                 DYNAMIC_LD_LIBS="",
Index: examples/menus.c
===================================================================
--- examples/menus.c    (revision 1153)
+++ examples/menus.c    (working copy)
@@ -48,9 +48,15 @@
   int output_fd = 0;
   int dump = 0, tt_dump = 0;
 
+  if( argc < 2 )
+  {
+    printf("Specify DVD device\n");
+    return 1;
+  }
+
   /* open dvdnav handle */
   printf("Opening DVD...\n");
-  if (dvdnav_open(&dvdnav, "/dev/dvd") != DVDNAV_STATUS_OK) {
+  if (dvdnav_open(&dvdnav, argv[1]) != DVDNAV_STATUS_OK) {
     printf("Error on dvdnav_open\n");
     return 1;
   }
_______________________________________________
DVDnav-discuss mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss

Reply via email to