2016-06-24 10:37:29 +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-06-24 10:37:29 +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-06-24 10:37:29 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "media/media_clip_implementation.h"
|
|
|
|
|
|
|
|
namespace Media {
|
|
|
|
namespace Clip {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
class QtGifReaderImplementation : public ReaderImplementation {
|
|
|
|
public:
|
|
|
|
|
|
|
|
QtGifReaderImplementation(FileLocation *location, QByteArray *data);
|
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
ReadResult readFramesTill(TimeMs frameMs, TimeMs systemMs) override;
|
2016-07-13 11:24:31 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs frameRealTime() const override;
|
|
|
|
TimeMs framePresentationTime() const override;
|
2016-07-13 11:24:31 +00:00
|
|
|
|
2016-06-24 10:37:29 +00:00
|
|
|
bool renderFrame(QImage &to, bool &hasAlpha, const QSize &size) override;
|
2016-07-13 11:24:31 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs durationMs() const override;
|
2016-07-12 18:04:34 +00:00
|
|
|
bool hasAudio() const override {
|
|
|
|
return false;
|
|
|
|
}
|
2016-07-13 11:24:31 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
bool start(Mode mode, TimeMs &positionMs) override;
|
2016-06-24 10:37:29 +00:00
|
|
|
|
|
|
|
~QtGifReaderImplementation();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool jumpToStart();
|
2016-07-12 18:04:34 +00:00
|
|
|
ReadResult readNextFrame();
|
|
|
|
|
|
|
|
Mode _mode = Mode::Normal;
|
2016-06-24 10:37:29 +00:00
|
|
|
|
2017-03-09 09:47:45 +00:00
|
|
|
std::unique_ptr<QImageReader> _reader;
|
2016-06-24 10:37:29 +00:00
|
|
|
int _framesLeft = 0;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _frameRealTime = 0;
|
|
|
|
TimeMs _frameTime = 0;
|
2016-06-24 10:37:29 +00:00
|
|
|
int _frameDelay = 0;
|
|
|
|
QImage _frame;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace Clip
|
|
|
|
} // namespace Media
|