Commit d02b7fa1 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

medialibrary: Use vlc::threads

parent 131275d3
......@@ -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 )
......
......@@ -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;
......
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