Commit cc5919ad authored by Gildas Bazin's avatar Gildas Bazin

* src/misc/modules.c: fixed a memory leak with the "plugin-path" config option.
* modules/audio_output/directx.c, modules/audio_output/waveout.c: ported the directx
   and waveout audio plugins to the new changes in the audio output layer.
* configure.ac.in: fixes for cygwin compilation, and the gtk plugin under mingw32.
parent c5bd872c
...@@ -1726,8 +1726,13 @@ then ...@@ -1726,8 +1726,13 @@ then
then then
AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.]) AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.])
fi fi
if test "x${SYS}" != "xmingw32"; then
CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`" CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk gthread`"
LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`" LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
else
CFLAGS_gtk="${CFLAGS_gtk} `${GTK_CONFIG} --cflags gtk`"
LDFLAGS_gtk="${LDFLAGS_gtk} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
fi
# now look for the gtk.h header # now look for the gtk.h header
CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}" CPPFLAGS="${CPPFLAGS_save} ${CFLAGS_gtk}"
ac_cv_gtk_headers=yes ac_cv_gtk_headers=yes
...@@ -2070,8 +2075,10 @@ AC_ARG_ENABLE(st, ...@@ -2070,8 +2075,10 @@ AC_ARG_ENABLE(st,
fi]) fi])
]) ])
LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}" if test "x${SYS}" != "xmingw32"; then
LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}" LDFLAGS_vlc="${LDFLAGS_vlc} ${THREAD_LIB}"
LDFLAGS_plugins="${LDFLAGS_plugins} ${THREAD_LIB}"
fi
dnl dnl
dnl Mozilla plugin dnl Mozilla plugin
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout.c: Windows DirectX audio output method * aout.c: Windows DirectX audio output method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.2 2002/10/06 19:28:28 gbazin Exp $ * $Id: directx.c,v 1.3 2002/10/11 10:08:06 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -179,13 +179,6 @@ static int OpenAudio( vlc_object_t *p_this ) ...@@ -179,13 +179,6 @@ static int OpenAudio( vlc_object_t *p_this )
vlc_mutex_lock( &p_aout->output.p_sys->buffer_lock ); vlc_mutex_lock( &p_aout->output.p_sys->buffer_lock );
/* first release the current secondary buffer */
DirectxDestroySecondaryBuffer( p_aout );
/* calculate the frame size in bytes */
p_aout->output.p_sys->p_notif->i_buffer_size = FRAME_SIZE * sizeof(s16)
* p_aout->output.output.i_channels;
/* then create a new secondary buffer */ /* then create a new secondary buffer */
if( DirectxCreateSecondaryBuffer( p_aout ) ) if( DirectxCreateSecondaryBuffer( p_aout ) )
{ {
...@@ -363,6 +356,9 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout ) ...@@ -363,6 +356,9 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout )
DSBUFFERDESC dsbdesc; DSBUFFERDESC dsbdesc;
DSBCAPS dsbcaps; DSBCAPS dsbcaps;
if( p_aout->output.output.i_channels > 2 )
p_aout->output.output.i_channels = 2;
/* First set the buffer format */ /* First set the buffer format */
memset(&waveformat, 0, sizeof(WAVEFORMATEX)); memset(&waveformat, 0, sizeof(WAVEFORMATEX));
waveformat.wFormatTag = WAVE_FORMAT_PCM; waveformat.wFormatTag = WAVE_FORMAT_PCM;
...@@ -393,12 +389,15 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout ) ...@@ -393,12 +389,15 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout )
goto error; goto error;
} }
/* backup the size of the secondary sound buffer */ /* backup the size of a frame */
p_aout->output.p_sys->p_notif->i_buffer_size = FRAME_SIZE * sizeof(s16)
* p_aout->output.output.i_channels;
memset(&dsbcaps, 0, sizeof(DSBCAPS)); memset(&dsbcaps, 0, sizeof(DSBCAPS));
dsbcaps.dwSize = sizeof(DSBCAPS); dsbcaps.dwSize = sizeof(DSBCAPS);
IDirectSoundBuffer_GetCaps( p_aout->output.p_sys->p_dsbuffer, &dsbcaps ); IDirectSoundBuffer_GetCaps( p_aout->output.p_sys->p_dsbuffer, &dsbcaps );
msg_Dbg( p_aout, "requested %li bytes buffer and got %li bytes.",
msg_Dbg( p_aout, "DirectxCreateSecondaryBuffer: %li", 2 * p_aout->output.p_sys->p_notif->i_buffer_size,
dsbcaps.dwBufferBytes ); dsbcaps.dwBufferBytes );
/* Now the secondary buffer is created, we need to setup its position /* Now the secondary buffer is created, we need to setup its position
...@@ -413,7 +412,7 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout ) ...@@ -413,7 +412,7 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout )
&IID_IDirectSoundNotify, &IID_IDirectSoundNotify,
(LPVOID *)&p_aout->output.p_sys->p_dsnotify ) ) (LPVOID *)&p_aout->output.p_sys->p_dsnotify ) )
{ {
msg_Warn( p_aout, "cannot get Notify interface" ); msg_Err( p_aout, "cannot get Notify interface" );
goto error; goto error;
} }
...@@ -421,10 +420,9 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout ) ...@@ -421,10 +420,9 @@ static int DirectxCreateSecondaryBuffer( aout_instance_t *p_aout )
p_aout->output.p_sys->p_dsnotify, 2, p_aout->output.p_sys->p_dsnotify, 2,
p_aout->output.p_sys->p_notif->p_events ) ) p_aout->output.p_sys->p_notif->p_events ) )
{ {
msg_Warn( p_aout, "cannot set position Notification" ); msg_Err( p_aout, "cannot set position Notification" );
goto error; goto error;
} }
p_aout->output.output.i_format = AOUT_FMT_S16_NE; p_aout->output.output.i_format = AOUT_FMT_S16_NE;
p_aout->output.i_nb_samples = FRAME_SIZE; p_aout->output.i_nb_samples = FRAME_SIZE;
...@@ -486,13 +484,6 @@ static void DirectSoundThread( notification_thread_t *p_notif ) ...@@ -486,13 +484,6 @@ static void DirectSoundThread( notification_thread_t *p_notif )
/* Tell the main thread that we are ready */ /* Tell the main thread that we are ready */
vlc_thread_ready( p_notif ); vlc_thread_ready( p_notif );
/* this thread must be high-priority */
if( !SetThreadPriority( GetCurrentThread(),
THREAD_PRIORITY_ABOVE_NORMAL ) )
{
msg_Warn( p_notif, "DirectSoundThread could not raise its priority" );
}
msg_Dbg( p_notif, "DirectSoundThread ready" ); msg_Dbg( p_notif, "DirectSoundThread ready" );
while( !p_notif->b_die ) while( !p_notif->b_die )
...@@ -546,8 +537,10 @@ static void DirectSoundThread( notification_thread_t *p_notif ) ...@@ -546,8 +537,10 @@ static void DirectSoundThread( notification_thread_t *p_notif )
continue; continue;
} }
/* FIXME : take into account DirectSound latency instead of mdate() */ /* We also take into account the latency instead of just mdate() */
p_buffer = aout_OutputNextBuffer( p_aout, mdate(), VLC_FALSE ); p_buffer = aout_OutputNextBuffer( p_aout,
mdate() + 1000000 / p_aout->output.output.i_rate * FRAME_SIZE,
VLC_FALSE );
/* Now do the actual memcpy into the circular buffer */ /* Now do the actual memcpy into the circular buffer */
if ( l_bytes1 != p_notif->i_buffer_size ) if ( l_bytes1 != p_notif->i_buffer_size )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* waveout.c : Windows waveOut plugin for vlc * waveout.c : Windows waveOut plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: waveout.c,v 1.7 2002/09/18 21:21:23 massiot Exp $ * $Id: waveout.c,v 1.8 2002/10/11 10:08:06 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <vlc/aout.h> #include <vlc/aout.h>
#include "aout_internal.h" #include "aout_internal.h"
#include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
#define FRAME_SIZE 2048 /* The size is in samples, not in bytes */ #define FRAME_SIZE 2048 /* The size is in samples, not in bytes */
...@@ -90,6 +91,7 @@ struct aout_sys_t ...@@ -90,6 +91,7 @@ struct aout_sys_t
static int Open( vlc_object_t *p_this ) static int Open( vlc_object_t *p_this )
{ {
aout_instance_t *p_aout = (aout_instance_t *)p_this; aout_instance_t *p_aout = (aout_instance_t *)p_this;
aout_buffer_t *p_buffer;
/* Allocate structure */ /* Allocate structure */
p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = malloc( sizeof( aout_sys_t ) );
...@@ -103,6 +105,37 @@ static int Open( vlc_object_t *p_this ) ...@@ -103,6 +105,37 @@ static int Open( vlc_object_t *p_this )
p_aout->output.pf_play = Play; p_aout->output.pf_play = Play;
aout_VolumeSoftInit( p_aout ); aout_VolumeSoftInit( p_aout );
/* FIXME */
if ( p_aout->output.output.i_channels > 2 )
{
msg_Warn( p_aout, "only two channels are supported at the moment" );
/* Trigger downmixing */
p_aout->output.output.i_channels = 2;
}
/* We need to open the device with default values to be sure it is
* available */
if ( OpenWaveOut( p_aout, WAVE_FORMAT_PCM,
p_aout->output.output.i_channels,
p_aout->output.output.i_rate ) )
{
msg_Err( p_aout, "cannot open waveout audio device with output "
"rate (%i)",
p_aout->output.output.i_rate );
return 1;
if ( OpenWaveOut( p_aout, WAVE_FORMAT_PCM,
p_aout->output.output.i_channels,
44100 ) )
{
msg_Err( p_aout, "cannot open waveout audio device with output "
"rate (44100)" );
return 1;
}
}
waveOutReset( p_aout->output.p_sys->h_waveout );
/* calculate the frame size in bytes */ /* calculate the frame size in bytes */
p_aout->output.p_sys->i_buffer_size = FRAME_SIZE * sizeof(s16) p_aout->output.p_sys->i_buffer_size = FRAME_SIZE * sizeof(s16)
* p_aout->output.p_sys->waveformat.nChannels; * p_aout->output.p_sys->waveformat.nChannels;
...@@ -115,16 +148,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -115,16 +148,6 @@ static int Open( vlc_object_t *p_this )
return 1; return 1;
} }
/* We need to open the device with default values to be sure it is
* available */
if ( OpenWaveOut( p_aout, WAVE_FORMAT_PCM, 2, 44100 ) )
{
msg_Err( p_aout, "cannot open waveout" );
return 1;
}
waveOutReset( p_aout->output.p_sys->h_waveout );
p_aout->output.output.i_format = AOUT_FMT_S16_NE; p_aout->output.output.i_format = AOUT_FMT_S16_NE;
p_aout->output.i_nb_samples = FRAME_SIZE; p_aout->output.i_nb_samples = FRAME_SIZE;
...@@ -132,8 +155,12 @@ static int Open( vlc_object_t *p_this ) ...@@ -132,8 +155,12 @@ static int Open( vlc_object_t *p_this )
* working */ * working */
PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout, PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout,
&p_aout->output.p_sys->waveheader[0], NULL ); &p_aout->output.p_sys->waveheader[0], NULL );
p_buffer = aout_OutputNextBuffer( p_aout,
mdate() + 1000000 / p_aout->output.output.i_rate * FRAME_SIZE,
VLC_FALSE );
PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout, PlayWaveOut( p_aout, p_aout->output.p_sys->h_waveout,
&p_aout->output.p_sys->waveheader[1], NULL ); &p_aout->output.p_sys->waveheader[1], p_buffer );
return 0; return 0;
} }
...@@ -256,9 +283,9 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg, ...@@ -256,9 +283,9 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg,
DWORD _p_aout, DWORD _p_aout,
DWORD dwParam1, DWORD dwParam2 ) DWORD dwParam1, DWORD dwParam2 )
{ {
aout_instance_t * p_aout = (aout_instance_t *)_p_aout; aout_instance_t *p_aout = (aout_instance_t *)_p_aout;
WAVEHDR *p_waveheader = (WAVEHDR *)dwParam1; WAVEHDR *p_waveheader = (WAVEHDR *)dwParam1;
aout_buffer_t * p_buffer; aout_buffer_t *p_buffer;
if( uMsg != WOM_DONE ) return; if( uMsg != WOM_DONE ) return;
...@@ -267,8 +294,10 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg, ...@@ -267,8 +294,10 @@ static void CALLBACK WaveOutCallback( HWAVEOUT h_waveout, UINT uMsg,
if( p_waveheader->dwUser ) if( p_waveheader->dwUser )
aout_BufferFree( (aout_buffer_t *)p_waveheader->dwUser ); aout_BufferFree( (aout_buffer_t *)p_waveheader->dwUser );
/* FIXME : take into account WaveOut latency instead of mdate() */ /* Take into account WaveOut latency instead of just mdate() */
p_buffer = aout_OutputNextBuffer( p_aout, mdate(), VLC_FALSE ); p_buffer = aout_OutputNextBuffer( p_aout,
mdate() + 1000000 / p_aout->output.output.i_rate * FRAME_SIZE,
VLC_FALSE );
PlayWaveOut( p_aout, h_waveout, p_waveheader, p_buffer ); PlayWaveOut( p_aout, h_waveout, p_waveheader, p_buffer );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions * modules.c : Builtin and plugin modules management functions
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.96 2002/10/08 18:10:10 sam Exp $ * $Id: modules.c,v 1.97 2002/10/11 10:08:06 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com> * Ethan C. Baldridge <BaldridgeE@cadmus.com>
...@@ -580,6 +580,10 @@ static void AllocateAllPlugins( vlc_object_t *p_this ) ...@@ -580,6 +580,10 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
} }
#endif #endif
} }
/* Free plugin-path */
free( path[ sizeof(path)/sizeof(char*) - 2 ] );
path[ sizeof(path)/sizeof(char*) - 2 ] = NULL;
} }
/***************************************************************************** /*****************************************************************************
......
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