vlc | branch: master | Hugo Beauzée-Luyssen <h...@beauzee.fr> | Fri Feb 17 15:56:12 2017 +0100| [a59884286c3981415efb7657a8f1c34fbfa648c5] | committer: Hugo Beauzée-Luyssen
chromecast: thread: Use a trampoline function to simplify So we don't have to prefix with p_sys everywhere > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a59884286c3981415efb7657a8f1c34fbfa648c5 --- modules/stream_out/chromecast/chromecast.h | 2 ++ modules/stream_out/chromecast/chromecast_ctrl.cpp | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h index 0334cef..9f79ac8 100644 --- a/modules/stream_out/chromecast/chromecast.h +++ b/modules/stream_out/chromecast/chromecast.h @@ -182,6 +182,8 @@ private: double getPlaybackPosition() const; + void mainLoop(); + private: static void* ChromecastThread(void* p_data); diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp index be94690..d9a17e7 100644 --- a/modules/stream_out/chromecast/chromecast_ctrl.cpp +++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp @@ -486,19 +486,22 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg) void* intf_sys_t::ChromecastThread(void* p_data) { intf_sys_t *p_sys = reinterpret_cast<intf_sys_t*>(p_data); + p_sys->mainLoop(); + return NULL; +} - vlc_interrupt_set( p_sys->p_ctl_thread_interrupt ); - vlc_interrupt_set( p_sys->p_ctl_thread_interrupt ); - - vlc_mutex_lock(&p_sys->lock); - p_sys->setConnectionStatus(CHROMECAST_TLS_CONNECTED); - vlc_mutex_unlock(&p_sys->lock); +void intf_sys_t::mainLoop() +{ + vlc_interrupt_set( p_ctl_thread_interrupt ); - p_sys->m_communication.msgAuth(); + vlc_mutex_lock(&lock); + setConnectionStatus(CHROMECAST_TLS_CONNECTED); + vlc_mutex_unlock(&lock); - while ( !vlc_killed() && p_sys->handleMessages() ); + m_communication.msgAuth(); - return NULL; + while ( !vlc_killed() && handleMessages() ) + ; } bool intf_sys_t::handleMessages() @@ -711,7 +714,6 @@ double intf_sys_t::getPlaybackPosition() const return 0.0; } - mtime_t intf_sys_t::get_time(void *pt) { intf_sys_t *p_this = reinterpret_cast<intf_sys_t*>(pt); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits