[vlc-commits] chromecast: Prefix intf_sys_t member variables

Hugo Beauzée-Luyssen git at videolan.org
Tue Feb 21 14:00:56 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Feb 17 16:20:08 2017 +0100| [d4b430e13bff41e3775a02baf8910c0bf59f0414] | committer: Hugo Beauzée-Luyssen

chromecast: Prefix intf_sys_t member variables

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

 modules/stream_out/chromecast/chromecast.h        |  44 +--
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 368 +++++++++++-----------
 2 files changed, 206 insertions(+), 206 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 9f79ac8..ca83868 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -91,7 +91,7 @@ enum receiver_state {
 class ChromecastCommunication
 {
 public:
-    ChromecastCommunication( vlc_object_t* m_module, const char* targetIP, unsigned int devicePort );
+    ChromecastCommunication( vlc_object_t* module, const char* targetIP, unsigned int devicePort );
     ~ChromecastCommunication();
     /**
      * @brief disconnect close the connection with the chromecast
@@ -203,46 +203,46 @@ private:
 
 
 private:
-    vlc_object_t  * const p_module;
-    const int      i_port;
-    std::string    mime;
+    vlc_object_t  * const m_module;
+    const int      m_streaming_port;
+    std::string    m_mime;
 
-    std::string appTransportId;
-    std::string mediaSessionId;
-    receiver_state receiverState;
+    std::string m_appTransportId;
+    std::string m_mediaSessionId;
+    receiver_state m_receiverState;
 
-    vlc_mutex_t  lock;
-    vlc_cond_t   loadCommandCond;
-    vlc_thread_t chromecastThread;
+    vlc_mutex_t  m_lock;
+    vlc_cond_t   m_loadCommandCond;
+    vlc_thread_t m_chromecastThread;
 
     ChromecastCommunication m_communication;
-    enum connection_status conn_status;
-    enum command_status    cmd_status;
-    std::atomic_bool requested_stop;
-    std::atomic_bool requested_seek;
+    connection_status m_conn_status;
+    command_status    m_cmd_status;
+    std::atomic_bool m_requested_stop;
+    std::atomic_bool m_requested_seek;
 
-    bool           has_input;
+    bool           m_has_input;
 
-    std::string artwork;
-    std::string title;
+    std::string m_artwork;
+    std::string m_title;
 
-    vlc_interrupt_t *p_ctl_thread_interrupt;
+    vlc_interrupt_t *m_ctl_thread_interrupt;
 
     /* local date when playback started/resumed, used by monotone clock */
     mtime_t           m_time_playback_started;
     /* local playback time of the input when playback started/resumed */
-    mtime_t           i_ts_local_start;
-    mtime_t           i_length;
+    mtime_t           m_ts_local_start;
+    mtime_t           m_length;
 
     /* playback time reported by the receiver, used to wait for seeking point */
     mtime_t           m_chromecast_start_time;
     /* seek time with Chromecast relative timestamp */
     mtime_t           m_seek_request_time;
 
-    vlc_cond_t   seekCommandCond;
+    vlc_cond_t   m_seekCommandCond;
 
     /* shared structure with the demux-filter */
-    chromecast_common      common;
+    chromecast_common      m_common;
 };
 
 #endif /* VLC_CHROMECAST_H */
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index d9a17e7..cb5480f 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -47,46 +47,46 @@ static const mtime_t SEEK_FORWARD_OFFSET = 1000000;
  * intf_sys_t: class definition
  *****************************************************************************/
 intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device_addr, int device_port, vlc_interrupt_t *p_interrupt)
- : p_module(p_this)
- , i_port(port)
- , receiverState(RECEIVER_IDLE)
+ : m_module(p_this)
+ , m_streaming_port(port)
+ , m_receiverState(RECEIVER_IDLE)
  , m_communication( p_this, device_addr.c_str(), device_port )
- , requested_stop(false)
- , requested_seek(false)
- , conn_status(CHROMECAST_DISCONNECTED)
- , cmd_status(NO_CMD_PENDING)
- , has_input(false)
- , p_ctl_thread_interrupt(p_interrupt)
+ , m_requested_stop(false)
+ , m_requested_seek(false)
+ , m_conn_status(CHROMECAST_DISCONNECTED)
+ , m_cmd_status(NO_CMD_PENDING)
+ , m_has_input(false)
+ , m_ctl_thread_interrupt(p_interrupt)
  , m_time_playback_started( VLC_TS_INVALID )
