mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(src/components/sound-player/SoundPlayer): handle end of file
This commit is contained in:
parent
946651139e
commit
b473902514
3 changed files with 27 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ public:
|
|||
mAssistant = assistant;
|
||||
}
|
||||
|
||||
private:
|
||||
void onCreateAccount (
|
||||
const shared_ptr<linphone::AccountCreator> &,
|
||||
linphone::AccountCreatorStatus status,
|
||||
|
|
|
|||
|
|
@ -25,10 +25,31 @@
|
|||
|
||||
#include "SoundPlayer.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// =============================================================================
|
||||
|
||||
class SoundPlayer::Handlers : public linphone::PlayerListener {
|
||||
public:
|
||||
Handlers (SoundPlayer *soundPlayer) {
|
||||
mSoundPlayer = soundPlayer;
|
||||
}
|
||||
|
||||
private:
|
||||
void onEofReached (const shared_ptr<linphone::Player> &) override {
|
||||
mSoundPlayer->stop();
|
||||
}
|
||||
|
||||
SoundPlayer *mSoundPlayer;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SoundPlayer::SoundPlayer (QObject *parent) : QObject(parent) {
|
||||
mHandlers = make_shared<SoundPlayer::Handlers>(this);
|
||||
|
||||
mInternalPlayer = CoreManager::getInstance()->getCore()->createLocalPlayer("", "", nullptr);
|
||||
mInternalPlayer->setListener(mHandlers);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ namespace linphone {
|
|||
}
|
||||
|
||||
class SoundPlayer : public QObject {
|
||||
class Handlers;
|
||||
|
||||
Q_OBJECT;
|
||||
|
||||
Q_PROPERTY(QString source READ getSource WRITE setSource NOTIFY sourceChanged);
|
||||
|
|
@ -81,9 +83,11 @@ private:
|
|||
|
||||
int getDuration () const;
|
||||
|
||||
std::shared_ptr<linphone::Player> mInternalPlayer;
|
||||
QString mSource;
|
||||
PlaybackState mPlaybackState = StoppedState;
|
||||
|
||||
std::shared_ptr<linphone::Player> mInternalPlayer;
|
||||
std::shared_ptr<Handlers> mHandlers;
|
||||
};
|
||||
|
||||
#endif // SOUND_PLAYER_H_
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue