Commit 64b98d84 authored by Laurent Aimar's avatar Laurent Aimar

Serialized libmodplug loading code.

libmodplug is thread safe except when loading files or configuring settings
(before loading a file).
parent c320a4eb
......@@ -106,6 +106,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static vlc_mutex_t libmodplug_lock = VLC_STATIC_MUTEX;
struct demux_sys_t
{
......@@ -198,6 +199,7 @@ static int Open( vlc_object_t *p_this )
}
/* Configure modplug before loading the file */
vlc_mutex_lock( &libmodplug_lock );
ModPlug_GetSettings( &settings );
settings.mFlags = MODPLUG_ENABLE_OVERSAMPLING;
settings.mChannels = 2;
......@@ -225,7 +227,10 @@ static int Open( vlc_object_t *p_this )
ModPlug_SetSettings( &settings );
if( ( p_sys->f = ModPlug_Load( p_sys->p_data, p_sys->i_data ) ) == NULL )
p_sys->f = ModPlug_Load( p_sys->p_data, p_sys->i_data );
vlc_mutex_unlock( &libmodplug_lock );
if( !p_sys->f )
{
msg_Err( p_demux, "failed to understand the file" );
/* we try to seek to recover for other plugin */
......
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