[vlc-commits] [Git][videolan/vlc][master] qt: properly handle VLC_PLAYER_VOUT_STOPPED

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Sep 6 18:00:27 UTC 2024



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
e1560198 by Fatih Uzunoglu at 2024-09-06T17:34:53+00:00
qt: properly handle VLC_PLAYER_VOUT_STOPPED

When last vout stops, a dummy vout is created.
For the interface, this has no relevance and
"has video" property should be set to false.

- - - - -


2 changed files:

- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller_p.hpp


Changes:

=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -205,11 +205,17 @@ void PlayerControllerPrivate::UpdateInfo( input_item_t *p_item )
     emit q->infoChanged( p_item );
 }
 
-void PlayerControllerPrivate::UpdateVouts(vout_thread_t **vouts, size_t i_vouts)
+void PlayerControllerPrivate::UpdateVouts(vout_thread_t **vouts, size_t i_vouts, enum vlc_player_vout_action action)
 {
     Q_Q(PlayerController);
     bool hadVideo = m_hasVideo;
-    m_hasVideo = i_vouts > 0;
+
+    if (action == VLC_PLAYER_VOUT_STARTED)
+        ++m_vout_ref;
+    else if (action == VLC_PLAYER_VOUT_STOPPED)
+        --m_vout_ref;
+    assert(m_vout_ref >= 0);
+    m_hasVideo = (m_vout_ref > 0);
 
     vout_thread_t* main_vout = nullptr;
     if (m_hasVideo)
@@ -777,7 +783,7 @@ static void on_player_subitems_changed(vlc_player_t *, input_item_t *, input_ite
 }
 
 
-static void on_player_vout_changed(vlc_player_t *player, enum vlc_player_vout_action,
+static void on_player_vout_changed(vlc_player_t *player, enum vlc_player_vout_action action,
     vout_thread_t *, enum vlc_vout_order order, vlc_es_id_t *es_id, void *data)
 {
     PlayerControllerPrivate* that = static_cast<PlayerControllerPrivate*>(data);
@@ -798,8 +804,8 @@ static void on_player_vout_changed(vlc_player_t *player, enum vlc_player_vout_ac
             });
 
             //call on object thread
-            that->callAsync([that,voutsPtr,i_vout] () {
-                that->UpdateVouts(voutsPtr.get(), i_vout);
+            that->callAsync([that,voutsPtr,i_vout,action] () {
+                that->UpdateVouts(voutsPtr.get(), i_vout, action);
             });
             break;
         }


=====================================
modules/gui/qt/player/player_controller_p.hpp
=====================================
@@ -45,7 +45,7 @@ public:
     void UpdateInfo( input_item_t *p_item );
     void UpdateStats( const input_stats_t& stats );
     void UpdateProgram(vlc_player_list_action action, const vlc_player_program *prgm);
-    void UpdateVouts(vout_thread_t **vouts, size_t i_vouts);
+    void UpdateVouts(vout_thread_t **vouts, size_t i_vouts, vlc_player_vout_action action);
     void UpdateTrackSelection(vlc_es_id_t *trackid, bool selected);
     void UpdateSpuOrder(vlc_es_id_t *es_id, enum vlc_vout_order spu_order);
     int interpolateTime(vlc_tick_t system_now);
@@ -148,6 +148,7 @@ public:
     bool            m_hasVideo = false;
     bool            m_fullscreen = false;
     bool            m_wallpaperMode = false;
+    int m_vout_ref = 0;
 
     //aout properties
     VLCVarChoiceModel m_audioStereoMode;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e1560198776438c3b75070159d5beaeb38240a57

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e1560198776438c3b75070159d5beaeb38240a57
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list