[vlc-devel] [PATCH V3 19/19] WIP: qt: use the SMPTE Timecode as time widget
Thomas Guillem
thomas at gllm.fr
Fri Sep 6 17:20:49 CEST 2019
This commit should not be merged in the current state. This new SMPTE Timecode
widget should be enabled by the user in some advanced settings.
---
.../gui/qt/components/player_controller.cpp | 20 +++++++++++++++++++
.../gui/qt/components/player_controller.hpp | 5 +++++
.../gui/qt/components/player_controller_p.hpp | 1 +
modules/gui/qt/qml/player/ControlBar.qml | 2 +-
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/modules/gui/qt/components/player_controller.cpp b/modules/gui/qt/components/player_controller.cpp
index 54b18f8c71..816f173e54 100644
--- a/modules/gui/qt/components/player_controller.cpp
+++ b/modules/gui/qt/components/player_controller.cpp
@@ -61,6 +61,7 @@ PlayerControllerPrivate::~PlayerControllerPrivate()
vlc_player_aout_RemoveListener( m_player, m_player_aout_listener );
vlc_player_RemoveListener( m_player, m_player_listener );
vlc_player_RemoveTimer( m_player, m_player_timer );
+ vlc_player_RemoveTimer( m_player, m_player_timer_smpte );
}
void PlayerControllerPrivate::UpdateName(input_item_t* media)
@@ -817,6 +818,18 @@ static void on_player_corks_changed(vlc_player_t *, unsigned, void *data)
msg_Dbg( that->p_intf, "on_player_corks_changed");
}
+static void on_player_timer_smpte_update(const struct vlc_player_timer_smpte_timecode *tcp,
+ void *data)
+{
+ PlayerControllerPrivate* that = static_cast<PlayerControllerPrivate*>(data);
+ that->callAsync([that,tc = *tcp](){
+ PlayerController* q = that->q_func();
+
+ that->m_smpte_tc = tc;
+ emit q->smpteTCChanged(that->m_smpte_tc);
+ });
+}
+
static void on_player_timer_update(enum vlc_player_timer_state state,
const struct vlc_player_timer_point *point,
void *data)
@@ -917,6 +930,10 @@ static const struct vlc_player_timer_cbs player_timer_cbs = {
on_player_timer_update,
};
+static const struct vlc_player_timer_smpte_cbs player_timer_smpte_cbs = {
+ on_player_timer_smpte_update,
+};
+
PlayerControllerPrivate::PlayerControllerPrivate(PlayerController *playercontroller, intf_thread_t *p_intf)
: q_ptr(playercontroller)
, p_intf(p_intf)
@@ -943,6 +960,7 @@ PlayerControllerPrivate::PlayerControllerPrivate(PlayerController *playercontrol
m_player_aout_listener = vlc_player_aout_AddListener( m_player, &player_aout_cbs, this );
m_player_vout_listener = vlc_player_vout_AddListener( m_player, &player_vout_cbs, this );
m_player_timer = vlc_player_AddTimer( m_player, VLC_TICK_FROM_MS(250), &player_timer_cbs, this );
+ m_player_timer_smpte = vlc_player_AddSmpteTimer( m_player, &player_timer_smpte_cbs, this );
}
QObject::connect( &m_autoscale, &QVLCBool::valueChanged, q_ptr, &PlayerController::autoscaleChanged );
@@ -1402,6 +1420,7 @@ void PlayerController::interpolateTime()
}
}
+
//MISC
void PlayerController::setABloopState(ABLoopState state)
@@ -1587,6 +1606,7 @@ QABSTRACTLIST_GETTER( VLCVarChoiceModel, getAudioVisualizations, m_audioVisualiz
PRIMITIVETYPE_GETTER(PlayerController::PlayingState, getPlayingState, m_playing_status)
PRIMITIVETYPE_GETTER(QString, getName, m_name)
PRIMITIVETYPE_GETTER(VLCTick, getTime, m_time)
+PRIMITIVETYPE_GETTER(VLCSmpteTC, getSmpteTC, m_smpte_tc)
PRIMITIVETYPE_GETTER(VLCTick, getRemainingTime, m_remainingTime)
PRIMITIVETYPE_GETTER(float, getPosition, m_position)
PRIMITIVETYPE_GETTER(VLCTick, getLength, m_length)
diff --git a/modules/gui/qt/components/player_controller.hpp b/modules/gui/qt/components/player_controller.hpp
index 7fa0d97547..e0c72e2bdb 100644
--- a/modules/gui/qt/components/player_controller.hpp
+++ b/modules/gui/qt/components/player_controller.hpp
@@ -33,6 +33,7 @@
#include "components/audio_device_model.hpp"
#include "adapters/var_choice_model.hpp"
#include "util/vlctick.hpp"
+#include "util/vlcsmptetc.hpp"
class QSignalMapper;
@@ -120,6 +121,8 @@ public:
Q_PROPERTY(float position READ getPosition WRITE setPosition NOTIFY positionChanged)
Q_PROPERTY(VLCTick length READ getLength NOTIFY lengthChanged)
+ Q_PROPERTY(VLCSmpteTC smpteTC READ getSmpteTC NOTIFY smpteTCChanged)
+
Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged)
Q_PROPERTY(bool rewindable READ isRewindable NOTIFY rewindableChanged)
Q_PROPERTY(bool pausable READ isPausable NOTIFY pausableChanged)
@@ -260,6 +263,7 @@ public slots:
MediaStopAction getMediaStopAction() const;
void setMediaStopAction(MediaStopAction );
VLCTick getTime() const;
+ VLCSmpteTC getSmpteTC() const;
void setTime(VLCTick);
VLCTick getRemainingTime() const;
float getPosition() const;
@@ -350,6 +354,7 @@ signals:
void mediaStopActionChanged( MediaStopAction );
void timeChanged( VLCTick );
+ void smpteTCChanged( VLCSmpteTC );
void remainingTimeChanged( VLCTick );
void positionChanged( float );
void lengthChanged( VLCTick );
diff --git a/modules/gui/qt/components/player_controller_p.hpp b/modules/gui/qt/components/player_controller_p.hpp
index ea82ad5c61..5625404e00 100644
--- a/modules/gui/qt/components/player_controller_p.hpp
+++ b/modules/gui/qt/components/player_controller_p.hpp
@@ -101,6 +101,7 @@ public:
struct vlc_player_timer_point m_player_time;
enum vlc_player_timer_state m_player_time_state = VLC_PLAYER_TIMER_STATE_DISCONTINUITY;
QTimer m_interpolate_timer;
+ VLCSmpteTC m_smpte_tc;
//title/chapters/menu
TitleListModel m_titleList;
diff --git a/modules/gui/qt/qml/player/ControlBar.qml b/modules/gui/qt/qml/player/ControlBar.qml
index 7921a914a1..1219bd47c7 100644
--- a/modules/gui/qt/qml/player/ControlBar.qml
+++ b/modules/gui/qt/qml/player/ControlBar.qml
@@ -49,7 +49,7 @@ Utils.NavigableFocusScope {
RowLayout {
Text {
- text: player.time.toString()
+ text: player.smpteTC.toString()
color: VLCStyle.colors.playerFg
font.pixelSize: VLCStyle.fontSize_normal
font.bold: true
--
2.20.1
More information about the vlc-devel
mailing list