diff options
author | John Preston <johnprestonmail@gmail.com> | 2023-03-08 13:31:58 +0400 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2023-03-08 16:10:36 +0400 |
commit | 9c74c04738d419496d2f9966ad16d33f321bbdca (patch) | |
tree | d6311d837e2cc97d6a9356ed7b726023d56a3d0e /Telegram/SourceFiles/media/audio/media_audio_loaders.h | |
parent | 0880a83c2c7d06d20f2fb06ce020fac14cbee6d8 (diff) |
Implement audio speed using libavfilter.
Diffstat (limited to 'Telegram/SourceFiles/media/audio/media_audio_loaders.h')
-rw-r--r-- | Telegram/SourceFiles/media/audio/media_audio_loaders.h | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/Telegram/SourceFiles/media/audio/media_audio_loaders.h b/Telegram/SourceFiles/media/audio/media_audio_loaders.h index 220d338efc..d8b732235d 100644 --- a/Telegram/SourceFiles/media/audio/media_audio_loaders.h +++ b/Telegram/SourceFiles/media/audio/media_audio_loaders.h @@ -37,7 +37,31 @@ public Q_SLOTS: void onCancel(const AudioMsgId &audio); private: + struct SetupLoaderResult { + AudioPlayerLoader *loader = nullptr; + float64 oldSpeed = 0.; + float64 newSpeed = 0.; + int64 fadeStartPosition = 0; + int64 position = 0; + int64 normalLength = 0; + int frequency = 0; + bool errorAtStart = false; + bool justStarted = false; + }; + void videoSoundAdded(); + [[nodiscard]] Mixer::Track::WithSpeed rebufferOnSpeedChange( + const SetupLoaderResult &setup); + + void emitError(AudioMsgId::Type type); + AudioMsgId clear(AudioMsgId::Type type); + void setStoppedState(Mixer::Track *m, State state = State::Stopped); + + void loadData(AudioMsgId audio, crl::time positionMs = 0); + [[nodiscard]] SetupLoaderResult setupLoader( + const AudioMsgId &audio, + crl::time positionMs); + Mixer::Track *checkLoader(AudioMsgId::Type type); AudioMsgId _audio, _song, _video; std::unique_ptr<AudioPlayerLoader> _audioLoader; @@ -51,23 +75,6 @@ private: base::flat_set<AudioMsgId> _fromExternalForceToBuffer; SingleQueuedInvokation _fromExternalNotify; - void emitError(AudioMsgId::Type type); - AudioMsgId clear(AudioMsgId::Type type); - void setStoppedState(Mixer::Track *m, State state = State::Stopped); - - enum SetupError { - SetupErrorAtStart = 0, - SetupErrorNotPlaying = 1, - SetupErrorLoadedFull = 2, - SetupNoErrorStarted = 3, - }; - void loadData(AudioMsgId audio, crl::time positionMs = 0); - AudioPlayerLoader *setupLoader( - const AudioMsgId &audio, - SetupError &err, - crl::time positionMs); - Mixer::Track *checkLoader(AudioMsgId::Type type); - }; } // namespace Player |