Commit 2ab09e38 authored by Laurent Aimar's avatar Laurent Aimar Committed by Jean-Baptiste Kempf

Serialized libmodplug loading code.

libmodplug is thread safe except when loading files or configuring settings
(before loading a file).
(cherry picked from commit 64b98d8415574337e8354c9ebb05c41d1d458f6e)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 56f92c7d
......@@ -106,6 +106,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static vlc_mutex_t libmodplug_lock = VLC_STATIC_MUTEX;
struct demux_sys_t
{
......@@ -196,6 +197,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;
......@@ -223,7 +225,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