summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qt/qgstplayer.cpp17
-rw-r--r--qt/qgstplayer.h6
2 files changed, 21 insertions, 2 deletions
diff --git a/qt/qgstplayer.cpp b/qt/qgstplayer.cpp
index 4fcc975..8117b74 100644
--- a/qt/qgstplayer.cpp
+++ b/qt/qgstplayer.cpp
@@ -340,6 +340,7 @@ Player::Player(QObject *parent, VideoRenderer *renderer)
, mediaInfo_()
, videoAvailable_(false)
, subtitleEnabled_(false)
+ , autoPlay_(false)
{
player_ = gst_player_new_full(renderer ? renderer->renderer() : 0,
@@ -443,9 +444,25 @@ Player::onMediaInfoUpdated(Player *player, GstPlayerMediaInfo *media_info)
emit player->mediaInfoChanged();
}
+
+bool Player::autoPlay() const
+{
+ return autoPlay_;
+}
+
+void Player::setAutoPlay(bool auto_play)
+{
+ autoPlay_ = auto_play;
+
+ if (autoPlay_) {
+ connect(this, SIGNAL(endOfStream()), SLOT(next()));
+ }
+}
+
QUrl Player::source() const
{
Q_ASSERT(player_ != 0);
+
QString url = QString::fromLocal8Bit(gst_player_get_uri(player_));
return QUrl(url);
diff --git a/qt/qgstplayer.h b/qt/qgstplayer.h
index c060bc9..afbefd4 100644
--- a/qt/qgstplayer.h
+++ b/qt/qgstplayer.h
@@ -57,6 +57,7 @@ class Player : public QObject
Q_PROPERTY(QVariant currentSubtitle READ currentSubtitle WRITE setCurrentSubtitle)
Q_PROPERTY(bool subtitleEnabled READ isSubtitleEnabled WRITE setSubtitleEnabled
NOTIFY subtitleEnabledChanged)
+ Q_PROPERTY(bool autoPlay READ autoPlay WRITE setAutoPlay)
Q_ENUMS(State)
@@ -89,12 +90,11 @@ public:
QVariant currentSubtitle() const;
bool isSubtitleEnabled() const;
quint32 positionUpdateInterval() const;
-
+ bool autoPlay() const;
signals:
void stateChanged(State new_state);
void bufferingChanged(int percent);
- void enfOfStream();
void positionUpdated(qint64 new_position);
void durationChanged(qint64 duration);
void resolutionChanged(QSize resolution);
@@ -119,6 +119,7 @@ public slots:
void setCurrentSubtitle(QVariant track);
void setSubtitleEnabled(bool enabled);
void setPositionUpdateInterval(quint32 interval);
+ void setAutoPlay(bool auto_play);
private:
Q_DISABLE_COPY(Player)
@@ -137,6 +138,7 @@ private:
MediaInfo *mediaInfo_;
bool videoAvailable_;
bool subtitleEnabled_;
+ bool autoPlay_;
};
class VideoRenderer