tdesktop/Telegram/SourceFiles/media/view/media_clip_playback.h

57 lines
1.3 KiB
C
Raw Normal View History

2016-07-11 18:05:46 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2016-07-11 18:05:46 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2016-07-11 18:05:46 +00:00
*/
#pragma once
2016-11-22 09:48:13 +00:00
#include "ui/widgets/continuous_sliders.h"
2016-07-11 18:05:46 +00:00
namespace Media {
namespace Player {
struct TrackState;
} // namespace Player
2016-07-11 18:05:46 +00:00
namespace Clip {
class Playback {
2016-07-11 18:05:46 +00:00
public:
Playback();
2016-07-11 18:05:46 +00:00
void setValueChangedCallback(Fn<void(float64)> callback) {
_valueChanged = std::move(callback);
}
void setInLoadingStateChangedCallback(Fn<void(bool)> callback) {
_inLoadingStateChanged = std::move(callback);
}
void setValue(float64 value, bool animated);
float64 value() const;
2017-05-24 14:36:58 +00:00
float64 value(TimeMs ms);
void updateState(const Player::TrackState &state);
void updateLoadingState(float64 progress);
2016-07-11 18:05:46 +00:00
private:
void step_value(float64 ms, bool timer);
// This can animate for a very long time (like in music playing),
// so it should be a BasicAnimation, not an Animation.
anim::value a_value;
BasicAnimation _a_value;
Fn<void(float64)> _valueChanged;
bool _inLoadingState = false;
Fn<void(bool)> _inLoadingStateChanged;
2016-07-11 18:05:46 +00:00
int64 _position = 0;
int64 _length = 0;
2016-07-11 18:05:46 +00:00
bool _playing = false;
2016-07-11 18:05:46 +00:00
};
} // namespace Clip
} // namespace Media