[vlc-commits] medialibrary: Use vlc::threads

Hugo Beauzée-Luyssen git at videolan.org
Tue Aug 21 13:39:56 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sat Aug 18 00:02:26 2018 +0200| [d02b7fa15df1a98a717ee20da7dafea3bdb2c8f8] | committer: Hugo Beauzée-Luyssen

medialibrary: Use vlc::threads

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d02b7fa15df1a98a717ee20da7dafea3bdb2c8f8
---

 modules/misc/medialibrary/MetadataExtractor.cpp | 10 +++++-----
 modules/misc/medialibrary/medialibrary.h        |  8 ++------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/modules/misc/medialibrary/MetadataExtractor.cpp b/modules/misc/medialibrary/MetadataExtractor.cpp
index 50fbf37d7e..3ff3bb19ff 100644
--- a/modules/misc/medialibrary/MetadataExtractor.cpp
+++ b/modules/misc/medialibrary/MetadataExtractor.cpp
@@ -39,17 +39,17 @@ void MetadataExtractor::onInputEvent( const vlc_input_event* ev,
             break;
         case INPUT_EVENT_STATE:
             {
-                vlc_mutex_locker lock( &ctx.m_mutex );
+                vlc::threads::mutex_locker lock( ctx.m_mutex );
                 ctx.state = ev->state;
             }
             break;
         case INPUT_EVENT_DEAD:
             {
-                vlc_mutex_locker lock( &ctx.m_mutex );
+                vlc::threads::mutex_locker lock( ctx.m_mutex );
                 // We need to probe the item now, but not from the input thread
                 ctx.needsProbing = true;
             }
-            vlc_cond_signal( &ctx.m_cond );
+            ctx.m_cond.signal();
             break;
         default:
             break;
@@ -168,10 +168,10 @@ medialibrary::parser::Status MetadataExtractor::run( medialibrary::parser::IItem
     input_Start( ctx.input.get() );
 
     {
-        vlc_mutex_locker lock( &ctx.m_mutex );
+        vlc::threads::mutex_locker lock( ctx.m_mutex );
         while ( ctx.needsProbing == false )
         {
-            vlc_cond_wait( &ctx.m_cond, &ctx.m_mutex );
+            ctx.m_cond.wait( ctx.m_mutex );
             if ( ctx.needsProbing == true )
             {
                 if ( ctx.state == END_S || ctx.state == ERROR_S )
diff --git a/modules/misc/medialibrary/medialibrary.h b/modules/misc/medialibrary/medialibrary.h
index f50b100803..bfab8f77db 100644
--- a/modules/misc/medialibrary/medialibrary.h
+++ b/modules/misc/medialibrary/medialibrary.h
@@ -54,19 +54,15 @@ private:
             , mde( mde )
             , item( item )
         {
-            vlc_mutex_init( &m_mutex );
-            vlc_cond_init( &m_cond );
         }
         ~ParseContext()
         {
-            vlc_cond_destroy( &m_cond );
-            vlc_mutex_destroy( &m_mutex );
         }
 
         std::unique_ptr<input_item_t, decltype(&input_item_Release)> inputItem;
         std::unique_ptr<input_thread_t, decltype(&input_Close)> input;
-        vlc_cond_t m_cond;
-        vlc_mutex_t m_mutex;
+        vlc::threads::condition_variable m_cond;
+        vlc::threads::mutex m_mutex;
         bool needsProbing;
         input_state_e state;
         MetadataExtractor* mde;



More information about the vlc-commits mailing list