Commit f20e5c35 authored by Gildas Bazin's avatar Gildas Bazin

- Fixed 2 Win32 bugs in libdvdcss (in _win32_dvdcss_readv), one of them
    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.
parent 20e17cf9
......@@ -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: Stphane 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;
......
......@@ -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 */
......@@ -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.. */
......
......@@ -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
......
......@@ -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
{
......
......@@ -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 Dors <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 )
{
......
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