[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: add some item meta properties to PlayerController

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Nov 17 09:09:40 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
b6b3104e by Fatih Uzunoglu at 2022-11-17T08:48:45+00:00
qt: add some item meta properties to PlayerController

- - - - -
d86694a7 by Fatih Uzunoglu at 2022-11-17T08:48:45+00:00
qml: use Player in ArtworkInfoWidget

- - - - -


4 changed files:

- modules/gui/qt/player/player_controller.cpp
- modules/gui/qt/player/player_controller.hpp
- modules/gui/qt/player/player_controller_p.hpp
- modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml


Changes:

=====================================
modules/gui/qt/player/player_controller.cpp
=====================================
@@ -186,6 +186,21 @@ void PlayerControllerPrivate::UpdateTrackSelection(vlc_es_id_t *trackid, bool se
 void PlayerControllerPrivate::UpdateMeta( input_item_t *p_item )
 {
     Q_Q(PlayerController);
+
+    {
+        vlc_mutex_lock(&p_item->lock);
+
+        if (p_item->p_meta)
+        {
+            m_title   = vlc_meta_Get(p_item->p_meta, vlc_meta_Title);
+            m_artist  = vlc_meta_Get(p_item->p_meta, vlc_meta_Artist);
+            m_album   = vlc_meta_Get(p_item->p_meta, vlc_meta_Album);
+            m_artwork = vlc_meta_Get(p_item->p_meta, vlc_meta_ArtworkURL);
+        }
+
+        vlc_mutex_unlock(&p_item->lock);
+    }
+
     emit q->currentMetaChanged( p_item  );
 }
 
@@ -1991,6 +2006,10 @@ PRIMITIVETYPE_GETTER(bool, isTeletextEnabled, m_teletextEnabled)
 PRIMITIVETYPE_GETTER(bool, isTeletextAvailable, m_teletextAvailable)
 PRIMITIVETYPE_GETTER(int, getTeletextPage, m_teletextPage)
 PRIMITIVETYPE_GETTER(bool, getTeletextTransparency, m_teletextTransparent)
+PRIMITIVETYPE_GETTER(QString, getTitle, m_title)
+PRIMITIVETYPE_GETTER(QString, getArtist, m_artist)
+PRIMITIVETYPE_GETTER(QString, getAlbum, m_album)
+PRIMITIVETYPE_GETTER(QUrl, getArtwork, m_artwork)
 
 // High resolution time fed by SMPTE timer
 PRIMITIVETYPE_GETTER(QString, highResolutionTime, m_highResolutionTime)


=====================================
modules/gui/qt/player/player_controller.hpp
=====================================
@@ -27,6 +27,7 @@
 #include <QObject>
 #include <QEvent>
 #include <QScopedPointer>
+#include <QUrl>
 #include <vlc_cxx_helpers.hpp>
 #include "player/input_models.hpp"
 #include "util/audio_device_model.hpp"
@@ -126,6 +127,12 @@ public:
 
     Q_PROPERTY(bool canRestorePlayback READ canRestorePlayback NOTIFY playbackRestoreQueried FINAL)
 
+    // meta
+    Q_PROPERTY(QString title READ getTitle NOTIFY currentMetaChanged FINAL)
+    Q_PROPERTY(QString artist READ getArtist NOTIFY currentMetaChanged FINAL)
+    Q_PROPERTY(QString album READ getAlbum NOTIFY currentMetaChanged FINAL)
+    Q_PROPERTY(QUrl artwork READ getArtwork NOTIFY currentMetaChanged FINAL)
+
     //tracks
     Q_PROPERTY(TrackListModel* videoTracks READ getVideoTracks CONSTANT FINAL)
     Q_PROPERTY(TrackListModel* audioTracks READ getAudioTracks CONSTANT FINAL)
@@ -379,6 +386,12 @@ public slots:
     // returns true on success
     bool associateSubtitleFile(const QString &uri);
 
+    // meta
+    QString getTitle() const;
+    QString getArtist() const;
+    QString getAlbum() const;
+    QUrl getArtwork() const;
+
 signals:
     //playback
     void playingStateChanged( PlayingState state );


=====================================
modules/gui/qt/player/player_controller_p.hpp
=====================================
@@ -25,6 +25,7 @@
 #include "util/varchoicemodel.hpp"
 
 #include <QTimer>
+#include <QUrl>
 
 class PlayerControllerPrivate {
     Q_DISABLE_COPY(PlayerControllerPrivate)
@@ -166,6 +167,11 @@ public:
     QString         m_artUrl;
     struct input_stats_t m_stats;
 
+    // meta
+    QString m_title;
+    QString m_artist;
+    QString m_album;
+    QUrl m_artwork;
 };
 
 #endif /* QVLC_INPUT_MANAGER_P_H_ */


=====================================
modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
=====================================
@@ -103,9 +103,9 @@ AbstractButton {
 
                 source: {
                     if (!paintOnly
-                        && mainPlaylistController.currentItem.artwork
-                        && mainPlaylistController.currentItem.artwork.toString())
-                        mainPlaylistController.currentItem.artwork
+                        && Player.artwork
+                        && Player.artwork.toString())
+                        Player.artwork
                     else
                         VLCStyle.noArtAlbumCover
                 }
@@ -142,7 +142,7 @@ AbstractButton {
                     if (paintOnly)
                         I18n.qtr("Title")
                     else
-                        mainPlaylistController.currentItem.title
+                        Player.title
                 }
                 color: colors.text
             }
@@ -157,7 +157,7 @@ AbstractButton {
                     if (paintOnly)
                         I18n.qtr("Artist")
                     else
-                        mainPlaylistController.currentItem.artist
+                        Player.artist
                 }
                 color: colors.menuCaption
             }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/444d5268d9ec662a93fc076cf77168c1e41cc54d...d86694a763a680f5b11faffec7712da81963470a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/444d5268d9ec662a93fc076cf77168c1e41cc54d...d86694a763a680f5b11faffec7712da81963470a
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