MythTV
master
|
#include <cmath>
#include <sys/time.h>
#include <QMetaType>
#include <chrono>
Go to the source code of this file.
Namespaces | |
std::chrono | |
mpeg | |
mpeg::chrono | |
mpeg::chrono_literals | |
Typedefs | |
using | CHRONO_TYPE = std::chrono::seconds::rep |
using | std::chrono::days = duration< CHRONO_TYPE, ratio< 86400 > > |
using | std::chrono::weeks = duration< CHRONO_TYPE, ratio< 604800 > > |
using | std::chrono::months = duration< CHRONO_TYPE, ratio< 2629746 > > |
using | std::chrono::years = duration< CHRONO_TYPE, ratio< 31556952 > > |
using | floatsecs = std::chrono::duration< double > |
using | floatmsecs = std::chrono::duration< double, std::milli > |
using | floatusecs = std::chrono::duration< double, std::micro > |
using | mpeg::chrono::pts = std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > |
using | SystemClock = std::chrono::system_clock |
using | SystemTime = std::chrono::time_point< SystemClock > |
Functions | |
Q_DECLARE_METATYPE (std::chrono::seconds) | |
Q_DECLARE_METATYPE (std::chrono::milliseconds) | |
Q_DECLARE_METATYPE (std::chrono::microseconds) | |
constexpr mpeg::chrono::pts | mpeg::chrono_literals::operator""_pts (unsigned long long v) |
template<typename T > | |
std::enable_if_t< std::is_floating_point_v< T >, std::chrono::seconds > | secondsFromFloat (T value) |
Helper function for convert a floating point number to a duration. More... | |
template<typename T > | |
std::enable_if_t< std::is_floating_point_v< T >, std::chrono::milliseconds > | millisecondsFromFloat (T value) |
Helper function for convert a floating point number to a duration. More... | |
template<typename T > | |
std::enable_if_t< std::is_floating_point_v< T >, std::chrono::microseconds > | microsecondsFromFloat (T value) |
Helper function for convert a floating point number to a duration. More... | |
static constexpr std::chrono::milliseconds | millisecondsFromParts (int hours, int minutes=0, int seconds=0, int milliseconds=0) |
Build a duration from separate minutes, seconds, etc. More... | |
template<typename T > | |
constexpr T | durationFromTimeval (timeval t) |
Convert a timeval to a duration. More... | |
template<typename T > | |
constexpr T | durationFromTimevalDelta (timeval a, timeval b) |
Compute delta between timevals and convert to a duration. More... | |
template<typename T > | |
constexpr T | durationFromTimespec (struct timespec time) |
Convert a timespec to a duration. More... | |
template<typename T > | |
T | nowAsDuration (bool adjustForTZ=false) |
Get the currenttime as a duration. More... | |
template<typename T > | |
static constexpr T | chronomult (T duration, double f) |
Multiply a duration by a float, returning a duration. More... | |
template<typename T > | |
static constexpr T | chronodivide (T duration, double f) |
Divide a duration by a float, returning a duration. More... | |
using CHRONO_TYPE = std::chrono::seconds::rep |
Definition at line 19 of file mythchrono.h.
using floatsecs = std::chrono::duration<double> |
Definition at line 39 of file mythchrono.h.
using floatmsecs = std::chrono::duration<double, std::milli> |
Definition at line 40 of file mythchrono.h.
using floatusecs = std::chrono::duration<double, std::micro> |
Definition at line 41 of file mythchrono.h.
using SystemClock = std::chrono::system_clock |
Definition at line 66 of file mythchrono.h.
using SystemTime = std::chrono::time_point<SystemClock> |
Definition at line 67 of file mythchrono.h.
Q_DECLARE_METATYPE | ( | std::chrono::seconds | ) |
Q_DECLARE_METATYPE | ( | std::chrono::milliseconds | ) |
Q_DECLARE_METATYPE | ( | std::chrono::microseconds | ) |
std::enable_if_t<std::is_floating_point_v<T>, std::chrono::seconds> secondsFromFloat | ( | T | value | ) |
Helper function for convert a floating point number to a duration.
value | A floating point number that represents a time in seconds. |
Definition at line 80 of file mythchrono.h.
Referenced by MythPlayer::CalcMaxFFTime(), MythPlayer::CalcRWTime(), CalcTrackLength(), MythCCExtractorPlayer::OnGotNewFrame(), AvFormatDecoder::OpenFile(), HLSRingBuffer::SeekInternal(), MythDVDPlayer::StillFrameCheck(), and DecoderBase::SyncPositionMap().
std::enable_if_t<std::is_floating_point_v<T>, std::chrono::milliseconds> millisecondsFromFloat | ( | T | value | ) |
Helper function for convert a floating point number to a duration.
value | A floating point number that represents a time in milliseconds. |
Definition at line 91 of file mythchrono.h.
Referenced by AudioOutputBase::AddData(), MythPlayer::CalcMaxFFTime(), MythDVDPlayer::ChangeSpeed(), TV::DoSeek(), MythPlayer::FastForward(), DTVRecorder::FinishRecording(), commDetector2::frameToTimestamp(), commDetector2::frameToTimestampms(), AudioOutputCA::GetAudiotime(), MythDVDPlayer::GetMillisecondsPlayed(), MythPlayerCaptionsUI::GetStreamPos(), AvFormatDecoder::NormalizeVideoTimecode(), AvFormatDecoder::OpenFile(), AvFormatDecoder::ProcessAudioPacket(), AvFormatDecoder::ProcessVideoFrame(), MythPlayer::Rewind(), and Transcode::TranscodeFile().
std::enable_if_t<std::is_floating_point_v<T>, std::chrono::microseconds> microsecondsFromFloat | ( | T | value | ) |
Helper function for convert a floating point number to a duration.
value | A floating point number that represents a time in microseconds. |
Definition at line 102 of file mythchrono.h.
Referenced by MythPlayerAVSync::AVSync(), AvFormatDecoder::GetFrame(), MythDisplay::GetRefreshInterval(), MythPlayer::SetFrameInterval(), and MythPlayer::UpdateFFRewSkip().
|
staticconstexpr |
Build a duration from separate minutes, seconds, etc.
Definition at line 109 of file mythchrono.h.
Referenced by LyricsData::setLyrics().
|
constexpr |
Convert a timeval to a duration.
Always specify the desired precision when calling this function. I.E. Always call in the form: durationFromTimeval<std::chrono::milliseconds>(t);
Timevals can support a precision as small as microseconds.
Definition at line 126 of file mythchrono.h.
|
constexpr |
Compute delta between timevals and convert to a duration.
Always specify the desired precision when calling this function. I.E. Always call in the form: durationFromTimevalDelta<std::chrono::milliseconds>(t);
Timevals can support a precision as small as microseconds.
Definition at line 143 of file mythchrono.h.
|
constexpr |
Convert a timespec to a duration.
Always specify the desired precision when calling this function. I.E. Always call in the form: durationFromTimespec<std::chrono::milliseconds>(t);
Timevals can support a precision as small as nanoseconds.
Definition at line 160 of file mythchrono.h.
Get the currenttime as a duration.
Always specify the desired precision when calling this function. I.E. Always call in the form: nowAsDuration<std::chrono::milliseconds>(t);
This function is based upon the gettimeoday function, so can return precisions as small as microseconds.
Definition at line 183 of file mythchrono.h.
|
staticconstexpr |
Multiply a duration by a float, returning a duration.
Definition at line 199 of file mythchrono.h.
Referenced by PeriodicHouseKeeperTask::CalculateWindow(), and MythPlayer::UpdateFFRewSkip().
|
staticconstexpr |
Divide a duration by a float, returning a duration.
Definition at line 205 of file mythchrono.h.