[vlc-devel] commit: playlist: add real functions for locking ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jan 17 18:20:15 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 17 19:19:51 2009 +0200| [4ca1e354903dcaa4452ceda2378d3a56e228b28f] | committer: Rémi Denis-Courmont
playlist: add real functions for locking
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4ca1e354903dcaa4452ceda2378d3a56e228b28f
---
include/vlc_playlist.h | 10 +++++++---
modules/control/http/mvar.c | 4 ++--
modules/control/http/rpn.c | 4 ++--
modules/gui/qt4/qt4.hpp | 4 ++--
modules/gui/skins2/commands/cmd_input.cpp | 4 ++--
modules/gui/skins2/vars/playtree.cpp | 12 ++++++------
modules/gui/wxwidgets/wxwidgets.hpp | 4 ++--
src/libvlccore.sym | 3 +++
src/playlist/control.c | 15 +++++++++++++++
9 files changed, 41 insertions(+), 19 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 4a885e5..b93f128 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -221,9 +221,9 @@ enum pl_locked_state
*****************************************************************************/
/* Helpers */
-#define PL_LOCK vlc_object_lock( p_playlist )
-#define PL_UNLOCK vlc_object_unlock( p_playlist )
-#define PL_ASSERT_LOCKED vlc_object_assert_locked( p_playlist )
+#define PL_LOCK playlist_Lock( p_playlist )
+#define PL_UNLOCK playlist_Unlock( p_playlist )
+#define PL_ASSERT_LOCKED playlist_AssertLocked( p_playlist )
VLC_EXPORT( playlist_t *, __pl_Hold, ( vlc_object_t * ) );
#define pl_Hold( a ) __pl_Hold( VLC_OBJECT(a) )
@@ -239,6 +239,10 @@ VLC_EXPORT( void, __pl_Release, ( vlc_object_t * ) );
#define playlist_Prev(p) playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, -1)
#define playlist_Skip(p,i) playlist_Control(p,PLAYLIST_SKIP, pl_Unlocked, (i) )
+VLC_EXPORT( void, playlist_Lock, ( playlist_t * ) );
+VLC_EXPORT( void, playlist_Unlock, ( playlist_t * ) );
+VLC_EXPORT( void, playlist_AssertLocked, ( playlist_t * ) );
+
/**
* Do a playlist action.
* If there is something in the playlist then you can do playlist actions.
diff --git a/modules/control/http/mvar.c b/modules/control/http/mvar.c
index eead1fe..c25dd34 100644
--- a/modules/control/http/mvar.c
+++ b/modules/control/http/mvar.c
@@ -287,9 +287,9 @@ mvar_t *mvar_PlaylistSetNew( intf_thread_t *p_intf, char *name,
playlist_t *p_pl )
{
mvar_t *s = mvar_New( name, "set" );
- vlc_object_lock( p_pl );
+ playlist_Lock( p_pl );
PlaylistListNode( p_intf, p_pl, p_pl->p_root_category , name, s, 0 );
- vlc_object_unlock( p_pl );
+ playlist_Unlock( p_pl );
return s;
}
diff --git a/modules/control/http/rpn.c b/modules/control/http/rpn.c
index fa4e6d3..50aa5e8 100644
--- a/modules/control/http/rpn.c
+++ b/modules/control/http/rpn.c
@@ -494,12 +494,12 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t *vars,
int i_id = SSPopN( st, vars );
int i_ret;
- vlc_object_lock( p_sys->p_playlist );
+ playlist_Lock( p_sys->p_playlist );
i_ret = playlist_Control( p_sys->p_playlist, PLAYLIST_VIEWPLAY,
pl_Locked, NULL,
playlist_ItemGetById( p_sys->p_playlist,
i_id, pl_Locked ) );
- vlc_object_unlock( p_sys->p_playlist );
+ playlist_Unlock( p_sys->p_playlist );
msg_Dbg( p_intf, "requested playlist item: %i", i_id );
SSPushN( st, i_ret );
}
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
index 45d116b..32a6ab6 100644
--- a/modules/gui/qt4/qt4.hpp
+++ b/modules/gui/qt4/qt4.hpp
@@ -76,8 +76,8 @@ struct intf_sys_t
};
#define THEPL p_intf->p_sys->p_playlist
-#define QPL_LOCK vlc_object_lock( THEPL );
-#define QPL_UNLOCK vlc_object_unlock( THEPL );
+#define QPL_LOCK playlist_Lock( THEPL );
+#define QPL_UNLOCK playlist_Unlock( THEPL );
#define THEDP DialogsProvider::getInstance()
#define THEMIM MainInputManager::getInstance( p_intf )
diff --git a/modules/gui/skins2/commands/cmd_input.cpp b/modules/gui/skins2/commands/cmd_input.cpp
index 76a8eab..4e76107 100644
--- a/modules/gui/skins2/commands/cmd_input.cpp
+++ b/modules/gui/skins2/commands/cmd_input.cpp
@@ -36,9 +36,9 @@ void CmdPlay::execute()
return;
}
- vlc_object_lock( pPlaylist );
+ playlist_Lock( pPlaylist );
const bool b_empty = playlist_IsEmpty( pPlaylist );
- vlc_object_unlock( pPlaylist );
+ playlist_Unlock( pPlaylist );
if( !b_empty )
{
diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index a15676b..405f072 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -52,7 +52,7 @@ Playtree::~Playtree()
void Playtree::delSelected()
{
Iterator it = begin();
- vlc_object_lock( getIntf()->p_sys->p_playlist );
+ playlist_Lock( getIntf()->p_sys->p_playlist );
for( it = begin(); it != end(); it = getNextVisibleItem( it ) )
{
if( (*it).m_selected && !(*it).isReadonly() )
@@ -93,12 +93,12 @@ void Playtree::delSelected()
it = getNextVisibleItem( it );
}
}
- vlc_object_unlock( getIntf()->p_sys->p_playlist );
+ playlist_Unlock( getIntf()->p_sys->p_playlist );
}
void Playtree::action( VarTree *pItem )
{
- vlc_object_lock( m_pPlaylist );
+ playlist_Lock( m_pPlaylist );
VarTree::Iterator it;
playlist_item_t *p_item = (playlist_item_t *)pItem->m_pData;
@@ -114,7 +114,7 @@ void Playtree::action( VarTree *pItem )
{
playlist_Control( m_pPlaylist, PLAYLIST_VIEWPLAY, pl_Locked, p_parent, p_item );
}
- vlc_object_unlock( m_pPlaylist );
+ playlist_Unlock( m_pPlaylist );
}
void Playtree::onChange()
@@ -213,7 +213,7 @@ void Playtree::buildNode( playlist_item_t *pNode, VarTree &rTree )
void Playtree::buildTree()
{
clear();
- vlc_object_lock( m_pPlaylist );
+ playlist_Lock( m_pPlaylist );
i_items_to_append = 0;
@@ -228,7 +228,7 @@ void Playtree::buildTree()
buildNode( m_pPlaylist->p_root_category, *this );
- vlc_object_unlock( m_pPlaylist );
+ playlist_Unlock( m_pPlaylist );
// What is it ?
// checkParents( NULL );
}
diff --git a/modules/gui/wxwidgets/wxwidgets.hpp b/modules/gui/wxwidgets/wxwidgets.hpp
index 39e433b..58fd527 100644
--- a/modules/gui/wxwidgets/wxwidgets.hpp
+++ b/modules/gui/wxwidgets/wxwidgets.hpp
@@ -225,13 +225,13 @@ wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
{
if( p_sys->i_playlist_usage++ == 0)
- vlc_object_lock( p_pl );
+ playlist_lock( p_pl );
}
inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
{
if( --p_sys->i_playlist_usage == 0)
- vlc_object_unlock( p_pl );
+ playlist_Unlock( p_pl );
}
#endif
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 6bedd05..78c72ce 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -275,6 +275,7 @@ playlist_Add
playlist_AddExt
playlist_AddInput
playlist_AskForArtEnqueue
+playlist_AssertLocked
playlist_BothAddInput
playlist_ChildSearchName
playlist_Clear
@@ -297,6 +298,7 @@ playlist_ItemGetByInputId
playlist_ItemNewWithType
playlist_ItemToNode
playlist_LiveSearchUpdate
+playlist_Lock
playlist_NodeAppend
playlist_NodeChildrenCount
playlist_NodeCreate
@@ -311,6 +313,7 @@ playlist_ServicesDiscoveryAdd
playlist_ServicesDiscoveryRemove
playlist_Status
playlist_TreeMove
+playlist_Unlock
__pl_Hold
__pl_Release
resolve_xml_special_chars
diff --git a/src/playlist/control.c b/src/playlist/control.c
index a3f87c6..f9260e0 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -66,6 +66,21 @@ void __pl_Release( vlc_object_t *p_this )
vlc_object_release( pl );
}
+void playlist_Lock( playlist_t *pl )
+{
+ vlc_object_lock( pl );
+}
+
+void playlist_Unlock( playlist_t *pl )
+{
+ vlc_object_unlock( pl );
+}
+
+void playlist_AssertLocked( playlist_t *pl )
+{
+ vlc_object_assert_locked( pl );
+}
+
int playlist_Control( playlist_t * p_playlist, int i_query,
bool b_locked, ... )
{
More information about the vlc-devel
mailing list