- , i_ts_local_start( VLC_TS_INVALID )
- , i_length( VLC_TS_INVALID )
+ , m_ts_local_start( VLC_TS_INVALID )
+ , m_length( VLC_TS_INVALID )
  , m_chromecast_start_time( VLC_TS_INVALID )
  , m_seek_request_time( VLC_TS_INVALID )
 {
-    vlc_mutex_init(&lock);
-    vlc_cond_init(&loadCommandCond);
-    vlc_cond_init(&seekCommandCond);
-
-    common.p_opaque = this;
-    common.pf_get_position     = get_position;
-    common.pf_get_time         = get_time;
-    common.pf_set_length       = set_length;
-    common.pf_wait_app_started = wait_app_started;
-    common.pf_request_seek     = request_seek;
-    common.pf_wait_seek_done   = wait_seek_done;
-    common.pf_set_pause_state  = set_pause_state;
-    common.pf_set_artwork      = set_artwork;
-    common.pf_set_title        = set_title;
-
-    assert( var_Type( p_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME) == 0 );
-    if (var_Create( p_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS )
-        var_SetAddress( p_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, &common );
+    vlc_mutex_init(&m_lock);
+    vlc_cond_init(&m_loadCommandCond);
+    vlc_cond_init(&m_seekCommandCond);
+
+    m_common.p_opaque = this;
+    m_common.pf_get_position     = get_position;
+    m_common.pf_get_time         = get_time;
+    m_common.pf_set_length       = set_length;
+    m_common.pf_wait_app_started = wait_app_started;
+    m_common.pf_request_seek     = request_seek;
+    m_common.pf_wait_seek_done   = wait_seek_done;
+    m_common.pf_set_pause_state  = set_pause_state;
+    m_common.pf_set_artwork      = set_artwork;
+    m_common.pf_set_title        = set_title;
+
+    assert( var_Type( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME) == 0 );
+    if (var_Create( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, VLC_VAR_ADDRESS ) == VLC_SUCCESS )
+        var_SetAddress( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME, &m_common );
 
     // Start the Chromecast event thread.
-    if (vlc_clone(&chromecastThread, ChromecastThread, this,
+    if (vlc_clone(&m_chromecastThread, ChromecastThread, this,
                   VLC_THREAD_PRIORITY_LOW))
     {
-        msg_Err( p_module, "Could not start the Chromecast talking thread");
+        msg_Err( m_module, "Could not start the Chromecast talking thread");
     }
 }
 
@@ -94,13 +94,13 @@ intf_sys_t::~intf_sys_t()
 {
     setHasInput( false );
 
-    var_Destroy( p_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME );
+    var_Destroy( m_module->obj.parent->obj.parent, CC_SHARED_VAR_NAME );
 
-    switch ( conn_status )
+    switch ( m_conn_status )
     {
     case CHROMECAST_APP_STARTED:
         // Generate the close messages.
-        m_communication.msgReceiverClose(appTransportId);
+        m_communication.msgReceiverClose(m_appTransportId);
         // ft
     case CHROMECAST_TLS_CONNECTED:
     case CHROMECAST_AUTHENTICATED:
@@ -112,50 +112,50 @@ intf_sys_t::~intf_sys_t()
         break;
     }
 
-    vlc_interrupt_kill( p_ctl_thread_interrupt );
+    vlc_interrupt_kill( m_ctl_thread_interrupt );
 
-    vlc_join(chromecastThread, NULL);
+    vlc_join(m_chromecastThread, NULL);
 
-    vlc_interrupt_destroy( p_ctl_thread_interrupt );
+    vlc_interrupt_destroy( m_ctl_thread_interrupt );
 
     // make sure we unblock the demuxer
     m_seek_request_time = VLC_TS_INVALID;
-    vlc_cond_signal(&seekCommandCond);
+    vlc_cond_signal(&m_seekCommandCond);
 
-    vlc_cond_destroy(&seekCommandCond);
-    vlc_cond_destroy(&loadCommandCond);
-    vlc_mutex_destroy(&lock);
+    vlc_cond_destroy(&m_seekCommandCond);
+    vlc_cond_destroy(&m_loadCommandCond);
+    vlc_mutex_destroy(&m_lock);
 }
 
 void intf_sys_t::setHasInput( bool b_has_input, const std::string mime_type )
 {
-    vlc_mutex_locker locker(&lock);
-    msg_Dbg( p_module, "setHasInput %s session:%s",b_has_input ? "true":"false", mediaSessionId.c_str() );
+    vlc_mutex_locker locker(&m_lock);
+    msg_Dbg( m_module, "setHasInput %s session:%s",b_has_input ? "true":"false", m_mediaSessionId.c_str() );
 
-    this->has_input = b_has_input;
-    this->mime = mime_type;
+    this->m_has_input = b_has_input;
+    this->m_mime = mime_type;
 
-    if( this->has_input )
+    if( this->m_has_input )
     {
-        mutex_cleanup_push(&lock);
-        while (conn_status != CHROMECAST_APP_STARTED && conn_status != CHROMECAST_CONNECTION_DEAD)
+        mutex_cleanup_push(&m_lock);
+        while (m_conn_status != CHROMECAST_APP_STARTED && m_conn_status != CHROMECAST_CONNECTION_DEAD)
         {
-            msg_Dbg( p_module, "setHasInput waiting for Chromecast connection, current %d", conn_status);
-            vlc_cond_wait(&loadCommandCond, &lock);
+            msg_Dbg( m_module, "setHasInput waiting for Chromecast connection, current %d", m_conn_status);
+            vlc_cond_wait(&m_loadCommandCond, &m_lock);
         }
         vlc_cleanup_pop();
 
-        if (conn_status == CHROMECAST_CONNECTION_DEAD)
+        if (m_conn_status == CHROMECAST_CONNECTION_DEAD)
         {
-            msg_Warn( p_module, "no Chromecast hook possible");
+            msg_Warn( m_module, "no Chromecast hook possible");
             return;
         }
 
-        if ( receiverState == RECEIVER_IDLE )
+        if ( m_receiverState == RECEIVER_IDLE )
         {
             // we cannot start a new load when the last one is still processing
-            i_ts_local_start = VLC_TS_0;
-            m_communication.msgPlayerLoad( appTransportId, i_port, title, artwork, mime_type );
+            m_ts_local_start = VLC_TS_0;
+            m_communication.msgPlayerLoad( m_appTransportId, m_streaming_port, m_title, m_artwork, mime_type );
             setPlayerStatus(CMD_LOAD_SENT);
         }
     }
@@ -168,10 +168,10 @@ void intf_sys_t::disconnectChromecast()
 {
     m_communication.disconnect();
     setConnectionStatus(CHROMECAST_DISCONNECTED);
-    appTransportId = "";
-    mediaSessionId = ""; // this session is not valid anymore
+    m_appTransportId = "";
+    m_mediaSessionId = ""; // this session is not valid anymore
     setPlayerStatus(NO_CMD_PENDING);
-    receiverState = RECEIVER_IDLE;
+    m_receiverState = RECEIVER_IDLE;
 }
 
 /**
@@ -184,7 +184,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
     const std::string & namespace_ = msg.namespace_();
 
 #ifndef NDEBUG
-    msg_Dbg( p_module, "processMessage: %s->%s %s", namespace_.c_str(), msg.destination_id().c_str(), msg.payload_utf8().c_str());
+    msg_Dbg( m_module, "processMessage: %s->%s %s", namespace_.c_str(), msg.destination_id().c_str(), msg.payload_utf8().c_str());
 #endif
 
     if (namespace_ == NAMESPACE_DEVICEAUTH)
@@ -194,15 +194,15 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
 
         if (authMessage.has_error())
         {
-            msg_Err( p_module, "Authentification error: %d", authMessage.error().error_type());
+            msg_Err( m_module, "Authentification error: %d", authMessage.error().error_type());
         }
         else if (!authMessage.has_response())
         {
-            msg_Err( p_module, "Authentification message has no response field");
+            msg_Err( m_module, "Authentification message has no response field");
         }
         else
         {
-            vlc_mutex_locker locker(&lock);
+            vlc_mutex_locker locker(&m_lock);
             setConnectionStatus(CHROMECAST_AUTHENTICATED);
             m_communication.msgConnect(DEFAULT_CHOMECAST_RECEIVER);
             m_communication.msgReceiverGetStatus();
@@ -215,16 +215,16 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
 
         if (type == "PING")
         {
-            msg_Dbg( p_module, "PING received from the Chromecast");
+            msg_Dbg( m_module, "PING received from the Chromecast");
             m_communication.msgPong();
         }
         else if (type == "PONG")
         {
-            msg_Dbg( p_module, "PONG received from the Chromecast");
+            msg_Dbg( m_module, "PONG received from the Chromecast");
         }
         else
         {
-            msg_Warn( p_module, "Heartbeat command not supported: %s", type.c_str());
+            msg_Warn( m_module, "Heartbeat command not supported: %s", type.c_str());
         }
 
         json_value_free(p_data);
@@ -239,7 +239,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
             json_value applications = (*p_data)["status"]["applications"];
             const json_value *p_app = NULL;
 
-            vlc_mutex_locker locker(&lock);
+            vlc_mutex_locker locker(&m_lock);
             for (unsigned i = 0; i < applications.u.array.length; ++i)
             {
                 std::string appId(applications[i]["appId"]);
@@ -248,7 +248,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
                     const char *pz_transportId = applications[i]["transportId"];
                     if (pz_transportId != NULL)
                     {
-                        appTransportId = std::string(pz_transportId);
+                        m_appTransportId = std::string(pz_transportId);
                         p_app = &applications[i];
                     }
                     break;
@@ -257,30 +257,30 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
 
             if ( p_app )
             {
-                if (!appTransportId.empty()
-                        && conn_status == CHROMECAST_AUTHENTICATED)
+                if (!m_appTransportId.empty()
+                        && m_conn_status == CHROMECAST_AUTHENTICATED)
                 {
-                    m_communication.msgConnect( appTransportId );
+                    m_communication.msgConnect( m_appTransportId );
                     setPlayerStatus(NO_CMD_PENDING);
                     setConnectionStatus(CHROMECAST_APP_STARTED);
                 }
             }
             else
             {
-                switch( conn_status )
+                switch( m_conn_status )
                 {
                 /* If the app is no longer present */
                 case CHROMECAST_APP_STARTED:
-                    msg_Warn( p_module, "app is no longer present. closing");
-                    m_communication.msgReceiverClose(appTransportId);
+                    msg_Warn( m_module, "app is no longer present. closing");
+                    m_communication.msgReceiverClose(m_appTransportId);
                     setConnectionStatus(CHROMECAST_CONNECTION_DEAD);
                     break;
 
                 case CHROMECAST_AUTHENTICATED:
-                    msg_Dbg( p_module, "Chromecast was running no app, launch media_app");
-                    appTransportId = "";
-                    mediaSessionId = ""; // this session is not valid anymore
-                    receiverState = RECEIVER_IDLE;
+                    msg_Dbg( m_module, "Chromecast was running no app, launch media_app");
+                    m_appTransportId = "";
+                    m_mediaSessionId = ""; // this session is not valid anymore
+                    m_receiverState = RECEIVER_IDLE;
                     m_communication.msgReceiverLaunchApp();
                     break;
 
@@ -293,12 +293,12 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
         else if (type == "LAUNCH_ERROR")
         {
             json_value reason = (*p_data)["reason"];
-            msg_Err( p_module, "Failed to start the MediaPlayer: %s",
+            msg_Err( m_module, "Failed to start the MediaPlayer: %s",
                     (const char *)reason);
         }
         else
         {
-            msg_Warn( p_module, "Receiver command not supported: %s",
+            msg_Warn( m_module, "Receiver command not supported: %s",
                     msg.payload_utf8().c_str());
         }
 
@@ -312,62 +312,62 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
         if (type == "MEDIA_STATUS")
         {
             json_value status = (*p_data)["status"];
-            msg_Dbg( p_module, "Player state: %s sessionId:%d",
+            msg_Dbg( m_module, "Player state: %s sessionId:%d",
                     status[0]["playerState"].operator const char *(),
                     (int)(json_int_t) status[0]["mediaSessionId"]);
 
-            vlc_mutex_locker locker(&lock);
-            receiver_state oldPlayerState = receiverState;
+            vlc_mutex_locker locker(&m_lock);
+            receiver_state oldPlayerState = m_receiverState;
             std::string newPlayerState = status[0]["playerState"].operator const char *();
             std::string idleReason = status[0]["idleReason"].operator const char *();
 
             if (newPlayerState == "IDLE")
-                receiverState = RECEIVER_IDLE;
+                m_receiverState = RECEIVER_IDLE;
             else if (newPlayerState == "PLAYING")
-                receiverState = RECEIVER_PLAYING;
+                m_receiverState = RECEIVER_PLAYING;
             else if (newPlayerState == "BUFFERING")
-                receiverState = RECEIVER_BUFFERING;
+                m_receiverState = RECEIVER_BUFFERING;
             else if (newPlayerState == "PAUSED")
-                receiverState = RECEIVER_PAUSED;
+                m_receiverState = RECEIVER_PAUSED;
             else if (!newPlayerState.empty())
-                msg_Warn( p_module, "Unknown Chromecast state %s", newPlayerState.c_str());
+                msg_Warn( m_module, "Unknown Chromecast state %s", newPlayerState.c_str());
 
-            if (receiverState == RECEIVER_IDLE)
+            if (m_receiverState == RECEIVER_IDLE)
             {
-                mediaSessionId = ""; // this session is not valid anymore
+                m_mediaSessionId = ""; // this session is not valid anymore
             }
             else
             {
                 char session_id[32];
                 if( snprintf( session_id, sizeof(session_id), "%" PRId64, (json_int_t) status[0]["mediaSessionId"] ) >= (int)sizeof(session_id) )
                 {
-                    msg_Err( p_module, "snprintf() truncated string for mediaSessionId" );
+                    msg_Err( m_module, "snprintf() truncated string for mediaSessionId" );
                     session_id[sizeof(session_id) - 1] = '\0';
                 }
-                if (session_id[0] && mediaSessionId != session_id) {
-                    if (!mediaSessionId.empty())
-                        msg_Warn( p_module, "different mediaSessionId detected %s was %s", session_id, this->mediaSessionId.c_str());
-                    mediaSessionId = session_id;
+                if (session_id[0] && m_mediaSessionId != session_id) {
+                    if (!m_mediaSessionId.empty())
+                        msg_Warn( m_module, "different mediaSessionId detected %s was %s", session_id, this->m_mediaSessionId.c_str());
+                    m_mediaSessionId = session_id;
                 }
             }
 
-            if (receiverState != oldPlayerState)
+            if (m_receiverState != oldPlayerState)
             {
 #ifndef NDEBUG
-                msg_Dbg( p_module, "change Chromecast player state from %d to %d", oldPlayerState, receiverState);
+                msg_Dbg( m_module, "change Chromecast player state from %d to %d", oldPlayerState, m_receiverState );
 #endif
-                switch( receiverState )
+                switch( m_receiverState )
                 {
                 case RECEIVER_BUFFERING:
                     if ( double(status[0]["currentTime"]) == 0.0 )
                     {
-                        receiverState = oldPlayerState;
-                        msg_Dbg( p_module, "Invalid buffering time, keep previous state %d", oldPlayerState);
+                        m_receiverState = oldPlayerState;
+                        msg_Dbg( m_module, "Invalid buffering time, keep previous state %d", oldPlayerState);
                     }
                     else
                     {
                         m_chromecast_start_time = (1 + mtime_t( double( status[0]["currentTime"] ) ) ) * 1000000L;
-                        msg_Dbg( p_module, "Playback pending with an offset of %" PRId64, m_chromecast_start_time);
+                        msg_Dbg( m_module, "Playback pending with an offset of %" PRId64, m_chromecast_start_time);
                     }
                     m_time_playback_started = VLC_TS_INVALID;
                     break;
@@ -375,76 +375,76 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
                 case RECEIVER_PLAYING:
                     /* TODO reset demux PCR ? */
                     if (unlikely(m_chromecast_start_time == VLC_TS_INVALID)) {
-                        msg_Warn( p_module, "start playing without buffering" );
+                        msg_Warn( m_module, "start playing without buffering" );
                         m_chromecast_start_time = (1 + mtime_t( double( status[0]["currentTime"] ) ) ) * 1000000L;
                     }
                     setPlayerStatus(CMD_PLAYBACK_SENT);
                     m_time_playback_started = mdate();
 #ifndef NDEBUG
-                    msg_Dbg( p_module, "Playback started with an offset of %" PRId64 " now:%" PRId64 " i_ts_local_start:%" PRId64, m_chromecast_start_time, m_time_playback_started, i_ts_local_start);
+                    msg_Dbg( m_module, "Playback started with an offset of %" PRId64 " now:%" PRId64 " i_ts_local_start:%" PRId64, m_chromecast_start_time, m_time_playback_started, m_ts_local_start);
 #endif
                     break;
 
                 case RECEIVER_PAUSED:
                     m_chromecast_start_time = (1 + mtime_t( double( status[0]["currentTime"] ) ) ) * 1000000L;
 #ifndef NDEBUG
-                    msg_Dbg( p_module, "Playback paused with an offset of %" PRId64 " date_play_start:%" PRId64, m_chromecast_start_time, m_time_playback_started);
+                    msg_Dbg( m_module, "Playback paused with an offset of %" PRId64 " date_play_start:%" PRId64, m_chromecast_start_time, m_time_playback_started);
 #endif
 
                     if ( m_time_playback_started != VLC_TS_INVALID && oldPlayerState == RECEIVER_PLAYING )
                     {
                         /* this is a pause generated remotely, adjust the playback time */
-                        i_ts_local_start += mdate() - m_time_playback_started;
+                        m_ts_local_start += mdate() - m_time_playback_started;
 #ifndef NDEBUG
-                        msg_Dbg( p_module, "updated i_ts_local_start:%" PRId64, i_ts_local_start);
+                        msg_Dbg( m_module, "updated i_ts_local_start:%" PRId64, m_ts_local_start);
 #endif
                     }
                     m_time_playback_started = VLC_TS_INVALID;
                     break;
 
                 case RECEIVER_IDLE:
-                    if ( has_input )
+                    if ( m_has_input )
                         setPlayerStatus(NO_CMD_PENDING);
                     m_time_playback_started = VLC_TS_INVALID;
                     break;
                 }
             }
 
-            if (receiverState == RECEIVER_BUFFERING && m_seek_request_time != VLC_TS_INVALID)
+            if (m_receiverState == RECEIVER_BUFFERING && m_seek_request_time != VLC_TS_INVALID)
             {
-                msg_Dbg( p_module, "Chromecast seeking possibly done");
-                vlc_cond_signal( &seekCommandCond );
+                msg_Dbg( m_module, "Chromecast seeking possibly done");
+                vlc_cond_signal( &m_seekCommandCond );
             }
 
-            if ( (cmd_status != CMD_LOAD_SENT || idleReason == "CANCELLED") && receiverState == RECEIVER_IDLE && has_input )
+            if ( (m_cmd_status != CMD_LOAD_SENT || idleReason == "CANCELLED") && m_receiverState == RECEIVER_IDLE && m_has_input )
             {
-                msg_Dbg( p_module, "the device missed the LOAD command");
-                i_ts_local_start = VLC_TS_0;
-                m_communication.msgPlayerLoad( appTransportId, i_port, title, artwork, mime );
+                msg_Dbg( m_module, "the device missed the LOAD command");
+                m_ts_local_start = VLC_TS_0;
+                m_communication.msgPlayerLoad( m_appTransportId, m_streaming_port, m_title, m_artwork, m_mime );
                 setPlayerStatus(CMD_LOAD_SENT);
             }
         }
         else if (type == "LOAD_FAILED")
         {
-            msg_Err( p_module, "Media load failed");
-            vlc_mutex_locker locker(&lock);
+            msg_Err( m_module, "Media load failed");
+            vlc_mutex_locker locker(&m_lock);
             /* close the app to restart it */
-            if ( conn_status == CHROMECAST_APP_STARTED )
-                m_communication.msgReceiverClose(appTransportId);
+            if ( m_conn_status == CHROMECAST_APP_STARTED )
+                m_communication.msgReceiverClose(m_appTransportId);
             else
                 m_communication.msgReceiverGetStatus();
         }
         else if (type == "LOAD_CANCELLED")
         {
-            msg_Dbg( p_module, "LOAD canceled by another command");
+            msg_Dbg( m_module, "LOAD canceled by another command");
         }
         else if (type == "INVALID_REQUEST")
         {
-            msg_Dbg( p_module, "We sent an invalid request reason:%s", (*p_data)["reason"].operator const char *());
+            msg_Dbg( m_module, "We sent an invalid request reason:%s", (*p_data)["reason"].operator const char *());
         }
         else
         {
-            msg_Warn( p_module, "Media command not supported: %s",
+            msg_Warn( m_module, "Media command not supported: %s",
                     msg.payload_utf8().c_str());
         }
 
@@ -458,23 +458,23 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
 
         if (type == "CLOSE")
         {
-            msg_Warn( p_module, "received close message");
+            msg_Warn( m_module, "received close message");
             setHasInput( false );
-            vlc_mutex_locker locker(&lock);
+            vlc_mutex_locker locker(&m_lock);
             setConnectionStatus(CHROMECAST_CONNECTION_DEAD);
             // make sure we unblock the demuxer
             m_seek_request_time = VLC_TS_INVALID;
-            vlc_cond_signal(&seekCommandCond);
+            vlc_cond_signal(&m_seekCommandCond);
         }
         else
         {
-            msg_Warn( p_module, "Connection command not supported: %s",
+            msg_Warn( m_module, "Connection command not supported: %s",
                     type.c_str());
         }
     }
     else
     {
-        msg_Err( p_module, "Unknown namespace: %s", msg.namespace_().c_str());
+        msg_Err( m_module, "Unknown namespace: %s", msg.namespace_().c_str());
     }
 }
 
@@ -492,11 +492,11 @@ void* intf_sys_t::ChromecastThread(void* p_data)
 
 void intf_sys_t::mainLoop()
 {
-    vlc_interrupt_set( p_ctl_thread_interrupt );
+    vlc_interrupt_set( m_ctl_thread_interrupt );
 
-    vlc_mutex_lock(&lock);
+    vlc_mutex_lock(&m_lock);
     setConnectionStatus(CHROMECAST_TLS_CONNECTED);
-    vlc_mutex_unlock(&lock);
+    vlc_mutex_unlock(&m_lock);
 
     m_communication.msgAuth();
 
@@ -516,24 +516,24 @@ bool intf_sys_t::handleMessages()
     bool b_msgReceived = false;
     uint32_t i_payloadSize = 0;
 
-    if ( requested_stop.exchange(false) && !mediaSessionId.empty() )
+    if ( m_requested_stop.exchange(false) && !m_mediaSessionId.empty() )
     {
-        m_communication.msgPlayerStop( appTransportId, mediaSessionId );
+        m_communication.msgPlayerStop( m_appTransportId, m_mediaSessionId );
     }
 
-    if ( requested_seek.exchange(false) && !mediaSessionId.empty() )
+    if ( m_requested_seek.exchange(false) && !m_mediaSessionId.empty() )
     {
         char current_time[32];
         m_seek_request_time = mdate() + SEEK_FORWARD_OFFSET;
         if( snprintf( current_time, sizeof(current_time), "%.3f", double( m_seek_request_time ) / 1000000.0 ) >= (int)sizeof(current_time) )
         {
-            msg_Err( p_module, "snprintf() truncated string for mediaSessionId" );
+            msg_Err( m_module, "snprintf() truncated string for mediaSessionId" );
             current_time[sizeof(current_time) - 1] = '\0';
         }
-        vlc_mutex_locker locker(&lock);
+        vlc_mutex_locker locker(&m_lock);
         setPlayerStatus(CMD_SEEK_SENT);
         /* send a fake time to seek to, to make sure the device flushes its buffers */
-        m_communication.msgPlayerSeek( appTransportId, mediaSessionId, current_time );
+        m_communication.msgPlayerSeek( m_appTransportId, m_mediaSessionId, current_time );
     }
 
     int i_ret = m_communication.recvPacket( &b_msgReceived, i_payloadSize,
@@ -547,8 +547,8 @@ bool intf_sys_t::handleMessages()
     if ((i_ret < 0 && errno != EAGAIN) || i_ret == 0)
 #endif
     {
-        msg_Err( p_module, "The connection to the Chromecast died (receiving).");
-        vlc_mutex_locker locker(&lock);
+        msg_Err( m_module, "The connection to the Chromecast died (receiving).");
+        vlc_mutex_locker locker(&m_lock);
         setConnectionStatus(CHROMECAST_CONNECTION_DEAD);
     }
 
@@ -565,47 +565,47 @@ bool intf_sys_t::handleMessages()
         processMessage(msg);
     }
 
-    vlc_mutex_locker locker(&lock);
-    return conn_status != CHROMECAST_CONNECTION_DEAD;
+    vlc_mutex_locker locker(&m_lock);
+    return m_conn_status != CHROMECAST_CONNECTION_DEAD;
 }
 
 void intf_sys_t::notifySendRequest()
 {
-    vlc_interrupt_raise( p_ctl_thread_interrupt );
+    vlc_interrupt_raise( m_ctl_thread_interrupt );
 }
 
 void intf_sys_t::requestPlayerStop()
 {
-    requested_stop = true;
+    m_requested_stop = true;
     setHasInput(false);
     notifySendRequest();
 }
 
 void intf_sys_t::requestPlayerSeek(mtime_t pos)
 {
-    vlc_mutex_locker locker(&lock);
+    vlc_mutex_locker locker(&m_lock);
     if ( pos != VLC_TS_INVALID )
-        i_ts_local_start = pos;
-    requested_seek = true;
+        m_ts_local_start = pos;
+    m_requested_seek = true;
     notifySendRequest();
 }
 
 void intf_sys_t::setPauseState(bool paused)
 {
-    msg_Dbg( p_module, "%s state for %s", paused ? "paused" : "playing", title.c_str() );
+    msg_Dbg( m_module, "%s state for %s", paused ? "paused" : "playing", m_title.c_str() );
     if ( !paused )
     {
-        if ( !mediaSessionId.empty() && receiverState != RECEIVER_IDLE )
+        if ( !m_mediaSessionId.empty() && m_receiverState != RECEIVER_IDLE )
         {
-            m_communication.msgPlayerPlay( appTransportId, mediaSessionId );
+            m_communication.msgPlayerPlay( m_appTransportId, m_mediaSessionId );
             setPlayerStatus(CMD_PLAYBACK_SENT);
         }
     }
     else
     {
-        if ( !mediaSessionId.empty() && receiverState != RECEIVER_IDLE )
+        if ( !m_mediaSessionId.empty() && m_receiverState != RECEIVER_IDLE )
         {
-            m_communication.msgPlayerPause( appTransportId, mediaSessionId );
+            m_communication.msgPlayerPause( m_appTransportId, m_mediaSessionId );
             setPlayerStatus(CMD_PLAYBACK_SENT);
         }
     }
@@ -613,29 +613,29 @@ void intf_sys_t::setPauseState(bool paused)
 
 void intf_sys_t::waitAppStarted()
 {
-    vlc_mutex_locker locker(&lock);
-    mutex_cleanup_push(&lock);
-    while ( conn_status != CHROMECAST_APP_STARTED &&
-            conn_status != CHROMECAST_CONNECTION_DEAD )
-        vlc_cond_wait(&loadCommandCond, &lock);
+    vlc_mutex_locker locker(&m_lock);
+    mutex_cleanup_push(&m_lock);
+    while ( m_conn_status != CHROMECAST_APP_STARTED &&
+            m_conn_status != CHROMECAST_CONNECTION_DEAD )
+        vlc_cond_wait(&m_loadCommandCond, &m_lock);
     vlc_cleanup_pop();
 }
 
 void intf_sys_t::waitSeekDone()
 {
-    vlc_mutex_locker locker(&lock);
+    vlc_mutex_locker locker(&m_lock);
     if ( m_seek_request_time != VLC_TS_INVALID )
     {
-        mutex_cleanup_push(&lock);
+        mutex_cleanup_push(&m_lock);
         while ( m_chromecast_start_time < m_seek_request_time &&
-                conn_status == CHROMECAST_APP_STARTED )
+                m_conn_status == CHROMECAST_APP_STARTED )
         {
 #ifndef NDEBUG
-            msg_Dbg( p_module, "waiting for Chromecast seek" );
+            msg_Dbg( m_module, "waiting for Chromecast seek" );
 #endif
-            vlc_cond_wait(&seekCommandCond, &lock);
+            vlc_cond_wait(&m_seekCommandCond, &m_lock);
 #ifndef NDEBUG
-            msg_Dbg( p_module, "finished waiting for Chromecast seek" );
+            msg_Dbg( m_module, "finished waiting for Chromecast seek" );
 #endif
         }
         vlc_cleanup_pop();
@@ -645,93 +645,93 @@ void intf_sys_t::waitSeekDone()
 
 void intf_sys_t::setConnectionStatus(connection_status status)
 {
-    if (conn_status != status)
+    if (m_conn_status != status)
     {
 #ifndef NDEBUG
-        msg_Dbg(p_module, "change Chromecast connection status from %d to %d", conn_status, status);
+        msg_Dbg(m_module, "change Chromecast connection status from %d to %d", m_conn_status, status);
 #endif
-        conn_status = status;
-        vlc_cond_broadcast(&loadCommandCond);
-        vlc_cond_signal(&seekCommandCond);
+        m_conn_status = status;
+        vlc_cond_broadcast(&m_loadCommandCond);
+        vlc_cond_signal(&m_seekCommandCond);
     }
 }
 
 bool intf_sys_t::isFinishedPlaying()
 {
-    vlc_mutex_locker locker(&lock);
-    return conn_status == CHROMECAST_CONNECTION_DEAD || (receiverState == RECEIVER_BUFFERING && cmd_status != CMD_SEEK_SENT);
+    vlc_mutex_locker locker(&m_lock);
+    return m_conn_status == CHROMECAST_CONNECTION_DEAD || (m_receiverState == RECEIVER_BUFFERING && m_cmd_status != CMD_SEEK_SENT);
 }
 
 void intf_sys_t::setTitle(const char* psz_title)
 {
     if ( psz_title )
-        title = psz_title;
+        m_title = psz_title;
     else
-        title = "";
+        m_title = "";
 }
 
 void intf_sys_t::setArtwork(const char* psz_artwork)
 {
     if ( psz_artwork )
-        artwork = psz_artwork;
+        m_artwork = psz_artwork;
     else
-        artwork = "";
+        m_artwork = "";
 }
 
 void intf_sys_t::setPlayerStatus(command_status status)
 {
-    if (cmd_status != status)
+    if (m_cmd_status != status)
     {
-        msg_Dbg(p_module, "change Chromecast command status from %d to %d", cmd_status, status);
-        cmd_status = status;
+        msg_Dbg(m_module, "change Chromecast command status from %d to %d", m_cmd_status, status);
+        m_cmd_status = status;
     }
 }
 
 mtime_t intf_sys_t::getPlaybackTimestamp() const
 {
-    switch( receiverState )
+    switch( m_receiverState )
     {
     case RECEIVER_PLAYING:
-        return ( mdate() - m_time_playback_started ) + i_ts_local_start;
+        return ( mdate() - m_time_playback_started ) + m_ts_local_start;
 
     case RECEIVER_IDLE:
-        msg_Dbg(p_module, "receiver idle using buffering time %" PRId64, i_ts_local_start);
+        msg_Dbg(m_module, "receiver idle using buffering time %" PRId64, m_ts_local_start);
         break;
     case RECEIVER_BUFFERING:
-        msg_Dbg(p_module, "receiver buffering using buffering time %" PRId64, i_ts_local_start);
+        msg_Dbg(m_module, "receiver buffering using buffering time %" PRId64, m_ts_local_start);
         break;
     case RECEIVER_PAUSED:
-        msg_Dbg(p_module, "receiver paused using buffering time %" PRId64, i_ts_local_start);
+        msg_Dbg(m_module, "receiver paused using buffering time %" PRId64, m_ts_local_start);
         break;
     }
-    return i_ts_local_start;
+    return m_ts_local_start;
 }
 
 double intf_sys_t::getPlaybackPosition() const
 {
-    if( i_length > 0 && m_time_playback_started != VLC_TS_INVALID)
-        return (double) getPlaybackTimestamp() / (double)( i_length );
+    if( m_length > 0 && m_time_playback_started != VLC_TS_INVALID)
+        return (double) getPlaybackTimestamp() / (double)( m_length );
     return 0.0;
 }
 
 mtime_t intf_sys_t::get_time(void *pt)
 {
     intf_sys_t *p_this = reinterpret_cast<intf_sys_t*>(pt);
-    vlc_mutex_locker locker( &p_this->lock );
+    vlc_mutex_locker locker( &p_this->m_lock );
     return p_this->getPlaybackTimestamp();
 }
 
 double intf_sys_t::get_position(void *pt)
 {
     intf_sys_t *p_this = reinterpret_cast<intf_sys_t*>(pt);
-    vlc_mutex_locker locker( &p_this->lock );
+    vlc_mutex_locker locker( &p_this->m_lock );
     return p_this->getPlaybackPosition();
 }
 
 void intf_sys_t::set_length(void *pt, mtime_t length)
 {
     intf_sys_t *p_this = reinterpret_cast<intf_sys_t*>(pt);
-    p_this->i_length = length;
+    p_this->m_length = length;
 }
 
 void intf_sys_t::wait_app_started(void *pt)



More information about the vlc-commits mailing list