]> git.sesse.net Git - vlc/commitdiff
- Fixed 2 Win32 bugs in libdvdcss (in _win32_dvdcss_readv), one of them
authorGildas Bazin <gbazin@videolan.org>
Thu, 12 Jul 2001 23:06:54 +0000 (23:06 +0000)
committerGildas Bazin <gbazin@videolan.org>
Thu, 12 Jul 2001 23:06:54 +0000 (23:06 +0000)
    should have prevented the Win9x dvd input from working.
- Moved the "if(Win2k)" out of the loop in _win32_dvdcss_readv.

- Put a readv() function in input_iovec.h, the input_es now compiles.
- Modified input_ts to use this function.

- Fixed an initialisation bug in vout_directx.c
- Right clicking on the mouse now displays the navigation menu.

PS: If someone is willing to test the DVD input on Win95/98/Me I will
    upload an up to date binary package.

extras/libdvdcss/libdvdcss.c
include/input_iovec.h
plugins/directx/vout_directx.c
plugins/directx/vout_events.c
plugins/mpeg/input_ts.c
plugins/mpeg/input_ts.h

index 7284a98725647df1ade33654b0e1f140ba4c1d7a..00d295e0216e331da3612604def8caee8c39d462 100644 (file)
@@ -2,7 +2,7 @@
  * libdvdcss.c: DVD reading library.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libdvdcss.c,v 1.5 2001/07/11 02:01:03 sam Exp $
+ * $Id: libdvdcss.c,v 1.6 2001/07/12 23:06:54 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -516,19 +516,18 @@ static int _win32_dvdcss_readv( int i_fd, struct iovec *p_iovec,
                                 int i_num_buffers )
 {
     int i_index, i_len, i_total = 0;
-    char *p_base;
+    unsigned char *p_base;
     int i_blocks;
 
-    for( i_index = i_num_buffers; i_index; i_index-- )
+    if( WIN2K )
     {
+        for( i_index = i_num_buffers; i_index; i_index-- )
+       {
+           i_len  = p_iovec->iov_len;
+           p_base = p_iovec->iov_base;
 
-        i_len  = p_iovec->iov_len;
-        p_base = p_iovec->iov_base;
-
-        if( i_len > 0 )
-        {
-            if( WIN2K )
-            {
+           if( i_len > 0 )
+           {
                 unsigned long int i_bytes;
                 if( !ReadFile( (HANDLE) i_fd, p_base, i_len, &i_bytes, NULL ) )
                 {
@@ -539,26 +538,47 @@ static int _win32_dvdcss_readv( int i_fd, struct iovec *p_iovec,
                        unspecified after a failure */
                 }
                 i_blocks = i_bytes / DVDCSS_BLOCK_SIZE;
-            }
-            else  /* Win9x */
-            {
+
+               i_total += i_blocks;
+
+               if( i_blocks != (i_len / DVDCSS_BLOCK_SIZE) )
+               {
+                   /* we reached the end of the file */
+                   return i_total;
+               }
+
+           }
+
+           p_iovec++;
+       }
+    }
+    else /* Win9x */
+    {
+        for( i_index = i_num_buffers; i_index; i_index-- )
+       {
+           i_len  = p_iovec->iov_len / DVDCSS_BLOCK_SIZE;
+           p_base = p_iovec->iov_base;
+
+           if( i_len > 0 )
+           {
                 i_blocks = _win32_dvdcss_aread( i_fd, p_base, i_len );
                 if( i_blocks < 0 )
                 {
                     return -1;  /* idem */
                 }
-            }
 
-            if( i_blocks != (i_len / DVDCSS_BLOCK_SIZE) )
-            {
-                /* we reached the end of the file */
-                return i_total;
-            }
+               i_total += i_blocks;
 
-            i_total += i_blocks;
-        }
+               if( i_blocks != i_len )
+               {
+                   /* we reached the end of the file or a signal interrupted
+                       the read */
+                   return i_total;
+               }
+           }
 
-        p_iovec++;
+           p_iovec++;
+       }
     }
 
     return i_total;
index 7d7a5866ce16496837431da5026819913140b26b..af24a980518d27563a12b964952a21849644c176 100644 (file)
@@ -30,3 +30,50 @@ struct iovec
     size_t iov_len;     /* Length of data.  */
 };
 
+/*****************************************************************************
+ * readv_*: readv() replacements for iovec-impaired C libraries
+ *****************************************************************************/
+#if defined( WIN32 )
+static __inline__ int readv( int i_fd, struct iovec *p_iovec, int i_count )
+{
+    int i_index, i_len, i_total = 0;
+    unsigned char *p_base;
+    int i_bytes;
+
+    for( i_index = i_count; i_index; i_index-- )
+    {
+
+        i_len  = p_iovec->iov_len;
+        p_base = p_iovec->iov_base;
+
+        /* Loop is unrolled one time to spare the (i_bytes <= 0) test */
+
+        if( i_len > 0 )
+        {
+            i_bytes = read( i_fd, p_base, i_len );
+
+            if( i_bytes < 0 )
+            {
+                /* One of the reads failed, too bad.
+                   We won't even bother returning the reads that went ok,
+                   and as in the posix spec the file postition is left
+                   unspecified after a failure */
+                return -1;
+            }
+
+           i_total += i_bytes;
+
+            if( i_bytes != i_len )
+           {
+                /* we reached the end of the file or a signal interrupted
+                  the read */
+                return i_total;
+           }
+        }
+
+        p_iovec++;
+    }
+
+    return i_total;
+}
+#endif /* WIN32 */
index 7cce1a293ca8159938ce7b81807f2002478f8b15..c26d62e89e842d7c2b8b55bd23a816c7615a0d40 100644 (file)
@@ -2,7 +2,7 @@
  * vout_directx.c: Windows DirectX video output display method
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_directx.c,v 1.7 2001/07/11 14:26:19 gbazin Exp $
+ * $Id: vout_directx.c,v 1.8 2001/07/12 23:06:54 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -159,6 +159,7 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys->hbrush = NULL;
     p_vout->p_sys->hwnd = NULL;
     p_vout->p_sys->i_changes = 0;
+    p_vout->p_sys->b_event_thread_die = 0;
     p_vout->p_sys->b_display_enabled = 0;
 
     p_vout->p_sys->b_cursor = 1; /* TODO should be done with a main_GetInt.. */
index bf5f087f568bace16eb72e596b703edc459a475c..b711141eeeb69ebf21f0741b91c61641d6796141 100644 (file)
@@ -2,7 +2,7 @@
  * vout_events.c: Windows DirectX video output events handler
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vout_events.c,v 1.1 2001/07/11 14:26:19 gbazin Exp $
+ * $Id: vout_events.c,v 1.2 2001/07/12 23:06:54 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -177,6 +177,12 @@ void DirectXEventThread( vout_thread_t *p_vout )
                 }               
                 break;
                 
