Commit 85c3dbc4 authored by Gildas Bazin's avatar Gildas Bazin

* Big rewrite of the DirectX audio plugin. The audio output is now (almost)
    perfect on Win32.
* Fixed a bug in ac3dec_CreateThread() in ac3_decoder_thread.
* On Win32, open() will now open files in binary mode by default.
* A few minor changes to vout_xvideo.c
parent f65e5509
This diff is collapsed.
......@@ -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.9 2001/07/30 00:53:04 sam Exp $
* $Id: vout_directx.c,v 1.10 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -202,7 +202,7 @@ static int vout_Create( vout_thread_t *p_vout )
* DirectXEventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
intf_WarnMsg( 3, "vout : vout_Create creating DirectXEventThread" );
intf_WarnMsg( 3, "vout: vout_Create creating DirectXEventThread" );
if( vlc_thread_create( &p_vout->p_sys->event_thread_id,
"DirectX Events Thread",
(void *) DirectXEventThread, (void *) p_vout) )
......@@ -475,6 +475,7 @@ static void vout_Display( vout_thread_t *p_vout )
{
DDSURFACEDESC ddsd;
HRESULT dxresult;
int i;
int i_image_width;
int i_image_height;
......@@ -503,8 +504,9 @@ static void vout_Display( vout_thread_t *p_vout )
if( p_vout->b_need_render )
{
RECT rect_window;
POINT point_window;
RECT rect_window;
POINT point_window;
DDBLTFX ddbltfx;
/* Nothing yet */
if( p_vout->p_sys->p_surface == NULL )
......@@ -539,17 +541,24 @@ static void vout_Display( vout_thread_t *p_vout )
rect_window.bottom = point_window.y;
/* We want to keep the aspect ratio of the video */
if( !p_vout->b_scale ) /* kuldge */
#if 0
if( p_vout->b_scale )
{
DirectXKeepAspectRatio( p_vout, &rect_window );
}
#endif
/* We ask for the "NOTEARING" option */
memset( &ddbltfx, 0, sizeof(DDBLTFX) );
ddbltfx.dwSize = sizeof(DDBLTFX);
ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
/* Blit video surface to display */
dxresult = IDirectDrawSurface3_Blt(p_vout->p_sys->p_display,
&rect_window,
p_vout->p_sys->p_surface,
NULL,
0, NULL );
0, &ddbltfx );
if( dxresult != DD_OK )
{
intf_WarnMsg( 3, "vout: could not Blit the surface" );
......
......@@ -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.24 2001/08/03 16:04:17 gbazin Exp $
* $Id: vout_xvideo.c,v 1.25 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -287,35 +287,16 @@ static int vout_Create( vout_thread_t *p_vout )
return( 1 );
}
/* Spawn base window - this window will include the video output window,
* but also command buttons, subtitles and other indicators */
if( XVideoCreateWindow( p_vout ) )
{
intf_ErrMsg( "vout error: cannot create XVideo window" );
XCloseDisplay( p_vout->p_sys->p_display );
free( p_vout->p_sys );
return( 1 );
}
if( (p_vout->p_sys->xv_port = XVideoGetPort( p_vout->p_sys->p_display ))<0 )
/* Check we have access to a video port */
if( (p_vout->p_sys->xv_port = XVideoGetPort(p_vout->p_sys->p_display)) <0 )
{
intf_ErrMsg( "vout error: cannot get XVideo port" );
XVideoDestroyWindow( p_vout );
XCloseDisplay( p_vout->p_sys->p_display );
free( p_vout->p_sys );
return 1;
}
intf_DbgMsg( "Using xv port %d" , p_vout->p_sys->xv_port );
/* p_vout->pf_setbuffers( p_vout, NULL, NULL ); */
#if 0
/* XXX The brightness and contrast values should be read from environment
* XXX variables... */
XVideoSetAttribute( p_vout, "XV_BRIGHTNESS", 0.5 );
XVideoSetAttribute( p_vout, "XV_CONTRAST", 0.5 );
#endif
/* Create blank cursor (for mouse cursor autohiding) */
p_vout->p_sys->b_mouse_pointer_visible = 1;
p_vout->p_sys->cursor_pixmap = XCreatePixmap( p_vout->p_sys->p_display,
......@@ -340,6 +321,24 @@ static int vout_Create( vout_thread_t *p_vout )
&cursor_color,
&cursor_color, 1, 1 );
/* Spawn base window - this window will include the video output window,
* but also command buttons, subtitles and other indicators */
if( XVideoCreateWindow( p_vout ) )
{
intf_ErrMsg( "vout error: cannot create XVideo window" );
XCloseDisplay( p_vout->p_sys->p_display );
free( p_vout->p_sys );
return( 1 );
}
/* p_vout->pf_setbuffers( p_vout, NULL, NULL ); */
#if 0
/* XXX The brightness and contrast values should be read from environment
* XXX variables... */
XVideoSetAttribute( p_vout, "XV_BRIGHTNESS", 0.5 );
XVideoSetAttribute( p_vout, "XV_CONTRAST", 0.5 );
#endif
/* Disable screen saver and return */
XVideoDisableScreenSaver( p_vout );
......@@ -550,7 +549,7 @@ static int vout_Manage( vout_thread_t *p_vout )
else if( xevent.type == MotionNotify )
{
p_vout->p_sys->i_time_mouse_last_moved = mdate();
if( !p_vout->p_sys->b_mouse_pointer_visible )
if( !p_vout->p_sys->b_mouse_pointer_visible )
X11ToggleMousePointer( p_vout );
}
/* Other event */
......@@ -938,6 +937,13 @@ static int XVideoCreateWindow( vout_thread_t *p_vout )
XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->yuv_window,
ExposureMask );
/* If the cursor was formerly blank than blank it again */
if( !p_vout->p_sys->b_mouse_pointer_visible )
{
X11ToggleMousePointer( p_vout );
X11ToggleMousePointer( p_vout );
}
return( 0 );
}
......@@ -1089,13 +1095,13 @@ void X11ToggleMousePointer( vout_thread_t *p_vout )
{
XDefineCursor( p_vout->p_sys->p_display,
p_vout->p_sys->window,
p_vout->p_sys->blank_cursor );
p_vout->p_sys->b_mouse_pointer_visible = 0;
p_vout->p_sys->blank_cursor );
p_vout->p_sys->b_mouse_pointer_visible = 0;
}
else
{
XUndefineCursor( p_vout->p_sys->p_display, p_vout->p_sys->window );
p_vout->p_sys->b_mouse_pointer_visible = 1;
p_vout->p_sys->b_mouse_pointer_visible = 1;
}
}
......
......@@ -2,7 +2,7 @@
* ac3_decoder_thread.c: ac3 decoder thread
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.c,v 1.35 2001/07/08 23:15:11 reno Exp $
* $Id: ac3_decoder_thread.c,v 1.36 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -78,15 +78,17 @@ static void BitstreamCallback ( bit_stream_t *p_bit_stream,
vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
{
ac3dec_thread_t * p_ac3thread;
ac3dec_thread_t * p_ac3thread_temp;
intf_DbgMsg( "ac3dec debug: creating ac3 decoder thread" );
/* Allocate the memory needed to store the thread's structure */
p_ac3thread = (ac3dec_thread_t *)malloc(sizeof(ac3dec_thread_t));
p_ac3thread_temp = (ac3dec_thread_t *)malloc(sizeof(ac3dec_thread_t) + 15);
/* We need to be 16 bytes aligned */
p_ac3thread->ac3thread = (int)p_ac3thread & (-15);
p_ac3thread = (ac3dec_thread_t *)p_ac3thread->ac3thread;
p_ac3thread = (ac3dec_thread_t *)(((unsigned long)p_ac3thread_temp + 15)
& ~0xFUL );
p_ac3thread->ac3thread = p_ac3thread_temp;
if(p_ac3thread == NULL)
{
......@@ -110,7 +112,7 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
if( DOWNMIX.p_module == NULL )
{
intf_ErrMsg( "ac3dec error: no suitable downmix module" );
free( p_ac3thread );
free( p_ac3thread->ac3thread );
return( 0 );
}
......@@ -135,7 +137,7 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
{
intf_ErrMsg( "ac3dec error: no suitable IMDCT module" );
module_Unneed( p_ac3thread->ac3_decoder.downmix.p_module );
free( p_ac3thread );
free( p_ac3thread->ac3thread );
return( 0 );
}
......@@ -163,7 +165,7 @@ vlc_thread_t ac3dec_CreateThread( adec_config_t * p_config )
intf_ErrMsg( "ac3dec error: can't spawn ac3 decoder thread" );
module_Unneed( p_ac3thread->ac3_decoder.downmix.p_module );
module_Unneed( p_ac3thread->ac3_decoder.imdct.p_module );
free (p_ac3thread);
free (p_ac3thread->ac3thread);
return 0;
}
......@@ -341,8 +343,7 @@ static void EndThread (ac3dec_thread_t * p_ac3thread)
/* Destroy descriptor */
free( p_ac3thread->p_config );
p_ac3thread = (ac3dec_thread_t *)p_ac3thread->ac3thread;
free( p_ac3thread );
free( p_ac3thread->ac3thread );
intf_DbgMsg ("ac3dec debug: ac3 decoder thread %p destroyed", p_ac3thread);
}
......
......@@ -2,7 +2,7 @@
* ac3_decoder_thread.h : ac3 decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.h,v 1.8 2001/07/08 23:15:11 reno Exp $
* $Id: ac3_decoder_thread.h,v 1.9 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
*
......@@ -50,7 +50,8 @@ typedef struct ac3dec_thread_s
* Output properties
*/
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
int ac3thread; /* save the old pointer */
struct ac3dec_thread_s * ac3thread; /* save the old pointer */
} ac3dec_thread_t;
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.127 2001/07/18 14:21:00 massiot Exp $
* $Id: input.c,v 1.128 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -605,12 +605,8 @@ static void FileOpen( input_thread_t * p_input )
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_WarnMsg( 1, "input: opening file `%s'", p_input->p_source );
#if defined( WIN32 )
if( (p_input->i_handle = open( psz_name, O_BINARY ) ) == (-1) )
#else
if( (p_input->i_handle = open( psz_name,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
#endif
{
intf_ErrMsg( "input error: cannot open file (%s)", strerror(errno) );
p_input->b_error = 1;
......
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.109 2001/07/30 00:53:05 sam Exp $
* $Id: main.c,v 1.110 2001/08/05 15:32:46 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -287,6 +287,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
*/
#if defined( SYS_BEOS ) || defined( SYS_DARWIN )
system_Init( &i_argc, ppsz_argv, ppsz_env );
#elif defined( WIN32 )
_fmode = _O_BINARY; /* sets the default file-translation mode on Win32 */
#endif
/*
......
......@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: video_text.c,v 1.29 2001/06/25 11:34:08 sam Exp $
* $Id: video_text.c,v 1.30 2001/08/05 15:32:47 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -263,11 +263,7 @@ vout_font_t *vout_LoadFont( const char *psz_name )
}
/* Open file */
#ifndef WIN32
i_file = open( psz_file, O_RDONLY );
#else
i_file = open( psz_file, O_RDONLY | O_BINARY );
#endif
free( psz_file );
if( i_file != -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