[vlc-commits] Serialized libmodplug loading code.
Laurent Aimar
git at videolan.org
Sun May 8 17:52:42 CEST 2011
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun May 8 17:48:00 2011 +0200| [64b98d8415574337e8354c9ebb05c41d1d458f6e] | committer: Laurent Aimar
Serialized libmodplug loading code.
libmodplug is thread safe except when loading files or configuring settings
(before loading a file).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64b98d8415574337e8354c9ebb05c41d1d458f6e
---
modules/demux/mod.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/modules/demux/mod.c b/modules/demux/mod.c
index 2bafec5..e751638 100644
--- a/modules/demux/mod.c
+++ b/modules/demux/mod.c
@@ -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 */
More information about the vlc-commits
mailing list