+            case WM_RBUTTONUP:
+                intf_WarnMsg( 4, "vout: vout_Manage WM_RBUTTONUP" );
+                /* FIXME: need locking ! */
+                p_main->p_intf->b_menu_change = 1;
+                break;
+
             case WM_KEYDOWN:
                 /* the key events are first processed here. The next
                  * message processed by this main message loop will be the
index 050ae87d0e068d28faa8bff4a088334e0e4a85ad..10581fae7d3a9db52820a49613b4bbdd899a3723 100644 (file)
@@ -2,7 +2,7 @@
  * input_ts.c: TS demux and netlist management
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_ts.c,v 1.28 2001/06/27 09:53:57 massiot Exp $
+ * $Id: input_ts.c,v 1.29 2001/07/12 23:06:54 gbazin Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
@@ -322,7 +322,7 @@ static int TSRead( input_thread_t * p_input,
 #if defined( WIN32 )
         if( p_input->stream.b_pace_control )
         {
-            i_read = readv_file( p_input->i_handle, p_iovec, INPUT_READ_ONCE );
+            i_read = readv( p_input->i_handle, p_iovec, INPUT_READ_ONCE );
         }
         else
         {
index 20f4183d790873e2cce069b3e697de4245bcc2dc..0bd8def0beb13c697dd0838540c839046303e704 100644 (file)
@@ -2,7 +2,7 @@
  * input_ts.h: structures of the input not exported to other modules
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ts.h,v 1.9 2001/06/21 07:22:03 sam Exp $
+ * $Id: input_ts.h,v 1.10 2001/07/12 23:06:54 gbazin Exp $
  *
  * Authors: Henri Fallon <henri@via.ecp.fr>
  *          Boris Dorès <babal@via.ecp.fr>
@@ -44,59 +44,9 @@ typedef struct thread_ts_data_s
 } thread_ts_data_t;
 
 /*****************************************************************************
- * readv_*: readv() replacements for iovec-impaired C libraries
+ * network readv() replacement for iovec-impaired C libraries
  *****************************************************************************/
-
-#if defined( WIN32 )
-static __inline__ int readv_file( int i_fd, struct iovec *p_iovec, int i_count )
-{
-    int i_index, i_len, i_total = 0;
-    u8 *p_base;
-
-    for( i_index = i_count; i_index; i_index-- )
-    {
-        register signed int i_bytes;
-
-        i_len  = p_iovec->iov_len;
-        p_base = p_iovec->iov_base;
-
-        /* Loop is unrolled one time to spare the (i_bytes <= 0) test */
-
-        if( i_len > 0 )
-        {
-            i_bytes = read( i_fd, p_base, i_len );
-
-            if( ( i_total == 0 ) && ( i_bytes < 0 ) )
-            {
-                return -1;
-            }
-
-            if( i_bytes <= 0 )
-            {
-                return i_total;
-            }
-
-            i_len -= i_bytes; i_total += i_bytes; p_base += i_bytes;
-
-            while( i_len > 0 )
-            {
-                i_bytes = read( i_fd, p_base, i_len );
-
-                if( i_bytes <= 0 )
-                {
-                    return i_total;
-                }
-
-                i_len -= i_bytes; i_total += i_bytes; p_base += i_bytes;
-            }
-        }
-
-        p_iovec++;
-    }
-
-    return i_total;
-}
-
+#if defined(WIN32)
 static __inline__ int read_network( int i_fd, char * p_base,
                                     thread_ts_data_t *p_sys, int i_len )
 {