diff options
author | Alwin Esch <alwin.esch@web.de> | 2020-10-18 15:09:25 +0200 |
---|---|---|
committer | Alwin Esch <alwin.esch@web.de> | 2020-10-28 22:53:45 +0100 |
commit | a7bb92e60e2d1e74dbe292ca68821fa793755f72 (patch) | |
tree | 92b6f186c918a796feb3132b220292b86501543f | |
parent | c68d4fbe006f144bc50df82fe1fb19fe9dbb22c4 (diff) |
[addons][inputstream] use independent TimingConstants.h for addons
This separate the Kodi TimingConstants.h to use a own on addons
where his text begin with "STREAM_..." now and them with "DVD_..." stays
on Kodi itself.
There are few Pro's and Contra's about but for wanted API better to have.
+++: It stays in pure "C" for them and as base for other languages and the "C++" also on new header
+++: For the time where the headers comes into a own dev-kit and no more in Kodi source
+++: No file outside of the addon header placed in Kodi
---: On changed by them in Kodi must be them on addon headers also by value changes the header updated.
7 files changed, 72 insertions, 1 deletions
diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index 1988d5b5dc..ac1ee12698 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -9,10 +9,12 @@ xbmc/addons/interfaces/gui/controls addons_interfaces_gui_controls xbmc/addons/interfaces/gui/dialogs addons_interfaces_gui_dialogs xbmc/addons/kodi-dev-kit/include/kodi addons_kodi-dev-kit_include_kodi xbmc/addons/kodi-dev-kit/include/kodi/addon-instance addons_kodi-dev-kit_include_kodi_addon-instance +xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream addons_kodi-dev-kit_include_kodi_addon-instance_inputstream xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/peripheral addons_kodi-dev-kit_include_kodi_addon-instance_peripheral xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/pvr addons_kodi-dev-kit_include_kodi_addon-instance_pvr xbmc/addons/kodi-dev-kit/include/kodi/c-api addons_kodi-dev-kit_include_kodi_c-api xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance addons_kodi-dev-kit_include_kodi_c-api_addon-instance +xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream addons_kodi-dev-kit_include_kodi_c-api_addon-instance_inputstream xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/pvr addons_kodi-dev-kit_include_kodi_c-api_addon-instance_pvr xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui addons_kodi-dev-kit_include_kodi_c-api_gui xbmc/addons/kodi-dev-kit/include/kodi/c-api/gui/controls addons_kodi-dev-kit_include_kodi_c-api_gui_controls diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h index 6631c53dab..44aa5efd39 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h @@ -11,6 +11,7 @@ #include "../AddonBase.h" #include "../StreamCrypto.h" #include "../c-api/addon-instance/inputstream.h" +#include "inputstream/TimingConstants.h" #ifdef __cplusplus diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt new file mode 100644 index 0000000000..56da3132aa --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/CMakeLists.txt @@ -0,0 +1,5 @@ +set(HEADERS TimingConstants.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-dev-kit_include_kodi_addon-instance_inputstream) +endif() 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 0000000000..32f00d3737 --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/inputstream/TimingConstants.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2005-2020 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#include "../../c-api/addon-instance/inputstream/timing_constants.h" + +#ifdef __cplusplus + +#undef STREAM_TIME_TO_MSEC +#undef STREAM_SEC_TO_TIME +#undef STREAM_MSEC_TO_TIME + +constexpr int STREAM_TIME_TO_MSEC(double x) +{ + return static_cast<int>(x * 1000 / STREAM_TIME_BASE); +} + +constexpr double STREAM_SEC_TO_TIME(double x) +{ + return x * STREAM_TIME_BASE; +} + +constexpr double STREAM_MSEC_TO_TIME(double x) +{ + return x * STREAM_TIME_BASE / 1000; +} + +#endif /* __cplusplus */ diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream.h index f55bdf83d1..bf28ba11d0 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream.h @@ -14,7 +14,7 @@ #include "../../StreamCodec.h" #include "../../StreamCrypto.h" #include "../addon_base.h" - +#include "inputstream/timing_constants.h" #ifdef BUILD_KODI_ADDON #include "../../DemuxPacket.h" #include "../../InputStreamConstants.h" diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/CMakeLists.txt new file mode 100644 index 0000000000..efb0d01bfe --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/CMakeLists.txt @@ -0,0 +1,5 @@ +set(HEADERS timing_constants.h) + +if(NOT ENABLE_STATIC_LIBS) + core_add_library(addons_kodi-dev-kit_include_kodi_c-api_addon-instance_inputstream) +endif() diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/timing_constants.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/timing_constants.h new file mode 100644 index 0000000000..9d64a4235c --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/addon-instance/inputstream/timing_constants.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2015-2020 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#ifndef C_API_ADDONINSTANCE_INPUTSTREAM_TIMINGCONSTANTS_H +#define C_API_ADDONINSTANCE_INPUTSTREAM_TIMINGCONSTANTS_H + +#define STREAM_TIME_BASE 1000000 +#define STREAM_NOPTS_VALUE 0xFFF0000000000000 + +#define STREAM_TIME_TO_MSEC(x) ((int)((double)(x)*1000 / STREAM_TIME_BASE)) +#define STREAM_SEC_TO_TIME(x) ((double)(x)*STREAM_TIME_BASE) +#define STREAM_MSEC_TO_TIME(x) ((double)(x)*STREAM_TIME_BASE / 1000) + +#define STREAM_PLAYSPEED_PAUSE 0 // frame stepping +#define STREAM_PLAYSPEED_NORMAL 1000 + +#endif /* !C_API_ADDONINSTANCE_INPUTSTREAM_TIMINGCONSTANTS_H */ |