forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QML Player supports changing notifyInterval
- Loading branch information
1 parent
cf2aaee
commit 6b28547
Showing
3 changed files
with
26 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/****************************************************************************** | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
|
@@ -98,6 +98,7 @@ class QmlAVPlayer : public QObject, public QQmlParserStatus | |
// TODO: startPosition/stopPosition | ||
Q_PROPERTY(QStringList audioBackends READ audioBackends WRITE setAudioBackends NOTIFY audioBackendsChanged) | ||
Q_PROPERTY(QStringList supportedAudioBackends READ supportedAudioBackends) | ||
Q_PROPERTY(int notifyInterval READ notifyInterval WRITE setNotifyInterval NOTIFY notifyIntervalChanged) | ||
public: | ||
enum Loop { Infinite = -1 }; | ||
// use (1<<31)-1 | ||
|
@@ -280,6 +281,7 @@ class QmlAVPlayer : public QObject, public QQmlParserStatus | |
QStringList supportedAudioBackends() const; | ||
QStringList audioBackends() const; | ||
void setAudioBackends(const QStringList& value); | ||
int notifyInterval() const; | ||
|
||
public Q_SLOTS: | ||
void play(); | ||
|
@@ -290,7 +292,7 @@ public Q_SLOTS: | |
void seek(int offset); | ||
void seekForward(); | ||
void seekBackward(); | ||
|
||
void setNotifyInterval(int notifyInterval); | ||
Q_SIGNALS: | ||
void volumeChanged(); | ||
void mutedChanged(); | ||
|
@@ -340,6 +342,8 @@ public Q_SLOTS: | |
void statusChanged(); | ||
void mediaObjectChanged(); | ||
void audioBackendsChanged(); | ||
void notifyIntervalChanged(int notifyInterval); | ||
|
||
private Q_SLOTS: | ||
// connect to signals from player | ||
void _q_error(const QtAV::AVError& e); | ||
|
@@ -397,6 +401,7 @@ private Q_SLOTS: | |
QList<QuickAudioFilter*> m_afilters; | ||
QList<QuickVideoFilter*> m_vfilters; | ||
QStringList m_ao; | ||
int m_notifyInterval; | ||
}; | ||
|
||
#endif // QTAV_QML_AVPLAYER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/****************************************************************************** | ||
/****************************************************************************** | ||
QtAV: Multimedia framework based on Qt and FFmpeg | ||
Copyright (C) 2012-2017 Wang Bin <[email protected]> | ||
|
@@ -89,6 +89,7 @@ void QmlAVPlayer::classBegin() | |
connect(mpPlayer, SIGNAL(seekableChanged()), SIGNAL(seekableChanged())); | ||
connect(mpPlayer, SIGNAL(seekFinished(qint64)), this, SIGNAL(seekFinished()), Qt::DirectConnection); | ||
connect(mpPlayer, SIGNAL(bufferProgressChanged(qreal)), SIGNAL(bufferProgressChanged())); | ||
connect(mpPlayer, SIGNAL(notifyIntervalChanged), SIGNAL(notifyIntervalChanged())); | ||
connect(this, SIGNAL(channelLayoutChanged()), SLOT(applyChannelLayout())); | ||
// direct connection to ensure volume() in slots is correct | ||
connect(mpPlayer->audio(), SIGNAL(volumeChanged(qreal)), SLOT(applyVolume()), Qt::DirectConnection); | ||
|
@@ -604,6 +605,13 @@ void QmlAVPlayer::setAudioBackends(const QStringList &value) | |
Q_EMIT audioBackendsChanged(); | ||
} | ||
|
||
int QmlAVPlayer::notifyInterval() const | ||
{ | ||
if(!mpPlayer) | ||
return -1; | ||
return mpPlayer->notifyInterval(); | ||
} | ||
|
||
QStringList QmlAVPlayer::supportedAudioBackends() const | ||
{ | ||
return AudioOutput::backendsAvailable(); | ||
|
@@ -898,6 +906,14 @@ void QmlAVPlayer::seekBackward() | |
mpPlayer->seekBackward(); | ||
} | ||
|
||
void QmlAVPlayer::setNotifyInterval(int notifyInterval) | ||
{ | ||
if (!mpPlayer) | ||
return; | ||
mpPlayer->setNotifyInterval(notifyInterval); | ||
} | ||
|
||
|
||
void QmlAVPlayer::_q_error(const AVError &e) | ||
{ | ||
mError = NoError; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters