mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 13:21:28 +00:00
playback/player: qt: add position update interval property
This commit is contained in:
parent
13156a713d
commit
3542cae138
3 changed files with 23 additions and 3 deletions
|
@ -42,6 +42,7 @@ ApplicationWindow {
|
||||||
id: player
|
id: player
|
||||||
objectName: "player"
|
objectName: "player"
|
||||||
volume: 0.5
|
volume: 0.5
|
||||||
|
positionUpdateInterval: 100
|
||||||
onStateChanged: {
|
onStateChanged: {
|
||||||
if (state === Player.STOPPED) {
|
if (state === Player.STOPPED) {
|
||||||
playbutton.state = "play"
|
playbutton.state = "play"
|
||||||
|
|
|
@ -307,6 +307,13 @@ bool Player::isSubtitleEnabled() const
|
||||||
return subtitleEnabled_;
|
return subtitleEnabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quint32 Player::positionUpdateInterval() const
|
||||||
|
{
|
||||||
|
Q_ASSERT(player_ != 0);
|
||||||
|
|
||||||
|
return gst_player_get_position_update_interval(player_);
|
||||||
|
}
|
||||||
|
|
||||||
void Player::setSubtitleEnabled(bool enabled)
|
void Player::setSubtitleEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
Q_ASSERT(player_ != 0);
|
Q_ASSERT(player_ != 0);
|
||||||
|
@ -318,6 +325,13 @@ void Player::setSubtitleEnabled(bool enabled)
|
||||||
emit subtitleEnabledChanged(enabled);
|
emit subtitleEnabledChanged(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::setPositionUpdateInterval(quint32 interval)
|
||||||
|
{
|
||||||
|
Q_ASSERT(player_ != 0);
|
||||||
|
|
||||||
|
gst_player_set_position_update_interval(player_, interval);
|
||||||
|
}
|
||||||
|
|
||||||
Player::Player(QObject *parent, VideoRenderer *renderer)
|
Player::Player(QObject *parent, VideoRenderer *renderer)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, player_()
|
, player_()
|
||||||
|
@ -356,7 +370,7 @@ Player::onStateChanged(Player * player, GstPlayerState state)
|
||||||
void
|
void
|
||||||
Player::onPositionUpdated(Player * player, GstClockTime position)
|
Player::onPositionUpdated(Player * player, GstClockTime position)
|
||||||
{
|
{
|
||||||
emit player->positionChanged(position);
|
emit player->positionUpdated(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -42,7 +42,9 @@ class Player : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
|
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
|
||||||
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
|
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
|
||||||
Q_PROPERTY(qint64 position READ position NOTIFY positionChanged)
|
Q_PROPERTY(qint64 position READ position NOTIFY positionUpdated)
|
||||||
|
Q_PROPERTY(quint32 positionUpdateInterval READ positionUpdateInterval
|
||||||
|
WRITE setPositionUpdateInterval)
|
||||||
Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
||||||
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
|
||||||
Q_PROPERTY(int buffering READ buffering NOTIFY bufferingChanged)
|
Q_PROPERTY(int buffering READ buffering NOTIFY bufferingChanged)
|
||||||
|
@ -85,12 +87,14 @@ public:
|
||||||
QVariant currentAudio() const;
|
QVariant currentAudio() const;
|
||||||
QVariant currentSubtitle() const;
|
QVariant currentSubtitle() const;
|
||||||
bool isSubtitleEnabled() const;
|
bool isSubtitleEnabled() const;
|
||||||
|
quint32 positionUpdateInterval() const;
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void stateChanged(State new_state);
|
void stateChanged(State new_state);
|
||||||
void bufferingChanged(int percent);
|
void bufferingChanged(int percent);
|
||||||
void enfOfStream();
|
void enfOfStream();
|
||||||
void positionChanged(qint64 new_position);
|
void positionUpdated(qint64 new_position);
|
||||||
void durationChanged(qint64 duration);
|
void durationChanged(qint64 duration);
|
||||||
void resolutionChanged(QSize resolution);
|
void resolutionChanged(QSize resolution);
|
||||||
void volumeChanged(qreal volume);
|
void volumeChanged(qreal volume);
|
||||||
|
@ -113,6 +117,7 @@ public slots:
|
||||||
void setCurrentAudio(QVariant track);
|
void setCurrentAudio(QVariant track);
|
||||||
void setCurrentSubtitle(QVariant track);
|
void setCurrentSubtitle(QVariant track);
|
||||||
void setSubtitleEnabled(bool enabled);
|
void setSubtitleEnabled(bool enabled);
|
||||||
|
void setPositionUpdateInterval(quint32 interval);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(Player)
|
Q_DISABLE_COPY(Player)
|
||||||
|
|
Loading…
Reference in a new issue