[vlc-devel] commit: mozilla: protect calls to libvlc_playlist_isplaying() ( Jean-Paul Saman )
git version control
git at videolan.org
Tue Feb 17 12:42:14 CET 2009
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Tue Feb 17 12:02:31 2009 +0100| [c26963910979f706f8830dde3785317aeb42ba03] | committer: Jean-Paul Saman
mozilla: protect calls to libvlc_playlist_isplaying()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c26963910979f706f8830dde3785317aeb42ba03
---
projects/mozilla/control/npolibvlc.cpp | 2 ++
projects/mozilla/vlcplugin.cpp | 4 ++++
projects/mozilla/vlcshell.cpp | 14 ++++++++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/projects/mozilla/control/npolibvlc.cpp b/projects/mozilla/control/npolibvlc.cpp
index c8ab15d..110a885 100644
--- a/projects/mozilla/control/npolibvlc.cpp
+++ b/projects/mozilla/control/npolibvlc.cpp
@@ -1349,7 +1349,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
}
case ID_playlist_isplaying:
{
+ libvlc_playlist_lock(p_plugin->getVLC());
int val = libvlc_playlist_isplaying(p_plugin->getVLC(), &ex);
+ libvlc_playlist_unlock(p_plugin->getVLC());
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
diff --git a/projects/mozilla/vlcplugin.cpp b/projects/mozilla/vlcplugin.cpp
index b0484f5..84e9a6e 100644
--- a/projects/mozilla/vlcplugin.cpp
+++ b/projects/mozilla/vlcplugin.cpp
@@ -583,7 +583,9 @@ void VlcPlugin::redrawToolbar()
if( p_md )
{
/* get isplaying */
+ libvlc_playlist_lock( getVLC() );
is_playing = libvlc_playlist_isplaying( getVLC(), &ex );
+ libvlc_playlist_unlock( getVLC() );
libvlc_exception_clear( &ex );
/* get movie position in % */
@@ -696,7 +698,9 @@ vlc_toolbar_clicked_t VlcPlugin::getToolbarButtonClicked( int i_xpos, int i_ypos
/* get isplaying */
libvlc_exception_init( &ex );
+ libvlc_playlist_lock( getVLC() );
is_playing = libvlc_playlist_isplaying( getVLC(), &ex );
+ libvlc_playlist_unlock( getVLC() );
libvlc_exception_clear( &ex );
/* get mute info */
diff --git a/projects/mozilla/vlcshell.cpp b/projects/mozilla/vlcshell.cpp
index 7adfca6..3fb3472 100644
--- a/projects/mozilla/vlcshell.cpp
+++ b/projects/mozilla/vlcshell.cpp
@@ -184,7 +184,11 @@ int16 NPP_HandleEvent( NPP instance, void * event )
libvlc_instance_t *p_vlc = p_plugin->getVLC();
if( p_vlc )
{
- if( libvlc_playlist_isplaying(p_vlc, NULL) )
+ int is_playing;
+ libvlc_playlist_lock(p_vlc);
+ is_playing = libvlc_playlist_isplaying(p_vlc, NULL);
+ libvlc_playlist_lunock(p_vlc);
+ if( is_playing )
{
libvlc_media_player_t *p_md =
libvlc_playlist_get_media_player(p_vlc, NULL);
@@ -215,7 +219,11 @@ int16 NPP_HandleEvent( NPP instance, void * event )
if( p_vlc )
{
- if( libvlc_playlist_isplaying(p_vlc, NULL) )
+ int is_playing;
+ libvlc_playlist_lock(p_vlc);
+ is_playing = libvlc_playlist_isplaying(p_vlc, NULL);
+ libvlc_playlist_unlock(p_vlc);
+ if( is_playing )
{
libvlc_media_player_t *p_md =
libvlc_playlist_get_media_player(p_vlc, NULL);
@@ -846,7 +854,9 @@ static void ControlHandler( Widget w, XtPointer closure, XEvent *event )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
libvlc_exception_clear( &ex );
+ libvlc_playlist_lock( p_plugin->getVLC() );
i_playing = libvlc_playlist_isplaying( p_plugin->getVLC(), &ex );
+ libvlc_playlist_unlock( p_plugin->getVLC() );
if( libvlc_exception_raised(&ex) )
fprintf( stderr, "%s\n", libvlc_exception_get_message(&ex));
libvlc_exception_clear( &ex );
More information about the vlc-devel
mailing list