2016-07-05 17:44:02 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-07-05 17:44:02 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-07-05 17:44:02 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "media/media_child_ffmpeg_loader.h"
|
|
|
|
#include "media/media_audio.h"
|
2016-07-19 16:02:39 +00:00
|
|
|
#include "media/media_child_ffmpeg_loader.h"
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
class AudioPlayerLoader;
|
|
|
|
class ChildFFMpegLoader;
|
2017-01-19 08:24:43 +00:00
|
|
|
|
|
|
|
namespace Media {
|
|
|
|
namespace Player {
|
|
|
|
|
|
|
|
class Loaders : public QObject {
|
2016-07-05 17:44:02 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-01-19 08:24:43 +00:00
|
|
|
Loaders(QThread *thread);
|
2016-07-05 17:44:02 +00:00
|
|
|
void feedFromVideo(VideoSoundPart &&part);
|
2017-01-19 08:24:43 +00:00
|
|
|
~Loaders();
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void error(const AudioMsgId &audio);
|
|
|
|
void needToCheck();
|
|
|
|
|
2017-01-19 08:24:43 +00:00
|
|
|
public slots:
|
2016-07-05 17:44:02 +00:00
|
|
|
void onInit();
|
|
|
|
|
2017-12-10 08:52:38 +00:00
|
|
|
void onStart(const AudioMsgId &audio, qint64 positionMs);
|
2016-07-05 17:44:02 +00:00
|
|
|
void onLoad(const AudioMsgId &audio);
|
|
|
|
void onCancel(const AudioMsgId &audio);
|
|
|
|
|
|
|
|
private:
|
2017-04-06 16:49:42 +00:00
|
|
|
void videoSoundAdded();
|
2016-07-05 17:44:02 +00:00
|
|
|
void clearFromVideoQueue();
|
|
|
|
|
|
|
|
AudioMsgId _audio, _song, _video;
|
2017-02-21 13:45:56 +00:00
|
|
|
std::unique_ptr<AudioPlayerLoader> _audioLoader;
|
|
|
|
std::unique_ptr<AudioPlayerLoader> _songLoader;
|
2017-05-18 20:18:59 +00:00
|
|
|
std::unique_ptr<AudioPlayerLoader> _videoLoader;
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
QMutex _fromVideoMutex;
|
2017-05-18 20:18:59 +00:00
|
|
|
QMap<AudioMsgId, QQueue<FFMpeg::AVPacketDataWrap>> _fromVideoQueues;
|
2017-04-06 16:49:42 +00:00
|
|
|
SingleQueuedInvokation _fromVideoNotify;
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
void emitError(AudioMsgId::Type type);
|
|
|
|
AudioMsgId clear(AudioMsgId::Type type);
|
2017-01-24 21:24:39 +00:00
|
|
|
void setStoppedState(Mixer::Track *m, State state = State::Stopped);
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
enum SetupError {
|
|
|
|
SetupErrorAtStart = 0,
|
|
|
|
SetupErrorNotPlaying = 1,
|
|
|
|
SetupErrorLoadedFull = 2,
|
|
|
|
SetupNoErrorStarted = 3,
|
|
|
|
};
|
2017-12-10 08:52:38 +00:00
|
|
|
void loadData(AudioMsgId audio, TimeMs positionMs);
|
|
|
|
AudioPlayerLoader *setupLoader(
|
|
|
|
const AudioMsgId &audio,
|
|
|
|
SetupError &err,
|
|
|
|
TimeMs positionMs);
|
2017-01-24 21:24:39 +00:00
|
|
|
Mixer::Track *checkLoader(AudioMsgId::Type type);
|
2016-07-05 17:44:02 +00:00
|
|
|
|
|
|
|
};
|
2017-01-19 08:24:43 +00:00
|
|
|
|
|
|
|
} // namespace Player
|
|
|
|
} // namespace Media
|