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
|
|
|
*/
|
2019-02-13 12:36:59 +00:00
|
|
|
#include "media/clip/media_clip_implementation.h"
|
2016-06-24 10:37:29 +00:00
|
|
|
|
2020-10-13 16:43:18 +00:00
|
|
|
#include "core/file_location.h"
|
|
|
|
|
2016-06-24 10:37:29 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Clip {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
void ReaderImplementation::initDevice() {
|
|
|
|
if (_data->isEmpty()) {
|
|
|
|
if (_file.isOpen()) _file.close();
|
|
|
|
_file.setFileName(_location->name());
|
|
|
|
_dataSize = _file.size();
|
|
|
|
} else {
|
|
|
|
if (_buffer.isOpen()) _buffer.close();
|
|
|
|
_buffer.setBuffer(_data);
|
|
|
|
_dataSize = _data->size();
|
|
|
|
}
|
|
|
|
_device = _data->isEmpty() ? static_cast<QIODevice*>(&_file) : static_cast<QIODevice*>(&_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace Clip
|
|
|
|
} // namespace Media
|