diff options
| author | manuel <manuel@mausz.at> | 2021-03-04 23:36:40 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2021-03-04 23:36:40 +0100 |
| commit | 3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f (patch) | |
| tree | 921f4829b32126f80f9113c124f2e14c0ebce8d9 /xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h | |
| parent | be933ef2241d79558f91796cc5b3a161f72ebf9c (diff) | |
| download | kodi-pvr-build-3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f.tar.gz kodi-pvr-build-3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f.tar.bz2 kodi-pvr-build-3cb8aa05f8cee9e860cf83531682ff0ed4af6a4f.zip | |
sync with upstreamMatrix
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h')
| -rw-r--r-- | xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h new file mode 100644 index 0000000..22f8952 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2005-2020 Team Kodi | ||
| 3 | * This file is part of Kodi - https://kodi.tv | ||
| 4 | * | ||
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later | ||
| 6 | * See LICENSES/README.md for more information. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #pragma once | ||
| 10 | |||
| 11 | #include "../../c-api/addon-instance/inputstream/timing_constants.h" | ||
| 12 | |||
| 13 | #ifdef __cplusplus | ||
| 14 | |||
| 15 | // Unset the on timing_constants.h given defines | ||
| 16 | #undef STREAM_TIME_TO_MSEC | ||
| 17 | #undef STREAM_SEC_TO_TIME | ||
| 18 | #undef STREAM_MSEC_TO_TIME | ||
| 19 | |||
| 20 | /// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants | ||
| 21 | /// @brief Converts a stream time to milliseconds as an integer value. | ||
| 22 | /// | ||
| 23 | /// @param[in] x Stream time | ||
| 24 | /// @return Milliseconds | ||
| 25 | /// | ||
| 26 | /// @note Within "C" code this is used as `#define`. | ||
| 27 | /// | ||
| 28 | constexpr int STREAM_TIME_TO_MSEC(double x) | ||
| 29 | { | ||
| 30 | return static_cast<int>(x * 1000 / STREAM_TIME_BASE); | ||
| 31 | } | ||
| 32 | |||
| 33 | /// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants | ||
| 34 | /// @brief Converts a time in seconds to the used stream time format. | ||
| 35 | /// | ||
| 36 | /// @param[in] x Seconds | ||
| 37 | /// @return Stream time | ||
| 38 | /// | ||
| 39 | /// @note Within "C" code this is used as `#define`. | ||
| 40 | /// | ||
| 41 | constexpr double STREAM_SEC_TO_TIME(double x) | ||
| 42 | { | ||
| 43 | return x * STREAM_TIME_BASE; | ||
| 44 | } | ||
| 45 | |||
| 46 | /// @ingroup cpp_kodi_addon_inputstream_Defs_TimingConstants | ||
| 47 | /// @brief Converts a time in milliseconds to the used stream time format. | ||
| 48 | /// | ||
| 49 | /// @param[in] x Milliseconds | ||
| 50 | /// @return Stream time | ||
| 51 | /// | ||
| 52 | /// @note Within "C" code this is used as `#define`. | ||
| 53 | /// | ||
| 54 | constexpr double STREAM_MSEC_TO_TIME(double x) | ||
| 55 | { | ||
| 56 | return x * STREAM_TIME_BASE / 1000; | ||
| 57 | } | ||
| 58 | |||
| 59 | #endif /* __cplusplus */ | ||
