mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Move files to media/audio and media/clip.
This commit is contained in:
@@ -5,14 +5,14 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio_loaders.h"
|
||||
#include "media/audio/media_audio_track.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/media_audio_loaders.h"
|
||||
#include "media/media_audio_track.h"
|
||||
#include "platform/platform_audio.h"
|
||||
#include "core/application.h"
|
||||
#include "facades.h"
|
@@ -5,9 +5,9 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio_capture.h"
|
||||
#include "media/audio/media_audio_capture.h"
|
||||
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
@@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
|
||||
#include "base/bytes.h"
|
||||
|
@@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_audio_loader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/audio/media_audio_loader.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
@@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio_loader.h"
|
||||
#include "media/audio/media_audio_loader.h"
|
||||
|
||||
AudioPlayerLoader::AudioPlayerLoader(const FileLocation &file, const QByteArray &data, bytes::vector &&buffer)
|
||||
: _file(file)
|
@@ -5,11 +5,11 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio_loaders.h"
|
||||
#include "media/audio/media_audio_loaders.h"
|
||||
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Player {
|
@@ -7,9 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
|
||||
class AudioPlayerLoader;
|
||||
class ChildFFMpegLoader;
|
@@ -5,10 +5,10 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_audio_track.h"
|
||||
#include "media/audio/media_audio_track.h"
|
||||
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "core/application.h"
|
||||
|
||||
#include <AL/al.h>
|
@@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
|
||||
#include "core/crash_reports.h"
|
||||
|
@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "media/media_audio_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio_ffmpeg_loader.h"
|
||||
|
||||
struct VideoSoundData {
|
||||
AVCodecContext *context = nullptr;
|
@@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_clip_check_streaming.h"
|
||||
#include "media/clip/media_clip_check_streaming.h"
|
||||
|
||||
|
||||
namespace Media {
|
@@ -5,10 +5,10 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_clip_ffmpeg.h"
|
||||
#include "media/clip/media_clip_ffmpeg.h"
|
||||
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
#include "storage/file_download.h"
|
||||
|
||||
namespace Media {
|
@@ -13,8 +13,8 @@ extern "C" {
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#include "media/media_clip_implementation.h"
|
||||
#include "media/media_child_ffmpeg_loader.h"
|
||||
#include "media/clip/media_clip_implementation.h"
|
||||
#include "media/audio/media_child_ffmpeg_loader.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
@@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_clip_implementation.h"
|
||||
#include "media/clip/media_clip_implementation.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
@@ -5,13 +5,12 @@ the official desktop application for the Telegram messaging service.
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "storage/file_download.h"
|
||||
#include "media/media_clip_ffmpeg.h"
|
||||
#include "media/media_clip_qtgif.h"
|
||||
#include "media/media_clip_check_streaming.h"
|
||||
#include "media/clip/media_clip_ffmpeg.h"
|
||||
#include "media/clip/media_clip_check_streaming.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
@@ -485,7 +484,6 @@ public:
|
||||
}
|
||||
|
||||
_implementation = std::make_unique<internal::FFMpegReaderImplementation>(_location.get(), &_data, _audioMsgId);
|
||||
// _implementation = new QtGifReaderImplementation(_location, &_data);
|
||||
|
||||
auto implementationMode = [this]() {
|
||||
using ImplementationMode = internal::ReaderImplementation::Mode;
|
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/media_clip_qtgif.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
||||
namespace internal {
|
||||
|
||||
QtGifReaderImplementation::QtGifReaderImplementation(FileLocation *location, QByteArray *data) : ReaderImplementation(location, data) {
|
||||
}
|
||||
|
||||
ReaderImplementation::ReadResult QtGifReaderImplementation::readFramesTill(TimeMs frameMs, TimeMs systemMs) {
|
||||
if (!_frame.isNull() && _frameTime > frameMs) {
|
||||
return ReadResult::Success;
|
||||
}
|
||||
auto readResult = readNextFrame();
|
||||
if (readResult != ReadResult::Success || _frameTime > frameMs) {
|
||||
return readResult;
|
||||
}
|
||||
readResult = readNextFrame();
|
||||
if (_frameTime <= frameMs) {
|
||||
_frameTime = frameMs + 5; // keep up
|
||||
}
|
||||
return readResult;
|
||||
}
|
||||
|
||||
TimeMs QtGifReaderImplementation::frameRealTime() const {
|
||||
return _frameRealTime;
|
||||
}
|
||||
|
||||
TimeMs QtGifReaderImplementation::framePresentationTime() const {
|
||||
return qMax(_frameTime, 0LL);
|
||||
}
|
||||
|
||||
ReaderImplementation::ReadResult QtGifReaderImplementation::readNextFrame() {
|
||||
if (_reader) _frameDelay = _reader->nextImageDelay();
|
||||
if (_framesLeft < 1) {
|
||||
if (_mode == Mode::Normal) {
|
||||
return ReadResult::EndOfFile;
|
||||
} else if (!jumpToStart()) {
|
||||
return ReadResult::Error;
|
||||
}
|
||||
}
|
||||
|
||||
_frame = QImage(); // QGifHandler always reads first to internal QImage and returns it
|
||||
if (!_reader->read(&_frame) || _frame.isNull()) {
|
||||
return ReadResult::Error;
|
||||
}
|
||||
--_framesLeft;
|
||||
_frameTime += _frameDelay;
|
||||
_frameRealTime += _frameDelay;
|
||||
return ReadResult::Success;
|
||||
}
|
||||
|
||||
bool QtGifReaderImplementation::renderFrame(QImage &to, bool &hasAlpha, const QSize &size) {
|
||||
Assert(!_frame.isNull());
|
||||
if (size.isEmpty() || size == _frame.size()) {
|
||||
int32 w = _frame.width(), h = _frame.height();
|
||||
if (to.width() == w && to.height() == h && to.format() == _frame.format()) {
|
||||
if (to.byteCount() != _frame.byteCount()) {
|
||||
int bpl = qMin(to.bytesPerLine(), _frame.bytesPerLine());
|
||||
for (int i = 0; i < h; ++i) {
|
||||
memcpy(to.scanLine(i), _frame.constScanLine(i), bpl);
|
||||
}
|
||||
} else {
|
||||
memcpy(to.bits(), _frame.constBits(), _frame.byteCount());
|
||||
}
|
||||
} else {
|
||||
to = _frame.copy();
|
||||
}
|
||||
} else {
|
||||
to = _frame.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
hasAlpha = _frame.hasAlphaChannel();
|
||||
_frame = QImage();
|
||||
return true;
|
||||
}
|
||||
|
||||
TimeMs QtGifReaderImplementation::durationMs() const {
|
||||
return 0; // not supported
|
||||
}
|
||||
|
||||
bool QtGifReaderImplementation::start(Mode mode, TimeMs &positionMs) {
|
||||
if (mode == Mode::Inspecting) {
|
||||
return false;
|
||||
}
|
||||
_mode = mode;
|
||||
return jumpToStart();
|
||||
}
|
||||
|
||||
QtGifReaderImplementation::~QtGifReaderImplementation() = default;
|
||||
|
||||
bool QtGifReaderImplementation::jumpToStart() {
|
||||
if (_reader && _reader->jumpToImage(0)) {
|
||||
_framesLeft = _reader->imageCount();
|
||||
return true;
|
||||
}
|
||||
|
||||
_reader = nullptr;
|
||||
initDevice();
|
||||
_reader = std::make_unique<QImageReader>(_device);
|
||||
#ifndef OS_MAC_OLD
|
||||
_reader->setAutoTransform(true);
|
||||
#endif // OS_MAC_OLD
|
||||
if (!_reader->canRead() || !_reader->supportsAnimation()) {
|
||||
return false;
|
||||
}
|
||||
_framesLeft = _reader->imageCount();
|
||||
if (_framesLeft < 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Clip
|
||||
} // namespace Media
|
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "media/media_clip_implementation.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
||||
namespace internal {
|
||||
|
||||
class QtGifReaderImplementation : public ReaderImplementation {
|
||||
public:
|
||||
|
||||
QtGifReaderImplementation(FileLocation *location, QByteArray *data);
|
||||
|
||||
ReadResult readFramesTill(TimeMs frameMs, TimeMs systemMs) override;
|
||||
|
||||
TimeMs frameRealTime() const override;
|
||||
TimeMs framePresentationTime() const override;
|
||||
|
||||
bool renderFrame(QImage &to, bool &hasAlpha, const QSize &size) override;
|
||||
|
||||
TimeMs durationMs() const override;
|
||||
bool hasAudio() const override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool start(Mode mode, TimeMs &positionMs) override;
|
||||
|
||||
~QtGifReaderImplementation();
|
||||
|
||||
private:
|
||||
bool jumpToStart();
|
||||
ReadResult readNextFrame();
|
||||
|
||||
Mode _mode = Mode::Normal;
|
||||
|
||||
std::unique_ptr<QImageReader> _reader;
|
||||
int _framesLeft = 0;
|
||||
TimeMs _frameRealTime = 0;
|
||||
TimeMs _frameTime = 0;
|
||||
int _frameDelay = 0;
|
||||
QImage _frame;
|
||||
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace Clip
|
||||
} // namespace Media
|
@@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "media/player/media_player_button.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
|
@@ -14,8 +14,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/media/history_media.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "media/player/media_player_round_controller.h"
|
||||
|
@@ -9,8 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/media_audio_capture.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/audio/media_audio_capture.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
|
@@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/player/media_player_round_controller.h"
|
||||
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "history/history_item.h"
|
||||
|
@@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/player/media_player_volume_controller.h"
|
||||
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
|
@@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "media/player/media_player_button.h"
|
||||
#include "media/player/media_player_instance.h"
|
||||
|
@@ -7,14 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/view/media_clip_controller.h"
|
||||
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/view/media_clip_playback.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "ui/effects/fade_animation.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "layout.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
||||
|
@@ -7,8 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "media/view/media_clip_playback.h"
|
||||
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "styles/style_mediaview.h"
|
||||
#include "media/media_audio.h"
|
||||
|
||||
namespace Media {
|
||||
namespace Clip {
|
||||
|
@@ -17,10 +17,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "media/media_clip_reader.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
#include "media/clip/media_clip_reader.h"
|
||||
#include "media/view/media_clip_controller.h"
|
||||
#include "media/view/media_view_group_thumbs.h"
|
||||
#include "media/media_audio.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_message.h"
|
||||
#include "data/data_media_types.h"
|
||||
|
Reference in New Issue
Block a user