[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: add subtitleDesc to mlvideo
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Jun 23 12:09:17 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
1a2e3315 by Prince Gupta at 2024-06-23T11:47:06+00:00
qt: add subtitleDesc to mlvideo
- - - - -
4c349437 by Prince Gupta at 2024-06-23T11:47:06+00:00
qt: add subtitleDesc property to items of MLVideoModel
- - - - -
5068b5ab by Prince Gupta at 2024-06-23T11:47:06+00:00
qml: show subtitle tracks for media in video expand panel
- - - - -
5 changed files:
- modules/gui/qt/medialibrary/mlvideo.cpp
- modules/gui/qt/medialibrary/mlvideo.hpp
- modules/gui/qt/medialibrary/mlvideomodel.cpp
- modules/gui/qt/medialibrary/mlvideomodel.hpp
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
Changes:
=====================================
modules/gui/qt/medialibrary/mlvideo.cpp
=====================================
@@ -119,6 +119,13 @@ MLVideo::MLVideo(const vlc_ml_media_t* data)
QString::fromUtf8( track.psz_language ) ,
track.v.i_fpsNum }
);
+ } else if ( track.i_type == VLC_ML_TRACK_TYPE_SUBTITLE )
+ {
+ m_subtitleDesc.emplaceBack( qfu(track.psz_codec)
+ , qfu(track.psz_language)
+ , qfu(track.psz_description)
+ , qfu(track.s.psz_encoding)
+ );
}
}
@@ -226,7 +233,41 @@ QList<VideoDescription> MLVideo::getVideoDesc() const
return m_videoDesc;
}
+QList<SubtitleDescription> MLVideo::getSubtitleDesc() const
+{
+ return m_subtitleDesc;
+}
+
QList<AudioDescription> MLVideo::getAudioDesc() const
{
return m_audioDesc;
}
+
+SubtitleDescription::SubtitleDescription(const QString &codec, const QString &language
+ , const QString &description, const QString &encoding)
+ : m_codec {codec}
+ , m_language {language}
+ , m_description {description}
+ , m_encoding {encoding}
+{
+}
+
+QString SubtitleDescription::getCodec() const
+{
+ return m_codec;
+}
+
+QString SubtitleDescription::getLanguage() const
+{
+ return m_language;
+}
+
+QString SubtitleDescription::getDescription() const
+{
+ return m_description;
+}
+
+QString SubtitleDescription::getEncoding() const
+{
+ return m_encoding;
+}
=====================================
modules/gui/qt/medialibrary/mlvideo.hpp
=====================================
@@ -83,6 +83,32 @@ private:
unsigned int m_sampleRate;
};
+class SubtitleDescription
+{
+ Q_GADGET
+
+ Q_PROPERTY(QString codec READ getCodec CONSTANT FINAL)
+ Q_PROPERTY(QString language READ getLanguage CONSTANT FINAL)
+ Q_PROPERTY(QString description READ getDescription CONSTANT FINAL)
+ Q_PROPERTY(QString encoding READ getEncoding CONSTANT FINAL)
+
+public:
+ SubtitleDescription() = default;
+ SubtitleDescription(const QString& codec, const QString& language
+ , const QString &description, const QString &encoding);
+
+ QString getCodec() const;
+ QString getLanguage() const;
+ QString getDescription() const;
+ QString getEncoding() const;
+
+private:
+ QString m_codec;
+ QString m_language;
+ QString m_description;
+ QString m_encoding;
+};
+
class MLVideo : public MLItem
{
public:
@@ -106,6 +132,7 @@ public:
VLCTick getProgressTime() const;
QList<AudioDescription> getAudioDesc() const;
QList<VideoDescription> getVideoDesc() const;
+ QList<SubtitleDescription> getSubtitleDesc() const;
private:
bool m_isNew;
@@ -123,6 +150,7 @@ private:
vlc_ml_thumbnail_status_t m_thumbnailStatus;
QList<AudioDescription> m_audioDesc;
QList<VideoDescription> m_videoDesc;
+ QList<SubtitleDescription> m_subtitleDesc;
};
#endif // MLVIDEO_H
=====================================
modules/gui/qt/medialibrary/mlvideomodel.cpp
=====================================
@@ -143,6 +143,8 @@ QVariant MLVideoModel::itemRoleData(MLItem *item, int role) const
return getVariantList( video->getVideoDesc() );
case VIDEO_AUDIO_TRACK:
return getVariantList( video->getAudioDesc() );
+ case VIDEO_SUBTITLE_TRACK:
+ return getVariantList( video->getSubtitleDesc() );
case VIDEO_TITLE_FIRST_SYMBOL:
return QVariant::fromValue( getFirstSymbol( video->getTitle() ) );
@@ -170,6 +172,7 @@ QHash<int, QByteArray> MLVideoModel::roleNames() const
{ VIDEO_DISPLAY_MRL, "display_mrl" },
{ VIDEO_AUDIO_TRACK, "audioDesc" },
{ VIDEO_VIDEO_TRACK, "videoDesc" },
+ { VIDEO_SUBTITLE_TRACK, "subtitleDesc" },
{ VIDEO_TITLE_FIRST_SYMBOL, "title_first_symbol"},
};
}
=====================================
modules/gui/qt/medialibrary/mlvideomodel.hpp
=====================================
@@ -53,6 +53,7 @@ public:
VIDEO_DISPLAY_MRL,
VIDEO_VIDEO_TRACK,
VIDEO_AUDIO_TRACK,
+ VIDEO_SUBTITLE_TRACK,
VIDEO_TITLE_FIRST_SYMBOL,
};
=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -274,6 +274,17 @@ FocusScope {
{text: qsTr("Channel:"), role: "nbchannels" }
]
}
+
+ DescriptionList {
+ title: qsTr("Subtitle track")
+
+ sourceModel: [{"text": root.model.subtitleDesc?.map(desc => desc.language)
+ .filter(l => !!l).join(", ")}]
+
+ delegateModel: [
+ {text: qsTr("Language:"), role: "text" }
+ ]
+ }
}
}
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7b2e9c21a0c15a98a9752d59e8cc7e64cfadd60a...5068b5ab6ee05364e8473128d3f7e7667a78d479
--
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7b2e9c21a0c15a98a9752d59e8cc7e64cfadd60a...5068b5ab6ee05364e8473128d3f7e7667a78d479
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