mirror of https://github.com/procxx/kepka.git
				
				
				
			Fix build on GCC.
This commit is contained in:
		
							parent
							
								
									a8aa66d191
								
							
						
					
					
						commit
						8171828c2a
					
				|  | @ -309,7 +309,6 @@ void DocumentOpenClickHandler::Open( | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 	if (!location.isEmpty() || (!data->data().isEmpty() && (playVoice || playAnimation))) { | 	if (!location.isEmpty() || (!data->data().isEmpty() && (playVoice || playAnimation))) { | ||||||
| 		using State = Media::Player::State; |  | ||||||
| 		if (playVoice) { | 		if (playVoice) { | ||||||
| 			Media::Player::instance()->playPause({ data, msgId }); | 			Media::Player::instance()->playPause({ data, msgId }); | ||||||
| 		} else if (data->size < App::kImageSizeLimit) { | 		} else if (data->size < App::kImageSizeLimit) { | ||||||
|  | @ -723,7 +722,6 @@ void DocumentData::performActionOnLoad() { | ||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	using State = Media::Player::State; |  | ||||||
| 	if (playVoice || playMusic) { | 	if (playVoice || playMusic) { | ||||||
| 		DocumentOpenClickHandler::Open({}, this, item, ActionOnLoadNone); | 		DocumentOpenClickHandler::Open({}, this, item, ActionOnLoadNone); | ||||||
| 	} else if (playAnimation) { | 	} else if (playAnimation) { | ||||||
|  |  | ||||||
|  | @ -3248,7 +3248,7 @@ bool MainWidget::failDifference(const RPCError &error) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWidget::getDifferenceByPts() { | void MainWidget::getDifferenceByPts() { | ||||||
| 	auto now = crl::now(), wait = 0LL; | 	auto now = crl::now(), wait = crl::time(0); | ||||||
| 	if (_getDifferenceTimeByPts) { | 	if (_getDifferenceTimeByPts) { | ||||||
| 		if (_getDifferenceTimeByPts > now) { | 		if (_getDifferenceTimeByPts > now) { | ||||||
| 			wait = _getDifferenceTimeByPts - now; | 			wait = _getDifferenceTimeByPts - now; | ||||||
|  | @ -3273,7 +3273,7 @@ void MainWidget::getDifferenceByPts() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void MainWidget::getDifferenceAfterFail() { | void MainWidget::getDifferenceAfterFail() { | ||||||
| 	auto now = crl::now(), wait = 0LL; | 	auto now = crl::now(), wait = crl::time(0); | ||||||
| 	if (_getDifferenceTimeAfterFail) { | 	if (_getDifferenceTimeAfterFail) { | ||||||
| 		if (_getDifferenceTimeAfterFail > now) { | 		if (_getDifferenceTimeAfterFail > now) { | ||||||
| 			wait = _getDifferenceTimeAfterFail - now; | 			wait = _getDifferenceTimeAfterFail - now; | ||||||
|  |  | ||||||
|  | @ -206,7 +206,7 @@ crl::time FFMpegReaderImplementation::frameRealTime() const { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| crl::time FFMpegReaderImplementation::framePresentationTime() const { | crl::time FFMpegReaderImplementation::framePresentationTime() const { | ||||||
| 	return qMax(_frameTime + _frameTimeCorrection, 0LL); | 	return qMax(_frameTime + _frameTimeCorrection, crl::time(0)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| crl::time FFMpegReaderImplementation::durationMs() const { | crl::time FFMpegReaderImplementation::durationMs() const { | ||||||
|  |  | ||||||
|  | @ -765,7 +765,7 @@ void Manager::process() { | ||||||
| 	_processingInThread = thread(); | 	_processingInThread = thread(); | ||||||
| 
 | 
 | ||||||
| 	bool checkAllReaders = false; | 	bool checkAllReaders = false; | ||||||
| 	auto ms = crl::now(), minms = ms + 86400 * 1000LL; | 	auto ms = crl::now(), minms = ms + 86400 * crl::time(1000); | ||||||
| 	{ | 	{ | ||||||
| 		QMutexLocker lock(&_readerPointersMutex); | 		QMutexLocker lock(&_readerPointersMutex); | ||||||
| 		for (auto it = _readerPointers.begin(), e = _readerPointers.end(); it != e; ++it) { | 		for (auto it = _readerPointers.begin(), e = _readerPointers.end(); it != e; ++it) { | ||||||
|  | @ -867,7 +867,7 @@ FileMediaInformation::Video PrepareForSending(const QString &fname, const QByteA | ||||||
| 	auto localLocation = FileLocation(fname); | 	auto localLocation = FileLocation(fname); | ||||||
| 	auto localData = QByteArray(data); | 	auto localData = QByteArray(data); | ||||||
| 
 | 
 | ||||||
| 	auto seekPositionMs = 0LL; | 	auto seekPositionMs = crl::time(0); | ||||||
| 	auto reader = std::make_unique<internal::FFMpegReaderImplementation>(&localLocation, &localData, AudioMsgId()); | 	auto reader = std::make_unique<internal::FFMpegReaderImplementation>(&localLocation, &localData, AudioMsgId()); | ||||||
| 	if (reader->start(internal::ReaderImplementation::Mode::Inspecting, seekPositionMs)) { | 	if (reader->start(internal::ReaderImplementation::Mode::Inspecting, seekPositionMs)) { | ||||||
| 		auto durationMs = reader->durationMs(); | 		auto durationMs = reader->durationMs(); | ||||||
|  |  | ||||||
|  | @ -233,7 +233,10 @@ Widget::~Widget() = default; | ||||||
| void Widget::handleSeekProgress(float64 progress) { | void Widget::handleSeekProgress(float64 progress) { | ||||||
| 	if (!_lastDurationMs) return; | 	if (!_lastDurationMs) return; | ||||||
| 
 | 
 | ||||||
| 	auto positionMs = snap(static_cast<crl::time>(progress * _lastDurationMs), 0LL, _lastDurationMs); | 	const auto positionMs = snap( | ||||||
|  | 		static_cast<crl::time>(progress * _lastDurationMs), | ||||||
|  | 		crl::time(0), | ||||||
|  | 		_lastDurationMs); | ||||||
| 	if (_seekPositionMs != positionMs) { | 	if (_seekPositionMs != positionMs) { | ||||||
| 		_seekPositionMs = positionMs; | 		_seekPositionMs = positionMs; | ||||||
| 		updateTimeLabel(); | 		updateTimeLabel(); | ||||||
|  | @ -245,7 +248,10 @@ void Widget::handleSeekProgress(float64 progress) { | ||||||
| void Widget::handleSeekFinished(float64 progress) { | void Widget::handleSeekFinished(float64 progress) { | ||||||
| 	if (!_lastDurationMs) return; | 	if (!_lastDurationMs) return; | ||||||
| 
 | 
 | ||||||
| 	auto positionMs = snap(static_cast<crl::time>(progress * _lastDurationMs), 0LL, _lastDurationMs); | 	const auto positionMs = snap( | ||||||
|  | 		static_cast<crl::time>(progress * _lastDurationMs), | ||||||
|  | 		crl::time(0), | ||||||
|  | 		_lastDurationMs); | ||||||
| 	_seekPositionMs = -1; | 	_seekPositionMs = -1; | ||||||
| 
 | 
 | ||||||
| 	instance()->finishSeeking(_type, progress); | 	instance()->finishSeeking(_type, progress); | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ constexpr auto kLoadFullIfStuckAfterPlayback = 3 * crl::time(1000); | ||||||
| 		? position | 		? position | ||||||
| 		: (position == kReceivedTillEnd) | 		: (position == kReceivedTillEnd) | ||||||
| 		? state.duration | 		? state.duration | ||||||
| 		: std::clamp(position, 0LL, state.duration - 1); | 		: std::clamp(position, crl::time(0), state.duration - 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| [[nodiscard]] bool FullTrackReceived(const TrackState &state) { | [[nodiscard]] bool FullTrackReceived(const TrackState &state) { | ||||||
|  | @ -126,7 +126,7 @@ void Player::trackReceivedTill( | ||||||
| 	if (position == kTimeUnknown) { | 	if (position == kTimeUnknown) { | ||||||
| 		return; | 		return; | ||||||
| 	} else if (state.duration != kTimeUnknown) { | 	} else if (state.duration != kTimeUnknown) { | ||||||
| 		position = std::clamp(position, 0LL, state.duration); | 		position = std::clamp(position, crl::time(0), state.duration); | ||||||
| 		if (state.receivedTill < position) { | 		if (state.receivedTill < position) { | ||||||
| 			state.receivedTill = position; | 			state.receivedTill = position; | ||||||
| 			trackSendReceivedTill(track, state); | 			trackSendReceivedTill(track, state); | ||||||
|  | @ -150,7 +150,7 @@ void Player::trackPlayedTill( | ||||||
| 	const auto guard = base::make_weak(&_sessionGuard); | 	const auto guard = base::make_weak(&_sessionGuard); | ||||||
| 	trackReceivedTill(track, state, position); | 	trackReceivedTill(track, state, position); | ||||||
| 	if (guard && position != kTimeUnknown) { | 	if (guard && position != kTimeUnknown) { | ||||||
| 		position = std::clamp(position, 0LL, state.duration); | 		position = std::clamp(position, crl::time(0), state.duration); | ||||||
| 		state.position = position; | 		state.position = position; | ||||||
| 		_updates.fire({ PlaybackUpdate<Track>{ position } }); | 		_updates.fire({ PlaybackUpdate<Track>{ position } }); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -109,15 +109,17 @@ VideoTrackObject::VideoTrackObject( | ||||||
| 
 | 
 | ||||||
| rpl::producer<crl::time> VideoTrackObject::displayFrameAt() const { | rpl::producer<crl::time> VideoTrackObject::displayFrameAt() const { | ||||||
| 	return interrupted() | 	return interrupted() | ||||||
| 		? rpl::complete<crl::time>() | 		? (rpl::complete<crl::time>() | rpl::type_erased()) | ||||||
| 		: (_nextFrameDisplayTime == kTimeUnknown) | 		: (_nextFrameDisplayTime == kTimeUnknown) | ||||||
| 		? _nextFrameTimeUpdates.events() | 		? (_nextFrameTimeUpdates.events() | rpl::type_erased()) | ||||||
| 		: _nextFrameTimeUpdates.events_starting_with_copy( | 		: _nextFrameTimeUpdates.events_starting_with_copy( | ||||||
| 			_nextFrameDisplayTime); | 			_nextFrameDisplayTime); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| rpl::producer<> VideoTrackObject::waitingForData() const { | rpl::producer<> VideoTrackObject::waitingForData() const { | ||||||
| 	return interrupted() ? rpl::never() : _waitingForData.events(); | 	return interrupted() | ||||||
|  | 		? (rpl::never() | rpl::type_erased()) | ||||||
|  | 		: _waitingForData.events(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void VideoTrackObject::process(Packet &&packet) { | void VideoTrackObject::process(Packet &&packet) { | ||||||
|  |  | ||||||
|  | @ -2252,7 +2252,7 @@ void OverlayWidget::updatePlaybackState() { | ||||||
| 		if (duration > 0) { | 		if (duration > 0) { | ||||||
| 			state.length = std::max( | 			state.length = std::max( | ||||||
| 				duration * crl::time(1000), | 				duration * crl::time(1000), | ||||||
| 				state.position); | 				crl::time(state.position)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if (state.position != kTimeUnknown && state.length != kTimeUnknown) { | 	if (state.position != kTimeUnknown && state.length != kTimeUnknown) { | ||||||
|  |  | ||||||
|  | @ -79,7 +79,10 @@ PlaybackControls::PlaybackControls(QWidget *parent, not_null<Delegate *> delegat | ||||||
| void PlaybackControls::handleSeekProgress(float64 progress) { | void PlaybackControls::handleSeekProgress(float64 progress) { | ||||||
| 	if (!_lastDurationMs) return; | 	if (!_lastDurationMs) return; | ||||||
| 
 | 
 | ||||||
| 	auto positionMs = snap(static_cast<crl::time>(progress * _lastDurationMs), 0LL, _lastDurationMs); | 	const auto positionMs = snap( | ||||||
|  | 		static_cast<crl::time>(progress * _lastDurationMs), | ||||||
|  | 		crl::time(0), | ||||||
|  | 		_lastDurationMs); | ||||||
| 	if (_seekPositionMs != positionMs) { | 	if (_seekPositionMs != positionMs) { | ||||||
| 		_seekPositionMs = positionMs; | 		_seekPositionMs = positionMs; | ||||||
| 		refreshTimeTexts(); | 		refreshTimeTexts(); | ||||||
|  | @ -92,7 +95,10 @@ void PlaybackControls::handleSeekProgress(float64 progress) { | ||||||
| void PlaybackControls::handleSeekFinished(float64 progress) { | void PlaybackControls::handleSeekFinished(float64 progress) { | ||||||
| 	if (!_lastDurationMs) return; | 	if (!_lastDurationMs) return; | ||||||
| 
 | 
 | ||||||
| 	auto positionMs = snap(static_cast<crl::time>(progress * _lastDurationMs), 0LL, _lastDurationMs); | 	const auto positionMs = snap( | ||||||
|  | 		static_cast<crl::time>(progress * _lastDurationMs), | ||||||
|  | 		crl::time(0), | ||||||
|  | 		_lastDurationMs); | ||||||
| 	_seekPositionMs = -1; | 	_seekPositionMs = -1; | ||||||
| 	_delegate->playbackControlsSeekFinished(positionMs); | 	_delegate->playbackControlsSeekFinished(positionMs); | ||||||
| 	refreshTimeTexts(); | 	refreshTimeTexts(); | ||||||
|  | @ -172,7 +178,7 @@ void PlaybackControls::updateTimeTexts(const Player::TrackState &state) { | ||||||
| 	auto playAlready = position / playFrequency; | 	auto playAlready = position / playFrequency; | ||||||
| 	auto playLeft = (state.length / playFrequency) - playAlready; | 	auto playLeft = (state.length / playFrequency) - playAlready; | ||||||
| 
 | 
 | ||||||
| 	_lastDurationMs = (state.length * 1000LL) / playFrequency; | 	_lastDurationMs = (state.length * crl::time(1000)) / playFrequency; | ||||||
| 
 | 
 | ||||||
| 	_timeAlready = formatDurationText(playAlready); | 	_timeAlready = formatDurationText(playAlready); | ||||||
| 	auto minus = QChar(8722); | 	auto minus = QChar(8722); | ||||||
|  | @ -188,8 +194,8 @@ void PlaybackControls::refreshTimeTexts() { | ||||||
| 	auto timeAlready = _timeAlready; | 	auto timeAlready = _timeAlready; | ||||||
| 	auto timeLeft = _timeLeft; | 	auto timeLeft = _timeLeft; | ||||||
| 	if (_seekPositionMs >= 0) { | 	if (_seekPositionMs >= 0) { | ||||||
| 		auto playAlready = _seekPositionMs / 1000LL; | 		auto playAlready = _seekPositionMs / crl::time(1000); | ||||||
| 		auto playLeft = (_lastDurationMs / 1000LL) - playAlready; | 		auto playLeft = (_lastDurationMs / crl::time(1000)) - playAlready; | ||||||
| 
 | 
 | ||||||
| 		timeAlready = formatDurationText(playAlready); | 		timeAlready = formatDurationText(playAlready); | ||||||
| 		auto minus = QChar(8722); | 		auto minus = QChar(8722); | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ namespace { | ||||||
| 
 | 
 | ||||||
| struct DnsEntry { | struct DnsEntry { | ||||||
| 	QString data; | 	QString data; | ||||||
| 	int64 TTL = 0; | 	crl::time TTL = 0; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| constexpr auto kSendNextTimeout = crl::time(1000); | constexpr auto kSendNextTimeout = crl::time(1000); | ||||||
|  | @ -155,8 +155,8 @@ std::vector<DnsEntry> ParseDnsResponse( | ||||||
| 
 | 
 | ||||||
| 		const auto ttlIt = object.find(qsl("TTL")); | 		const auto ttlIt = object.find(qsl("TTL")); | ||||||
| 		const auto ttl = (ttlIt != object.constEnd()) | 		const auto ttl = (ttlIt != object.constEnd()) | ||||||
| 			? int64(std::round((*ttlIt).toDouble())) | 			? crl::time(std::round((*ttlIt).toDouble())) | ||||||
| 			: int64(0); | 			: crl::time(0); | ||||||
| 		result.push_back({ (*dataIt).toString(), ttl }); | 		result.push_back({ (*dataIt).toString(), ttl }); | ||||||
| 	} | 	} | ||||||
| 	return result; | 	return result; | ||||||
|  |  | ||||||
|  | @ -203,7 +203,7 @@ void SendActionAnimation::Impl::paint( | ||||||
| 		x, | 		x, | ||||||
| 		y, | 		y, | ||||||
| 		outerWidth, | 		outerWidth, | ||||||
| 		anim::Disabled() ? 0 : (qMax(ms - _started, 0LL) % _period)); | 		anim::Disabled() ? 0 : (qMax(ms - _started, crl::time(0)) % _period)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -235,7 +235,7 @@ void System::showNext() { | ||||||
| 		return false; | 		return false; | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	auto ms = crl::now(), nextAlert = 0LL; | 	auto ms = crl::now(), nextAlert = crl::time(0); | ||||||
| 	bool alert = false; | 	bool alert = false; | ||||||
| 	int32 now = unixtime(); | 	int32 now = unixtime(); | ||||||
| 	for (auto i = _whenAlerts.begin(); i != _whenAlerts.end();) { | 	for (auto i = _whenAlerts.begin(); i != _whenAlerts.end();) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue