summaryrefslogtreecommitdiffstats
path: root/xbmc
diff options
context:
space:
mode:
Diffstat (limited to 'xbmc')
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/Doxyfile107
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-cpp.pngbin0 -> 5153 bytes
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-python.pngbin6550 -> 5496 bytes
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_cpp.dox85
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/doxygen/kodi-dev.pngbin2208 -> 1680 bytes
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/NOTE3
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h39
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h39
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h322
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h33
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h37
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h1288
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h240
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h223
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h163
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h621
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h682
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp)19
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h310
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h622
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h256
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h766
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h86
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h385
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h176
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h276
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h159
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h123
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h128
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h121
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h171
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h215
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h323
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h336
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h376
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h176
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h240
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h)21
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogExtendedProgress.h)45
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogFileBrowser.h)35
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogKeyboard.h)43
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogNumeric.h)47
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogOK.h)27
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogProgress.h)51
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogSelect.h)26
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogTextViewer.h)21
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h (renamed from xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogYesNo.h)33
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h529
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h543
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h62
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h113
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_dll.h46
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_types.h76
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h256
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h187
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h246
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h337
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_dll.h126
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp96
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h204
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h16
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h89
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h103
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h129
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h88
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h60
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h121
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h20
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h55
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h57
-rw-r--r--xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h124
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h2
-rw-r--r--xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h166
-rw-r--r--xbmc/input/ActionIDs.h2
74 files changed, 9597 insertions, 3751 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/Doxyfile b/xbmc/addons/kodi-addon-dev-kit/doxygen/Doxyfile
index 184b34e..729f159 100644
--- a/xbmc/addons/kodi-addon-dev-kit/doxygen/Doxyfile
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/Doxyfile
@@ -1,4 +1,4 @@
1# Doxyfile 1.8.9.1 1# Doxyfile 1.8.13
2 2
3# This file describes the settings to be used by the documentation system 3# This file describes the settings to be used by the documentation system
4# doxygen (www.doxygen.org) for a project. 4# doxygen (www.doxygen.org) for a project.
@@ -44,7 +44,7 @@ PROJECT_NUMBER = 17.0
44# for a project that appears at the top of each page and should give viewer a 44# for a project that appears at the top of each page and should give viewer a
45# quick idea about the purpose of the project. Keep the description short. 45# quick idea about the purpose of the project. Keep the description short.
46 46
47PROJECT_BRIEF = "for Binary (API Level 2) and Script based Add-Ons" 47PROJECT_BRIEF = "for Binary and Script based Add-Ons"
48 48
49# With the PROJECT_LOGO tag one can specify a logo or an icon that is included 49# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
50# in the documentation. The maximum height of the logo should not exceed 55 50# in the documentation. The maximum height of the logo should not exceed 55
@@ -245,9 +245,11 @@ ALIASES = "table_start=<table width= 100% style= border bgcolor=
245 "table_h3{3}=<tr bgcolor= 576f9f><th width= 30% align=left>\1</th><th width= 10% align=left>\2</th><th width= 60% align=left>\3</th></tr>" \ 245 "table_h3{3}=<tr bgcolor= 576f9f><th width= 30% align=left>\1</th><th width= 10% align=left>\2</th><th width= 60% align=left>\3</th></tr>" \
246 "table_row3{3}=<tr bgcolor=white><td width= 30% align=left>\1</td><td width= 10% align=left>\2</td><td width= 60% align=left>\3</td></tr>" \ 246 "table_row3{3}=<tr bgcolor=white><td width= 30% align=left>\1</td><td width= 10% align=left>\2</td><td width= 60% align=left>\3</td></tr>" \
247 "python_func{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Function: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \ 247 "python_func{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Function: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \
248 "python_func_with_rev{2}=\htmlonly <h4><code><span style=\"font-style: italic;\">Function: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code><span style="float:right;"><small>\2</small></span></h4> \endhtmlonly" \ 248 "python_func_with_rev{2}=\htmlonly <h4><code><span style=\"font-style: italic;\">Function: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code><span style= float:right;><small>\2</small></span></h4> \endhtmlonly" \
249 "python_class{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Class: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \ 249 "python_class{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Class: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \
250 "python_class_with_rev{2}=\htmlonly <h4><code><span style=\"font-style: italic;\">Class: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code><span style="float:right;"><small>\2</small></span></h4> \endhtmlonly" \ 250 "python_class_with_rev{2}=\htmlonly <h4><code><span style=\"font-style: italic;\">Class: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code><span style= float:right;><small>\2</small></span></h4> \endhtmlonly" \
251 "cpp_class{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Class: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \
252 "cpp_namespace{1}=\htmlonly <h4><code><span style=\"font-style: italic;\">Namespace: </span><span style=\"font-style: bold;\"><font color=31363b><big>\1</big></font></span></code></h4> \endhtmlonly" \
251 "doc_header{1}=\htmlonly <h3><span style=\"text-decoration: underline;\"><span style=\"font-style: italic;\"><span style=\"color: rgb(102, 102, 102);\">\1</span></span></span></h3> \endhtmlonly" \ 253 "doc_header{1}=\htmlonly <h3><span style=\"text-decoration: underline;\"><span style=\"font-style: italic;\"><span style=\"color: rgb(102, 102, 102);\">\1</span></span></span></h3> \endhtmlonly" \
252 "python_v12=\xrefitem python_v12 \"v12 Python API changes\" \"\"" \ 254 "python_v12=\xrefitem python_v12 \"v12 Python API changes\" \"\"" \
253 "python_v13=\xrefitem python_v13 \"v13 Python API changes\" \"\"" \ 255 "python_v13=\xrefitem python_v13 \"v13 Python API changes\" \"\"" \
@@ -320,6 +322,15 @@ EXTENSION_MAPPING =
320 322
321MARKDOWN_SUPPORT = YES 323MARKDOWN_SUPPORT = YES
322 324
325# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
326# to that level are automatically included in the table of contents, even if
327# they do not have an id attribute.
328# Note: This feature currently applies only to Markdown headings.
329# Minimum value: 0, maximum value: 99, default value: 0.
330# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
331
332TOC_INCLUDE_HEADINGS = 0
333
323# When enabled doxygen tries to link words that correspond to documented 334# When enabled doxygen tries to link words that correspond to documented
324# classes, or namespaces to their corresponding documentation. Such a link can 335# classes, or namespaces to their corresponding documentation. Such a link can
325# be prevented in individual cases by putting a % sign in front of the word or 336# be prevented in individual cases by putting a % sign in front of the word or
@@ -370,6 +381,13 @@ IDL_PROPERTY_SUPPORT = YES
370 381
371DISTRIBUTE_GROUP_DOC = YES 382DISTRIBUTE_GROUP_DOC = YES
372 383
384# If one adds a struct or class to a group and this option is enabled, then also
385# any nested class or struct is added to the same group. By default this option
386# is disabled and one has to add nested compounds explicitly via \ingroup.
387# The default value is: NO.
388
389GROUP_NESTED_COMPOUNDS = NO
390
373# Set the SUBGROUPING tag to YES to allow class member groups of the same type 391# Set the SUBGROUPING tag to YES to allow class member groups of the same type
374# (for instance a group of public functions) to be put as a subgroup of that 392# (for instance a group of public functions) to be put as a subgroup of that
375# type (e.g. under the Public Functions section). Set it to NO to prevent 393# type (e.g. under the Public Functions section). Set it to NO to prevent
@@ -398,7 +416,7 @@ INLINE_GROUPED_CLASSES = NO
398# Man pages) or section (for LaTeX and RTF). 416# Man pages) or section (for LaTeX and RTF).
399# The default value is: NO. 417# The default value is: NO.
400 418
401INLINE_SIMPLE_STRUCTS = NO 419INLINE_SIMPLE_STRUCTS = YES
402 420
403# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or 421# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
404# enum is documented as struct, union, or enum with the name of the typedef. So 422# enum is documented as struct, union, or enum with the name of the typedef. So
@@ -759,6 +777,12 @@ WARN_IF_DOC_ERROR = YES
759 777
760WARN_NO_PARAMDOC = NO 778WARN_NO_PARAMDOC = NO
761 779
780# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
781# a warning is encountered.
782# The default value is: NO.
783
784WARN_AS_ERROR = NO
785
762# The WARN_FORMAT tag determines the format of the warning messages that doxygen 786# The WARN_FORMAT tag determines the format of the warning messages that doxygen
763# can produce. The string should contain the $file, $line, and $text tags, which 787# can produce. The string should contain the $file, $line, and $text tags, which
764# will be replaced by the file and line number from which the warning originated 788# will be replaced by the file and line number from which the warning originated
@@ -782,7 +806,7 @@ WARN_LOGFILE =
782# The INPUT tag is used to specify the files and/or directories that contain 806# The INPUT tag is used to specify the files and/or directories that contain
783# documented source files. You may enter file names like myfile.cpp or 807# documented source files. You may enter file names like myfile.cpp or
784# directories like /usr/src/myproject. Separate the files or directories with 808# directories like /usr/src/myproject. Separate the files or directories with
785# spaces. 809# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
786# Note: If this tag is empty the current directory is searched. 810# Note: If this tag is empty the current directory is searched.
787 811
788INPUT = main.txt \ 812INPUT = main.txt \
@@ -791,6 +815,7 @@ INPUT = main.txt \
791 ../../../../CODING_GUIDELINES.dox \ 815 ../../../../CODING_GUIDELINES.dox \
792 ../../../GUIInfoManager.cpp \ 816 ../../../GUIInfoManager.cpp \
793 Modules/modules_general.dox \ 817 Modules/modules_general.dox \
818 Modules/modules_cpp.dox \
794 Modules/modules_python.dox \ 819 Modules/modules_python.dox \
795 Skin/skin.dox \ 820 Skin/skin.dox \
796 ../../../guilib/GUIRenderingControl.dox \ 821 ../../../guilib/GUIRenderingControl.dox \
@@ -863,7 +888,8 @@ INPUT = main.txt \
863 ../../../interfaces/legacy/wsgi/WsgiInputStream.h \ 888 ../../../interfaces/legacy/wsgi/WsgiInputStream.h \
864 ../../../interfaces/legacy/wsgi/WsgiResponseBody.h \ 889 ../../../interfaces/legacy/wsgi/WsgiResponseBody.h \
865 ../../../interfaces/legacy/wsgi/WsgiResponse.h \ 890 ../../../interfaces/legacy/wsgi/WsgiResponse.h \
866 ../../../pictures/PictureInfoTag.cpp 891 ../../../pictures/PictureInfoTag.cpp \
892 ../include
867 893
868# This tag can be used to specify the character encoding of the source files 894# This tag can be used to specify the character encoding of the source files
869# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses 895# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -876,12 +902,17 @@ INPUT_ENCODING = UTF-8
876 902
877# If the value of the INPUT tag contains directories, you can use the 903# If the value of the INPUT tag contains directories, you can use the
878# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and 904# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
879# *.h) to filter out the source-files in the directories. If left blank the 905# *.h) to filter out the source-files in the directories.
880# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, 906#
881# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, 907# Note that for custom extensions or not directly supported extensions you also
882# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, 908# need to set EXTENSION_MAPPING for the extension otherwise the files are not
883# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, 909# read by doxygen.
884# *.qsf, *.as and *.js. 910#
911# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
912# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
913# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
914# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
915# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
885 916
886FILE_PATTERNS = *.c \ 917FILE_PATTERNS = *.c \
887 *.cc \ 918 *.cc \
@@ -1009,6 +1040,10 @@ IMAGE_PATH = .
1009# Note that the filter must not add or remove lines; it is applied before the 1040# Note that the filter must not add or remove lines; it is applied before the
1010# code is scanned, but not when the output code is generated. If lines are added 1041# code is scanned, but not when the output code is generated. If lines are added
1011# or removed, the anchors will not be placed correctly. 1042# or removed, the anchors will not be placed correctly.
1043#
1044# Note that for custom extensions or not directly supported extensions you also
1045# need to set EXTENSION_MAPPING for the extension otherwise the files are not
1046# properly processed by doxygen.
1012 1047
1013INPUT_FILTER = 1048INPUT_FILTER =
1014 1049
@@ -1018,6 +1053,10 @@ INPUT_FILTER =
1018# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how 1053# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
1019# filters are used. If the FILTER_PATTERNS tag is empty or if none of the 1054# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
1020# patterns match the file name, INPUT_FILTER is applied. 1055# patterns match the file name, INPUT_FILTER is applied.
1056#
1057# Note that for custom extensions or not directly supported extensions you also
1058# need to set EXTENSION_MAPPING for the extension otherwise the files are not
1059# properly processed by doxygen.
1021 1060
1022FILTER_PATTERNS = 1061FILTER_PATTERNS =
1023 1062
@@ -1135,7 +1174,7 @@ VERBATIM_HEADERS = YES
1135# rich C++ code for which doxygen's built-in parser lacks the necessary type 1174# rich C++ code for which doxygen's built-in parser lacks the necessary type
1136# information. 1175# information.
1137# Note: The availability of this option depends on whether or not doxygen was 1176# Note: The availability of this option depends on whether or not doxygen was
1138# compiled with the --with-libclang option. 1177# generated with the -Duse-libclang=ON option for CMake.
1139# The default value is: NO. 1178# The default value is: NO.
1140 1179
1141CLANG_ASSISTED_PARSING = NO 1180CLANG_ASSISTED_PARSING = NO
@@ -1321,7 +1360,7 @@ HTML_DYNAMIC_SECTIONS = NO
1321# Minimum value: 0, maximum value: 9999, default value: 100. 1360# Minimum value: 0, maximum value: 9999, default value: 100.
1322# This tag requires that the tag GENERATE_HTML is set to YES. 1361# This tag requires that the tag GENERATE_HTML is set to YES.
1323 1362
1324HTML_INDEX_NUM_ENTRIES = 100 1363HTML_INDEX_NUM_ENTRIES = 30
1325 1364
1326# If the GENERATE_DOCSET tag is set to YES, additional index files will be 1365# If the GENERATE_DOCSET tag is set to YES, additional index files will be
1327# generated that can be used as input for Apple's Xcode 3 integrated development 1366# generated that can be used as input for Apple's Xcode 3 integrated development
@@ -1572,7 +1611,7 @@ EXT_LINKS_IN_WINDOW = NO
1572 1611
1573FORMULA_FONTSIZE = 10 1612FORMULA_FONTSIZE = 10
1574 1613
1575# Use the FORMULA_TRANSPARENT tag to determine whether or not the images 1614# Use the FORMULA_TRANPARENT tag to determine whether or not the images
1576# generated for formulas are transparent PNGs. Transparent PNGs are not 1615# generated for formulas are transparent PNGs. Transparent PNGs are not
1577# supported properly for IE 6.0, but are supported on all modern browsers. 1616# supported properly for IE 6.0, but are supported on all modern browsers.
1578# 1617#
@@ -1771,9 +1810,12 @@ COMPACT_LATEX = NO
1771PAPER_TYPE = a4 1810PAPER_TYPE = a4
1772 1811
1773# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names 1812# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
1774# that should be included in the LaTeX output. To get the times font for 1813# that should be included in the LaTeX output. The package can be specified just
1775# instance you can specify 1814# by its name or with the correct syntax as to be used with the LaTeX
1776# EXTRA_PACKAGES=times 1815# \usepackage command. To get the times font for instance you can specify :
1816# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
1817# To use the option intlimits with the amsmath package you can specify:
1818# EXTRA_PACKAGES=[intlimits]{amsmath}
1777# If left blank no extra packages will be included. 1819# If left blank no extra packages will be included.
1778# This tag requires that the tag GENERATE_LATEX is set to YES. 1820# This tag requires that the tag GENERATE_LATEX is set to YES.
1779 1821
@@ -1876,6 +1918,14 @@ LATEX_SOURCE_CODE = NO
1876 1918
1877LATEX_BIB_STYLE = plain 1919LATEX_BIB_STYLE = plain
1878 1920
1921# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
1922# page will contain the date and time when the page was generated. Setting this
1923# to NO can help when comparing the output of multiple runs.
1924# The default value is: NO.
1925# This tag requires that the tag GENERATE_LATEX is set to YES.
1926
1927LATEX_TIMESTAMP = NO
1928
1879#--------------------------------------------------------------------------- 1929#---------------------------------------------------------------------------
1880# Configuration options related to the RTF output 1930# Configuration options related to the RTF output
1881#--------------------------------------------------------------------------- 1931#---------------------------------------------------------------------------
@@ -2375,7 +2425,8 @@ INCLUDED_BY_GRAPH = YES
2375# 2425#
2376# Note that enabling this option will significantly increase the time of a run. 2426# Note that enabling this option will significantly increase the time of a run.
2377# So in most cases it will be better to enable call graphs for selected 2427# So in most cases it will be better to enable call graphs for selected
2378# functions only using the \callgraph command. 2428# functions only using the \callgraph command. Disabling a call graph can be
2429# accomplished by means of the command \hidecallgraph.
2379# The default value is: NO. 2430# The default value is: NO.
2380# This tag requires that the tag HAVE_DOT is set to YES. 2431# This tag requires that the tag HAVE_DOT is set to YES.
2381 2432
@@ -2386,7 +2437,8 @@ CALL_GRAPH = NO
2386# 2437#
2387# Note that enabling this option will significantly increase the time of a run. 2438# Note that enabling this option will significantly increase the time of a run.
2388# So in most cases it will be better to enable caller graphs for selected 2439# So in most cases it will be better to enable caller graphs for selected
2389# functions only using the \callergraph command. 2440# functions only using the \callergraph command. Disabling a caller graph can be
2441# accomplished by means of the command \hidecallergraph.
2390# The default value is: NO. 2442# The default value is: NO.
2391# This tag requires that the tag HAVE_DOT is set to YES. 2443# This tag requires that the tag HAVE_DOT is set to YES.
2392 2444
@@ -2409,13 +2461,17 @@ GRAPHICAL_HIERARCHY = YES
2409DIRECTORY_GRAPH = YES 2461DIRECTORY_GRAPH = YES
2410 2462
2411# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 2463# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
2412# generated by dot. 2464# generated by dot. For an explanation of the image formats see the section
2465# output formats in the documentation of the dot tool (Graphviz (see:
2466# http://www.graphviz.org/)).
2413# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order 2467# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
2414# to make the SVG files visible in IE 9+ (other browsers do not have this 2468# to make the SVG files visible in IE 9+ (other browsers do not have this
2415# requirement). 2469# requirement).
2416# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd, 2470# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
2417# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo, 2471# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
2418# gif:cairo:gd, gif:gd, gif:gd:gd and svg. 2472# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
2473# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
2474# png:gdiplus:gdiplus.
2419# The default value is: png. 2475# The default value is: png.
2420# This tag requires that the tag HAVE_DOT is set to YES. 2476# This tag requires that the tag HAVE_DOT is set to YES.
2421 2477
@@ -2466,6 +2522,11 @@ DIAFILE_DIRS =
2466 2522
2467PLANTUML_JAR_PATH = 2523PLANTUML_JAR_PATH =
2468 2524
2525# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
2526# configuration file for plantuml.
2527
2528PLANTUML_CFG_FILE =
2529
2469# When using plantuml, the specified paths are searched for files specified by 2530# When using plantuml, the specified paths are searched for files specified by
2470# the !include statement in a plantuml block. 2531# the !include statement in a plantuml block.
2471 2532
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-cpp.png b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-cpp.png
new file mode 100644
index 0000000..870065e
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-cpp.png
Binary files differ
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-python.png b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-python.png
index 26867b0..179a2ae 100644
--- a/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-python.png
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/logo-python.png
Binary files differ
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_cpp.dox b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_cpp.dox
new file mode 100644
index 0000000..fcb21c0
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/Modules/modules_cpp.dox
@@ -0,0 +1,85 @@
1/*!
2
3\defgroup cpp C++
4\image html logo-cpp.png
5\brief \htmlonly
6 <h3><span style="text-decoration: underline;"><span style="font-style: italic;"><span
7 style="color: rgb(102, 102, 102);">C++ Binary Add-On Development</span></span></span></h3>
8 \endhtmlonly
9*/
10/*!
11\defgroup cpp_kodi Interface - kodi
12\ingroup cpp
13\brief **General addon interface functions**
14*/
15 /*!
16 \defgroup cpp_kodi_Defs Definitions, structures and enumerators
17 \ingroup cpp_kodi
18 @brief **General definition values**
19 */
20/*!
21\defgroup cpp_kodi_addon Interface - kodi::addon
22\ingroup cpp
23\brief **Addon type interface functions and classes**
24*/
25 /*!
26 \defgroup cpp_kodi_addon_addonbase class CAddonBase
27 \ingroup cpp_kodi_addon
28 */
29 /*!
30 \defgroup cpp_kodi_addon_instances Addon type instances
31 \ingroup cpp_kodi_addon
32 */
33 /*!
34 \defgroup cpp_kodi_addon_audiodsp Audio DSP
35 \ingroup cpp_kodi_addon_instances
36 */
37 /*!
38 \defgroup cpp_kodi_addon_audiodecoder Audio Decoder
39 \ingroup cpp_kodi_addon_instances
40 */
41 /*!
42 \defgroup cpp_kodi_addon_audioencoder Audio Encoder
43 \ingroup cpp_kodi_addon_instances
44 */
45 /*!
46 \defgroup cpp_kodi_addon_game Game
47 \ingroup cpp_kodi_addon_instances
48 */
49 /*!
50 \defgroup cpp_kodi_addon_imagedecoder Image Decoder
51 \ingroup cpp_kodi_addon_instances
52 */
53 /*!
54 \defgroup cpp_kodi_addon_inputstream Inputstream
55 \ingroup cpp_kodi_addon_instances
56 */
57 /*!
58 \defgroup cpp_kodi_addon_peripheral Peripheral
59 \ingroup cpp_kodi_addon_instances
60 */
61 /*!
62 \defgroup cpp_kodi_addon_pvr PVR
63 \ingroup cpp_kodi_addon_instances
64 */
65 /*!
66 \defgroup cpp_kodi_addon_screensaver Screensaver
67 \ingroup cpp_kodi_addon_instances
68 */
69 /*!
70 \defgroup cpp_kodi_addon_vfs VFS
71 \ingroup cpp_kodi_addon_instances
72 */
73 /*!
74 \defgroup cpp_kodi_addon_videocodec Video Codec
75 \ingroup cpp_kodi_addon_instances
76 */
77 /*!
78 \defgroup cpp_kodi_addon_visualization Visualization
79 \ingroup cpp_kodi_addon_instances
80 */
81/*!
82\defgroup cpp_kodi_gui Interface - kodi::gui
83\ingroup cpp
84\brief **Graphical functions for Windows and Dialogs to show**
85*/
diff --git a/xbmc/addons/kodi-addon-dev-kit/doxygen/kodi-dev.png b/xbmc/addons/kodi-addon-dev-kit/doxygen/kodi-dev.png
index e513ef2..315a13b 100644
--- a/xbmc/addons/kodi-addon-dev-kit/doxygen/kodi-dev.png
+++ b/xbmc/addons/kodi-addon-dev-kit/doxygen/kodi-dev.png
Binary files differ
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/NOTE b/xbmc/addons/kodi-addon-dev-kit/include/NOTE
index c375cd8..41a7b47 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/NOTE
+++ b/xbmc/addons/kodi-addon-dev-kit/include/NOTE
@@ -10,6 +10,3 @@ change.
10 10
11The current PVR API version can be found in xbmc_pvr_types.h: 11The current PVR API version can be found in xbmc_pvr_types.h:
12XBMC_PVR_API_VERSION 12XBMC_PVR_API_VERSION
13
14The current audio DSP API version can be found in kodi_adsp_types.h:
15KODI_AE_DSP_API_VERSION
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h
index fdf030b..07fd8ce 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/AddonBase.h
@@ -82,9 +82,6 @@ typedef enum ADDON_STATUS
82 /// 82 ///
83 ADDON_STATUS_UNKNOWN, 83 ADDON_STATUS_UNKNOWN,
84 84
85 ///
86 ADDON_STATUS_NEED_SAVEDSETTINGS,
87
88 /// permanent failure, like failing to resolve methods 85 /// permanent failure, like failing to resolve methods
89 ADDON_STATUS_PERMANENT_FAILURE, 86 ADDON_STATUS_PERMANENT_FAILURE,
90 87
@@ -159,8 +156,16 @@ typedef struct AddonToKodiFuncTable_Addon
159 char* (*get_addon_path)(void* kodiBase); 156 char* (*get_addon_path)(void* kodiBase);
160 char* (*get_base_user_path)(void* kodiBase); 157 char* (*get_base_user_path)(void* kodiBase);
161 void (*addon_log_msg)(void* kodiBase, const int loglevel, const char *msg); 158 void (*addon_log_msg)(void* kodiBase, const int loglevel, const char *msg);
162 bool (*get_setting)(void* kodiBase, const char* settingName, void *settingValue); 159
163 bool (*set_setting)(void* kodiBase, const char* settingName, const char* settingValue); 160 bool (*get_setting_bool)(void* kodiBase, const char* id, bool* value);
161 bool (*get_setting_int)(void* kodiBase, const char* id, int* value);
162 bool (*get_setting_float)(void* kodiBase, const char* id, float* value);
163 bool (*get_setting_string)(void* kodiBase, const char* id, char** value);
164
165 bool (*set_setting_bool)(void* kodiBase, const char* id, bool value);
166 bool (*set_setting_int)(void* kodiBase, const char* id, int value);
167 bool (*set_setting_float)(void* kodiBase, const char* id, float value);
168 bool (*set_setting_string)(void* kodiBase, const char* id, const char* value);
164 169
165 AddonToKodiFuncTable_kodi* kodi; 170 AddonToKodiFuncTable_kodi* kodi;
166 AddonToKodiFuncTable_kodi_audioengine* kodi_audioengine; 171 AddonToKodiFuncTable_kodi_audioengine* kodi_audioengine;
@@ -432,8 +437,8 @@ namespace kodi {
432/// 437///
433inline bool CheckSettingString(const std::string& settingName, std::string& settingValue) 438inline bool CheckSettingString(const std::string& settingName, std::string& settingValue)
434{ 439{
435 char * buffer = nullptr; 440 char* buffer = nullptr;
436 bool ret = ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &buffer); 441 bool ret = ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &buffer);
437 if (buffer) 442 if (buffer)
438 { 443 {
439 if (ret) 444 if (ret)
@@ -462,7 +467,7 @@ namespace kodi {
462/// 467///
463inline void SetSettingString(const std::string& settingName, const std::string& settingValue) 468inline void SetSettingString(const std::string& settingName, const std::string& settingValue)
464{ 469{
465 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue.c_str()); 470 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue.c_str());
466} 471}
467} /* namespace kodi */ 472} /* namespace kodi */
468//---------------------------------------------------------------------------- 473//----------------------------------------------------------------------------
@@ -472,7 +477,7 @@ namespace kodi {
472/// 477///
473inline bool CheckSettingInt(const std::string& settingName, int& settingValue) 478inline bool CheckSettingInt(const std::string& settingName, int& settingValue)
474{ 479{
475 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue); 480 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting_int(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue);
476} 481}
477} /* namespace kodi */ 482} /* namespace kodi */
478//---------------------------------------------------------------------------- 483//----------------------------------------------------------------------------
@@ -494,9 +499,7 @@ namespace kodi {
494/// 499///
495inline void SetSettingInt(const std::string& settingName, int settingValue) 500inline void SetSettingInt(const std::string& settingName, int settingValue)
496{ 501{
497 char buffer[33]; 502 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting_int(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue);
498 snprintf(buffer, sizeof(buffer), "%i", settingValue);
499 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), buffer);
500} 503}
501} /* namespace kodi */ 504} /* namespace kodi */
502//---------------------------------------------------------------------------- 505//----------------------------------------------------------------------------
@@ -506,7 +509,7 @@ namespace kodi {
506/// 509///
507inline bool CheckSettingBoolean(const std::string& settingName, bool& settingValue) 510inline bool CheckSettingBoolean(const std::string& settingName, bool& settingValue)
508{ 511{
509 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue); 512 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting_bool(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue);
510} 513}
511} /* namespace kodi */ 514} /* namespace kodi */
512//---------------------------------------------------------------------------- 515//----------------------------------------------------------------------------
@@ -528,7 +531,7 @@ namespace kodi {
528/// 531///
529inline void SetSettingBoolean(const std::string& settingName, bool settingValue) 532inline void SetSettingBoolean(const std::string& settingName, bool settingValue)
530{ 533{
531 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue ? "true" : "false"); 534 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting_bool(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue);
532} 535}
533} /* namespace kodi */ 536} /* namespace kodi */
534//---------------------------------------------------------------------------- 537//----------------------------------------------------------------------------
@@ -538,7 +541,7 @@ namespace kodi {
538/// 541///
539inline bool CheckSettingFloat(const std::string& settingName, float& settingValue) 542inline bool CheckSettingFloat(const std::string& settingName, float& settingValue)
540{ 543{
541 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue); 544 return ::kodi::addon::CAddonBase::m_interface->toKodi->get_setting_float(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), &settingValue);
542} 545}
543} /* namespace kodi */ 546} /* namespace kodi */
544//---------------------------------------------------------------------------- 547//----------------------------------------------------------------------------
@@ -560,9 +563,7 @@ namespace kodi {
560/// 563///
561inline void SetSettingFloat(const std::string& settingName, float settingValue) 564inline void SetSettingFloat(const std::string& settingName, float settingValue)
562{ 565{
563 char buffer[50]; 566 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting_float(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), settingValue);
564 snprintf(buffer, sizeof(buffer), "%f", settingValue);
565 ::kodi::addon::CAddonBase::m_interface->toKodi->set_setting(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, settingName.c_str(), buffer);
566} 567}
567} /* namespace kodi */ 568} /* namespace kodi */
568//---------------------------------------------------------------------------- 569//----------------------------------------------------------------------------
@@ -584,8 +585,6 @@ inline std::string TranslateAddonStatus(ADDON_STATUS status)
584 return "Need Settings"; 585 return "Need Settings";
585 case ADDON_STATUS_UNKNOWN: 586 case ADDON_STATUS_UNKNOWN:
586 return "Unknown error"; 587 return "Unknown error";
587 case ADDON_STATUS_NEED_SAVEDSETTINGS:
588 return "Need saved settings";
589 case ADDON_STATUS_PERMANENT_FAILURE: 588 case ADDON_STATUS_PERMANENT_FAILURE:
590 return "Permanent failure"; 589 return "Permanent failure";
591 case ADDON_STATUS_NOT_IMPLEMENTED: 590 case ADDON_STATUS_NOT_IMPLEMENTED:
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h
index 3222e8b..76210cf 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/Filesystem.h
@@ -119,14 +119,26 @@ extern "C"
119} /* extern "C" */ 119} /* extern "C" */
120 120
121//============================================================================== 121//==============================================================================
122/// \defgroup cpp_kodi_vfs_CFile_Defs Definitions, structures and enumerators 122///
123/// \ingroup cpp_kodi_vfs_CFile 123/// \defgroup cpp_kodi_vfs Interface - kodi::vfs
124/// \ingroup cpp
125/// @brief **Virtual filesystem functions**
126///
127///
128/// It has the header \ref Filesystem.h "#include <kodi/Filesystem.h>" be
129/// included to enjoy it.
130///
131//------------------------------------------------------------------------------
132
133//==============================================================================
134/// \defgroup cpp_kodi_vfs_Defs Definitions, structures and enumerators
135/// \ingroup cpp_kodi_vfs
124/// @brief **Virtual file Server definition values** 136/// @brief **Virtual file Server definition values**
125//------------------------------------------------------------------------------ 137//------------------------------------------------------------------------------
126 138
127//============================================================================== 139//==============================================================================
128/// 140///
129/// @ingroup cpp_kodi_vfs_CFile_Defs 141/// @ingroup cpp_kodi_vfs_Defs
130/// Flags to define way how file becomes opened with kodi::vfs::CFile::OpenFile() 142/// Flags to define way how file becomes opened with kodi::vfs::CFile::OpenFile()
131/// 143///
132/// The values can be used together, e.g. <b>`file.Open("myfile", READ_TRUNCATED | READ_CHUNKED);`</b> 144/// The values can be used together, e.g. <b>`file.Open("myfile", READ_TRUNCATED | READ_CHUNKED);`</b>
@@ -166,7 +178,7 @@ typedef enum OpenFileFlags
166//------------------------------------------------------------------------------ 178//------------------------------------------------------------------------------
167 179
168//============================================================================== 180//==============================================================================
169/// \ingroup cpp_kodi_vfs_CFile_Defs 181/// \ingroup cpp_kodi_vfs_Defs
170/// @brief Used CURL message types 182/// @brief Used CURL message types
171/// 183///
172typedef enum CURLOptiontype 184typedef enum CURLOptiontype
@@ -184,8 +196,11 @@ typedef enum CURLOptiontype
184 196
185//============================================================================ 197//============================================================================
186/// 198///
187/// \ingroup cpp_kodi_vfs_CFile_Defs 199/// \ingroup cpp_kodi_vfs_Defs
188/// @brief Information about a file 200/// @brief File information status
201///
202/// Used on kodi::vfs::StatFile(), all of these calls return a this stat
203/// structure, which contains the following fields:
189/// 204///
190struct STAT_STRUCTURE 205struct STAT_STRUCTURE
191{ 206{
@@ -785,7 +800,7 @@ namespace vfs
785 800
786 //============================================================================ 801 //============================================================================
787 /// 802 ///
788 /// \ingroup cpp_kodi 803 /// @ingroup cpp_kodi_vfs
789 /// @brief Returns the translated path 804 /// @brief Returns the translated path
790 /// 805 ///
791 /// @param[in] source string or unicode - Path to format 806 /// @param[in] source string or unicode - Path to format
@@ -929,7 +944,7 @@ namespace vfs
929 /// fprintf(stderr, "Log file should be always present, is it present? %s\n", exists ? "yes" : "no"); 944 /// fprintf(stderr, "Log file should be always present, is it present? %s\n", exists ? "yes" : "no");
930 /// ~~~~~~~~~~~~~ 945 /// ~~~~~~~~~~~~~
931 /// 946 ///
932 static inline bool FileExists(const std::string& filename, bool usecache = false) 947 inline bool FileExists(const std::string& filename, bool usecache = false)
933 { 948 {
934 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->file_exists(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), usecache); 949 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->file_exists(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), usecache);
935 } 950 }
@@ -980,7 +995,7 @@ namespace vfs
980 /// ret); 995 /// ret);
981 /// ~~~~~~~~~~~~~ 996 /// ~~~~~~~~~~~~~
982 /// 997 ///
983 static inline bool StatFile(const std::string& filename, STAT_STRUCTURE& buffer) 998 inline bool StatFile(const std::string& filename, STAT_STRUCTURE& buffer)
984 { 999 {
985 struct __stat64 frontendBuffer = { }; 1000 struct __stat64 frontendBuffer = { };
986 if (::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->stat_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), &frontendBuffer)) 1001 if (::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->stat_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), &frontendBuffer))
@@ -1045,7 +1060,7 @@ namespace vfs
1045 /// } 1060 /// }
1046 /// ~~~~~~~~~~~~~ 1061 /// ~~~~~~~~~~~~~
1047 /// 1062 ///
1048 static inline bool DeleteFile(const std::string& filename) 1063 inline bool DeleteFile(const std::string& filename)
1049 { 1064 {
1050 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->delete_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str()); 1065 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->delete_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str());
1051 } 1066 }
@@ -1061,7 +1076,7 @@ namespace vfs
1061 /// @return true if successfully renamed 1076 /// @return true if successfully renamed
1062 /// 1077 ///
1063 /// 1078 ///
1064 static inline bool RenameFile(const std::string& filename, const std::string& newFileName) 1079 inline bool RenameFile(const std::string& filename, const std::string& newFileName)
1065 { 1080 {
1066 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->rename_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), newFileName.c_str()); 1081 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->rename_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), newFileName.c_str());
1067 } 1082 }
@@ -1077,7 +1092,7 @@ namespace vfs
1077 /// @return true if successfully copied 1092 /// @return true if successfully copied
1078 /// 1093 ///
1079 /// 1094 ///
1080 static inline bool CopyFile(const std::string& filename, const std::string& destination) 1095 inline bool CopyFile(const std::string& filename, const std::string& destination)
1081 { 1096 {
1082 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->copy_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), destination.c_str()); 1097 return ::kodi::addon::CAddonBase::m_interface->toKodi->kodi_filesystem->copy_file(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, filename.c_str(), destination.c_str());
1083 } 1098 }
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h
index 50718af..f4295ea 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/General.h
@@ -34,11 +34,18 @@
34 */ 34 */
35typedef struct AddonToKodiFuncTable_kodi 35typedef struct AddonToKodiFuncTable_kodi
36{ 36{
37 char* (*get_addon_info)(void* kodiBase, const char* id);
37 bool (*open_settings_dialog)(void* kodiBase); 38 bool (*open_settings_dialog)(void* kodiBase);
38 char* (*unknown_to_utf8)(void* kodiBase, const char* source, bool* ret, bool failOnBadChar); 39 char* (*unknown_to_utf8)(void* kodiBase, const char* source, bool* ret, bool failOnBadChar);
39 char* (*get_localized_string)(void* kodiBase, long dwCode); 40 char* (*get_localized_string)(void* kodiBase, long dwCode);
40 char* (*get_language)(void* kodiBase, int format, bool region); 41 char* (*get_language)(void* kodiBase, int format, bool region);
41 bool (*queue_notification)(void* kodiBase, int type, const char* header, const char* message, const char* imageFile, unsigned int displayTime, bool withSound, unsigned int messageTime); 42 bool (*queue_notification)(void* kodiBase, int type, const char* header, const char* message, const char* imageFile, unsigned int displayTime, bool withSound, unsigned int messageTime);
43 void (*get_md5)(void* kodiBase, const char* text, char* md5);
44 char* (*get_temp_path)(void* kodiBase);
45 char* (*get_region)(void* kodiBase, const char* id);
46 void (*get_free_mem)(void* kodiBase, long* free, long* total, bool as_bytes);
47 int (*get_global_idle_time)(void* kodiBase);
48 void (*kodi_version)(void* kodiBase, char** compile_name, int* major, int* minor, char** revision, char** tag, char** tagversion);
42} AddonToKodiFuncTable_kodi; 49} AddonToKodiFuncTable_kodi;
43 50
44//============================================================================== 51//==============================================================================
@@ -62,6 +69,8 @@ typedef enum QueueMsg
62/// \ingroup cpp_kodi_Defs 69/// \ingroup cpp_kodi_Defs
63/// @brief Format codes to get string from them. 70/// @brief Format codes to get string from them.
64/// 71///
72/// Used on kodi::GetLanguage().
73///
65typedef enum LangFormats 74typedef enum LangFormats
66{ 75{
67 /// two letter code as defined in ISO 639-1 76 /// two letter code as defined in ISO 639-1
@@ -73,6 +82,71 @@ typedef enum LangFormats
73} LangFormats; 82} LangFormats;
74//------------------------------------------------------------------------------ 83//------------------------------------------------------------------------------
75 84
85//==============================================================================
86/// \ingroup cpp_kodi_Defs
87/// @brief For kodi::Version used structure
88///
89typedef struct kodi_version_t
90{
91 /// Application name, normally 'Kodi'
92 std::string compile_name;
93 /// Major code version of Kodi
94 int major;
95 /// Minor code version of Kodi
96 int minor;
97 /// The Revision contains a id and the build date, e.g. 20170706-c6b22fe217-dirty
98 std::string revision;
99 /// The version canditate e.g. alpha, beta or release
100 std::string tag;
101 /// The revision of tag before
102 std::string tag_revision;
103} kodi_version_t;
104//------------------------------------------------------------------------------
105
106//==============================================================================
107namespace kodi {
108///
109/// \ingroup cpp_kodi
110/// @brief Returns the value of an addon property as a string
111///
112/// @param[in] id id of the property that the module needs to access
113/// | | Choices are | |
114/// |:------------:|:------------:|:------------:|
115/// | author | icon | stars |
116/// | changelog | id | summary |
117/// | description | name | type |
118/// | disclaimer | path | version |
119/// | fanart | profile | |
120///
121/// @return AddOn property as a string
122///
123///
124/// ------------------------------------------------------------------------
125///
126/// **Example:**
127/// ~~~~~~~~~~~~~{.cpp}
128/// #include <kodi/General.h>
129/// ...
130/// std::string addonName = kodi::GetAddonInfo("name");
131/// ...
132/// ~~~~~~~~~~~~~
133///
134inline std::string GetAddonInfo(const std::string& id)
135{
136 AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi;
137
138 std::string strReturn;
139 char* strMsg = toKodi->kodi->get_addon_info(toKodi->kodiBase, id.c_str());
140 if (strMsg != nullptr)
141 {
142 if (std::strlen(strMsg))
143 strReturn = strMsg;
144 toKodi->free_string(toKodi->kodiBase, strMsg);
145 }
146 return strReturn;
147}
148} /* namespace kodi */
149//------------------------------------------------------------------------------
76 150
77//============================================================================== 151//==============================================================================
78namespace kodi { 152namespace kodi {
@@ -374,3 +448,251 @@ inline void QueueNotification(QueueMsg type, const std::string& header,
374} 448}
375} /* namespace kodi */ 449} /* namespace kodi */
376//------------------------------------------------------------------------------ 450//------------------------------------------------------------------------------
451
452//============================================================================
453namespace kodi {
454///
455/// \ingroup cpp_kodi
456/// @brief Get the MD5 digest of the given text
457///
458/// @param[in] text text to compute the MD5 for
459/// @return Returned MD5 digest
460///
461///
462/// ------------------------------------------------------------------------
463///
464/// **Example:**
465/// ~~~~~~~~~~~~~{.cpp}
466/// #include <kodi/General.h>
467/// ...
468/// std::string md5 = kodi::GetMD5("Make me as md5");
469/// fprintf(stderr, "My md5 digest is: '%s'\n", md5.c_str());
470/// ...
471/// ~~~~~~~~~~~~~
472///
473inline std::string GetMD5(const std::string& text)
474{
475 char* md5ret = static_cast<char*>(malloc(40*sizeof(char))); // md5 size normally 32 bytes
476 ::kodi::addon::CAddonBase::m_interface->toKodi->kodi->get_md5(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), md5ret);
477 std::string md5 = md5ret;
478 free(md5ret);
479 return md5;
480}
481} /* namespace kodi */
482//----------------------------------------------------------------------------
483
484//==============================================================================
485namespace kodi {
486///
487/// \ingroup cpp_kodi
488/// @brief To get a temporary path for the addon
489///
490/// This gives a temporary path which the addon can use individually for its things.
491///
492/// The content of this folder will be deleted when Kodi is finished!
493///
494/// @param[in] append A string to append to returned temporary path
495/// @return Individual path for the addon
496///
497inline std::string GetTempAddonPath(const std::string& append = "")
498{
499 char* str = ::kodi::addon::CAddonBase::m_interface->toKodi->kodi->get_temp_path(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase);
500 std::string ret = str;
501 ::kodi::addon::CAddonBase::m_interface->toKodi->free_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, str);
502 if (!append.empty())
503 {
504 if (append.at(0) != '\\' &&
505 append.at(0) != '/')
506#ifdef TARGET_WINDOWS
507 ret.append("\\");
508#else
509 ret.append("/");
510#endif
511 ret.append(append);
512 }
513 return ret;
514}
515} /* namespace kodi */
516//------------------------------------------------------------------------------
517
518//==============================================================================
519namespace kodi {
520///
521/// \ingroup cpp_kodi
522/// @brief Returns your regions setting as a string for the specified id
523///
524/// @param[in] id id of setting to return
525/// | | Choices are | |
526/// |:------------:|:------------:|:------------:|
527/// | dateshort | time | tempunit |
528/// | datelong | meridiem | speedunit |
529///
530/// @return settings string
531///
532///
533/// ------------------------------------------------------------------------
534///
535/// **Example:**
536/// ~~~~~~~~~~~~~{.cpp}
537/// #include <kodi/General.h>
538/// ...
539/// std::string timeFormat = kodi::GetRegion("time");
540/// ...
541/// ~~~~~~~~~~~~~
542///
543inline std::string GetRegion(const std::string& id)
544{
545 AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi;
546
547 std::string strReturn;
548 char* strMsg = toKodi->kodi->get_region(toKodi->kodiBase, id.c_str());
549 if (strMsg != nullptr)
550 {
551 if (std::strlen(strMsg))
552 strReturn = strMsg;
553 toKodi->free_string(toKodi->kodiBase, strMsg);
554 }
555 return strReturn;
556}
557} /* namespace kodi */
558//------------------------------------------------------------------------------
559
560//==============================================================================
561namespace kodi {
562///
563/// \ingroup cpp_kodi
564/// @brief Returns the amount of free memory in MByte (or as bytes) as an long
565/// integer
566///
567/// @param[out] free free memory
568/// @param[out] total total memory
569/// @param[in] asBytes [opt] if set to true becomes returned as bytes, otherwise
570/// as mega bytes
571///
572///
573/// ------------------------------------------------------------------------
574///
575/// **Example:**
576/// ~~~~~~~~~~~~~{.cpp}
577/// #include <kodi/General.h>
578/// ...
579/// long freeMem;
580/// long totalMem;
581/// kodi::GetFreeMem(freeMem, totalMem);
582/// ...
583/// ~~~~~~~~~~~~~
584///
585inline void GetFreeMem(long& free, long& total, bool asBytes = false)
586{
587 free = -1;
588 total = -1;
589 AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi;
590 toKodi->kodi->get_free_mem(toKodi->kodiBase, &free, &total, asBytes);
591}
592} /* namespace kodi */
593//------------------------------------------------------------------------------
594
595//==============================================================================
596namespace kodi {
597///
598/// \ingroup cpp_kodi
599/// @brief Returns the elapsed idle time in seconds as an integer
600///
601/// @return idle time
602///
603///
604/// ------------------------------------------------------------------------
605///
606/// **Example:**
607/// ~~~~~~~~~~~~~{.cpp}
608/// #include <kodi/General.h>
609/// ...
610/// int time = kodi::GetGlobalIdleTime();
611/// ...
612/// ~~~~~~~~~~~~~
613///
614inline int GetGlobalIdleTime()
615{
616 AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi;
617 return toKodi->kodi->get_global_idle_time(toKodi->kodiBase);
618}
619} /* namespace kodi */
620//------------------------------------------------------------------------------
621
622//==============================================================================
623namespace kodi {
624///
625/// \ingroup cpp_kodi
626/// @brief Get current Kodi informations and versions, returned data from the following
627/// <b><tt>kodi_version_t version; kodi::KodiVersion(version);</tt></b>
628/// is e.g.:
629/// ~~~~~~~~~~~~~{.cpp}
630/// version.compile_name = Kodi
631/// version.major = 18
632/// version.minor = 0
633/// version.revision = 20170706-c6b22fe217-di
634/// version.tag = alpha
635/// version.tag_revision = 1
636/// ~~~~~~~~~~~~~
637///
638/// @param[out] version structure to store data from kodi
639///
640///
641/// ------------------------------------------------------------------------
642///
643/// **Example:**
644/// ~~~~~~~~~~~~~{.cpp}
645/// #include <kodi/General.h>
646/// ...
647/// kodi_version_t version;
648/// kodi::KodiVersion(version);
649/// fprintf(stderr,
650/// "kodi_version_t version;\n"
651/// "kodi::KodiVersion(version);\n"
652/// " - version.compile_name = %s\n"
653/// " - version.major = %i\n"
654/// " - version.minor = %i\n"
655/// " - version.revision = %s\n"
656/// " - version.tag = %s\n"
657/// " - version.tag_revision = %s\n",
658/// version.compile_name.c_str(), version.major, version.minor,
659/// version.revision.c_str(), version.tag.c_str(), version.tag_revision.c_str());
660/// ...
661/// ~~~~~~~~~~~~~
662///
663inline void KodiVersion(kodi_version_t& version)
664{
665 char* compile_name = nullptr;
666 char* revision = nullptr;
667 char* tag = nullptr;
668 char* tag_revision = nullptr;
669
670 AddonToKodiFuncTable_Addon* toKodi = ::kodi::addon::CAddonBase::m_interface->toKodi;
671 toKodi->kodi->kodi_version(toKodi->kodiBase, &compile_name, &version.major, &version.minor, &revision, &tag, &tag_revision);
672 if (compile_name != nullptr)
673 {
674 version.compile_name = compile_name;
675 toKodi->free_string
676 (
677 toKodi->kodiBase,
678 compile_name
679 );
680 }
681 if (revision != nullptr)
682 {
683 version.revision = revision;
684 toKodi->free_string(toKodi->kodiBase, revision);
685 }
686 if (tag != nullptr)
687 {
688 version.tag = tag;
689 toKodi->free_string(toKodi->kodiBase, tag);
690 }
691 if (tag_revision != nullptr)
692 {
693 version.tag_revision = tag_revision;
694 toKodi->free_string(toKodi->kodiBase, tag_revision);
695 }
696}
697} /* namespace kodi */
698//------------------------------------------------------------------------------
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h
new file mode 100644
index 0000000..85de3ec
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCodec.h
@@ -0,0 +1,33 @@
1#pragma once
2/*
3 * Copyright (C) 2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22enum STREAMCODEC_PROFILE
23{
24 CodecProfileUnknown = 0,
25 CodecProfileNotNeeded,
26 H264CodecProfileBaseline,
27 H264CodecProfileMain,
28 H264CodecProfileExtended,
29 H264CodecProfileHigh,
30 H264CodecProfileHigh10,
31 H264CodecProfileHigh422,
32 H264CodecProfileHigh444Predictive
33};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h
new file mode 100644
index 0000000..f802f3b
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/StreamCrypto.h
@@ -0,0 +1,37 @@
1#pragma once
2/*
3 * Copyright (C) 2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22typedef struct CRYPTO_INFO
23{
24 enum CRYPTO_KEY_SYSTEM : uint8_t
25 {
26 CRYPTO_KEY_SYSTEM_NONE = 0,
27 CRYPTO_KEY_SYSTEM_WIDEVINE,
28 CRYPTO_KEY_SYSTEM_PLAYREADY,
29 CRYPTO_KEY_SYSTEM_COUNT
30 } m_CryptoKeySystem; /*!< @brief keysystem for encrypted media, KEY_SYSTEM_NONE for unencrypted media */
31
32 static const uint8_t FLAG_SECURE_DECODER = 1; /*!< @brief is set in flags if decoding has to be done in TEE environment */
33
34 uint8_t flags;
35 uint16_t m_CryptoSessionIdSize; /*!< @brief The size of the crypto session key id */
36 const char *m_CryptoSessionId; /*!< @brief The crypto session key id */
37} CRYPTO_INFO;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h
new file mode 100644
index 0000000..c508f80
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDSP.h
@@ -0,0 +1,1288 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include "../AddonBase.h"
24
25#define AE_DSP_STREAM_MAX_STREAMS 8
26#define AE_DSP_STREAM_MAX_MODES 32
27
28/*!
29 * @file Addon.h
30 * @section sec1 Basic audio dsp addon interface description
31 * @author Team Kodi
32 * @date 10. May 2014
33 * @version 0.1.5
34 *
35 * @subsection sec1_1 General
36 * @li The basic support on the addon is supplied with the
37 * AE_DSP_ADDON_CAPABILITIES data which becomes asked over
38 * GetCapabilities(...), further the addon must register his available
39 * modes on startup with the RegisterMode(...) callback function.
40 * If one of this two points is not set the addon becomes
41 * ignored for the chain step.
42 *
43 * @subsection sec1_2 Processing
44 * @li On start of new stream the addon becomes called with StreamCreate(...)
45 * to check about given values that it support it basically and can create
46 * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME.
47 *
48 * @li As next step StreamIsModeSupported(...) becomes called for every
49 * available and enabled modes, is separated due to more as one available mode
50 * on the addon is possible, if the mode is not supported it can also be return
51 * AE_DSP_ERROR_IGNORE_ME.
52 * - If mode is a resample mode and returns no error it becomes asked with
53 * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant
54 * to his type) about his given sample rate.
55 * - About the from user selected master processing mode the related addon
56 * becomes called now with MasterProcessSetMode(...) to handle it's
57 * selectionon the addon given by the own addon type identifier or by
58 * KODI's useddatabase id, also the currently used stream type (e.g.
59 * Music or Video) is send.
60 * - If the addon supports only one master mode it can ignore this function
61 * and return always AE_DSP_ERROR_NO_ERROR.
62 * - If the master mode is set the addon becomes asked about the from him
63 * given output channel layout related to up- or downmix modes, if
64 * nothing becomes changed on the layout it can return -1.
65 * - The MasterProcessSetMode(...) is also called if from user a another
66 * mode becomes selected.
67 *
68 * @li Then as last step shortly before the first process call becomes executed
69 * the addon is called one time with StreamInitialize(...) to inform that
70 * processing is started on the given settings.
71 * - This function becomes also called on all add-ons if the master process
72 * becomes changed.
73 * - Also every process after StreamInitialize on the addon mode becomes asked
74 * with _..._ProcessNeededSamplesize(...) about required memory size for the
75 * output of his data, if no other size is required it can return 0.
76 *
77 * @li From now the processing becomes handled for the different steps with
78 * _..._Process(...).
79 * - Further it becomes asked with _..._GetDelay(...) about his processing
80 * time as float value in seconds, needed for video and audio alignment.
81 *
82 * @li On the end of the processing if the source becomes stopped the
83 * StreamDestroy(...) function becomes called on all active processing add-ons.
84 *
85 * @note
86 * The StreamCreate(...) can be becomes called for a new stream before the
87 * previous was closed with StreamDestroy(...) ! To have a speed improve.
88 */
89
90namespace kodi { namespace addon { class CInstanceAudioDSP; }}
91
92extern "C" {
93
94 typedef void* ADSPHANDLE;
95
96 typedef unsigned int AE_DSP_STREAM_ID;
97
98 /*!
99 * @brief Audio DSP add-on error codes
100 */
101 typedef enum
102 {
103 AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */
104 AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */
105 AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */
106 AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */
107 AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */
108 AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */
109 AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */
110 AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */
111 AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */
112 AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */
113 } AE_DSP_ERROR;
114
115 /*!
116 * @brief The possible DSP channels (used as pointer inside arrays)
117 */
118 typedef enum
119 {
120 AE_DSP_CH_INVALID = -1,
121 AE_DSP_CH_FL = 0,
122 AE_DSP_CH_FR,
123 AE_DSP_CH_FC,
124 AE_DSP_CH_LFE,
125 AE_DSP_CH_BL,
126 AE_DSP_CH_BR,
127 AE_DSP_CH_FLOC,
128 AE_DSP_CH_FROC,
129 AE_DSP_CH_BC,
130 AE_DSP_CH_SL,
131 AE_DSP_CH_SR,
132 AE_DSP_CH_TFL,
133 AE_DSP_CH_TFR,
134 AE_DSP_CH_TFC,
135 AE_DSP_CH_TC,
136 AE_DSP_CH_TBL,
137 AE_DSP_CH_TBR,
138 AE_DSP_CH_TBC,
139 AE_DSP_CH_BLOC,
140 AE_DSP_CH_BROC,
141
142 AE_DSP_CH_MAX
143 } AE_DSP_CHANNEL;
144
145 /*!
146 * @brief Present channel flags
147 */
148 typedef enum
149 {
150 AE_DSP_PRSNT_CH_UNDEFINED = 0,
151 AE_DSP_PRSNT_CH_FL = 1<<AE_DSP_CH_FL,
152 AE_DSP_PRSNT_CH_FR = 1<<AE_DSP_CH_FR,
153 AE_DSP_PRSNT_CH_FC = 1<<AE_DSP_CH_FC,
154 AE_DSP_PRSNT_CH_LFE = 1<<AE_DSP_CH_LFE,
155 AE_DSP_PRSNT_CH_BL = 1<<AE_DSP_CH_BL,
156 AE_DSP_PRSNT_CH_BR = 1<<AE_DSP_CH_BR,
157 AE_DSP_PRSNT_CH_FLOC = 1<<AE_DSP_CH_FLOC,
158 AE_DSP_PRSNT_CH_FROC = 1<<AE_DSP_CH_FROC,
159 AE_DSP_PRSNT_CH_BC = 1<<AE_DSP_CH_BC,
160 AE_DSP_PRSNT_CH_SL = 1<<AE_DSP_CH_SL,
161 AE_DSP_PRSNT_CH_SR = 1<<AE_DSP_CH_SR,
162 AE_DSP_PRSNT_CH_TFL = 1<<AE_DSP_CH_TFL,
163 AE_DSP_PRSNT_CH_TFR = 1<<AE_DSP_CH_TFR,
164 AE_DSP_PRSNT_CH_TFC = 1<<AE_DSP_CH_TFC,
165 AE_DSP_PRSNT_CH_TC = 1<<AE_DSP_CH_TC,
166 AE_DSP_PRSNT_CH_TBL = 1<<AE_DSP_CH_TBL,
167 AE_DSP_PRSNT_CH_TBR = 1<<AE_DSP_CH_TBR,
168 AE_DSP_PRSNT_CH_TBC = 1<<AE_DSP_CH_TBC,
169 AE_DSP_PRSNT_CH_BLOC = 1<<AE_DSP_CH_BLOC,
170 AE_DSP_PRSNT_CH_BROC = 1<<AE_DSP_CH_BROC
171 } AE_DSP_CHANNEL_PRESENT;
172
173 /**
174 * @brief The various stream type formats
175 * Used for audio DSP processing to know input audio type
176 */
177 typedef enum
178 {
179 AE_DSP_ASTREAM_INVALID = -1,
180 AE_DSP_ASTREAM_BASIC = 0,
181 AE_DSP_ASTREAM_MUSIC,
182 AE_DSP_ASTREAM_MOVIE,
183 AE_DSP_ASTREAM_GAME,
184 AE_DSP_ASTREAM_APP,
185 AE_DSP_ASTREAM_PHONE,
186 AE_DSP_ASTREAM_MESSAGE,
187
188 AE_DSP_ASTREAM_AUTO,
189 AE_DSP_ASTREAM_MAX
190 } AE_DSP_STREAMTYPE;
191
192 /*!
193 * @brief Add-ons supported audio stream type flags
194 * used on master mode information on AE_DSP_MODES to know
195 * on which audio stream the master mode is supported
196 */
197 typedef enum
198 {
199 AE_DSP_PRSNT_ASTREAM_BASIC = 1<<AE_DSP_ASTREAM_BASIC,
200 AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<AE_DSP_ASTREAM_MUSIC,
201 AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<AE_DSP_ASTREAM_MOVIE,
202 AE_DSP_PRSNT_ASTREAM_GAME = 1<<AE_DSP_ASTREAM_GAME,
203 AE_DSP_PRSNT_ASTREAM_APP = 1<<AE_DSP_ASTREAM_APP,
204 AE_DSP_PRSNT_ASTREAM_PHONE = 1<<AE_DSP_ASTREAM_PHONE,
205 AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<AE_DSP_ASTREAM_MESSAGE,
206 } AE_DSP_ASTREAM_PRESENT;
207
208 /**
209 * @brief The various base type formats
210 * Used for audio DSP processing to know input audio source
211 */
212 typedef enum
213 {
214 AE_DSP_ABASE_INVALID = -1,
215 AE_DSP_ABASE_STEREO = 0,
216 AE_DSP_ABASE_MONO,
217 AE_DSP_ABASE_MULTICHANNEL,
218 AE_DSP_ABASE_AC3,
219 AE_DSP_ABASE_EAC3,
220 AE_DSP_ABASE_DTS,
221 AE_DSP_ABASE_DTSHD_MA,
222 AE_DSP_ABASE_DTSHD_HRA,
223 AE_DSP_ABASE_TRUEHD,
224 AE_DSP_ABASE_MLP,
225 AE_DSP_ABASE_FLAC,
226
227 AE_DSP_ABASE_MAX
228 } AE_DSP_BASETYPE;
229
230
231 /**
232 * @brief The from KODI in settings requested audio process quality.
233 * The KODI internal used quality levels is translated to this values
234 * for usage on DSP processing add-ons. Is present on iQualityLevel
235 * inside AE_DSP_SETTINGS.
236 */
237 typedef enum
238 {
239 AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */
240 AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */
241
242 /* Basic quality levels */
243 AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */
244 AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */
245 AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */
246
247 /* Optional quality levels */
248 AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */
249 } AE_DSP_QUALITY;
250
251 /*!
252 * @brief Audio DSP menu hook categories.
253 * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows.
254 * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available
255 * from DSP playback dialogue which can be opened over KODI file context menu and over
256 * button on full screen OSD window.
257 *
258 * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue.
259 */
260 typedef enum
261 {
262 AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */
263 AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */
264 AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */
265 AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */
266 AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */
267 AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */
268 AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */
269 AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */
270 AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */
271 } AE_DSP_MENUHOOK_CAT;
272
273 /*!
274 * @brief Menu hooks that are available in the menus while playing a stream via this add-on.
275 */
276 typedef struct AE_DSP_MENUHOOK
277 {
278 unsigned int iHookId; /*!< @brief (required) this hook's identifier */
279 unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */
280 AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */
281 unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */
282 bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */
283 } ATTRIBUTE_PACKED AE_DSP_MENUHOOK;
284
285 /*!
286 * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default.
287 * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented.
288 */
289 typedef struct AE_DSP_ADDON_CAPABILITIES
290 {
291 bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */
292 bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */
293 bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */
294 bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */
295 bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */
296 bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */
297 } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES;
298
299 /*!
300 * @brief Audio processing settings for in and out arrays
301 * Send on creation and before first processed audio packet to add-on
302 */
303 typedef struct AE_DSP_SETTINGS
304 {
305 AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */
306 AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
307 int iInChannels; /*!< @brief the amount of input channels */
308 unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */
309 int iInFrames; /*!< @brief the input frame size from KODI */
310 unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */
311 int iProcessFrames; /*!< @brief the processing frame size inside add-on's */
312 unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */
313 int iOutChannels; /*!< @brief the amount of output channels */
314 unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */
315 int iOutFrames; /*!< @brief the final out frame size for KODI */
316 unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */
317 bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */
318 bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */
319 int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */
320 /*!
321 * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling
322 * and processing is handled inside the same add-on, this value must be ignored!
323 */
324 } ATTRIBUTE_PACKED AE_DSP_SETTINGS;
325
326 /*!
327 * @brief Stream profile properties
328 * Can be used to detect best master processing mode and for post processing methods.
329 */
330//@{
331
332 /*!
333 * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD
334 * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD
335 */
336 #define AE_DSP_PROFILE_DOLBY_NONE 0
337 #define AE_DSP_PROFILE_DOLBY_SURROUND 1
338 #define AE_DSP_PROFILE_DOLBY_PLII 2
339 #define AE_DSP_PROFILE_DOLBY_PLIIX 3
340 #define AE_DSP_PROFILE_DOLBY_PLIIZ 4
341 #define AE_DSP_PROFILE_DOLBY_EX 5
342 #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6
343
344 /*!
345 * @brief DTS/DTS HD profile types
346 * Used on AE_DSP_PROFILE_DTS_DTSHD
347 */
348 #define AE_DSP_PROFILE_DTS 0
349 #define AE_DSP_PROFILE_DTS_ES 1
350 #define AE_DSP_PROFILE_DTS_96_24 2
351 #define AE_DSP_PROFILE_DTS_HD_HRA 3
352 #define AE_DSP_PROFILE_DTS_HD_MA 4
353
354 /*!
355 * @brief AC3/EAC3 based service types
356 * Used on AE_DSP_PROFILE_AC3_EAC3
357 */
358 #define AE_DSP_SERVICE_TYPE_MAIN 0
359 #define AE_DSP_SERVICE_TYPE_EFFECTS 1
360 #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2
361 #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3
362 #define AE_DSP_SERVICE_TYPE_DIALOGUE 4
363 #define AE_DSP_SERVICE_TYPE_COMMENTARY 5
364 #define AE_DSP_SERVICE_TYPE_EMERGENCY 6
365 #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7
366 #define AE_DSP_SERVICE_TYPE_KARAOKE 8
367
368 /*!
369 * @brief AC3/EAC3 based room types
370 * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections
371 * at post processing, e.g. THX Re-Equalization
372 */
373 #define AE_DSP_ROOM_TYPE_UNDEFINED 0
374 #define AE_DSP_ROOM_TYPE_SMALL 1
375 #define AE_DSP_ROOM_TYPE_LARGE 2
376
377 /*!
378 * @brief AC3/EAC3 stream profile properties
379 */
380 //! @todo add handling for it (currently never becomes set)
381 typedef struct AE_DSP_PROFILE_AC3_EAC3
382 {
383 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
384 unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */
385 unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */
386 } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3;
387
388 /*!
389 * @brief MLP/Dolby TrueHD stream profile properties
390 */
391 //! @todo add handling for it (currently never becomes set)
392 typedef struct AE_DSP_PROFILE_MLP_TRUEHD
393 {
394 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
395 } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD;
396
397 /*!
398 * @brief DTS/DTS HD stream profile properties
399 */
400 //! @todo add handling for it (currently never becomes set)
401 typedef struct AE_DSP_PROFILE_DTS_DTSHD
402 {
403 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */
404 bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */
405 } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD;
406
407 union AE_DSP_PROFILE
408 {
409 AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */
410 AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */
411 AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */
412 };
413 //@}
414
415 /*!
416 * @brief Audio DSP stream properties
417 * Used to check for the DSP add-on that the stream is supported,
418 * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout
419 */
420 typedef struct AE_DSP_STREAM_PROPERTIES
421 {
422 AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */
423 AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
424 int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */
425 const char* strName; /*!< @brief the audio stream name */
426 const char* strCodecId; /*!< @brief codec id string of the audio stream */
427 const char* strLanguage; /*!< @brief language id of the audio stream */
428 int iIdentifier; /*!< @brief audio stream id inside player */
429 int iChannels; /*!< @brief amount of basic channels */
430 int iSampleRate; /*!< @brief sample rate */
431 AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */
432 } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES;
433
434 /*!
435 * @brief Audio DSP mode categories
436 */
437 typedef enum
438 {
439 AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */
440 AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */
441 AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */
442 AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */
443 AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */
444 AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */
445 AE_DSP_MODE_TYPE_MAX = 5
446 } AE_DSP_MODE_TYPE;
447
448 /*!
449 * @brief Audio DSP master mode information
450 * Used to get all available modes for current input stream
451 */
452 typedef struct AE_DSP_MODES
453 {
454 unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */
455 struct AE_DSP_MODE
456 {
457 int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */
458 AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processong mode type, see AE_DSP_MODE_TYPE */
459 char strModeName[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */
460
461 unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */
462 unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */
463 bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */
464 bool bIsDisabled; /*!< @brief (optional) true if this mode is marked as disabled and not enabled default, only relevant for master processes, all other types always disabled as default */
465
466 unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */
467 unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */
468 unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */
469 unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */
470
471 char strOwnModeImage[ADDON_STANDARD_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */
472 char strOverrideModeImage[ADDON_STANDARD_STRING_LENGTH];/*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */
473 } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */
474 } ATTRIBUTE_PACKED AE_DSP_MODES;
475
476 /*!
477 * @brief Audio DSP menu hook data
478 */
479 typedef struct AE_DSP_MENUHOOK_DATA
480 {
481 AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */
482 union data {
483 AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */
484 } data; /*!< @brief related category related data */
485 } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA;
486
487 /*!
488 * @brief Properties passed to the Create() method of an add-on.
489 */
490 typedef struct AddonProps_AudioDSP
491 {
492 const char* strUserPath; /*!< @brief path to the user profile */
493 const char* strAddonPath; /*!< @brief path to this add-on */
494 } AddonProps_AudioDSP;
495
496 typedef struct AddonToKodiFuncTable_AudioDSP
497 {
498 void* kodiInstance;
499 void (*add_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
500 void (*remove_menu_hook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
501 void (*register_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
502 void (*unregister_mode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
503 } AddonToKodiFuncTable_AudioDSP;
504
505 struct AddonInstance_AudioDSP;
506 typedef struct KodiToAddonFuncTable_AudioDSP
507 {
508 kodi::addon::CInstanceAudioDSP* addonInstance;
509 void (__cdecl* get_capabilities)(AddonInstance_AudioDSP const* addonInstance, AE_DSP_ADDON_CAPABILITIES*);
510 const char* (__cdecl* get_dsp_name)(AddonInstance_AudioDSP const* addonInstance);
511 const char* (__cdecl* get_dsp_version)(AddonInstance_AudioDSP const* addonInstance);
512 AE_DSP_ERROR (__cdecl* menu_hook)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_MENUHOOK*, const AE_DSP_MENUHOOK_DATA*);
513
514 AE_DSP_ERROR (__cdecl* stream_create)(AddonInstance_AudioDSP const* addonInstance, const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE);
515 AE_DSP_ERROR (__cdecl* stream_destroy)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
516 AE_DSP_ERROR (__cdecl* stream_is_mode_supported)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int);
517 AE_DSP_ERROR (__cdecl* stream_initialize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const AE_DSP_SETTINGS*);
518
519 bool (__cdecl* input_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, unsigned int);
520
521 unsigned int (__cdecl* input_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
522 unsigned int (__cdecl* input_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
523 float (__cdecl* input_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
524 int (__cdecl* input_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
525
526 unsigned int (__cdecl* pre_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
527 float (__cdecl* pre_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
528 unsigned int (__cdecl* pre_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int);
529
530 AE_DSP_ERROR (__cdecl* master_process_set_mode)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int);
531 unsigned int (__cdecl* master_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
532 float (__cdecl* master_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
533 int (__cdecl* master_process_get_out_channels)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned long*);
534 unsigned int (__cdecl* master_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
535 const char* (__cdecl* master_process_get_stream_info_string)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
536
537 unsigned int (__cdecl* post_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
538 float (__cdecl* post_process_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int);
539 unsigned int (__cdecl* post_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, unsigned int, const float**, float**, unsigned int);
540
541 unsigned int (__cdecl* output_resample_process_needed_samplesize)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
542 unsigned int (__cdecl* output_resample_process)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE, const float**, float**, unsigned int);
543 float (__cdecl* output_resample_get_delay)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
544 int (__cdecl* output_resample_samplerate)(AddonInstance_AudioDSP const* addonInstance, const ADDON_HANDLE);
545 } KodiToAddonFuncTable_AudioDSP;
546
547 typedef struct AddonInstance_AudioDSP
548 {
549 AddonProps_AudioDSP props;
550 AddonToKodiFuncTable_AudioDSP toKodi;
551 KodiToAddonFuncTable_AudioDSP toAddon;
552 } AddonInstance_AudioDSP;
553
554} /* extern "C" */
555
556namespace kodi {
557namespace addon {
558
559 class CInstanceAudioDSP : public IAddonInstance
560 {
561 public:
562 //==========================================================================
563 /// @brief Class constructor
564 ///
565 CInstanceAudioDSP()
566 : IAddonInstance(ADDON_INSTANCE_ADSP)
567 {
568 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
569 throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of more as one in single instance way is not allowed!");
570
571 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance);
572 CAddonBase::m_interface->globalSingleInstance = this;
573 }
574 //--------------------------------------------------------------------------
575
576 //==========================================================================
577 /// @brief Class constructor
578 ///
579 /// @param[in] instance The from Kodi given instance given be
580 /// add-on CreateInstance call with instance
581 /// id ADDON_INSTANCE_ADSP.
582 ///
583 CInstanceAudioDSP(KODI_HANDLE instance)
584 : IAddonInstance(ADDON_INSTANCE_ADSP)
585 {
586 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
587 throw std::logic_error("kodi::addon::CInstanceAudioDSP: Creation of multiple together with single instance way is not allowed!");
588
589 SetAddonStruct(instance);
590 }
591 //--------------------------------------------------------------------------
592
593 /*! @name Audio DSP add-on methods */
594 //@{
595 //==========================================================================
596 ///
597 /// @brief Get the list of features that this add-on provides.
598 /// Called by KODI to query the add-ons capabilities.
599 /// Used to check which options should be presented in the DSP, which methods
600 /// to call, etc.
601 /// All capabilities that the add-on supports should be set to true.
602 /// @param capabilities The add-ons capabilities.
603 /// @remarks Valid implementation required.
604 ///
605 virtual void GetCapabilities(AE_DSP_ADDON_CAPABILITIES& capabilities) = 0;
606 //--------------------------------------------------------------------------
607
608 //==========================================================================
609 ///
610 /// @return The name reported by the back end that will be displayed in the
611 /// UI.
612 /// @remarks Valid implementation required.
613 ///
614 virtual std::string GetDSPName() = 0;
615 //--------------------------------------------------------------------------
616
617 //==========================================================================
618 ///
619 /// @return The version string reported by the back end that will be displayed
620 /// in the UI.
621 /// @remarks Valid implementation required.
622 ///
623 virtual std::string GetDSPVersion() = 0;
624 //--------------------------------------------------------------------------
625
626 //==========================================================================
627 ///
628 /// @brief Call one of the menu hooks (if supported).
629 /// Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(),
630 /// by calling AddMenuHook() on the callback.
631 /// @param menuhook The hook to call.
632 /// @param item The selected item for which the hook was called.
633 /// @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully.
634 /// @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on
635 /// won't provide this function.
636 ///
637 virtual AE_DSP_ERROR MenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA& item) { return AE_DSP_ERROR_NOT_IMPLEMENTED; }
638 //--------------------------------------------------------------------------
639 //@}
640
641 //==========================================================================
642 /// @name DSP processing control, used to open and close a stream
643 /// @remarks Valid implementation required.
644 ///
645 //@{
646 ///
647 /// @brief Set up Audio DSP with selected audio settings (use the basic
648 /// present audio stream data format).
649 /// Used to detect available add-ons for present stream, as example stereo
650 /// surround upmix not needed on 5.1 audio stream.
651 /// @param addonSettings The add-ons audio settings.
652 /// @param properties The properties of the currently playing stream.
653 /// @param handle On this becomes addon informated about stream id and can set function addresses which need on calls
654 /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
655 /// and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not
656 /// supported, but without fault.
657 /// @remarks Valid implementation required.
658 ///
659 virtual AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS& addonSettings, const AE_DSP_STREAM_PROPERTIES& properties, ADDON_HANDLE handle) = 0;
660 //--------------------------------------------------------------------------
661
662 //==========================================================================
663 ///
664 /// Remove the selected id from currently used DSP processes
665 /// @param handle identification data for stream
666 /// @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed
667 /// @remarks Valid implementation required.
668 ///
669 virtual AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle) = 0;
670 //--------------------------------------------------------------------------
671
672 //==========================================================================
673 ///
674 /// @brief Ask the add-on about a requested processing mode that it is
675 /// supported on the current stream. Is called about every add-on mode after
676 /// successed StreamCreate.
677 /// @param handle identification data for stream
678 /// @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions
679 /// @param mode_id The mode inside add-on which must be performed on call. Id
680 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
681 /// RegisterMode callback,
682 /// @param unique_db_mode_id The Mode unique id generated from dsp database.
683 /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
684 /// or if the stream is not supported the add-on must return
685 /// AE_DSP_ERROR_IGNORE_ME.
686 /// @remarks Valid implementation required.
687 ///
688 virtual AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id) = 0;
689 //--------------------------------------------------------------------------
690
691 //==========================================================================
692 ///
693 /// @brief Set up Audio DSP with selected audio settings (detected on data of
694 /// first present audio packet)
695 /// @param addonSettings The add-ons audio settings.
696 /// @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
697 /// @remarks Valid implementation required.
698 ///
699 virtual AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS& addonSettings) = 0;
700 //--------------------------------------------------------------------------
701
702 //@}
703
704 /// @name DSP input processing
705 /// @remarks Only used by KODI if bSupportsInputProcess is set to true.
706 ///
707 //@{
708 //==========================================================================
709 ///
710 /// @brief DSP input processing
711 /// Can be used to have unchanged stream..
712 /// All DSP add-ons allowed to-do this.
713 /// @param handle identification data for stream
714 /// @param array_in Pointer to data memory
715 /// @param samples Amount of samples inside array_in
716 /// @return true if work was OK
717 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
718 /// GetCapabilities
719 ///
720 virtual bool InputProcess(const ADDON_HANDLE handle, const float** array_in, unsigned int samples) { return true; }
721 //--------------------------------------------------------------------------
722 //@}
723
724 /// @name DSP pre-resampling
725 /// @remarks Only used by KODI if bSupportsInputResample is set to true.
726 ///
727 //@{
728 //==========================================================================
729 ///
730 /// @brief If the add-on operate with buffered arrays and the output size can
731 /// be higher as the input it becomes asked about needed size before any
732 /// InputResampleProcess call.
733 /// @param handle identification data for stream
734 /// @return The needed size of output array or 0 if no changes within it
735 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
736 /// GetCapabilities
737 ///
738 virtual unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
739 //--------------------------------------------------------------------------
740
741 //==========================================================================
742 ///
743 /// @brief DSP re sample processing before master.
744 /// Here a high quality resample can be performed.
745 /// Only one DSP add-on is allowed to-do this!
746 /// @param handle identification data for stream
747 /// @param array_in Pointer to input data memory
748 /// @param array_out Pointer to output data memory
749 /// @param samples Amount of samples inside array_in
750 /// @return Amount of samples processed
751 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
752 /// GetCapabilities
753 ///
754 virtual unsigned int InputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
755 //--------------------------------------------------------------------------
756
757 //==========================================================================
758 ///
759 /// @brief Returns the re-sampling generated new sample rate used before the
760 /// master process
761 /// @param handle identification data for stream
762 /// @return The new sample rate
763 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
764 /// GetCapabilities
765 ///
766 virtual int InputResampleSampleRate(const ADDON_HANDLE handle) { return 0; }
767 //--------------------------------------------------------------------------
768
769 //==========================================================================
770 ///
771 /// @brief Returns the time in seconds that it will take
772 /// for the next added packet to be returned to KODI.
773 /// @param handle identification data for stream
774 /// @return the delay in seconds
775 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
776 /// GetCapabilities
777 ///
778 virtual float InputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
779 //--------------------------------------------------------------------------
780 //@}
781
782 /** @name DSP Pre processing
783 * @remarks Only used by KODI if bSupportsPreProcess is set to true.
784 */
785 //@{
786 //==========================================================================
787 ///
788 /// @brief If the addon operate with buffered arrays and the output size can
789 /// be higher as the input it becomes asked about needed size before any
790 /// PreProcess call.
791 /// @param handle identification data for stream
792 /// @param mode_id The mode inside add-on which must be performed on call. Id
793 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
794 /// RegisterMode callback and can be defined from add-on as a structure
795 /// pointer or anything else what is needed to find it.
796 /// @return The needed size of output array or 0 if no changes within it
797 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
798 /// GetCapabilities
799 ///
800 virtual unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; }
801 //--------------------------------------------------------------------------
802
803 //==========================================================================
804 ///
805 /// @brief Returns the time in seconds that it will take
806 /// for the next added packet to be returned to KODI.
807 /// @param handle identification data for stream
808 /// @param mode_id The mode inside add-on which must be performed on call. Id
809 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
810 /// RegisterMode callback and can be defined from add-on as a structure
811 /// pointer or anything else what is needed to find it.
812 /// @return the delay in seconds
813 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
814 /// GetCapabilities
815 ///
816 virtual float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; }
817 //--------------------------------------------------------------------------
818
819 //==========================================================================
820 ///
821 /// @brief DSP preprocessing
822 /// All DSP add-ons allowed to-do this.
823 /// @param handle identification data for stream
824 /// @param mode_id The mode inside add-on which must be performed on call. Id
825 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
826 /// RegisterMode callback and can be defined from add-on as a structure
827 /// pointer or anything else what is needed to find it.
828 /// @param array_in Pointer to input data memory
829 /// @param array_out Pointer to output data memory
830 /// @param samples Amount of samples inside array_in
831 /// @return Amount of samples processed
832 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
833 /// GetCapabilities
834 ///
835 virtual unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; }
836 //--------------------------------------------------------------------------
837 //@}
838
839 /** @name DSP Master processing
840 * @remarks Only used by KODI if bSupportsMasterProcess is set to true.
841 */
842 //@{
843 //==========================================================================
844 ///
845 /// @brief Set the active master process mode
846 /// @param handle identification data for stream
847 /// @param type Requested stream type for the selected master mode
848 /// @param mode_id The Mode identifier.
849 /// @param unique_db_mode_id The Mode unique id generated from DSP database.
850 /// @return AE_DSP_ERROR_NO_ERROR if the setup was successful
851 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
852 /// GetCapabilities
853 ///
854 virtual AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id) { return AE_DSP_ERROR_NOT_IMPLEMENTED; }
855 //--------------------------------------------------------------------------
856
857 //==========================================================================
858 ///
859 /// @brief If the add-on operate with buffered arrays and the output size can
860 /// be higher as the input it becomes asked about needed size before any
861 /// MasterProcess call.
862 /// @param handle identification data for stream
863 /// @return The needed size of output array or 0 if no changes within it
864 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
865 /// GetCapabilities
866 ///
867 virtual unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
868 //--------------------------------------------------------------------------
869
870 //==========================================================================
871 ///
872 /// @brief Returns the time in seconds that it will take
873 /// for the next added packet to be returned to KODI.
874 /// @param handle identification data for stream
875 /// @return the delay in seconds
876 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
877 /// GetCapabilities
878 ///
879 virtual float MasterProcessGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
880 //--------------------------------------------------------------------------
881
882 //==========================================================================
883 ///
884 /// @brief Returns the from selected master mode performed channel alignment
885 /// @param handle identification data for stream
886 /// @retval out_channel_present_flags the exact channel present flags after
887 /// performed up-/downmix
888 /// @return the amount channels
889 /// @remarks Optional. Must be used and set if a channel up- or downmix is
890 /// processed from the active master mode
891 ///
892 virtual int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long& out_channel_present_flags) { return 0; }
893 //--------------------------------------------------------------------------
894
895 //==========================================================================
896 ///
897 /// @brief Master processing becomes performed with it
898 /// Here a channel up-mix/down-mix for stereo surround sound can be performed
899 /// Only one DSP add-on is allowed to-do this!
900 /// @param handle identification data for stream
901 /// @param array_in Pointer to input data memory
902 /// @param array_out Pointer to output data memory
903 /// @param samples Amount of samples inside array_in
904 /// @return Amount of samples processed
905 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
906 /// GetCapabilities
907 ///
908 virtual unsigned int MasterProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
909 //--------------------------------------------------------------------------
910
911 //==========================================================================
912 ///
913 /// Used to get a information string about the processed work to show on skin
914 /// @return A string to show
915 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
916 /// GetCapabilities
917 ///
918 virtual std::string MasterProcessGetStreamInfoString(const ADDON_HANDLE handle) { return ""; }
919 //--------------------------------------------------------------------------
920 //@}
921
922 /** @name DSP Post processing
923 * @remarks Only used by KODI if bSupportsPostProcess is set to true.
924 */
925 //@{
926 //==========================================================================
927 ///
928 /// If the add-on operate with buffered arrays and the output size can be
929 /// higher as the input it becomes asked about needed size before any
930 /// PostProcess call.
931 /// @param handle identification data for stream
932 /// @param mode_id The mode inside add-on which must be performed on call. Id
933 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
934 /// RegisterMode callback, and can be defined from add-on as a structure
935 /// pointer or anything else what is needed to find it.
936 /// @return The needed size of output array or 0 if no changes within it
937 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
938 /// GetCapabilities
939 ///
940 virtual unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id) { return 0; }
941 //--------------------------------------------------------------------------
942
943 //==========================================================================
944 ///
945 /// Returns the time in seconds that it will take
946 /// for the next added packet to be returned to KODI.
947 /// @param handle identification data for stream
948 /// @param mode_id The mode inside add-on which must be performed on call. Id
949 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
950 /// RegisterMode callback, and can be defined from add-on as a structure
951 /// pointer or anything else what is needed to find it.
952 /// @return the delay in seconds
953 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
954 /// GetCapabilities
955 ///
956 virtual float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id) { return 0.0f; }
957 //--------------------------------------------------------------------------
958
959 //==========================================================================
960
961 ///
962 /// @brief DSP post processing
963 /// On the post processing can be things performed with additional channel
964 /// upmix like 6.1 to 7.1
965 /// or frequency/volume corrections, speaker distance handling, equalizer... .
966 /// All DSP add-ons allowed to-do this.
967 /// @param handle identification data for stream
968 /// @param mode_id The mode inside add-on which must be performed on call. Id
969 /// is set from add-on by iModeNumber on AE_DSP_MODE structure during
970 /// RegisterMode callback, and can be defined from add-on as a structure
971 /// pointer or anything else what is needed to find it.
972 /// @param array_in Pointer to input data memory
973 /// @param array_out Pointer to output data memory
974 /// @param samples Amount of samples inside array_in
975 /// @return Amount of samples processed
976 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
977 /// GetCapabilities
978 ///
979 virtual unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples) { return 0; }
980
981 //--------------------------------------------------------------------------
982 //@}
983
984 /** @name DSP Post re-sampling
985 * @remarks Only used by KODI if bSupportsOutputResample is set to true.
986 */
987 //@{
988 //==========================================================================
989 ///
990 /// @brief If the add-on operate with buffered arrays and the output size
991 /// can be higher as the input
992 /// it becomes asked about needed size before any OutputResampleProcess call.
993 /// @param handle identification data for stream
994 /// @return The needed size of output array or 0 if no changes within it
995 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
996 /// GetCapabilities
997 ///
998 virtual unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle) { return 0; }
999 //--------------------------------------------------------------------------
1000
1001 //==========================================================================
1002 ///
1003 /// @brief Re-sampling after master processing becomes performed with it if
1004 /// needed, only
1005 /// one add-on can perform it.
1006 /// @param handle identification data for stream
1007 /// @param array_in Pointer to input data memory
1008 /// @param array_out Pointer to output data memory
1009 /// @param samples Amount of samples inside array_in
1010 /// @return Amount of samples processed
1011 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
1012 /// GetCapabilities
1013 ///
1014 virtual unsigned int OutputResampleProcess(const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples) { return 0; }
1015 //--------------------------------------------------------------------------
1016
1017 //==========================================================================
1018 ///
1019 /// @brief Returns the re-sampling generated new sample rate used after the
1020 /// master process.
1021 /// @param handle identification data for stream
1022 /// @return The new sample rate
1023 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
1024 /// GetCapabilities
1025 ///
1026 virtual int OutputResampleSampleRate(const ADDON_HANDLE handle) { return 0; }
1027 //--------------------------------------------------------------------------
1028
1029 //==========================================================================
1030 ///
1031 /// @brief Returns the time in seconds that it will take for the next added
1032 /// packet to be returned to KODI.
1033 /// @param handle identification data for stream
1034 /// @return the delay in seconds
1035 /// @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
1036 /// GetCapabilities
1037 ///
1038 virtual float OutputResampleGetDelay(const ADDON_HANDLE handle) { return 0.0f; }
1039 //--------------------------------------------------------------------------
1040 //@}
1041
1042 //==========================================================================
1043 ///
1044 /// @brief Add or replace a menu hook for the context menu for this add-on
1045 /// @param hook The hook to add
1046 ///
1047 void AddMenuHook(AE_DSP_MENUHOOK* hook)
1048 {
1049 return m_instanceData->toKodi.add_menu_hook(m_instanceData->toKodi.kodiInstance, hook);
1050 }
1051 //--------------------------------------------------------------------------
1052
1053 //==========================================================================
1054 ///
1055 /// @brief Remove a menu hook for the context menu for this add-on
1056 /// @param hook The hook to remove
1057 ///
1058 void RemoveMenuHook(AE_DSP_MENUHOOK* hook)
1059 {
1060 return m_instanceData->toKodi.remove_menu_hook(m_instanceData->toKodi.kodiInstance, hook);
1061 }
1062 //--------------------------------------------------------------------------
1063
1064 //==========================================================================
1065 ///
1066 /// @brief Add or replace master mode information inside audio dsp database.
1067 /// Becomes identifier written inside mode to iModeID if it was 0 (undefined)
1068 /// @param mode The master mode to add or update inside database
1069 ///
1070 void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
1071 {
1072 return m_instanceData->toKodi.register_mode(m_instanceData->toKodi.kodiInstance, mode);
1073 }
1074 //--------------------------------------------------------------------------
1075
1076 //==========================================================================
1077 ///
1078 /// @brief Remove a master mode from audio dsp database
1079 /// @param mode The Mode to remove
1080 ///
1081 void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
1082 {
1083 return m_instanceData->toKodi.unregister_mode(m_instanceData->toKodi.kodiInstance, mode);
1084 }
1085 //--------------------------------------------------------------------------
1086
1087 private:
1088 void SetAddonStruct(KODI_HANDLE instance)
1089 {
1090 if (instance == nullptr)
1091 throw std::logic_error("kodi::addon::CInstanceAudioDSP: Null pointer instance passed.");
1092
1093 m_instanceData = static_cast<AddonInstance_AudioDSP*>(instance);
1094
1095 m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities;
1096 m_instanceData->toAddon.get_dsp_name = ADDON_GetDSPName;
1097 m_instanceData->toAddon.get_dsp_version = ADDON_GetDSPVersion;
1098 m_instanceData->toAddon.menu_hook = ADDON_MenuHook;
1099
1100 m_instanceData->toAddon.stream_create = ADDON_StreamCreate;
1101 m_instanceData->toAddon.stream_destroy = ADDON_StreamDestroy;
1102 m_instanceData->toAddon.stream_is_mode_supported = ADDON_StreamIsModeSupported;
1103 m_instanceData->toAddon.stream_initialize = ADDON_StreamInitialize;
1104
1105 m_instanceData->toAddon.input_process = ADDON_InputProcess;
1106
1107 m_instanceData->toAddon.input_resample_process_needed_samplesize = ADDON_InputResampleProcessNeededSamplesize;
1108 m_instanceData->toAddon.input_resample_process = ADDON_InputResampleProcess;
1109 m_instanceData->toAddon.input_resample_get_delay = ADDON_InputResampleGetDelay;
1110 m_instanceData->toAddon.input_resample_samplerate = ADDON_InputResampleSampleRate;
1111
1112 m_instanceData->toAddon.pre_process_needed_samplesize = ADDON_PreProcessNeededSamplesize;
1113 m_instanceData->toAddon.pre_process_get_delay = ADDON_PreProcessGetDelay;
1114 m_instanceData->toAddon.pre_process = ADDON_PreProcess;
1115
1116 m_instanceData->toAddon.master_process_set_mode = ADDON_MasterProcessSetMode;
1117 m_instanceData->toAddon.master_process_needed_samplesize = ADDON_MasterProcessNeededSamplesize;
1118 m_instanceData->toAddon.master_process_get_delay = ADDON_MasterProcessGetDelay;
1119 m_instanceData->toAddon.master_process_get_out_channels = ADDON_MasterProcessGetOutChannels;
1120 m_instanceData->toAddon.master_process = ADDON_MasterProcess;
1121 m_instanceData->toAddon.master_process_get_stream_info_string = ADDON_MasterProcessGetStreamInfoString;
1122
1123 m_instanceData->toAddon.post_process_needed_samplesize = ADDON_PostProcessNeededSamplesize;
1124 m_instanceData->toAddon.post_process_get_delay = ADDON_PostProcessGetDelay;
1125 m_instanceData->toAddon.post_process = ADDON_PostProcess;
1126
1127 m_instanceData->toAddon.output_resample_process_needed_samplesize = ADDON_OutputResampleProcessNeededSamplesize;
1128 m_instanceData->toAddon.output_resample_process = ADDON_OutputResampleProcess;
1129 m_instanceData->toAddon.output_resample_get_delay = ADDON_OutputResampleGetDelay;
1130 m_instanceData->toAddon.output_resample_samplerate = ADDON_OutputResampleSampleRate;
1131 }
1132
1133 static inline void ADDON_GetCapabilities(AddonInstance_AudioDSP const* instance, AE_DSP_ADDON_CAPABILITIES *capabilities)
1134 {
1135 instance->toAddon.addonInstance->GetCapabilities(*capabilities);
1136 }
1137
1138 static inline const char* ADDON_GetDSPName(AddonInstance_AudioDSP const* instance)
1139 {
1140 instance->toAddon.addonInstance->m_dspName = instance->toAddon.addonInstance->GetDSPName();
1141 return instance->toAddon.addonInstance->m_dspName.c_str();
1142 }
1143
1144 static inline const char* ADDON_GetDSPVersion(AddonInstance_AudioDSP const* instance)
1145 {
1146 instance->toAddon.addonInstance->m_dspVersion = instance->toAddon.addonInstance->GetDSPVersion();
1147 return instance->toAddon.addonInstance->m_dspVersion.c_str();
1148 }
1149
1150 static inline AE_DSP_ERROR ADDON_MenuHook(AddonInstance_AudioDSP const* instance, const AE_DSP_MENUHOOK* menuhook, const AE_DSP_MENUHOOK_DATA* item)
1151 {
1152 return instance->toAddon.addonInstance->MenuHook(*menuhook, *item);
1153 }
1154
1155 static inline AE_DSP_ERROR ADDON_StreamCreate(AddonInstance_AudioDSP const* instance, const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* properties, ADDON_HANDLE handle)
1156 {
1157 return instance->toAddon.addonInstance->StreamCreate(*addonSettings, *properties, handle);
1158 }
1159
1160 static inline AE_DSP_ERROR ADDON_StreamDestroy(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1161 {
1162 return instance->toAddon.addonInstance->StreamDestroy(handle);
1163 }
1164
1165 static inline AE_DSP_ERROR ADDON_StreamIsModeSupported(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id)
1166 {
1167 return instance->toAddon.addonInstance->StreamIsModeSupported(handle, type, mode_id, unique_db_mode_id);
1168 }
1169
1170 static inline AE_DSP_ERROR ADDON_StreamInitialize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings)
1171 {
1172 return instance->toAddon.addonInstance->StreamInitialize(handle, *addonSettings);
1173 }
1174
1175 static inline bool ADDON_InputProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, unsigned int samples)
1176 {
1177 return instance->toAddon.addonInstance->InputProcess(handle, array_in, samples);
1178 }
1179
1180 static inline unsigned int ADDON_InputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1181 {
1182 return instance->toAddon.addonInstance->InputResampleProcessNeededSamplesize(handle);
1183 }
1184
1185 static inline unsigned int ADDON_InputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
1186 {
1187 return instance->toAddon.addonInstance->InputResampleProcess(handle, array_in, array_out, samples);
1188 }
1189
1190 static inline int ADDON_InputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1191 {
1192 return instance->toAddon.addonInstance->InputResampleSampleRate(handle);
1193 }
1194
1195 static inline float ADDON_InputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1196 {
1197 return instance->toAddon.addonInstance->InputResampleGetDelay(handle);
1198 }
1199
1200 static inline unsigned int ADDON_PreProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
1201 {
1202 return instance->toAddon.addonInstance->PreProcessNeededSamplesize(handle, mode_id);
1203 }
1204
1205 static inline float ADDON_PreProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
1206 {
1207 return instance->toAddon.addonInstance->PreProcessGetDelay(handle, mode_id);
1208 }
1209
1210 static inline unsigned int ADDON_PreProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples)
1211 {
1212 return instance->toAddon.addonInstance->PreProcess(handle, mode_id, array_in, array_out, samples);
1213 }
1214
1215 static inline AE_DSP_ERROR ADDON_MasterProcessSetMode(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id)
1216 {
1217 return instance->toAddon.addonInstance->MasterProcessSetMode(handle, type, mode_id, unique_db_mode_id);
1218 }
1219
1220 static inline unsigned int ADDON_MasterProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1221 {
1222 return instance->toAddon.addonInstance->MasterProcessNeededSamplesize(handle);
1223 }
1224
1225 static inline float ADDON_MasterProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1226 {
1227 return instance->toAddon.addonInstance->MasterProcessGetDelay(handle);
1228 }
1229
1230 static inline int ADDON_MasterProcessGetOutChannels(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned long* out_channel_present_flags)
1231 {
1232 return instance->toAddon.addonInstance->MasterProcessGetOutChannels(handle, *out_channel_present_flags);
1233 }
1234
1235 static inline unsigned int ADDON_MasterProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
1236 {
1237 return instance->toAddon.addonInstance->MasterProcess(handle, array_in, array_out, samples);
1238 }
1239
1240 static inline const char* ADDON_MasterProcessGetStreamInfoString(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1241 {
1242 instance->toAddon.addonInstance->m_streamInfoString = instance->toAddon.addonInstance->MasterProcessGetStreamInfoString(handle);
1243 return instance->toAddon.addonInstance->m_streamInfoString.c_str();
1244 }
1245
1246 static inline unsigned int ADDON_PostProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
1247 {
1248 return instance->toAddon.addonInstance->PostProcessNeededSamplesize(handle, mode_id);
1249 }
1250
1251 static inline float ADDON_PostProcessGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id)
1252 {
1253 return instance->toAddon.addonInstance->PostProcessGetDelay(handle, mode_id);
1254 }
1255
1256 static inline unsigned int ADDON_PostProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, unsigned int mode_id, const float** array_in, float** array_out, unsigned int samples)
1257 {
1258 return instance->toAddon.addonInstance->PostProcess(handle, mode_id, array_in, array_out, samples);
1259 }
1260
1261 static inline unsigned int ADDON_OutputResampleProcessNeededSamplesize(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1262 {
1263 return instance->toAddon.addonInstance->OutputResampleProcessNeededSamplesize(handle);
1264 }
1265
1266 static inline unsigned int ADDON_OutputResampleProcess(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle, const float** array_in, float** array_out, unsigned int samples)
1267 {
1268 return instance->toAddon.addonInstance->OutputResampleProcess(handle, array_in, array_out, samples);
1269 }
1270
1271 static inline int ADDON_OutputResampleSampleRate(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1272 {
1273 return instance->toAddon.addonInstance->OutputResampleSampleRate(handle);
1274 }
1275
1276 static inline float ADDON_OutputResampleGetDelay(AddonInstance_AudioDSP const* instance, const ADDON_HANDLE handle)
1277 {
1278 return instance->toAddon.addonInstance->OutputResampleGetDelay(handle);
1279 }
1280
1281 std::string m_dspName;
1282 std::string m_dspVersion;
1283 std::string m_streamInfoString;
1284 AddonInstance_AudioDSP* m_instanceData;
1285 };
1286
1287} /* namespace addon */
1288} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h
new file mode 100644
index 0000000..f56f8ae
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h
@@ -0,0 +1,240 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../AddonBase.h"
23#ifdef BUILD_KODI_ADDON
24#include "../AEChannelData.h"
25#else
26#include "cores/AudioEngine/Utils/AEChannelData.h"
27#endif
28#include <stdint.h>
29
30namespace kodi { namespace addon { class CInstanceAudioDecoder; }}
31
32extern "C"
33{
34
35 typedef struct AddonProps_AudioDecoder
36 {
37 int dummy;
38 } AddonProps_AudioDecoder;
39
40 typedef struct AddonToKodiFuncTable_AudioDecoder
41 {
42 void* kodiInstance;
43 } AddonToKodiFuncTable_AudioDecoder;
44
45 struct AddonInstance_AudioDecoder;
46 typedef struct KodiToAddonFuncTable_AudioDecoder
47 {
48 kodi::addon::CInstanceAudioDecoder* addonInstance;
49 bool (__cdecl* init) (const AddonInstance_AudioDecoder* instance,
50 const char* file, unsigned int filecache,
51 int* channels, int* samplerate,
52 int* bitspersample, int64_t* totaltime,
53 int* bitrate, AEDataFormat* format,
54 const AEChannel** info);
55 int (__cdecl* read_pcm) (const AddonInstance_AudioDecoder* instance, uint8_t* buffer, int size, int* actualsize);
56 int64_t (__cdecl* seek) (const AddonInstance_AudioDecoder* instance, int64_t time);
57 bool (__cdecl* read_tag) (const AddonInstance_AudioDecoder* instance,
58 const char* file, char* title,
59 char* artist, int* length);
60 int (__cdecl* track_count) (const AddonInstance_AudioDecoder* instance, const char* file);
61 } KodiToAddonFuncTable_AudioDecoder;
62
63 typedef struct AddonInstance_AudioDecoder
64 {
65 AddonProps_AudioDecoder props;
66 AddonToKodiFuncTable_AudioDecoder toKodi;
67 KodiToAddonFuncTable_AudioDecoder toAddon;
68 } AddonInstance_AudioDecoder;
69
70} /* extern "C" */
71
72namespace kodi
73{
74namespace addon
75{
76
77 class CInstanceAudioDecoder : public IAddonInstance
78 {
79 public:
80 //==========================================================================
81 /// @brief Class constructor
82 ///
83 /// @param[in] instance The from Kodi given instance given be
84 /// add-on CreateInstance call with instance
85 /// id ADDON_INSTANCE_AUDIODECODER.
86 CInstanceAudioDecoder(KODI_HANDLE instance)
87 : IAddonInstance(ADDON_INSTANCE_AUDIODECODER)
88 {
89 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
90 throw std::logic_error("kodi::addon::CInstanceAudioDecoder: Creation of multiple together with single instance way is not allowed!");
91
92 SetAddonStruct(instance);
93 }
94 //--------------------------------------------------------------------------
95
96 //==========================================================================
97 /// @ingroup cpp_kodi_addon_audiodecoder
98 /// @brief Initialize a decoder
99 ///
100 /// @param[in] filename The file to read
101 /// @param[in] filecache The file cache size
102 /// @param[out] channels Number of channels in output stream
103 /// @param[out] samplerate Samplerate of output stream
104 /// @param[out] bitspersample Bits per sample in output stream
105 /// @param[out] totaltime Total time for stream
106 /// @param[out] bitrate Average bitrate of input stream
107 /// @param[out] format Data format for output stream
108 /// @param[out] channellist Channel mapping for output stream
109 /// @return true if successfully done, otherwise
110 /// false
111 ///
112 virtual bool Init(const std::string& filename, unsigned int filecache,
113 int& channels, int& samplerate,
114 int& bitspersample, int64_t& totaltime,
115 int& bitrate, AEDataFormat& format,
116 std::vector<AEChannel>& channellist) = 0;
117 //--------------------------------------------------------------------------
118
119 //==========================================================================
120 /// @ingroup cpp_kodi_addon_audiodecoder
121 /// @brief Produce some noise
122 ///
123 /// @param[in] buffer Output buffer
124 /// @param[in] size Size of output buffer
125 /// @param[out] actualsize Actual number of bytes written to output buffer
126 /// @return Return with following possible values:
127 /// | Value | Description |
128 /// |:-----:|:-----------------------------|
129 /// | 0 | on success
130 /// | -1 | on end of stream
131 /// | 1 | on failure
132 ///
133 virtual int ReadPCM(uint8_t* buffer, int size, int& actualsize) = 0;
134 //--------------------------------------------------------------------------
135
136 //==========================================================================
137 /// @ingroup cpp_kodi_addon_audiodecoder
138 /// @brief Seek in output stream
139 ///
140 /// @param[in] time Time position to seek to in milliseconds
141 /// @return Time position seek ended up on
142 ///
143 virtual int64_t Seek(int64_t time) { return time; }
144 //--------------------------------------------------------------------------
145
146 //==========================================================================
147 /// @ingroup cpp_kodi_addon_audiodecoder
148 /// @brief Read tag of a file
149 ///
150 /// @param[in] file File to read tag for
151 /// @param[out] title Title of file
152 /// @param[out] artist Artist of file
153 /// @param[out] length Length of file
154 /// @return True on success, false on failure
155 ///
156 virtual bool ReadTag(const std::string& file, std::string& title, std::string& artist, int& length) { return false; }
157 //--------------------------------------------------------------------------
158
159 //==========================================================================
160 /// @ingroup cpp_kodi_addon_audiodecoder
161 /// @brief Get number of tracks in a file
162 ///
163 /// @param[in] file File to read tag for
164 /// @return Number of tracks in file
165 ///
166 virtual int TrackCount(const std::string& file) { return 1; }
167 //--------------------------------------------------------------------------
168
169 private:
170 void SetAddonStruct(KODI_HANDLE instance)
171 {
172 if (instance == nullptr)
173 throw std::logic_error("kodi::addon::CInstanceAudioDecoder: Creation with empty addon structure not allowed, table must be given from Kodi!");
174
175 m_instanceData = static_cast<AddonInstance_AudioDecoder*>(instance);
176
177 m_instanceData->toAddon.addonInstance = this;
178 m_instanceData->toAddon.init = ADDON_Init;
179 m_instanceData->toAddon.read_pcm = ADDON_ReadPCM;
180 m_instanceData->toAddon.seek = ADDON_Seek;
181 m_instanceData->toAddon.read_tag = ADDON_ReadTag;
182 m_instanceData->toAddon.track_count = ADDON_TrackCount;
183 }
184
185 inline static bool ADDON_Init(const AddonInstance_AudioDecoder* instance, const char* file, unsigned int filecache,
186 int* channels, int* samplerate,
187 int* bitspersample, int64_t* totaltime,
188 int* bitrate, AEDataFormat* format,
189 const AEChannel** info)
190 {
191 instance->toAddon.addonInstance->m_channelList.clear();
192 bool ret = instance->toAddon.addonInstance->Init(file, filecache, *channels,
193 *samplerate, *bitspersample,
194 *totaltime, *bitrate, *format,
195 instance->toAddon.addonInstance->m_channelList);
196 if (!instance->toAddon.addonInstance->m_channelList.empty())
197 {
198 if (instance->toAddon.addonInstance->m_channelList.back() != AE_CH_NULL)
199 instance->toAddon.addonInstance->m_channelList.push_back(AE_CH_NULL);
200 *info = instance->toAddon.addonInstance->m_channelList.data();
201 }
202 else
203 *info = nullptr;
204 return ret;
205 }
206
207 inline static int ADDON_ReadPCM(const AddonInstance_AudioDecoder* instance, uint8_t* buffer, int size, int* actualsize)
208 {
209 return instance->toAddon.addonInstance->ReadPCM(buffer, size, *actualsize);
210 }
211
212 inline static int64_t ADDON_Seek(const AddonInstance_AudioDecoder* instance, int64_t time)
213 {
214 return instance->toAddon.addonInstance->Seek(time);
215 }
216
217 inline static bool ADDON_ReadTag(const AddonInstance_AudioDecoder* instance, const char* file, char* title, char* artist, int* length)
218 {
219 std::string intTitle;
220 std::string intArtist;
221 bool ret = instance->toAddon.addonInstance->ReadTag(file, intTitle, intArtist, *length);
222 if (ret)
223 {
224 strncpy(title, intTitle.c_str(), ADDON_STANDARD_STRING_LENGTH_SMALL-1);
225 strncpy(artist, intArtist.c_str(), ADDON_STANDARD_STRING_LENGTH_SMALL-1);
226 }
227 return ret;
228 }
229
230 inline static int ADDON_TrackCount(const AddonInstance_AudioDecoder* instance, const char* file)
231 {
232 return instance->toAddon.addonInstance->TrackCount(file);
233 }
234
235 std::vector<AEChannel> m_channelList;
236 AddonInstance_AudioDecoder* m_instanceData;
237 };
238
239} /* namespace addon */
240} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h
new file mode 100644
index 0000000..3d59a99
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioEncoder.h
@@ -0,0 +1,223 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../AddonBase.h"
23
24namespace kodi { namespace addon { class CInstanceAudioEncoder; }}
25
26extern "C"
27{
28
29 typedef struct AddonProps_AudioEncoder
30 {
31 int dummy;
32 } AddonProps_AudioEncoder;
33
34 typedef struct AddonToKodiFuncTable_AudioEncoder
35 {
36 void* kodiInstance;
37 int (*write) (void* kodiInstance, const uint8_t* data, int len);
38 int64_t (*seek)(void* kodiInstance, int64_t pos, int whence);
39 } AddonToKodiFuncTable_AudioEncoder;
40
41 struct AddonInstance_AudioEncoder;
42 typedef struct KodiToAddonFuncTable_AudioEncoder
43 {
44 kodi::addon::CInstanceAudioEncoder* addonInstance;
45 bool (__cdecl* start) (const AddonInstance_AudioEncoder* instance, int in_channels, int in_rate, int in_bits,
46 const char* title, const char* artist,
47 const char* albumartist, const char* album,
48 const char* year, const char* track,
49 const char* genre, const char* comment,
50 int track_length);
51 int (__cdecl* encode) (const AddonInstance_AudioEncoder* instance, int num_bytes_read, const uint8_t* pbt_stream);
52 bool (__cdecl* finish) (const AddonInstance_AudioEncoder* instance);
53 } KodiToAddonFuncTable_AudioEncoder;
54
55 typedef struct AddonInstance_AudioEncoder
56 {
57 AddonProps_AudioEncoder props;
58 AddonToKodiFuncTable_AudioEncoder toKodi;
59 KodiToAddonFuncTable_AudioEncoder toAddon;
60 } AddonInstance_AudioEncoder;
61
62} /* extern "C" */
63
64namespace kodi
65{
66namespace addon
67{
68
69 class CInstanceAudioEncoder : public IAddonInstance
70 {
71 public:
72 //==========================================================================
73 /// @brief Class constructor
74 ///
75 /// @param[in] instance The from Kodi given instance given be
76 /// add-on CreateInstance call with instance
77 /// id ADDON_INSTANCE_AUDIOENCODER.
78 CInstanceAudioEncoder(KODI_HANDLE instance)
79 : IAddonInstance(ADDON_INSTANCE_AUDIOENCODER)
80 {
81 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
82 throw std::logic_error("kodi::addon::CInstanceAudioEncoder: Creation of multiple together with single instance way is not allowed!");
83
84 SetAddonStruct(instance);
85 }
86 //--------------------------------------------------------------------------
87
88 //==========================================================================
89 /// \brief Start encoder (**required**)
90 ///
91 /// \param[in] inChannels Number of channels
92 /// \param[in] inRate Sample rate of input data
93 /// \param[in] inBits Bits per sample in input data
94 /// \param[in] title The title of the song
95 /// \param[in] artist The artist of the song
96 /// \param[in] albumartist The albumartist of the song
97 /// \param[in] year The year of the song
98 /// \param[in] track The track number of the song
99 /// \param[in] genre The genre of the song
100 /// \param[in] comment A comment to attach to the song
101 /// \param[in] trackLength Total track length in seconds
102 /// \return True on success, false on failure.
103 ///
104 virtual bool Start(int inChannels,
105 int inRate,
106 int inBits,
107 const std::string& title,
108 const std::string& artist,
109 const std::string& albumartist,
110 const std::string& album,
111 const std::string& year,
112 const std::string& track,
113 const std::string& genre,
114 const std::string& comment,
115 int trackLength) = 0;
116 //--------------------------------------------------------------------------
117
118 //==========================================================================
119 /// \brief Encode a chunk of audio (**required**)
120 ///
121 /// \param[in] numBytesRead Number of bytes in input buffer
122 /// \param[in] pbtStream the input buffer
123 /// \return Number of bytes consumed
124 ///
125 virtual int Encode(int numBytesRead, const uint8_t* pbtStream) = 0;
126 //--------------------------------------------------------------------------
127
128 //==========================================================================
129 /// \brief Finalize encoding (**optional**)
130 ///
131 /// \return True on success, false on failure.
132 ///
133 virtual bool Finish() { return true; }
134 //--------------------------------------------------------------------------
135
136 //==========================================================================
137 /// \brief Write block of data
138 ///
139 /// \param[in] data Pointer to the array of elements to be
140 /// written
141 /// \param[in] length Size in bytes to be written.
142 /// \return The total number of bytes
143 /// successfully written is returned.
144 int Write(const uint8_t* data, int length)
145 {
146 return m_instanceData->toKodi.write(m_instanceData->toKodi.kodiInstance, data, length);
147 }
148 //--------------------------------------------------------------------------
149
150 //==========================================================================
151 /// \brief Set the file's current position.
152 ///
153 /// The whence argument is optional and defaults to SEEK_SET (0)
154 ///
155 /// \param[in] position the position that you want to seek to
156 /// \param[in] whence [optional] offset relative to
157 /// You can set the value of whence to one
158 /// of three things:
159 /// | Value | int | Description |
160 /// |:--------:|:---:|:---------------------------------------------------|
161 /// | SEEK_SET | 0 | position is relative to the beginning of the file. This is probably what you had in mind anyway, and is the most commonly used value for whence.
162 /// | SEEK_CUR | 1 | position is relative to the current file pointer position. So, in effect, you can say, "Move to my current position plus 30 bytes," or, "move to my current position minus 20 bytes."
163 /// | SEEK_END | 2 | position is relative to the end of the file. Just like SEEK_SET except from the other end of the file. Be sure to use negative values for offset if you want to back up from the end of the file, instead of going past the end into oblivion.
164 ///
165 /// \return Returns the resulting offset location as
166 /// measured in bytes from the beginning of
167 /// the file. On error, the value -1 is
168 /// returned.
169 int64_t Seek(int64_t position, int whence = SEEK_SET)
170 {
171 return m_instanceData->toKodi.seek(m_instanceData->toKodi.kodiInstance, position, whence);
172 }
173 //--------------------------------------------------------------------------
174
175 private:
176 void SetAddonStruct(KODI_HANDLE instance)
177 {
178 if (instance == nullptr)
179 throw std::logic_error("kodi::addon::CInstanceAudioEncoder: Creation with empty addon structure not allowed, table must be given from Kodi!");
180
181 m_instanceData = static_cast<AddonInstance_AudioEncoder*>(instance);
182 m_instanceData->toAddon.addonInstance = this;
183 m_instanceData->toAddon.start = ADDON_Start;
184 m_instanceData->toAddon.encode = ADDON_Encode;
185 m_instanceData->toAddon.finish = ADDON_Finish;
186 }
187
188 inline static bool ADDON_Start(const AddonInstance_AudioEncoder* instance, int inChannels, int inRate, int inBits,
189 const char* title, const char* artist,
190 const char* albumartist, const char* album,
191 const char* year, const char* track,
192 const char* genre, const char* comment,
193 int trackLength)
194 {
195 return instance->toAddon.addonInstance->Start(inChannels,
196 inRate,
197 inBits,
198 title,
199 artist,
200 albumartist,
201 album,
202 year,
203 track,
204 genre,
205 comment,
206 trackLength);
207 }
208
209 inline static int ADDON_Encode(const AddonInstance_AudioEncoder* instance, int numBytesRead, const uint8_t* pbtStream)
210 {
211 return instance->toAddon.addonInstance->Encode(numBytesRead, pbtStream);
212 }
213
214 inline static bool ADDON_Finish(const AddonInstance_AudioEncoder* instance)
215 {
216 return instance->toAddon.addonInstance->Finish();
217 }
218
219 AddonInstance_AudioEncoder* m_instanceData;
220 };
221
222} /* namespace addon */
223} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h
new file mode 100644
index 0000000..a854711
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/ImageDecoder.h
@@ -0,0 +1,163 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../AddonBase.h"
23
24namespace kodi { namespace addon { class CInstanceImageDecoder; }}
25
26extern "C"
27{
28
29 typedef struct AddonProps_ImageDecoder
30 {
31 const char* mimetype;
32 } AddonProps_ImageDecoder;
33
34 typedef struct AddonToKodiFuncTable_ImageDecoder
35 {
36 KODI_HANDLE kodi_instance;
37 } AddonToKodiFuncTable_ImageDecoder;
38
39 struct AddonInstance_ImageDecoder;
40 typedef struct KodiToAddonFuncTable_ImageDecoder
41 {
42 kodi::addon::CInstanceImageDecoder* addonInstance;
43 bool (__cdecl* load_image_from_memory) (const AddonInstance_ImageDecoder* instance,
44 unsigned char* buffer, unsigned int buf_size,
45 unsigned int* width, unsigned int* height);
46
47 bool (__cdecl* decode) (const AddonInstance_ImageDecoder* instance,
48 unsigned char* pixels,
49 unsigned int width, unsigned int height,
50 unsigned int pitch, unsigned int format);
51 } KodiToAddonFuncTable_ImageDecoder;
52
53 typedef struct AddonInstance_ImageDecoder
54 {
55 AddonProps_ImageDecoder props;
56 AddonToKodiFuncTable_ImageDecoder toKodi;
57 KodiToAddonFuncTable_ImageDecoder toAddon;
58 } AddonInstance_ImageDecoder;
59
60} /* extern "C" */
61
62typedef enum ImageFormat : unsigned int
63{
64 ADDON_IMG_FMT_A8R8G8B8 = 1,
65 ADDON_IMG_FMT_A8 = 2,
66 ADDON_IMG_FMT_RGBA8 = 3,
67 ADDON_IMG_FMT_RGB8 = 4
68} ImageFormat;
69
70namespace kodi
71{
72namespace addon
73{
74
75 class CInstanceImageDecoder : public IAddonInstance
76 {
77 public:
78 //==========================================================================
79 /// @brief Class constructor
80 ///
81 /// @param[in] instance The from Kodi given instance given be
82 /// add-on CreateInstance call with instance
83 /// id ADDON_INSTANCE_IMAGEDECODER.
84 CInstanceImageDecoder(KODI_HANDLE instance)
85 : IAddonInstance(ADDON_INSTANCE_IMAGEDECODER)
86 {
87 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
88 throw std::logic_error("kodi::addon::CInstanceImageDecoder: Creation of multiple together with single instance way is not allowed!");
89
90 SetAddonStruct(instance);
91 }
92 //--------------------------------------------------------------------------
93
94 ~CInstanceImageDecoder() override = default;
95
96 //==========================================================================
97 /// @brief Initialize an encoder
98 ///
99 /// @param[in] buffer The data to read from memory
100 /// @param[in] bufSize The buffer size
101 /// @param[in,out] width The optimal width of image on entry, obtained width on return
102 /// @param[in,out] height The optimal height of image, actual obtained height on return
103 /// @return true if successful done, false on error
104 ///
105 virtual bool LoadImageFromMemory(unsigned char* buffer, unsigned int bufSize,
106 unsigned int& width, unsigned int& height) = 0;
107 //--------------------------------------------------------------------------
108
109 //==========================================================================
110 /// @brief Decode previously loaded image
111 ///
112 /// @param[in] pixels Output buffer
113 /// @param[in] width Width of output image
114 /// @param[in] height Height of output image
115 /// @param[in] pitch Pitch of output image
116 /// @param[in] format Format of output image
117 /// @return true if successful done, false on error
118 ///
119 virtual bool Decode(unsigned char* pixels,
120 unsigned int width, unsigned int height,
121 unsigned int pitch, ImageFormat format) = 0;
122 //--------------------------------------------------------------------------
123
124 //==========================================================================
125 /// @brief Get the wanted mime type from Kodi
126 ///
127 /// @return the mimetype wanted from Kodi
128 ///
129 inline std::string MimeType() { return m_instanceData->props.mimetype; }
130 //--------------------------------------------------------------------------
131
132 private:
133 void SetAddonStruct(KODI_HANDLE instance)
134 {
135 if (instance == nullptr)
136 throw std::logic_error("kodi::addon::CInstanceImageDecoder: Creation with empty addon structure not allowed, table must be given from Kodi!");
137
138 m_instanceData = static_cast<AddonInstance_ImageDecoder*>(instance);
139 m_instanceData->toAddon.addonInstance = this;
140 m_instanceData->toAddon.load_image_from_memory = ADDON_LoadImageFromMemory;
141 m_instanceData->toAddon.decode = ADDON_Decode;
142 }
143
144 inline static bool ADDON_LoadImageFromMemory(const AddonInstance_ImageDecoder* instance,
145 unsigned char* buffer, unsigned int bufSize,
146 unsigned int* width, unsigned int* height)
147 {
148 return instance->toAddon.addonInstance->LoadImageFromMemory(buffer, bufSize, *width, *height);
149 }
150
151 inline static bool ADDON_Decode(const AddonInstance_ImageDecoder* instance,
152 unsigned char* pixels,
153 unsigned int width, unsigned int height,
154 unsigned int pitch, unsigned int format)
155 {
156 return instance->toAddon.addonInstance->Decode(pixels, width, height, pitch, static_cast<ImageFormat>(format));
157 }
158
159 AddonInstance_ImageDecoder* m_instanceData;
160 };
161
162} /* namespace addon */
163} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h
new file mode 100644
index 0000000..76cfe92
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Inputstream.h
@@ -0,0 +1,621 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Parts with a comment named "internal" are only used inside header and not
24 * used or accessed direct during add-on development!
25 */
26
27#include "../AddonBase.h"
28#include "../StreamCrypto.h"
29#include "../StreamCodec.h"
30
31#ifdef BUILD_KODI_ADDON
32#include "../DVDDemuxPacket.h"
33#else
34#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h"
35#endif
36
37namespace kodi { namespace addon { class CInstanceInputStream; }}
38
39extern "C" {
40
41 /*!
42 * @brief InputStream add-on capabilities. All capabilities are set to "false" as default.
43 */
44 typedef struct INPUTSTREAM_CAPABILITIES
45 {
46 enum MASKTYPE: uint32_t
47 {
48 /// supports interface IDemux
49 SUPPORTS_IDEMUX = (1 << 0),
50
51 /// supports interface IPosTime
52 SUPPORTS_IPOSTIME = (1 << 1),
53
54 /// supports interface IDisplayTime
55 SUPPORTS_IDISPLAYTIME = (1 << 2),
56
57 /// supports seek
58 SUPPORTS_SEEK = (1 << 3),
59
60 /// supports pause
61 SUPPORTS_PAUSE = (1 << 4)
62 };
63
64 /// set of supported capabilities
65 uint32_t m_mask;
66 } INPUTSTREAM_CAPABILITIES;
67
68 /*!
69 * @brief structure of key/value pairs passed to addon on Open()
70 */
71 typedef struct INPUTSTREAM
72 {
73 static const unsigned int MAX_INFO_COUNT = 8;
74
75 const char *m_strURL;
76
77 unsigned int m_nCountInfoValues;
78 struct LISTITEMPROPERTY
79 {
80 const char *m_strKey;
81 const char *m_strValue;
82 } m_ListItemProperties[MAX_INFO_COUNT];
83
84 const char *m_libFolder;
85 const char *m_profileFolder;
86 } INPUTSTREAM;
87
88 /*!
89 * @brief Array of stream IDs
90 */
91 typedef struct INPUTSTREAM_IDS
92 {
93 static const unsigned int MAX_STREAM_COUNT = 32;
94 unsigned int m_streamCount;
95 unsigned int m_streamIds[MAX_STREAM_COUNT];
96 } INPUTSTREAM_IDS;
97
98 /*!
99 * @brief stream properties
100 */
101 typedef struct INPUTSTREAM_INFO
102 {
103 enum STREAM_TYPE
104 {
105 TYPE_NONE,
106 TYPE_VIDEO,
107 TYPE_AUDIO,
108 TYPE_SUBTITLE,
109 TYPE_TELETEXT
110 } m_streamType;
111
112 enum Codec_FEATURES
113 {
114 FEATURE_DECODE = 1
115 };
116 unsigned int m_features;
117
118 char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */
119 char m_codecInternalName[32]; /*!< @brief (optional) internal name of codec (selectionstream info) */
120 STREAMCODEC_PROFILE m_codecProfile; /*!< @brief (optional) the profile of the codec */
121 unsigned int m_pID; /*!< @brief (required) physical index */
122
123 const uint8_t *m_ExtraData;
124 unsigned int m_ExtraSize;
125
126 char m_language[4]; /*!< @brief ISO 639 3-letter language code (empty string if undefined) */
127
128 unsigned int m_FpsScale; /*!< @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps */
129 unsigned int m_FpsRate;
130 unsigned int m_Height; /*!< @brief height of the stream reported by the demuxer */
131 unsigned int m_Width; /*!< @brief width of the stream reported by the demuxer */
132 float m_Aspect; /*!< @brief display aspect of stream */
133
134 unsigned int m_Channels; /*!< @brief (required) amount of channels */
135 unsigned int m_SampleRate; /*!< @brief (required) sample rate */
136 unsigned int m_BitRate; /*!< @brief (required) bit rate */
137 unsigned int m_BitsPerSample; /*!< @brief (required) bits per sample */
138 unsigned int m_BlockAlign;
139
140 CRYPTO_INFO m_cryptoInfo;
141 } INPUTSTREAM_INFO;
142
143 /*!
144 * @brief Structure to transfer the methods from xbmc_inputstream_dll.h to XBMC
145 */
146
147 // this are properties given to the addon on create
148 // at this time we have no parameters for the addon
149 typedef struct AddonProps_InputStream /* internal */
150 {
151 int dummy;
152 } AddonProps_InputStream;
153
154 typedef struct AddonToKodiFuncTable_InputStream /* internal */
155 {
156 KODI_HANDLE kodiInstance;
157 DemuxPacket* (*allocate_demux_packet)(void* kodiInstance, int data_size);
158 DemuxPacket* (*allocate_encrypted_demux_packet)(void* kodiInstance, unsigned int data_size, unsigned int encrypted_subsample_count);
159 void (*free_demux_packet)(void* kodiInstance, DemuxPacket* packet);
160 } AddonToKodiFuncTable_InputStream;
161
162 struct AddonInstance_InputStream;
163 typedef struct KodiToAddonFuncTable_InputStream /* internal */
164 {
165 kodi::addon::CInstanceInputStream* addonInstance;
166
167 bool (__cdecl* open)(const AddonInstance_InputStream* instance, INPUTSTREAM* props);
168 void (__cdecl* close)(const AddonInstance_InputStream* instance);
169 const char* (__cdecl* get_path_list)(const AddonInstance_InputStream* instance);
170 void (__cdecl* get_capabilities)(const AddonInstance_InputStream* instance, INPUTSTREAM_CAPABILITIES* capabilities);
171
172 // IDemux
173 struct INPUTSTREAM_IDS (__cdecl* get_stream_ids)(const AddonInstance_InputStream* instance);
174 struct INPUTSTREAM_INFO (__cdecl* get_stream)(const AddonInstance_InputStream* instance, int streamid);
175 void (__cdecl* enable_stream)(const AddonInstance_InputStream* instance, int streamid, bool enable);
176 void(__cdecl* open_stream)(const AddonInstance_InputStream* instance, int streamid);
177 void (__cdecl* demux_reset)(const AddonInstance_InputStream* instance);
178 void (__cdecl* demux_abort)(const AddonInstance_InputStream* instance);
179 void (__cdecl* demux_flush)(const AddonInstance_InputStream* instance);
180 DemuxPacket* (__cdecl* demux_read)(const AddonInstance_InputStream* instance);
181 bool (__cdecl* demux_seek_time)(const AddonInstance_InputStream* instance, double time, bool backwards, double* startpts);
182 void (__cdecl* demux_set_speed)(const AddonInstance_InputStream* instance, int speed);
183 void (__cdecl* set_video_resolution)(const AddonInstance_InputStream* instance, int width, int height);
184
185 // IDisplayTime
186 int (__cdecl* get_total_time)(const AddonInstance_InputStream* instance);
187 int (__cdecl* get_time)(const AddonInstance_InputStream* instance);
188
189 // IPosTime
190 bool (__cdecl* pos_time)(const AddonInstance_InputStream* instance, int ms);
191
192 // Seekable (mandatory)
193 bool (__cdecl* can_pause_stream)(const AddonInstance_InputStream* instance);
194 bool (__cdecl* can_seek_stream)(const AddonInstance_InputStream* instance);
195
196 int (__cdecl* read_stream)(const AddonInstance_InputStream* instance, uint8_t* buffer, unsigned int bufferSize);
197 int64_t(__cdecl* seek_stream)(const AddonInstance_InputStream* instance, int64_t position, int whence);
198 int64_t (__cdecl* position_stream)(const AddonInstance_InputStream* instance);
199 int64_t (__cdecl* length_stream)(const AddonInstance_InputStream* instance);
200 void (__cdecl* pause_stream)(const AddonInstance_InputStream* instance, double time);
201 bool (__cdecl* is_real_time_stream)(const AddonInstance_InputStream* instance);
202 } KodiToAddonFuncTable_InputStream;
203
204 typedef struct AddonInstance_InputStream /* internal */
205 {
206 AddonProps_InputStream props;
207 AddonToKodiFuncTable_InputStream toKodi;
208 KodiToAddonFuncTable_InputStream toAddon;
209 } AddonInstance_InputStream;
210
211} /* extern "C" */
212
213namespace kodi
214{
215namespace addon
216{
217
218 class CInstanceInputStream : public IAddonInstance
219 {
220 public:
221 CInstanceInputStream(KODI_HANDLE instance)
222 : IAddonInstance(ADDON_INSTANCE_INPUTSTREAM)
223 {
224 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
225 throw std::logic_error("kodi::addon::CInstanceInputStream: Creation of multiple together with single instance way is not allowed!");
226
227 SetAddonStruct(instance);
228 }
229
230 ~CInstanceInputStream() override = default;
231
232 /*!
233 * Open a stream.
234 * @param props
235 * @return True if the stream has been opened successfully, false otherwise.
236 * @remarks
237 */
238 virtual bool Open(INPUTSTREAM& props) = 0;
239
240 /*!
241 * Close an open stream.
242 * @remarks
243 */
244 virtual void Close() = 0;
245
246 /*!
247 * Get Capabilities of this addon.
248 * @param capabilities The add-on's capabilities.
249 * @remarks
250 */
251 virtual void GetCapabilities(INPUTSTREAM_CAPABILITIES& capabilities) = 0;
252
253 /*!
254 * Get IDs of available streams
255 * @remarks
256 */
257 virtual INPUTSTREAM_IDS GetStreamIds() = 0;
258
259 /*!
260 * Get stream properties of a stream.
261 * @param streamid unique id of stream
262 * @return struc of stream properties
263 * @remarks
264 */
265 virtual INPUTSTREAM_INFO GetStream(int streamid) = 0;
266
267 /*!
268 * Enable or disable a stream.
269 * A disabled stream does not send demux packets
270 * @param streamid unique id of stream
271 * @param enable true for enable, false for disable
272 * @remarks
273 */
274 virtual void EnableStream(int streamid, bool enable) = 0;
275
276 /*!
277 * Opens a stream for playback.
278 * @param streamid unique id of stream
279 * @remarks
280 */
281 virtual void OpenStream(int streamid) = 0;
282
283 /*!
284 * Reset the demultiplexer in the add-on.
285 * @remarks Required if bHandlesDemuxing is set to true.
286 */
287 virtual void DemuxReset() { }
288
289 /*!
290 * Abort the demultiplexer thread in the add-on.
291 * @remarks Required if bHandlesDemuxing is set to true.
292 */
293 virtual void DemuxAbort() { }
294
295 /*!
296 * Flush all data that's currently in the demultiplexer buffer in the add-on.
297 * @remarks Required if bHandlesDemuxing is set to true.
298 */
299 virtual void DemuxFlush() { }
300
301 /*!
302 * Read the next packet from the demultiplexer, if there is one.
303 * @return The next packet.
304 * If there is no next packet, then the add-on should return the
305 * packet created by calling AllocateDemuxPacket(0) on the callback.
306 * If the stream changed and Kodi's player needs to be reinitialised,
307 * then, the add-on should call AllocateDemuxPacket(0) on the
308 * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and
309 * return the value.
310 * The add-on should return NULL if an error occured.
311 * @remarks Return NULL if this add-on won't provide this function.
312 */
313 virtual DemuxPacket* DemuxRead() { return nullptr; }
314
315 /*!
316 * Notify the InputStream addon/demuxer that Kodi wishes to seek the stream by time
317 * Demuxer is required to set stream to an IDR frame
318 * @param time The absolute time since stream start
319 * @param backwards True to seek to keyframe BEFORE time, else AFTER
320 * @param startpts can be updated to point to where display should start
321 * @return True if the seek operation was possible
322 * @remarks Optional, and only used if addon has its own demuxer.
323 */
324 virtual bool DemuxSeekTime(double time, bool backwards, double &startpts) { return false; }
325
326 /*!
327 * Notify the InputStream addon/demuxer that Kodi wishes to change playback speed
328 * @param speed The requested playback speed
329 * @remarks Optional, and only used if addon has its own demuxer.
330 */
331 virtual void DemuxSetSpeed(int speed) { }
332
333 /*!
334 * Sets desired width / height
335 * @param width / hight
336 */
337 virtual void SetVideoResolution(int width, int height) { }
338
339 /*!
340 * Totel time in ms
341 * @remarks
342 */
343 virtual int GetTotalTime() { return -1; }
344
345 /*!
346 * Playing time in ms
347 * @remarks
348 */
349 virtual int GetTime() { return -1; }
350
351 /*!
352 * Positions inputstream to playing time given in ms
353 * @remarks
354 */
355 virtual bool PosTime(int ms) { return false; }
356
357
358 /*!
359 * Check if the backend support pausing the currently playing stream
360 * This will enable/disable the pause button in Kodi based on the return value
361 * @return false if the InputStream addon/backend does not support pausing, true if possible
362 */
363 virtual bool CanPauseStream() { return false; }
364
365 /*!
366 * Check if the backend supports seeking for the currently playing stream
367 * This will enable/disable the rewind/forward buttons in Kodi based on the return value
368 * @return false if the InputStream addon/backend does not support seeking, true if possible
369 */
370 virtual bool CanSeekStream() { return false; }
371
372 /*!
373 * Read from an open stream.
374 * @param buffer The buffer to store the data in.
375 * @param bufferSize The amount of bytes to read.
376 * @return The amount of bytes that were actually read from the stream.
377 * @remarks Return -1 if this add-on won't provide this function.
378 */
379 virtual int ReadStream(uint8_t* buffer, unsigned int bufferSize) { return -1; }
380
381 /*!
382 * Seek in a stream.
383 * @param position The position to seek to.
384 * @param whence ?
385 * @return The new position.
386 * @remarks Return -1 if this add-on won't provide this function.
387 */
388 virtual int64_t SeekStream(int64_t position, int whence = SEEK_SET) { return -1; }
389
390 /*!
391 * @return The position in the stream that's currently being read.
392 * @remarks Return -1 if this add-on won't provide this function.
393 */
394 virtual int64_t PositionStream() { return -1; }
395
396 /*!
397 * @return The total length of the stream that's currently being read.
398 * @remarks Return -1 if this add-on won't provide this function.
399 */
400 virtual int64_t LengthStream() { return -1; }
401
402
403 /*!
404 * @brief Notify the InputStream addon that Kodi (un)paused the currently playing stream
405 */
406 virtual void PauseStream(double time) { }
407
408
409 /*!
410 * Check for real-time streaming
411 * @return true if current stream is real-time
412 */
413 virtual bool IsRealTimeStream() { return true; }
414
415 /*!
416 * @brief Allocate a demux packet. Free with FreeDemuxPacket
417 * @param dataSize The size of the data that will go into the packet
418 * @return The allocated packet
419 */
420 DemuxPacket* AllocateDemuxPacket(int dataSize)
421 {
422 return m_instanceData->toKodi.allocate_demux_packet(m_instanceData->toKodi.kodiInstance, dataSize);
423 }
424
425 /*!
426 * @brief Allocate a demux packet. Free with FreeDemuxPacket
427 * @param dataSize The size of the data that will go into the packet
428 * @return The allocated packet
429 */
430 DemuxPacket* AllocateEncryptedDemuxPacket(int dataSize, unsigned int encryptedSubsampleCount)
431 {
432 return m_instanceData->toKodi.allocate_encrypted_demux_packet(m_instanceData->toKodi.kodiInstance, dataSize, encryptedSubsampleCount);
433 }
434
435 /*!
436 * @brief Free a packet that was allocated with AllocateDemuxPacket
437 * @param packet The packet to free
438 */
439 void FreeDemuxPacket(DemuxPacket* packet)
440 {
441 return m_instanceData->toKodi.free_demux_packet(m_instanceData->toKodi.kodiInstance, packet);
442 }
443
444 private:
445 void SetAddonStruct(KODI_HANDLE instance)
446 {
447 if (instance == nullptr)
448 throw std::logic_error("kodi::addon::CInstanceInputStream: Creation with empty addon structure not allowed, table must be given from Kodi!");
449
450 m_instanceData = static_cast<AddonInstance_InputStream*>(instance);
451 m_instanceData->toAddon.addonInstance = this;
452 m_instanceData->toAddon.open = ADDON_Open;
453 m_instanceData->toAddon.close = ADDON_Close;
454 m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities;
455
456 m_instanceData->toAddon.get_stream_ids = ADDON_GetStreamIds;
457 m_instanceData->toAddon.get_stream = ADDON_GetStream;
458 m_instanceData->toAddon.enable_stream = ADDON_EnableStream;
459 m_instanceData->toAddon.open_stream = ADDON_OpenStream;
460 m_instanceData->toAddon.demux_reset = ADDON_DemuxReset;
461 m_instanceData->toAddon.demux_abort = ADDON_DemuxAbort;
462 m_instanceData->toAddon.demux_flush = ADDON_DemuxFlush;
463 m_instanceData->toAddon.demux_read = ADDON_DemuxRead;
464 m_instanceData->toAddon.demux_seek_time = ADDON_DemuxSeekTime;
465 m_instanceData->toAddon.demux_set_speed = ADDON_DemuxSetSpeed;
466 m_instanceData->toAddon.set_video_resolution = ADDON_SetVideoResolution;
467
468 m_instanceData->toAddon.get_total_time = ADDON_GetTotalTime;
469 m_instanceData->toAddon.get_time = ADDON_GetTime;
470
471 m_instanceData->toAddon.pos_time = ADDON_PosTime;
472
473 m_instanceData->toAddon.can_pause_stream = ADDON_CanPauseStream;
474 m_instanceData->toAddon.can_seek_stream = ADDON_CanSeekStream;
475
476 m_instanceData->toAddon.read_stream = ADDON_ReadStream;
477 m_instanceData->toAddon.seek_stream = ADDON_SeekStream;
478 m_instanceData->toAddon.position_stream = ADDON_PositionStream;
479 m_instanceData->toAddon.length_stream = ADDON_LengthStream;
480 m_instanceData->toAddon.pause_stream = ADDON_PauseStream;
481 m_instanceData->toAddon.is_real_time_stream = ADDON_IsRealTimeStream;
482 }
483
484 inline static bool ADDON_Open(const AddonInstance_InputStream* instance, INPUTSTREAM* props)
485 {
486 return instance->toAddon.addonInstance->Open(*props);
487 }
488
489 inline static void ADDON_Close(const AddonInstance_InputStream* instance)
490 {
491 instance->toAddon.addonInstance->Close();
492 }
493
494 inline static void ADDON_GetCapabilities(const AddonInstance_InputStream* instance, INPUTSTREAM_CAPABILITIES* capabilities)
495 {
496 instance->toAddon.addonInstance->GetCapabilities(*capabilities);
497 }
498
499
500 // IDemux
501 inline static struct INPUTSTREAM_IDS ADDON_GetStreamIds(const AddonInstance_InputStream* instance)
502 {
503 return instance->toAddon.addonInstance->GetStreamIds();
504 }
505
506 inline static struct INPUTSTREAM_INFO ADDON_GetStream(const AddonInstance_InputStream* instance, int streamid)
507 {
508 return instance->toAddon.addonInstance->GetStream(streamid);
509 }
510
511 inline static void ADDON_EnableStream(const AddonInstance_InputStream* instance, int streamid, bool enable)
512 {
513 instance->toAddon.addonInstance->EnableStream(streamid, enable);
514 }
515
516 inline static void ADDON_OpenStream(const AddonInstance_InputStream* instance, int streamid)
517 {
518 instance->toAddon.addonInstance->OpenStream(streamid);
519 }
520
521 inline static void ADDON_DemuxReset(const AddonInstance_InputStream* instance)
522 {
523 instance->toAddon.addonInstance->DemuxReset();
524 }
525
526 inline static void ADDON_DemuxAbort(const AddonInstance_InputStream* instance)
527 {
528 instance->toAddon.addonInstance->DemuxAbort();
529 }
530
531 inline static void ADDON_DemuxFlush(const AddonInstance_InputStream* instance)
532 {
533 instance->toAddon.addonInstance->DemuxFlush();
534 }
535
536 inline static DemuxPacket* ADDON_DemuxRead(const AddonInstance_InputStream* instance)
537 {
538 return instance->toAddon.addonInstance->DemuxRead();
539 }
540
541 inline static bool ADDON_DemuxSeekTime(const AddonInstance_InputStream* instance, double time, bool backwards, double *startpts)
542 {
543 return instance->toAddon.addonInstance->DemuxSeekTime(time, backwards, *startpts);
544 }
545
546 inline static void ADDON_DemuxSetSpeed(const AddonInstance_InputStream* instance, int speed)
547 {
548 instance->toAddon.addonInstance->DemuxSetSpeed(speed);
549 }
550
551 inline static void ADDON_SetVideoResolution(const AddonInstance_InputStream* instance, int width, int height)
552 {
553 instance->toAddon.addonInstance->SetVideoResolution(width, height);
554 }
555
556
557 // IDisplayTime
558 inline static int ADDON_GetTotalTime(const AddonInstance_InputStream* instance)
559 {
560 return instance->toAddon.addonInstance->GetTotalTime();
561 }
562
563 inline static int ADDON_GetTime(const AddonInstance_InputStream* instance)
564 {
565 return instance->toAddon.addonInstance->GetTime();
566 }
567
568
569 // IPosTime
570 inline static bool ADDON_PosTime(const AddonInstance_InputStream* instance, int ms)
571 {
572 return instance->toAddon.addonInstance->PosTime(ms);
573 }
574
575 // Seekable (mandatory)
576 inline static bool ADDON_CanPauseStream(const AddonInstance_InputStream* instance)
577 {
578 return instance->toAddon.addonInstance->CanPauseStream();
579 }
580
581 inline static bool ADDON_CanSeekStream(const AddonInstance_InputStream* instance)
582 {
583 return instance->toAddon.addonInstance->CanSeekStream();
584 }
585
586
587 inline static int ADDON_ReadStream(const AddonInstance_InputStream* instance, uint8_t* buffer, unsigned int bufferSize)
588 {
589 return instance->toAddon.addonInstance->ReadStream(buffer, bufferSize);
590 }
591
592 inline static int64_t ADDON_SeekStream(const AddonInstance_InputStream* instance, int64_t position, int whence)
593 {
594 return instance->toAddon.addonInstance->SeekStream(position, whence);
595 }
596
597 inline static int64_t ADDON_PositionStream(const AddonInstance_InputStream* instance)
598 {
599 return instance->toAddon.addonInstance->PositionStream();
600 }
601
602 inline static int64_t ADDON_LengthStream(const AddonInstance_InputStream* instance)
603 {
604 return instance->toAddon.addonInstance->LengthStream();
605 }
606
607 inline static void ADDON_PauseStream(const AddonInstance_InputStream* instance, double time)
608 {
609 instance->toAddon.addonInstance->PauseStream(time);
610 }
611
612 inline static bool ADDON_IsRealTimeStream(const AddonInstance_InputStream* instance)
613 {
614 return instance->toAddon.addonInstance->IsRealTimeStream();
615 }
616
617 AddonInstance_InputStream* m_instanceData;
618 };
619
620} /* namespace addon */
621} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h
new file mode 100644
index 0000000..631b9b4
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Peripheral.h
@@ -0,0 +1,682 @@
1#pragma once
2/*
3 * Copyright (C) 2014-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this Program; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../AddonBase.h"
23
24namespace kodi { namespace addon { class CInstancePeripheral; }}
25
26/* indicates a joystick has no preference for port number */
27#define NO_PORT_REQUESTED (-1)
28
29/* joystick's driver button/hat/axis index is unknown */
30#define DRIVER_INDEX_UNKNOWN (-1)
31
32extern "C"
33{
34
35 /// @name Peripheral types
36 ///{
37 typedef enum PERIPHERAL_ERROR
38 {
39 PERIPHERAL_NO_ERROR = 0, // no error occurred
40 PERIPHERAL_ERROR_UNKNOWN = -1, // an unknown error occurred
41 PERIPHERAL_ERROR_FAILED = -2, // the command failed
42 PERIPHERAL_ERROR_INVALID_PARAMETERS = -3, // the parameters of the method are invalid for this operation
43 PERIPHERAL_ERROR_NOT_IMPLEMENTED = -4, // the method that the frontend called is not implemented
44 PERIPHERAL_ERROR_NOT_CONNECTED = -5, // no peripherals are connected
45 PERIPHERAL_ERROR_CONNECTION_FAILED = -6, // peripherals are connected, but command was interrupted
46 } PERIPHERAL_ERROR;
47
48 typedef enum PERIPHERAL_TYPE
49 {
50 PERIPHERAL_TYPE_UNKNOWN,
51 PERIPHERAL_TYPE_JOYSTICK,
52 PERIPHERAL_TYPE_KEYBOARD,
53 } PERIPHERAL_TYPE;
54
55 typedef struct PERIPHERAL_INFO
56 {
57 PERIPHERAL_TYPE type; /*!< @brief type of peripheral */
58 char* name; /*!< @brief name of peripheral */
59 uint16_t vendor_id; /*!< @brief vendor ID of peripheral, 0x0000 if unknown */
60 uint16_t product_id; /*!< @brief product ID of peripheral, 0x0000 if unknown */
61 unsigned int index; /*!< @brief the order in which the add-on identified this peripheral */
62 } ATTRIBUTE_PACKED PERIPHERAL_INFO;
63
64 /*!
65 * @brief Peripheral add-on capabilities.
66 * If a capability is set to true, then the corresponding methods from
67 * kodi_peripheral_dll.h need to be implemented.
68 */
69 typedef struct PERIPHERAL_CAPABILITIES
70 {
71 bool provides_joysticks; /*!< @brief true if the add-on provides joysticks */
72 bool provides_joystick_rumble;
73 bool provides_joystick_power_off;
74 bool provides_buttonmaps; /*!< @brief true if the add-on provides button maps */
75 } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES;
76 ///}
77
78 /// @name Event types
79 ///{
80 typedef enum PERIPHERAL_EVENT_TYPE
81 {
82 PERIPHERAL_EVENT_TYPE_NONE, /*!< @brief unknown event */
83 PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON, /*!< @brief state changed for joystick driver button */
84 PERIPHERAL_EVENT_TYPE_DRIVER_HAT, /*!< @brief state changed for joystick driver hat */
85 PERIPHERAL_EVENT_TYPE_DRIVER_AXIS, /*!< @brief state changed for joystick driver axis */
86 PERIPHERAL_EVENT_TYPE_SET_MOTOR, /*!< @brief set the state for joystick rumble motor */
87 } PERIPHERAL_EVENT_TYPE;
88
89 typedef enum JOYSTICK_STATE_BUTTON
90 {
91 JOYSTICK_STATE_BUTTON_UNPRESSED = 0x0, /*!< @brief button is released */
92 JOYSTICK_STATE_BUTTON_PRESSED = 0x1, /*!< @brief button is pressed */
93 } JOYSTICK_STATE_BUTTON;
94
95 typedef enum JOYSTICK_STATE_HAT
96 {
97 JOYSTICK_STATE_HAT_UNPRESSED = 0x0, /*!< @brief no directions are pressed */
98 JOYSTICK_STATE_HAT_LEFT = 0x1, /*!< @brief only left is pressed */
99 JOYSTICK_STATE_HAT_RIGHT = 0x2, /*!< @brief only right is pressed */
100 JOYSTICK_STATE_HAT_UP = 0x4, /*!< @brief only up is pressed */
101 JOYSTICK_STATE_HAT_DOWN = 0x8, /*!< @brief only down is pressed */
102 JOYSTICK_STATE_HAT_LEFT_UP = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_UP,
103 JOYSTICK_STATE_HAT_LEFT_DOWN = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_DOWN,
104 JOYSTICK_STATE_HAT_RIGHT_UP = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_UP,
105 JOYSTICK_STATE_HAT_RIGHT_DOWN = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_DOWN,
106 } JOYSTICK_STATE_HAT;
107
108 /*!
109 * @brief value in the closed interval [-1.0, 1.0]
110 *
111 * The axis state uses the XInput coordinate system:
112 * - Negative values signify down or to the left
113 * - Positive values signify up or to the right
114 */
115 typedef float JOYSTICK_STATE_AXIS;
116
117 typedef float JOYSTICK_STATE_MOTOR;
118
119 typedef struct PERIPHERAL_EVENT
120 {
121 unsigned int peripheral_index;
122 PERIPHERAL_EVENT_TYPE type;
123 unsigned int driver_index;
124 JOYSTICK_STATE_BUTTON driver_button_state;
125 JOYSTICK_STATE_HAT driver_hat_state;
126 JOYSTICK_STATE_AXIS driver_axis_state;
127 JOYSTICK_STATE_MOTOR motor_state;
128 } ATTRIBUTE_PACKED PERIPHERAL_EVENT;
129 ///}
130
131 /// @name Joystick types
132 ///{
133 typedef struct JOYSTICK_INFO
134 {
135 PERIPHERAL_INFO peripheral; /*!< @brief peripheral info for this joystick */
136 char* provider; /*!< @brief name of the driver or interface providing the joystick */
137 int requested_port; /*!< @brief requested port number (such as for 360 controllers), or NO_PORT_REQUESTED */
138 unsigned int button_count; /*!< @brief number of buttons reported by the driver */
139 unsigned int hat_count; /*!< @brief number of hats reported by the driver */
140 unsigned int axis_count; /*!< @brief number of axes reported by the driver */
141 unsigned int motor_count; /*!< @brief number of motors reported by the driver */
142 bool supports_poweroff; /*!< @brief whether the joystick supports being powered off */
143 } ATTRIBUTE_PACKED JOYSTICK_INFO;
144
145 typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE
146 {
147 JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN,
148 JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON,
149 JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION,
150 JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS,
151 JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR,
152 } JOYSTICK_DRIVER_PRIMITIVE_TYPE;
153
154 typedef struct JOYSTICK_DRIVER_BUTTON
155 {
156 int index;
157 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_BUTTON;
158
159 typedef enum JOYSTICK_DRIVER_HAT_DIRECTION
160 {
161 JOYSTICK_DRIVER_HAT_UNKNOWN,
162 JOYSTICK_DRIVER_HAT_LEFT,
163 JOYSTICK_DRIVER_HAT_RIGHT,
164 JOYSTICK_DRIVER_HAT_UP,
165 JOYSTICK_DRIVER_HAT_DOWN,
166 } JOYSTICK_DRIVER_HAT_DIRECTION;
167
168 typedef struct JOYSTICK_DRIVER_HAT
169 {
170 int index;
171 JOYSTICK_DRIVER_HAT_DIRECTION direction;
172 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_HAT;
173
174 typedef enum JOYSTICK_DRIVER_SEMIAXIS_DIRECTION
175 {
176 JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE = -1, /*!< @brief negative half of the axis */
177 JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN = 0, /*!< @brief unknown direction */
178 JOYSTICK_DRIVER_SEMIAXIS_POSITIVE = 1, /*!< @brief positive half of the axis */
179 } JOYSTICK_DRIVER_SEMIAXIS_DIRECTION;
180
181 typedef struct JOYSTICK_DRIVER_SEMIAXIS
182 {
183 int index;
184 int center;
185 JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction;
186 unsigned int range;
187 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS;
188
189 typedef struct JOYSTICK_DRIVER_MOTOR
190 {
191 int index;
192 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR;
193
194 typedef struct JOYSTICK_DRIVER_PRIMITIVE
195 {
196 JOYSTICK_DRIVER_PRIMITIVE_TYPE type;
197 union
198 {
199 struct JOYSTICK_DRIVER_BUTTON button;
200 struct JOYSTICK_DRIVER_HAT hat;
201 struct JOYSTICK_DRIVER_SEMIAXIS semiaxis;
202 struct JOYSTICK_DRIVER_MOTOR motor;
203 };
204 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE;
205
206 typedef enum JOYSTICK_FEATURE_TYPE
207 {
208 JOYSTICK_FEATURE_TYPE_UNKNOWN,
209 JOYSTICK_FEATURE_TYPE_SCALAR,
210 JOYSTICK_FEATURE_TYPE_ANALOG_STICK,
211 JOYSTICK_FEATURE_TYPE_ACCELEROMETER,
212 JOYSTICK_FEATURE_TYPE_MOTOR,
213 } JOYSTICK_FEATURE_TYPE;
214
215 typedef enum JOYSTICK_FEATURE_PRIMITIVE
216 {
217 // Scalar feature
218 JOYSTICK_SCALAR_PRIMITIVE = 0,
219
220 // Analog stick
221 JOYSTICK_ANALOG_STICK_UP = 0,
222 JOYSTICK_ANALOG_STICK_DOWN = 1,
223 JOYSTICK_ANALOG_STICK_RIGHT = 2,
224 JOYSTICK_ANALOG_STICK_LEFT = 3,
225
226 // Accelerometer
227 JOYSTICK_ACCELEROMETER_POSITIVE_X = 0,
228 JOYSTICK_ACCELEROMETER_POSITIVE_Y = 1,
229 JOYSTICK_ACCELEROMETER_POSITIVE_Z = 2,
230
231 // Motor
232 JOYSTICK_MOTOR_PRIMITIVE = 0,
233
234 // Maximum number of primitives
235 JOYSTICK_PRIMITIVE_MAX = 4,
236 } JOYSTICK_FEATURE_PRIMITIVE;
237
238 typedef struct JOYSTICK_FEATURE
239 {
240 char* name;
241 JOYSTICK_FEATURE_TYPE type;
242 struct JOYSTICK_DRIVER_PRIMITIVE primitives[JOYSTICK_PRIMITIVE_MAX];
243 } ATTRIBUTE_PACKED JOYSTICK_FEATURE;
244 ///}
245
246 typedef struct AddonProps_Peripheral
247 {
248 const char* user_path; /*!< @brief path to the user profile */
249 const char* addon_path; /*!< @brief path to this add-on */
250 } ATTRIBUTE_PACKED AddonProps_Peripheral;
251
252 struct AddonInstance_Peripheral;
253
254 typedef struct AddonToKodiFuncTable_Peripheral
255 {
256 KODI_HANDLE kodiInstance;
257 void (*trigger_scan)(void* kodiInstance);
258 void (*refresh_button_maps)(void* kodiInstance, const char* device_name, const char* controller_id);
259 unsigned int (*feature_count)(void* kodiInstance, const char* controller_id, JOYSTICK_FEATURE_TYPE type);
260 } AddonToKodiFuncTable_Peripheral;
261
262 //! @todo Mouse, light gun, multitouch
263
264 typedef struct KodiToAddonFuncTable_Peripheral
265 {
266 kodi::addon::CInstancePeripheral* addonInstance;
267
268 void (__cdecl* get_capabilities)(const AddonInstance_Peripheral* addonInstance, PERIPHERAL_CAPABILITIES* capabilities);
269 PERIPHERAL_ERROR (__cdecl* perform_device_scan)(const AddonInstance_Peripheral* addonInstance, unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results);
270 void (__cdecl* free_scan_results)(const AddonInstance_Peripheral* addonInstance, unsigned int peripheral_count, PERIPHERAL_INFO* scan_results);
271 PERIPHERAL_ERROR (__cdecl* get_events)(const AddonInstance_Peripheral* addonInstance, unsigned int* event_count, PERIPHERAL_EVENT** events);
272 void (__cdecl* free_events)(const AddonInstance_Peripheral* addonInstance, unsigned int event_count, PERIPHERAL_EVENT* events);
273 bool (__cdecl* send_event)(const AddonInstance_Peripheral* addonInstance, const PERIPHERAL_EVENT* event);
274
275 /// @name Joystick operations
276 ///{
277 PERIPHERAL_ERROR (__cdecl* get_joystick_info)(const AddonInstance_Peripheral* addonInstance, unsigned int index, JOYSTICK_INFO* info);
278 void (__cdecl* free_joystick_info)(const AddonInstance_Peripheral* addonInstance, JOYSTICK_INFO* info);
279 PERIPHERAL_ERROR (__cdecl* get_features)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id, unsigned int* feature_count, JOYSTICK_FEATURE** features);
280 void (__cdecl* free_features)(const AddonInstance_Peripheral* addonInstance, unsigned int feature_count, JOYSTICK_FEATURE* features);
281 PERIPHERAL_ERROR (__cdecl* map_features)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id, unsigned int feature_count, const JOYSTICK_FEATURE* features);
282 PERIPHERAL_ERROR (__cdecl* get_ignored_primitives)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, unsigned int* feature_count, JOYSTICK_DRIVER_PRIMITIVE** primitives);
283 void (__cdecl* free_primitives)(const AddonInstance_Peripheral* addonInstance, unsigned int, JOYSTICK_DRIVER_PRIMITIVE* primitives);
284 PERIPHERAL_ERROR (__cdecl* set_ignored_primitives)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, unsigned int primitive_count, const JOYSTICK_DRIVER_PRIMITIVE* primitives);
285 void (__cdecl* save_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick);
286 void (__cdecl* revert_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick);
287 void (__cdecl* reset_button_map)(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id);
288 void (__cdecl* power_off_joystick)(const AddonInstance_Peripheral* addonInstance, unsigned int index);
289 ///}
290 } KodiToAddonFuncTable_Peripheral;
291
292 typedef struct AddonInstance_Peripheral
293 {
294 AddonProps_Peripheral props;
295 AddonToKodiFuncTable_Peripheral toKodi;
296 KodiToAddonFuncTable_Peripheral toAddon;
297 } AddonInstance_Peripheral;
298
299} /* extern "C" */
300
301namespace kodi
302{
303namespace addon
304{
305
306 class CInstancePeripheral : public IAddonInstance
307 {
308 public:
309 CInstancePeripheral()
310 : IAddonInstance(ADDON_INSTANCE_PERIPHERAL)
311 {
312 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
313 throw std::logic_error("kodi::addon::CInstancePeripheral: Creation of more as one in single instance way is not allowed!");
314
315 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance);
316 CAddonBase::m_interface->globalSingleInstance = this;
317 }
318
319 CInstancePeripheral(KODI_HANDLE instance)
320 : IAddonInstance(ADDON_INSTANCE_PERIPHERAL)
321 {
322 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
323 throw std::logic_error("kodi::addon::CInstancePeripheral: Creation of multiple together with single instance way is not allowed!");
324
325 SetAddonStruct(instance);
326 }
327
328 ~CInstancePeripheral() override = default;
329
330 /// @name Peripheral operations
331 ///{
332 /*!
333 * @brief Get the list of features that this add-on provides
334 * @param capabilities The add-on's capabilities.
335 * @remarks Valid implementation required.
336 *
337 * Called by the frontend to query the add-on's capabilities and supported
338 * peripherals. All capabilities that the add-on supports should be set to true.
339 *
340 */
341 virtual void GetCapabilities(PERIPHERAL_CAPABILITIES &capabilities) { }
342
343 /*!
344 * @brief Perform a scan for joysticks
345 * @param peripheral_count Assigned to the number of peripherals allocated
346 * @param scan_results Assigned to allocated memory
347 * @return PERIPHERAL_NO_ERROR if successful; peripherals must be freed using
348 * FreeScanResults() in this case
349 *
350 * The frontend calls this when a hardware change is detected. If an add-on
351 * detects a hardware change, it can trigger this function using the
352 * TriggerScan() callback.
353 */
354 virtual PERIPHERAL_ERROR PerformDeviceScan(unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
355
356 /*!
357 * @brief Free the memory allocated in PerformDeviceScan()
358 *
359 * Must be called if PerformDeviceScan() returns PERIPHERAL_NO_ERROR.
360 *
361 * @param peripheral_count The number of events allocated for the events array
362 * @param scan_results The array of allocated peripherals
363 */
364 virtual void FreeScanResults(unsigned int peripheral_count, PERIPHERAL_INFO* scan_results) { }
365
366 /*!
367 * @brief Get all events that have occurred since the last call to GetEvents()
368 * @return PERIPHERAL_NO_ERROR if successful; events must be freed using
369 * FreeEvents() in this case
370 */
371 virtual PERIPHERAL_ERROR GetEvents(unsigned int* event_count, PERIPHERAL_EVENT** events) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
372
373 /*!
374 * @brief Free the memory allocated in GetEvents()
375 *
376 * Must be called if GetEvents() returns PERIPHERAL_NO_ERROR.
377 *
378 * @param event_count The number of events allocated for the events array
379 * @param events The array of allocated events
380 */
381 virtual void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events) { }
382
383 /*!
384 * @brief Send an input event to the specified peripheral
385 * @param peripheralIndex The index of the device receiving the input event
386 * @param event The input event
387 * @return true if the event was handled, false otherwise
388 */
389 virtual bool SendEvent(const PERIPHERAL_EVENT* event) { return false; }
390 ///}
391
392 /// @name Joystick operations
393 /*!
394 * @note #define PERIPHERAL_ADDON_JOYSTICKS before including kodi_peripheral_dll.h
395 * in the add-on if the add-on provides joysticks and add provides_joysticks="true"
396 * to the kodi.peripheral extension point node in addon.xml.
397 */
398 ///{
399 /*!
400 * @brief Get extended info about an attached joystick
401 * @param index The joystick's driver index
402 * @param info The container for the allocated joystick info
403 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
404 * FreeJoystickInfo() in this case
405 */
406 virtual PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, JOYSTICK_INFO* info) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
407
408 /*!
409 * @brief Free the memory allocated in GetJoystickInfo()
410 */
411 virtual void FreeJoystickInfo(JOYSTICK_INFO* info) { }
412
413 /*!
414 * @brief Get the features that allow translating the joystick into the controller profile
415 * @param joystick The device's joystick properties; unknown values may be left at their default
416 * @param controller_id The controller profile being requested, e.g. game.controller.default
417 * @param feature_count The number of features allocated for the features array
418 * @param features The array of allocated features
419 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
420 * FreeButtonMap() in this case
421 */
422 virtual PERIPHERAL_ERROR GetFeatures(const JOYSTICK_INFO* joystick, const char* controller_id,
423 unsigned int* feature_count, JOYSTICK_FEATURE** features) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
424
425 /*!
426 * @brief Free the memory allocated in GetFeatures()
427 *
428 * Must be called if GetFeatures() returns PERIPHERAL_NO_ERROR.
429 *
430 * @param feature_count The number of features allocated for the features array
431 * @param features The array of allocated features
432 */
433 virtual void FreeFeatures(unsigned int feature_count, JOYSTICK_FEATURE* features) { }
434
435 /*!
436 * @brief Add or update joystick features
437 * @param joystick The device's joystick properties; unknown values may be left at their default
438 * @param controller_id The game controller profile being updated
439 * @param feature_count The number of features in the features array
440 * @param features The array of features
441 * @return PERIPHERAL_NO_ERROR if successful
442 */
443 virtual PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id,
444 unsigned int feature_count, const JOYSTICK_FEATURE* features) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
445
446 /*!
447 * @brief Get the driver primitives that should be ignored while mapping the device
448 * @param joystick The device's joystick properties; unknown values may be left at their default
449 * @param primitive_count The number of features allocated for the primitives array
450 * @param primitives The array of allocated driver primitives to be ignored
451 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
452 * FreePrimitives() in this case
453 */
454 virtual PERIPHERAL_ERROR GetIgnoredPrimitives(const JOYSTICK_INFO* joystick,
455 unsigned int* primitive_count,
456 JOYSTICK_DRIVER_PRIMITIVE** primitives) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
457
458 /*!
459 * @brief Free the memory allocated in GetIgnoredPrimitives()
460 *
461 * Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR.
462 *
463 * @param primitive_count The number of driver primitives allocated for the primitives array
464 * @param primitives The array of allocated driver primitives
465 */
466 virtual void FreePrimitives(unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives) { }
467
468 /*!
469 * @brief Set the list of driver primitives that are ignored for the device
470 * @param joystick The device's joystick properties; unknown values may be left at their default
471 * @param primitive_count The number of driver features in the primitives array
472 * @param primitives The array of driver primitives to ignore
473 * @return PERIPHERAL_NO_ERROR if successful
474 */
475 virtual PERIPHERAL_ERROR SetIgnoredPrimitives(const JOYSTICK_INFO* joystick,
476 unsigned int primitive_count,
477 const JOYSTICK_DRIVER_PRIMITIVE* primitives) { return PERIPHERAL_ERROR_NOT_IMPLEMENTED; }
478
479 /*!
480 * @brief Save the button map for the given joystick
481 * @param joystick The device's joystick properties
482 */
483 virtual void SaveButtonMap(const JOYSTICK_INFO* joystick) { }
484
485 /*!
486 * @brief Revert the button map to the last time it was loaded or committed to disk
487 * @param joystick The device's joystick properties
488 */
489 virtual void RevertButtonMap(const JOYSTICK_INFO* joystick) { }
490
491 /*!
492 * @brief Reset the button map for the given joystick and controller profile ID
493 * @param joystick The device's joystick properties
494 * @param controller_id The game controller profile being reset
495 */
496 virtual void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id) { }
497
498 /*!
499 * @brief Powers off the given joystick if supported
500 * @param index The joystick's driver index
501 */
502 virtual void PowerOffJoystick(unsigned int index) { }
503
504 const std::string AddonPath() const
505 {
506 return m_instanceData->props.addon_path;
507 }
508
509 const std::string UserPath() const
510 {
511 return m_instanceData->props.user_path;
512 }
513
514 /*!
515 * @brief Trigger a scan for peripherals
516 *
517 * The add-on calls this if a change in hardware is detected.
518 */
519 void TriggerScan(void)
520 {
521 return m_instanceData->toKodi.trigger_scan(m_instanceData->toKodi.kodiInstance);
522 }
523
524 /*!
525 * @brief Notify the frontend that button maps have changed
526 *
527 * @param[optional] deviceName The name of the device to refresh, or empty/null for all devices
528 * @param[optional] controllerId The controller ID to refresh, or empty/null for all controllers
529 */
530 void RefreshButtonMaps(const std::string& strDeviceName = "", const std::string& strControllerId = "")
531 {
532 return m_instanceData->toKodi.refresh_button_maps(m_instanceData->toKodi.kodiInstance, strDeviceName.c_str(), strControllerId.c_str());
533 }
534
535 /*!
536 * @brief Return the number of features belonging to the specified controller
537 *
538 * @param controllerId The controller ID to enumerate
539 * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features
540 *
541 * @return The number of features matching the request parameters
542 */
543 unsigned int FeatureCount(const std::string& strControllerId, JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN)
544 {
545 return m_instanceData->toKodi.feature_count(m_instanceData->toKodi.kodiInstance, strControllerId.c_str(), type);
546 }
547
548 private:
549 void SetAddonStruct(KODI_HANDLE instance)
550 {
551 if (instance == nullptr)
552 throw std::logic_error("kodi::addon::CInstancePeripheral: Creation with empty addon structure not allowed, table must be given from Kodi!");
553
554 m_instanceData = static_cast<AddonInstance_Peripheral*>(instance);
555 m_instanceData->toAddon.addonInstance = this;
556
557 m_instanceData->toAddon.get_capabilities = ADDON_GetCapabilities;
558 m_instanceData->toAddon.perform_device_scan = ADDON_PerformDeviceScan;
559 m_instanceData->toAddon.free_scan_results = ADDON_FreeScanResults;
560 m_instanceData->toAddon.get_events = ADDON_GetEvents;
561 m_instanceData->toAddon.free_events = ADDON_FreeEvents;
562 m_instanceData->toAddon.send_event = ADDON_SendEvent;
563
564 m_instanceData->toAddon.get_joystick_info = ADDON_GetJoystickInfo;
565 m_instanceData->toAddon.free_joystick_info = ADDON_FreeJoystickInfo;
566 m_instanceData->toAddon.get_features = ADDON_GetFeatures;
567 m_instanceData->toAddon.free_features = ADDON_FreeFeatures;
568 m_instanceData->toAddon.map_features = ADDON_MapFeatures;
569 m_instanceData->toAddon.get_ignored_primitives = ADDON_GetIgnoredPrimitives;
570 m_instanceData->toAddon.free_primitives = ADDON_FreePrimitives;
571 m_instanceData->toAddon.set_ignored_primitives = ADDON_SetIgnoredPrimitives;
572 m_instanceData->toAddon.save_button_map = ADDON_SaveButtonMap;
573 m_instanceData->toAddon.revert_button_map = ADDON_RevertButtonMap;
574 m_instanceData->toAddon.reset_button_map = ADDON_ResetButtonMap;
575 m_instanceData->toAddon.power_off_joystick = ADDON_PowerOffJoystick;
576 }
577
578 inline static void ADDON_GetCapabilities(const AddonInstance_Peripheral* addonInstance, PERIPHERAL_CAPABILITIES *capabilities)
579 {
580 addonInstance->toAddon.addonInstance->GetCapabilities(*capabilities);
581 }
582
583 inline static PERIPHERAL_ERROR ADDON_PerformDeviceScan(const AddonInstance_Peripheral* addonInstance, unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results)
584 {
585 return addonInstance->toAddon.addonInstance->PerformDeviceScan(peripheral_count, scan_results);
586 }
587
588 inline static void ADDON_FreeScanResults(const AddonInstance_Peripheral* addonInstance, unsigned int peripheral_count, PERIPHERAL_INFO* scan_results)
589 {
590 addonInstance->toAddon.addonInstance->FreeScanResults(peripheral_count, scan_results);
591 }
592
593 inline static PERIPHERAL_ERROR ADDON_GetEvents(const AddonInstance_Peripheral* addonInstance, unsigned int* event_count, PERIPHERAL_EVENT** events)
594 {
595 return addonInstance->toAddon.addonInstance->GetEvents(event_count, events);
596 }
597
598 inline static void ADDON_FreeEvents(const AddonInstance_Peripheral* addonInstance, unsigned int event_count, PERIPHERAL_EVENT* events)
599 {
600 addonInstance->toAddon.addonInstance->FreeEvents(event_count, events);
601 }
602
603 inline static bool ADDON_SendEvent(const AddonInstance_Peripheral* addonInstance, const PERIPHERAL_EVENT* event)
604 {
605 return addonInstance->toAddon.addonInstance->SendEvent(event);
606 }
607
608
609 inline static PERIPHERAL_ERROR ADDON_GetJoystickInfo(const AddonInstance_Peripheral* addonInstance, unsigned int index, JOYSTICK_INFO* info)
610 {
611 return addonInstance->toAddon.addonInstance->GetJoystickInfo(index, info);
612 }
613
614 inline static void ADDON_FreeJoystickInfo(const AddonInstance_Peripheral* addonInstance, JOYSTICK_INFO* info)
615 {
616 addonInstance->toAddon.addonInstance->FreeJoystickInfo(info);
617 }
618
619 inline static PERIPHERAL_ERROR ADDON_GetFeatures(const AddonInstance_Peripheral* addonInstance,
620 const JOYSTICK_INFO* joystick, const char* controller_id,
621 unsigned int* feature_count, JOYSTICK_FEATURE** features)
622 {
623 return addonInstance->toAddon.addonInstance->GetFeatures(joystick, controller_id, feature_count, features);
624 }
625
626 inline static void ADDON_FreeFeatures(const AddonInstance_Peripheral* addonInstance, unsigned int feature_count, JOYSTICK_FEATURE* features)
627 {
628 addonInstance->toAddon.addonInstance->FreeFeatures(feature_count, features);
629 }
630
631 inline static PERIPHERAL_ERROR ADDON_MapFeatures(const AddonInstance_Peripheral* addonInstance,
632 const JOYSTICK_INFO* joystick, const char* controller_id,
633 unsigned int feature_count, const JOYSTICK_FEATURE* features)
634 {
635 return addonInstance->toAddon.addonInstance->MapFeatures(joystick, controller_id, feature_count, features);
636 }
637
638 inline static PERIPHERAL_ERROR ADDON_GetIgnoredPrimitives(const AddonInstance_Peripheral* addonInstance,
639 const JOYSTICK_INFO* joystick, unsigned int* primitive_count,
640 JOYSTICK_DRIVER_PRIMITIVE** primitives)
641 {
642 return addonInstance->toAddon.addonInstance->GetIgnoredPrimitives(joystick, primitive_count, primitives);
643 }
644
645 inline static void ADDON_FreePrimitives(const AddonInstance_Peripheral* addonInstance,
646 unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives)
647 {
648 addonInstance->toAddon.addonInstance->FreePrimitives(primitive_count, primitives);
649 }
650
651 inline static PERIPHERAL_ERROR ADDON_SetIgnoredPrimitives(const AddonInstance_Peripheral* addonInstance,
652 const JOYSTICK_INFO* joystick, unsigned int primitive_count,
653 const JOYSTICK_DRIVER_PRIMITIVE* primitives)
654 {
655 return addonInstance->toAddon.addonInstance->SetIgnoredPrimitives(joystick, primitive_count, primitives);
656 }
657
658 inline static void ADDON_SaveButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick)
659 {
660 addonInstance->toAddon.addonInstance->SaveButtonMap(joystick);
661 }
662
663 inline static void ADDON_RevertButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick)
664 {
665 addonInstance->toAddon.addonInstance->RevertButtonMap(joystick);
666 }
667
668 inline static void ADDON_ResetButtonMap(const AddonInstance_Peripheral* addonInstance, const JOYSTICK_INFO* joystick, const char* controller_id)
669 {
670 addonInstance->toAddon.addonInstance->ResetButtonMap(joystick, controller_id);
671 }
672
673 inline static void ADDON_PowerOffJoystick(const AddonInstance_Peripheral* addonInstance, unsigned int index)
674 {
675 addonInstance->toAddon.addonInstance->PowerOffJoystick(index);
676 }
677
678 AddonInstance_Peripheral* m_instanceData;
679 };
680
681} /* namespace addon */
682} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h
index 2106d19..8cfa91b 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_utils.hpp
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/PeripheralUtils.h
@@ -19,7 +19,7 @@
19 */ 19 */
20#pragma once 20#pragma once
21 21
22#include "kodi_peripheral_types.h" 22#include "Peripheral.h"
23 23
24#include <array> // Requires c++11 24#include <array> // Requires c++11
25#include <cstring> 25#include <cstring>
@@ -30,7 +30,9 @@
30#define PERIPHERAL_SAFE_DELETE(x) do { delete (x); (x) = NULL; } while (0) 30#define PERIPHERAL_SAFE_DELETE(x) do { delete (x); (x) = NULL; } while (0)
31#define PERIPHERAL_SAFE_DELETE_ARRAY(x) do { delete[] (x); (x) = NULL; } while (0) 31#define PERIPHERAL_SAFE_DELETE_ARRAY(x) do { delete[] (x); (x) = NULL; } while (0)
32 32
33namespace ADDON 33namespace kodi
34{
35namespace addon
34{ 36{
35 /*! 37 /*!
36 * Utility class to manipulate arrays of peripheral types. 38 * Utility class to manipulate arrays of peripheral types.
@@ -111,7 +113,7 @@ namespace ADDON
111 { 113 {
112 } 114 }
113 115
114 virtual ~Peripheral(void) { } 116 virtual ~Peripheral(void) = default;
115 117
116 PERIPHERAL_TYPE Type(void) const { return m_type; } 118 PERIPHERAL_TYPE Type(void) const { return m_type; }
117 const std::string& Name(void) const { return m_strName; } 119 const std::string& Name(void) const { return m_strName; }
@@ -232,7 +234,7 @@ namespace ADDON
232 typedef PeripheralVector<PeripheralEvent, PERIPHERAL_EVENT> PeripheralEvents; 234 typedef PeripheralVector<PeripheralEvent, PERIPHERAL_EVENT> PeripheralEvents;
233 235
234 /*! 236 /*!
235 * ADDON::Joystick 237 * kodi::addon::Joystick
236 * 238 *
237 * Wrapper class providing additional joystick information not provided by 239 * Wrapper class providing additional joystick information not provided by
238 * ADDON::Peripheral. 240 * ADDON::Peripheral.
@@ -269,7 +271,7 @@ namespace ADDON
269 { 271 {
270 } 272 }
271 273
272 virtual ~Joystick(void) { } 274 ~Joystick(void) override = default;
273 275
274 Joystick& operator=(const Joystick& rhs) 276 Joystick& operator=(const Joystick& rhs)
275 { 277 {
@@ -570,7 +572,7 @@ namespace ADDON
570 typedef PeripheralVector<DriverPrimitive, JOYSTICK_DRIVER_PRIMITIVE> DriverPrimitives; 572 typedef PeripheralVector<DriverPrimitive, JOYSTICK_DRIVER_PRIMITIVE> DriverPrimitives;
571 573
572 /*! 574 /*!
573 * ADDON::JoystickFeature 575 * kodi::addon::JoystickFeature
574 * 576 *
575 * Class for joystick features. A feature can be: 577 * Class for joystick features. A feature can be:
576 * 578 *
@@ -660,4 +662,7 @@ namespace ADDON
660 }; 662 };
661 663
662 typedef PeripheralVector<JoystickFeature, JOYSTICK_FEATURE> JoystickFeatures; 664 typedef PeripheralVector<JoystickFeature, JOYSTICK_FEATURE> JoystickFeatures;
663} 665
666} /* namespace addon */
667} /* namespace kodi */
668
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h
index 39baae7..85cd7bc 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Screensaver.h
@@ -28,6 +28,11 @@ extern "C"
28 28
29struct AddonInstance_Screensaver; 29struct AddonInstance_Screensaver;
30 30
31/*!
32 * @brief Screensaver properties
33 *
34 * Not to be used outside this header.
35 */
31typedef struct AddonProps_Screensaver 36typedef struct AddonProps_Screensaver
32{ 37{
33 void *device; 38 void *device;
@@ -41,11 +46,21 @@ typedef struct AddonProps_Screensaver
41 const char *profile; 46 const char *profile;
42} AddonProps_Screensaver; 47} AddonProps_Screensaver;
43 48
49/*!
50 * @brief Screensaver callbacks
51 *
52 * Not to be used outside this header.
53 */
44typedef struct AddonToKodiFuncTable_Screensaver 54typedef struct AddonToKodiFuncTable_Screensaver
45{ 55{
46 KODI_HANDLE kodiInstance; 56 KODI_HANDLE kodiInstance;
47} AddonToKodiFuncTable_Screensaver; 57} AddonToKodiFuncTable_Screensaver;
48 58
59/*!
60 * @brief Screensaver function hooks
61 *
62 * Not to be used outside this header.
63 */
49typedef struct KodiToAddonFuncTable_Screensaver 64typedef struct KodiToAddonFuncTable_Screensaver
50{ 65{
51 kodi::addon::CInstanceScreensaver* addonInstance; 66 kodi::addon::CInstanceScreensaver* addonInstance;
@@ -54,6 +69,11 @@ typedef struct KodiToAddonFuncTable_Screensaver
54 void (__cdecl* Render) (AddonInstance_Screensaver* instance); 69 void (__cdecl* Render) (AddonInstance_Screensaver* instance);
55} KodiToAddonFuncTable_Screensaver; 70} KodiToAddonFuncTable_Screensaver;
56 71
72/*!
73 * @brief Screensaver instance
74 *
75 * Not to be used outside this header.
76 */
57typedef struct AddonInstance_Screensaver 77typedef struct AddonInstance_Screensaver
58{ 78{
59 AddonProps_Screensaver props; 79 AddonProps_Screensaver props;
@@ -68,9 +88,157 @@ namespace kodi
68namespace addon 88namespace addon
69{ 89{
70 90
91 //============================================================================
92 ///
93 /// \addtogroup cpp_kodi_addon_screensaver
94 /// @brief \cpp_class{ kodi::addon::CInstanceScreensaver }
95 /// **Screensaver add-on instance**
96 ///
97 /// A screensaver is a Kodi addon that fills the screen with moving images or
98 /// patterns when the computer is not in use. Initially designed to prevent
99 /// phosphor burn-in on CRT and plasma computer monitors (hence the name),
100 /// screensavers are now used primarily for entertainment, security or to
101 /// display system status information.
102 ///
103 /// Include the header \ref ScreenSaver.h "#include <kodi/addon-instance/ScreenSaver.h>"
104 /// to use this class.
105 ///
106 /// This interface allows the creating of screensavers for Kodi, based upon
107 /// **DirectX** or/and **OpenGL** rendering with `C++` code.
108 ///
109 /// The interface is small and easy usable. It has three functions:
110 ///
111 /// * <b><c>Start()</c></b> - Called on creation
112 /// * <b><c>Render()</c></b> - Called at render time
113 /// * <b><c>Stop()</c></b> - Called when the screensaver has no work
114 ///
115 /// Additionally, there are several \ref cpp_kodi_addon_screensaver_CB "other functions"
116 /// available in which the child class can ask about the current hardware,
117 /// including the device, display and several other parts.
118 ///
119 ///
120 /// --------------------------------------------------------------------------
121 ///
122 ///
123 /// **Here is an example of the minimum required code to start a screensaver:**
124 /// ~~~~~~~~~~~~~{.cpp}
125 /// #include <kodi/addon-instance/Screensaver.h>
126 ///
127 /// class CMyScreenSaver : public kodi::addon::CAddonBase,
128 /// public kodi::addon::CInstanceScreensaver
129 /// {
130 /// public:
131 /// CMyScreenSaver();
132 ///
133 /// bool Start() override;
134 /// void Render() override;
135 /// };
136 ///
137 /// CMyScreenSaver::CMyScreenSaver()
138 /// {
139 /// ...
140 /// }
141 ///
142 /// bool CMyScreenSaver::Start()
143 /// {
144 /// ...
145 /// return true;
146 /// }
147 ///
148 /// void CMyScreenSaver::Render()
149 /// {
150 /// ...
151 /// }
152 ///
153 /// ADDONCREATOR(CMyScreenSaver)
154 /// ~~~~~~~~~~~~~
155 ///
156 ///
157 /// --------------------------------------------------------------------------
158 ///
159 ///
160 /// **Here is another example where the screensaver is used together with
161 /// other instance types:**
162 ///
163 /// ~~~~~~~~~~~~~{.cpp}
164 /// #include <kodi/addon-instance/Screensaver.h>
165 ///
166 /// class CMyScreenSaver : public ::kodi::addon::CInstanceScreensaver
167 /// {
168 /// public:
169 /// CMyScreenSaver(KODI_HANDLE instance);
170 ///
171 /// bool Start() override;
172 /// void Render() override;
173 /// };
174 ///
175 /// CMyScreenSaver::CMyScreenSaver(KODI_HANDLE instance)
176 /// : CInstanceScreensaver(instance)
177 /// {
178 /// ...
179 /// }
180 ///
181 /// bool CMyScreenSaver::Start()
182 /// {
183 /// ...
184 /// return true;
185 /// }
186 ///
187 /// void CMyScreenSaver::Render()
188 /// {
189 /// ...
190 /// }
191 ///
192 ///
193 /// /*----------------------------------------------------------------------*/
194 ///
195 /// class CMyAddon : public ::kodi::addon::CAddonBase
196 /// {
197 /// public:
198 /// CMyAddon() { }
199 /// ADDON_STATUS CreateInstance(int instanceType,
200 /// std::string instanceID,
201 /// KODI_HANDLE instance,
202 /// KODI_HANDLE& addonInstance) override;
203 /// };
204 ///
205 /// /* If you use only one instance in your add-on, can be instanceType and
206 /// * instanceID ignored */
207 /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
208 /// std::string instanceID,
209 /// KODI_HANDLE instance,
210 /// KODI_HANDLE& addonInstance)
211 /// {
212 /// if (instanceType == ADDON_INSTANCE_SCREENSAVER)
213 /// {
214 /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Screensaver");
215 /// addonInstance = new CMyScreenSaver(instance);
216 /// return ADDON_STATUS_OK;
217 /// }
218 /// else if (...)
219 /// {
220 /// ...
221 /// }
222 /// return ADDON_STATUS_UNKNOWN;
223 /// }
224 ///
225 /// ADDONCREATOR(CMyAddon)
226 /// ~~~~~~~~~~~~~
227 ///
228 /// The destruction of the example class `CMyScreenSaver` is called from
229 /// Kodi's header. Manually deleting the add-on instance is not required.
230 ///
231 //----------------------------------------------------------------------------
71 class CInstanceScreensaver : public IAddonInstance 232 class CInstanceScreensaver : public IAddonInstance
72 { 233 {
73 public: 234 public:
235 //==========================================================================
236 ///
237 /// @ingroup cpp_kodi_addon_screensaver
238 /// @brief Screensaver class constructor
239 ///
240 /// Used by an add-on that only supports screensavers.
241 ///
74 CInstanceScreensaver() 242 CInstanceScreensaver()
75 : IAddonInstance(ADDON_INSTANCE_SCREENSAVER) 243 : IAddonInstance(ADDON_INSTANCE_SCREENSAVER)
76 { 244 {
@@ -80,7 +248,19 @@ namespace addon
80 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance); 248 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance);
81 CAddonBase::m_interface->globalSingleInstance = this; 249 CAddonBase::m_interface->globalSingleInstance = this;
82 } 250 }
251 //--------------------------------------------------------------------------
83 252
253 //==========================================================================
254 ///
255 /// @ingroup cpp_kodi_addon_screensaver
256 /// @brief Screensaver class constructor used to support multiple instance
257 /// types
258 ///
259 /// @param[in] instance The instance value given to
260 /// <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>.
261 ///
262 /// @warning Only use `instance` from the CreateInstance call
263 ///
84 CInstanceScreensaver(KODI_HANDLE instance) 264 CInstanceScreensaver(KODI_HANDLE instance)
85 : IAddonInstance(ADDON_INSTANCE_SCREENSAVER) 265 : IAddonInstance(ADDON_INSTANCE_SCREENSAVER)
86 { 266 {
@@ -89,22 +269,150 @@ namespace addon
89 269
90 SetAddonStruct(instance); 270 SetAddonStruct(instance);
91 } 271 }
272 //--------------------------------------------------------------------------
92 273
93 virtual ~CInstanceScreensaver() { } 274 //==========================================================================
275 ///
276 /// @ingroup cpp_kodi_addon_screensaver
277 /// @brief Destructor
278 ///
279 ~CInstanceScreensaver() override = default;
280 //--------------------------------------------------------------------------
94 281
282 //==========================================================================
283 ///
284 /// @ingroup cpp_kodi_addon_screensaver
285 /// @brief Used to notify the screensaver that it has been started
286 ///
287 /// @return true if the screensaver was started
288 /// successfully, false otherwise
289 ///
95 virtual bool Start() { return true; } 290 virtual bool Start() { return true; }
291 //--------------------------------------------------------------------------
292
293 //==========================================================================
294 ///
295 /// @ingroup cpp_kodi_addon_screensaver
296 /// @brief Used to inform the screensaver that the rendering control was
297 /// stopped
298 ///
96 virtual void Stop() {} 299 virtual void Stop() {}
300 //--------------------------------------------------------------------------
301
302 //==========================================================================
303 ///
304 /// @ingroup cpp_kodi_addon_screensaver
305 /// @brief Used to indicate when the add-on should render
306 ///
97 virtual void Render() {} 307 virtual void Render() {}
308 //--------------------------------------------------------------------------
98 309
310 //==========================================================================
311 ///
312 /// \defgroup cpp_kodi_addon_screensaver_CB Information functions
313 /// \ingroup cpp_kodi_addon_screensaver
314 /// @brief **To get info about the device, display and several other parts**
315 ///
316 //@{
317
318 //==========================================================================
319 ///
320 /// @ingroup cpp_kodi_addon_screensaver_CB
321 /// @brief Device that represents the display adapter
322 ///
323 /// @return A pointer to the device
324 ///
325 /// @note This is only available on **DirectX**, It us unused (`nullptr`) on
326 /// **OpenGL**
327 ///
99 inline void* Device() { return m_instanceData->props.device; } 328 inline void* Device() { return m_instanceData->props.device; }
329 //--------------------------------------------------------------------------
330
331 //==========================================================================
332 ///
333 /// @ingroup cpp_kodi_addon_screensaver_CB
334 /// @brief Returns the X position of the rendering window
335 ///
336 /// @return The X position, in pixels
337 ///
100 inline int X() { return m_instanceData->props.x; } 338 inline int X() { return m_instanceData->props.x; }
339 //--------------------------------------------------------------------------
340
341 //==========================================================================
342 ///
343 /// @ingroup cpp_kodi_addon_screensaver_CB
344 /// @brief Returns the Y position of the rendering window
345 ///
346 /// @return The Y position, in pixels
347 ///
101 inline int Y() { return m_instanceData->props.y; } 348 inline int Y() { return m_instanceData->props.y; }
349 //--------------------------------------------------------------------------
350
351 //==========================================================================
352 ///
353 /// @ingroup cpp_kodi_addon_screensaver_CB
354 /// @brief Returns the width of the rendering window
355 ///
356 /// @return The width, in pixels
357 ///
102 inline int Width() { return m_instanceData->props.width; } 358 inline int Width() { return m_instanceData->props.width; }
359 //--------------------------------------------------------------------------
360
361 //==========================================================================
362 ///
363 /// @ingroup cpp_kodi_addon_screensaver_CB
364 /// @brief Returns the height of the rendering window
365 ///
366 /// @return The height, in pixels
367 ///
103 inline int Height() { return m_instanceData->props.height; } 368 inline int Height() { return m_instanceData->props.height; }
369 //--------------------------------------------------------------------------
370
371 //==========================================================================
372 ///
373 /// @ingroup cpp_kodi_addon_screensaver_CB
374 /// @brief Pixel aspect ratio (often abbreviated PAR) is a ratio that
375 /// describes how the width of a pixel compares to the height of that pixel.
376 ///
377 /// @return The pixel aspect ratio used by the display
378 ///
104 inline float PixelRatio() { return m_instanceData->props.pixelRatio; } 379 inline float PixelRatio() { return m_instanceData->props.pixelRatio; }
380 //--------------------------------------------------------------------------
381
382 //==========================================================================
383 ///
384 /// @ingroup cpp_kodi_addon_screensaver_CB
385 /// @brief Used to get the name of the add-on defined in `addon.xml`
386 ///
387 /// @return The add-on name
388 ///
105 inline std::string Name() { return m_instanceData->props.name; } 389 inline std::string Name() { return m_instanceData->props.name; }
390 //--------------------------------------------------------------------------
391
392 //==========================================================================
393 ///
394 /// @ingroup cpp_kodi_addon_screensaver_CB
395 /// @brief Used to get the full path where the add-on is installed
396 ///
397 /// @return The add-on installation path
398 ///
106 inline std::string Presets() { return m_instanceData->props.presets; } 399 inline std::string Presets() { return m_instanceData->props.presets; }
400 //--------------------------------------------------------------------------
401
402 //==========================================================================
403 ///
404 /// @ingroup cpp_kodi_addon_screensaver_CB
405 /// @brief Used to get the full path to the add-on's user profile
406 ///
407 /// @note The trailing folder (consisting of the add-on's ID) is not created
408 /// by default. If it is needed, you must call kodi::vfs::CreateDirectory()
409 /// to create the folder.
410 ///
411 /// @return Path to the user profile
412 ///
107 inline std::string Profile() { return m_instanceData->props.profile; } 413 inline std::string Profile() { return m_instanceData->props.profile; }
414 //--------------------------------------------------------------------------
415 //@}
108 416
109 private: 417 private:
110 void SetAddonStruct(KODI_HANDLE instance) 418 void SetAddonStruct(KODI_HANDLE instance)
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h
new file mode 100644
index 0000000..4bb3e69
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VFS.h
@@ -0,0 +1,622 @@
1#pragma once
2/*
3 * Copyright (C) 2015 Team Kodi
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Kodi; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#include "../AddonBase.h"
22#include "../Filesystem.h"
23
24#ifdef BUILD_KODI_ADDON
25#include "../IFileTypes.h"
26#else
27#include "filesystem/IFileTypes.h"
28#include "PlatformDefs.h"
29#endif
30
31namespace kodi { namespace addon { class CInstanceVFS; }}
32
33extern "C"
34{
35
36 struct VFSURL
37 {
38 const char* url;
39 const char* domain;
40 const char* hostname;
41 const char* filename;
42 unsigned int port;
43 const char* options;
44 const char* username;
45 const char* password;
46 const char* redacted;
47 const char* sharename;
48 };
49
50 typedef struct VFSGetDirectoryCallbacks /* internal */
51 {
52 bool (__cdecl* get_keyboard_input)(void* ctx, const char* heading, char** input, bool hidden_input);
53 void (__cdecl* set_error_dialog)(void* ctx, const char* heading, const char* line1, const char* line2, const char* line3);
54 void (__cdecl* require_authentication)(void* ctx, const char* url);
55 void* ctx;
56 } VFSGetDirectoryCallbacks;
57
58 typedef struct AddonProps_VFSEntry /* internal */
59 {
60 int dummy;
61 } AddonProps_VFSEntry;
62
63 typedef struct AddonToKodiFuncTable_VFSEntry /* internal */
64 {
65 KODI_HANDLE kodiInstance;
66 } AddonToKodiFuncTable_VFSEntry;
67
68 struct AddonInstance_VFSEntry;
69 typedef struct KodiToAddonFuncTable_VFSEntry /* internal */
70 {
71 kodi::addon::CInstanceVFS* addonInstance;
72
73 void* (__cdecl* open) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
74 void* (__cdecl* open_for_write) (const AddonInstance_VFSEntry* instance, const VFSURL* url, bool overwrite);
75 ssize_t (__cdecl* read) (const AddonInstance_VFSEntry* instance, void* context, void* buffer, size_t buf_size);
76 ssize_t (__cdecl* write) (const AddonInstance_VFSEntry* instance, void* context, const void* buffer, size_t buf_size);
77 int64_t (__cdecl* seek) (const AddonInstance_VFSEntry* instance, void* context, int64_t position, int whence);
78 int (__cdecl* truncate) (const AddonInstance_VFSEntry* instance, void* context, int64_t size);
79 int64_t (__cdecl* get_length) (const AddonInstance_VFSEntry* instance, void* context);
80 int64_t (__cdecl* get_position) (const AddonInstance_VFSEntry* instance, void* context);
81 int (__cdecl* get_chunk_size) (const AddonInstance_VFSEntry* instance, void* context);
82 int (__cdecl* io_control) (const AddonInstance_VFSEntry* instance, void* context, XFILE::EIoControl request, void* param);
83 int (__cdecl* stat) (const AddonInstance_VFSEntry* instance, const VFSURL* url, struct __stat64* buffer);
84 bool (__cdecl* close) (const AddonInstance_VFSEntry* instance, void* context);
85 bool (__cdecl* exists) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
86 void (__cdecl* clear_out_idle) (const AddonInstance_VFSEntry* instance);
87 void (__cdecl* disconnect_all) (const AddonInstance_VFSEntry* instance);
88 bool (__cdecl* delete_it) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
89 bool (__cdecl* rename) (const AddonInstance_VFSEntry* instance, const VFSURL* url, const VFSURL* url2);
90 bool (__cdecl* directory_exists) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
91 bool (__cdecl* remove_directory) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
92 bool (__cdecl* create_directory) (const AddonInstance_VFSEntry* instance, const VFSURL* url);
93 bool (__cdecl* get_directory) (const AddonInstance_VFSEntry* instance,
94 const VFSURL* url,
95 VFSDirEntry** entries,
96 int* num_entries,
97 VFSGetDirectoryCallbacks* callbacks);
98 bool (__cdecl* contains_files) (const AddonInstance_VFSEntry* instance,
99 const VFSURL* url,
100 VFSDirEntry** entries,
101 int* num_entries,
102 char* rootpath);
103 void (__cdecl* free_directory) (const AddonInstance_VFSEntry* instance, VFSDirEntry* entries, int num_entries);
104 } KodiToAddonFuncTable_VFSEntry;
105
106 typedef struct AddonInstance_VFSEntry /* internal */
107 {
108 AddonProps_VFSEntry props;
109 AddonToKodiFuncTable_VFSEntry toKodi;
110 KodiToAddonFuncTable_VFSEntry toAddon;
111 } AddonInstance_VFSEntry;
112
113} /* extern "C" */
114
115namespace kodi
116{
117namespace addon
118{
119 class CInstanceVFS : public IAddonInstance
120 {
121 public:
122 CInstanceVFS(KODI_HANDLE instance)
123 : IAddonInstance(ADDON_INSTANCE_VFS)
124 {
125 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
126 throw std::logic_error("kodi::addon::CInstanceVFS: Creation of multiple together with single instance way is not allowed!");
127
128 SetAddonStruct(instance);
129 }
130
131 ~CInstanceVFS() override = default;
132
133 /// @brief Open a file for input
134 ///
135 /// @param[in] url The URL of the file
136 /// @return Context for the opened file
137 virtual void* Open(const VFSURL& url) { return nullptr; }
138
139 /// @brief Open a file for output
140 ///
141 /// @param[in] url The URL of the file
142 /// @param[in] overWrite Whether or not to overwrite an existing file
143 /// @return Context for the opened file
144 ///
145 virtual void* OpenForWrite(const VFSURL& url, bool overWrite) { return nullptr; }
146
147 /// @brief Read from a file
148 ///
149 /// @param[in] context The context of the file
150 /// @param[out] buffer The buffer to read data into
151 /// @param[in] uiBufSize Number of bytes to read
152 /// @return Number of bytes read
153 ///
154 virtual ssize_t Read(void* context, void* buffer, size_t uiBufSize) { return -1; }
155
156 /// @brief Write to a file
157 ///
158 /// @param[in] context The context of the file
159 /// @param[in] buffer The buffer to read data from
160 /// @param[in] uiBufSize Number of bytes to write
161 /// @return Number of bytes written
162 ///
163 virtual ssize_t Write(void* context, const void* buffer, size_t uiBufSize) { return -1; }
164
165 /// @brief Seek in a file
166 ///
167 /// @param[in] context The context of the file
168 /// @param[in] position The position to seek to
169 /// @param[in] whence Position in file 'position' is relative to (SEEK_CUR, SEEK_SET, SEEK_END)
170 /// @return Offset in file after seek
171 ///
172 virtual int64_t Seek(void* context, int64_t position, int whence) { return -1; }
173
174 /// @brief Truncate a file
175 ///
176 /// @param[in] context The context of the file
177 /// @param[in] size The size to truncate the file to
178 /// @return 0 on success, -1 on error
179 ///
180 virtual int Truncate(void* context, int64_t size) { return -1; }
181
182 /// @brief Get total size of a file
183 ///
184 /// @param[in] context The context of the file
185 /// @return Total file size
186 ///
187 virtual int64_t GetLength(void* context) { return 0; }
188
189 /// @brief Get current position in a file
190 ///
191 /// @param[in] context The context of the file
192 /// @return Current position
193 ///
194 virtual int64_t GetPosition(void* context) { return 0; }
195
196 /// @brief Get chunk size of a file
197 ///
198 /// @param[in] context The context of the file
199 /// @return Chunk size
200 ///
201 virtual int GetChunkSize(void* context) { return 1; }
202
203 /// @brief Perform an IO-control on the file
204 ///
205 /// @param[in] context The context of the file
206 /// @param[in] request The requested IO-control
207 /// @param[in] param Parameter attached to the IO-control
208 /// @return -1 on error, >= 0 on success
209 ///
210 virtual int IoControl(void* context, XFILE::EIoControl request, void* param) { return -1; }
211
212 /// @brief Close a file
213 ///
214 /// @param[in] context The context of the file
215 /// @return True on success, false on failure
216 ///
217 virtual bool Close(void* context) { return false; }
218
219 /// @brief Stat a file
220 ///
221 /// @param[in] url The URL of the file
222 /// @param[in] buffer The buffer to store results in
223 /// @return -1 on error, 0 otherwise
224 ///
225 virtual int Stat(const VFSURL& url, struct __stat64* buffer) { return 0; }
226
227 /// @brief Check for file existence
228 ///
229 /// @param[in] url The URL of the file
230 /// @return True if file exists, false otherwise
231 ///
232 virtual bool Exists(const VFSURL& url) { return false; }
233
234 /// @brief Clear out any idle connections
235 ///
236 virtual void ClearOutIdle() { }
237
238 /// @brief Disconnect all connections
239 ///
240 virtual void DisconnectAll() { }
241
242 /// @brief Delete a file
243 ///
244 /// @param[in] url The URL of the file
245 /// @return True if deletion was successful, false otherwise
246 ///
247 virtual bool Delete(const VFSURL& url) { return false; }
248
249 /// @brief Rename a file
250 ///
251 /// @param[in] url The URL of the source file
252 /// @param[in] url2 The URL of the destination file
253 /// @return True if deletion was successful, false otherwise
254 ///
255 virtual bool Rename(const VFSURL& url, const VFSURL& url2) { return false; }
256
257 /// @brief Check for directory existence
258 ///
259 /// @param[in] url The URL of the file
260 /// @return True if directory exists, false otherwise
261 ///
262 virtual bool DirectoryExists(const VFSURL& url) { return false; }
263
264 /// @brief Remove a directory
265 ///
266 /// @param[in] url The URL of the directory
267 /// @return True if removal was successful, false otherwise
268 ///
269 virtual bool RemoveDirectory(const VFSURL& url) { return false; }
270
271 /// @brief Create a directory
272 ///
273 /// @param[in] url The URL of the file
274 /// @return True if creation was successful, false otherwise
275 ///
276 virtual bool CreateDirectory(const VFSURL& url) { return false; }
277
278 /// @brief Callback functions on GetDirectory()
279 ///
280 /// This functions becomes available during call of GetDirectory() from
281 /// Kodi.
282 ///
283 /// If GetDirectory() returns false becomes the parts from here used on
284 /// next call of the function.
285 ///
286 /// **Example:**
287 /// ~~~~~~~~~~~~~{.cpp}
288 ///
289 /// #include <kodi/addon-instance/VFS.h>
290 ///
291 /// ...
292 ///
293 /// bool CMyFile::GetDirectory(const VFSURL& url, std::vector<kodi::vfs::CDirEntry>& items, CVFSCallbacks callbacks)
294 /// {
295 /// std::string neededString;
296 /// callbacks.GetKeyboardInput("Test", neededString, true);
297 /// if (neededString.empty())
298 /// return false;
299 ///
300 /// /* Do the work */
301 /// ...
302 /// return true;
303 /// }
304 /// ~~~~~~~~~~~~~
305 ///
306 //@{
307 class CVFSCallbacks
308 {
309 public:
310 /// @brief Require keyboard input
311 ///
312 /// Becomes called if GetDirectory() returns false and GetDirectory()
313 /// becomes after entry called again.
314 ///
315 /// @param[in] heading The heading of the keyboard dialog
316 /// @param[out] input The resulting string. Returns string after
317 /// second call!
318 /// @param[in] hiddenInput To show input only as "*" on dialog
319 /// @return True if input was received, false otherwise
320 ///
321 bool GetKeyboardInput(const std::string& heading, std::string& input, bool hiddenInput = false)
322 {
323 char* cInput = nullptr;
324 bool ret = m_cb->get_keyboard_input(m_cb->ctx, heading.c_str(), &cInput, hiddenInput);
325 if (cInput)
326 {
327 input = cInput;
328 ::kodi::addon::CAddonBase::m_interface->toKodi->free_string(::kodi::addon::CAddonBase::m_interface->toKodi->kodiBase, cInput);
329 }
330 return ret;
331 }
332
333 /// @brief Display an error dialog
334 ///
335 /// @param[in] heading The heading of the error dialog
336 /// @param[in] line1 The first line of the error dialog
337 /// @param[in] line2 [opt] The second line of the error dialog
338 /// @param[in] line3 [opt] The third line of the error dialog
339 ///
340 void SetErrorDialog(const std::string& heading, const std::string& line1, const std::string& line2 = "", const std::string& line3 = "")
341 {
342 m_cb->set_error_dialog(m_cb->ctx, heading.c_str(), line1.c_str(), line2.c_str(), line3.c_str());
343 }
344
345 /// @brief Prompt the user for authentication of a URL
346 ///
347 /// @param[in] url The URL
348 void RequireAuthentication(const std::string& url)
349 {
350 m_cb->require_authentication(m_cb->ctx, url.c_str());
351 }
352
353 CVFSCallbacks(const VFSGetDirectoryCallbacks* cb) : m_cb(cb) { }
354
355 private:
356 const VFSGetDirectoryCallbacks* m_cb;
357 };
358 //@}
359
360 /// @brief List a directory
361 ///
362 /// @param[in] url The URL of the directory
363 /// @param[out] entries The entries in the directory
364 /// @param[in] callbacks A callback structure
365 /// @return Context for the directory listing
366 ///
367 virtual bool GetDirectory(const VFSURL& url,
368 std::vector<kodi::vfs::CDirEntry>& entries,
369 CVFSCallbacks callbacks) { return false; }
370
371 /// @brief Check if file should be presented as a directory (multiple streams)
372 ///
373 /// @param[in] url The URL of the file
374 /// @param[out] entries The entries in the directory
375 /// @param[out] rootPath Path to root directory if multiple entries
376 /// @return Context for the directory listing
377 ///
378 virtual bool ContainsFiles(const VFSURL& url,
379 std::vector<kodi::vfs::CDirEntry>& entries,
380 std::string& rootPath) { return false; }
381
382 private:
383 void SetAddonStruct(KODI_HANDLE instance)
384 {
385 if (instance == nullptr)
386 throw std::logic_error("kodi::addon::CInstanceVFS: Creation with empty addon structure not allowed, table must be given from Kodi!");
387
388 m_instanceData = static_cast<AddonInstance_VFSEntry*>(instance);
389 m_instanceData->toAddon.addonInstance = this;
390 m_instanceData->toAddon.open = ADDON_Open;
391 m_instanceData->toAddon.open_for_write = ADDON_OpenForWrite;
392 m_instanceData->toAddon.read = ADDON_Read;
393 m_instanceData->toAddon.write = ADDON_Write;
394 m_instanceData->toAddon.seek = ADDON_Seek;
395 m_instanceData->toAddon.truncate = ADDON_Truncate;
396 m_instanceData->toAddon.get_length = ADDON_GetLength;
397 m_instanceData->toAddon.get_position = ADDON_GetPosition;
398 m_instanceData->toAddon.get_chunk_size = ADDON_GetChunkSize;
399 m_instanceData->toAddon.io_control = ADDON_IoControl;
400 m_instanceData->toAddon.stat = ADDON_Stat;
401 m_instanceData->toAddon.close = ADDON_Close;
402 m_instanceData->toAddon.exists = ADDON_Exists;
403 m_instanceData->toAddon.clear_out_idle = ADDON_ClearOutIdle;
404 m_instanceData->toAddon.disconnect_all = ADDON_DisconnectAll;
405 m_instanceData->toAddon.delete_it = ADDON_Delete;
406 m_instanceData->toAddon.rename = ADDON_Rename;
407 m_instanceData->toAddon.directory_exists = ADDON_DirectoryExists;
408 m_instanceData->toAddon.remove_directory = ADDON_RemoveDirectory;
409 m_instanceData->toAddon.create_directory = ADDON_CreateDirectory;
410 m_instanceData->toAddon.get_directory = ADDON_GetDirectory;
411 m_instanceData->toAddon.free_directory = ADDON_FreeDirectory;
412 m_instanceData->toAddon.contains_files = ADDON_ContainsFiles;
413 }
414
415 inline static void* ADDON_Open(const AddonInstance_VFSEntry* instance, const VFSURL* url)
416 {
417 return instance->toAddon.addonInstance->Open(*url);
418 }
419
420 inline static void* ADDON_OpenForWrite(const AddonInstance_VFSEntry* instance, const VFSURL* url, bool overWrite)
421 {
422 return instance->toAddon.addonInstance->OpenForWrite(*url, overWrite);
423 }
424
425 inline static ssize_t ADDON_Read(const AddonInstance_VFSEntry* instance, void* context, void* buffer, size_t uiBufSize)
426 {
427 return instance->toAddon.addonInstance->Read(context, buffer, uiBufSize);
428 }
429
430 inline static ssize_t ADDON_Write(const AddonInstance_VFSEntry* instance, void* context, const void* buffer, size_t uiBufSize)
431 {
432 return instance->toAddon.addonInstance->Write(context, buffer, uiBufSize);
433 }
434
435 inline static int64_t ADDON_Seek(const AddonInstance_VFSEntry* instance, void* context, int64_t position, int whence)
436 {
437 return instance->toAddon.addonInstance->Seek(context, position, whence);
438 }
439
440 inline static int ADDON_Truncate(const AddonInstance_VFSEntry* instance, void* context, int64_t size)
441 {
442 return instance->toAddon.addonInstance->Truncate(context, size);
443 }
444
445 inline static int64_t ADDON_GetLength(const AddonInstance_VFSEntry* instance, void* context)
446 {
447 return instance->toAddon.addonInstance->GetLength(context);
448 }
449
450 inline static int64_t ADDON_GetPosition(const AddonInstance_VFSEntry* instance, void* context)
451 {
452 return instance->toAddon.addonInstance->GetPosition(context);
453 }
454
455 inline static int ADDON_GetChunkSize(const AddonInstance_VFSEntry* instance, void* context)
456 {
457 return instance->toAddon.addonInstance->GetChunkSize(context);
458 }
459
460 inline static int ADDON_IoControl(const AddonInstance_VFSEntry* instance, void* context, XFILE::EIoControl request, void* param)
461 {
462 return instance->toAddon.addonInstance->IoControl(context, request, param);
463 }
464
465 inline static int ADDON_Stat(const AddonInstance_VFSEntry* instance, const VFSURL* url, struct __stat64* buffer)
466 {
467 return instance->toAddon.addonInstance->Stat(*url, buffer);
468 }
469
470 inline static bool ADDON_Close(const AddonInstance_VFSEntry* instance, void* context)
471 {
472 return instance->toAddon.addonInstance->Close(context);
473 }
474
475 inline static bool ADDON_Exists(const AddonInstance_VFSEntry* instance, const VFSURL* url)
476 {
477 return instance->toAddon.addonInstance->Exists(*url);
478 }
479
480 inline static void ADDON_ClearOutIdle(const AddonInstance_VFSEntry* instance)
481 {
482 return instance->toAddon.addonInstance->ClearOutIdle();
483 }
484
485 inline static void ADDON_DisconnectAll(const AddonInstance_VFSEntry* instance)
486 {
487 return instance->toAddon.addonInstance->DisconnectAll();
488 }
489
490 inline static bool ADDON_Delete(const AddonInstance_VFSEntry* instance, const VFSURL* url)
491 {
492 return instance->toAddon.addonInstance->Delete(*url);
493 }
494
495 inline static bool ADDON_Rename(const AddonInstance_VFSEntry* instance, const VFSURL* url, const VFSURL* url2)
496 {
497 return instance->toAddon.addonInstance->Rename(*url, *url2);
498 }
499
500 inline static bool ADDON_DirectoryExists(const AddonInstance_VFSEntry* instance, const VFSURL* url)
501 {
502 return instance->toAddon.addonInstance->DirectoryExists(*url);
503 }
504
505 inline static bool ADDON_RemoveDirectory(const AddonInstance_VFSEntry* instance, const VFSURL* url)
506 {
507 return instance->toAddon.addonInstance->RemoveDirectory(*url);
508 }
509
510 inline static bool ADDON_CreateDirectory(const AddonInstance_VFSEntry* instance, const VFSURL* url)
511 {
512 return instance->toAddon.addonInstance->CreateDirectory(*url);
513 }
514
515 inline static bool ADDON_GetDirectory(const AddonInstance_VFSEntry* instance,
516 const VFSURL* url,
517 VFSDirEntry** retEntries,
518 int* num_entries,
519 VFSGetDirectoryCallbacks* callbacks)
520 {
521 std::vector<kodi::vfs::CDirEntry> addonEntries;
522 bool ret = instance->toAddon.addonInstance->GetDirectory(*url, addonEntries, callbacks);
523 if (ret)
524 {
525 VFSDirEntry* entries = static_cast<VFSDirEntry*>(malloc(sizeof(VFSDirEntry) * addonEntries.size()));
526 for (unsigned int i = 0; i < addonEntries.size(); ++i)
527 {
528 entries[i].label = strdup(addonEntries[i].Label().c_str());
529 entries[i].title = strdup(addonEntries[i].Title().c_str());
530 entries[i].path = strdup(addonEntries[i].Path().c_str());
531 entries[i].folder = addonEntries[i].IsFolder();
532 entries[i].size = addonEntries[i].Size();
533
534 entries[i].num_props = 0;
535 const std::map<std::string, std::string>& props = addonEntries[i].GetProperties();
536 if (!props.empty())
537 {
538 entries[i].properties = static_cast<VFSProperty*>(malloc(sizeof(VFSProperty)*props.size()));
539 for (const auto& prop : props)
540 {
541 entries[i].properties[entries[i].num_props].name = strdup(prop.first.c_str());
542 entries[i].properties[entries[i].num_props].val = strdup(prop.second.c_str());
543 ++entries[i].num_props;
544 }
545 }
546 else
547 entries[i].properties = nullptr;
548 }
549 *retEntries = entries;
550 *num_entries = addonEntries.size();
551 }
552 return ret;
553 }
554
555 inline static void ADDON_FreeDirectory(const AddonInstance_VFSEntry* instance, VFSDirEntry* entries, int num_entries)
556 {
557 for (int i = 0; i < num_entries; ++i)
558 {
559 if (entries[i].properties)
560 {
561 for (unsigned int j = 0; j < entries[i].num_props; ++j)
562 {
563 free(entries[i].properties[j].name);
564 free(entries[i].properties[j].val);
565 }
566 free(entries[i].properties);
567 }
568 free(entries[i].label);
569 free(entries[i].title);
570 free(entries[i].path);
571 }
572 free(entries);
573 }
574
575 inline static bool ADDON_ContainsFiles(const AddonInstance_VFSEntry* instance,
576 const VFSURL* url,
577 VFSDirEntry** retEntries,
578 int* num_entries,
579 char* rootpath)
580 {
581 std::string cppRootPath;
582 std::vector<kodi::vfs::CDirEntry> addonEntries;
583 bool ret = instance->toAddon.addonInstance->ContainsFiles(*url, addonEntries, cppRootPath);
584 if (ret)
585 {
586 strncpy(rootpath, cppRootPath.c_str(), ADDON_STANDARD_STRING_LENGTH);
587
588 VFSDirEntry* entries = static_cast<VFSDirEntry*>(malloc(sizeof(VFSDirEntry) * addonEntries.size()));
589 for (unsigned int i = 0; i < addonEntries.size(); ++i)
590 {
591 entries[i].label = strdup(addonEntries[i].Label().c_str());
592 entries[i].title = strdup(addonEntries[i].Title().c_str());
593 entries[i].path = strdup(addonEntries[i].Path().c_str());
594 entries[i].folder = addonEntries[i].IsFolder();
595 entries[i].size = addonEntries[i].Size();
596
597 entries[i].num_props = 0;
598 const std::map<std::string, std::string>& props = addonEntries[i].GetProperties();
599 if (!props.empty())
600 {
601 entries[i].properties = static_cast<VFSProperty*>(malloc(sizeof(VFSProperty)*props.size()));
602 for (const auto& prop : props)
603 {
604 entries[i].properties[entries[i].num_props].name = strdup(prop.first.c_str());
605 entries[i].properties[entries[i].num_props].val = strdup(prop.second.c_str());
606 ++entries[i].num_props;
607 }
608 }
609 else
610 entries[i].properties = nullptr;
611 }
612 *retEntries = entries;
613 *num_entries = addonEntries.size();
614 }
615 return ret;
616 }
617
618 AddonInstance_VFSEntry* m_instanceData;
619 };
620
621} /* namespace addon */
622} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h
new file mode 100644
index 0000000..710fda0
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/VideoCodec.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright (C) 2017 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include "../AddonBase.h"
24#include "../StreamCrypto.h"
25#include "../StreamCodec.h"
26
27#ifdef BUILD_KODI_ADDON
28#include "../DVDDemuxPacket.h"
29#else
30#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h"
31#endif
32
33namespace kodi { namespace addon { class CInstanceVideoCodec; } }
34
35extern "C"
36{
37 enum VIDEOCODEC_FORMAT
38 {
39 UnknownVideoFormat = 0,
40 VideoFormatYV12,
41 VideoFormatI420,
42 MaxVideoFormats
43 };
44
45
46 struct VIDEOCODEC_INITDATA
47 {
48 enum Codec {
49 CodecUnknown = 0,
50 CodecVp8,
51 CodecH264,
52 CodecVp9
53 } codec;
54
55 STREAMCODEC_PROFILE codecProfile;
56
57 //UnknownVideoFormat is terminator
58 VIDEOCODEC_FORMAT *videoFormats;
59
60 uint32_t width, height;
61
62 const uint8_t *extraData;
63 unsigned int extraDataSize;
64
65 CRYPTO_INFO cryptoInfo;
66 };
67
68 struct VIDEOCODEC_PICTURE
69 {
70 enum VideoPlane {
71 YPlane = 0,
72 UPlane,
73 VPlane,
74 MaxPlanes = 3,
75 };
76
77 enum Flags : uint32_t {
78 FLAG_DROP,
79 FLAG_DRAIN
80 };
81
82 VIDEOCODEC_FORMAT videoFormat;
83 uint32_t flags;
84
85 uint32_t width, height;
86
87 uint8_t *decodedData;
88 size_t decodedDataSize;
89
90 uint32_t planeOffsets[VideoPlane::MaxPlanes];
91 uint32_t stride[VideoPlane::MaxPlanes];
92
93 int64_t pts;
94
95 void *buffer; //< will be passed in release_frame_buffer
96 };
97
98 enum VIDEOCODEC_RETVAL
99 {
100 VC_NONE = 0, //< noop
101 VC_ERROR, //< an error occured, no other messages will be returned
102 VC_BUFFER, //< the decoder needs more data
103 VC_PICTURE, //< the decoder got a picture
104 VC_EOF, //< the decoder signals EOF
105 };
106
107 // this are properties given to the addon on create
108 // at this time we have no parameters for the addon
109 typedef struct AddonProps_VideoCodec
110 {
111 int dummy;
112 } AddonProps_VideoCodec;
113
114 struct AddonInstance_VideoCodec;
115 typedef struct KodiToAddonFuncTable_VideoCodec
116 {
117 kodi::addon::CInstanceVideoCodec* addonInstance;
118
119 //! \brief Opens a codec
120 bool (__cdecl* open) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData);
121
122 //! \brief Reconfigures a codec
123 bool (__cdecl* reconfigure) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData);
124
125 //! \brief Feed codec if requested from GetPicture() (return VC_BUFFER)
126 bool (__cdecl* add_data) (const AddonInstance_VideoCodec* instance, const DemuxPacket *packet);
127
128 //! \brief Get a decoded picture / request new data
129 VIDEOCODEC_RETVAL (__cdecl* get_picture) (const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture);
130
131 //! \brief Get the name of this video decoder
132 const char *(__cdecl* get_name) (const AddonInstance_VideoCodec* instance);
133
134 //! \brief Reset the codec
135 void (__cdecl* reset)(const AddonInstance_VideoCodec* instance);
136 } KodiToAddonFuncTable_VideoCodec;
137
138 typedef struct AddonToKodiFuncTable_VideoCodec
139 {
140 KODI_HANDLE kodiInstance;
141 bool(*get_frame_buffer)(void* kodiInstance, VIDEOCODEC_PICTURE *picture);
142 void(*release_frame_buffer)(void* kodiInstance, void *buffer);
143 } AddonToKodiFuncTable_VideoCodec;
144
145 typedef struct AddonInstance_VideoCodec
146 {
147 AddonProps_VideoCodec props;
148 AddonToKodiFuncTable_VideoCodec toKodi;
149 KodiToAddonFuncTable_VideoCodec toAddon;
150 } AddonInstance_VideoCodec;
151}
152
153namespace kodi
154{
155 namespace addon
156 {
157
158 class CInstanceVideoCodec : public IAddonInstance
159 {
160 public:
161 CInstanceVideoCodec(KODI_HANDLE instance)
162 : IAddonInstance(ADDON_INSTANCE_VIDEOCODEC)
163 {
164 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
165 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation of multiple together with single instance way is not allowed!");
166
167 SetAddonStruct(instance);
168 }
169
170 ~CInstanceVideoCodec() override = default;
171
172 //! \copydoc CInstanceVideoCodec::Open
173 virtual bool Open(VIDEOCODEC_INITDATA &initData) { return false; };
174
175 //! \copydoc CInstanceVideoCodec::Reconfigure
176 virtual bool Reconfigure(VIDEOCODEC_INITDATA &initData) { return false; };
177
178 //! \copydoc CInstanceVideoCodec::AddData
179 virtual bool AddData(const DemuxPacket &packet) { return false; };
180
181 //! \copydoc CInstanceVideoCodec::GetPicture
182 virtual VIDEOCODEC_RETVAL GetPicture(VIDEOCODEC_PICTURE &picture) { return VC_ERROR; };
183
184 //! \copydoc CInstanceVideoCodec::GetName
185 virtual const char *GetName() { return nullptr; };
186
187 //! \copydoc CInstanceVideoCodec::Reset
188 virtual void Reset() {};
189
190 /*!
191 * @brief AddonToKodi interface
192 */
193
194 //! \copydoc CInstanceVideoCodec::GetFrameBuffer
195 bool GetFrameBuffer(VIDEOCODEC_PICTURE &picture)
196 {
197 return m_instanceData->toKodi.get_frame_buffer(m_instanceData->toKodi.kodiInstance, &picture);
198 }
199
200 //! \copydoc CInstanceVideoCodec::ReleaseFrameBuffer
201 void ReleaseFrameBuffer(void *buffer)
202 {
203 return m_instanceData->toKodi.release_frame_buffer(m_instanceData->toKodi.kodiInstance, buffer);
204 }
205
206 private:
207 void SetAddonStruct(KODI_HANDLE instance)
208 {
209 if (instance == nullptr)
210 throw std::logic_error("kodi::addon::CInstanceVideoCodec: Creation with empty addon structure not allowed, table must be given from Kodi!");
211
212 m_instanceData = static_cast<AddonInstance_VideoCodec*>(instance);
213
214 m_instanceData->toAddon.addonInstance = this;
215 m_instanceData->toAddon.open = ADDON_Open;
216 m_instanceData->toAddon.reconfigure = ADDON_Reconfigure;
217 m_instanceData->toAddon.add_data = ADDON_AddData;
218 m_instanceData->toAddon.get_picture = ADDON_GetPicture;
219 m_instanceData->toAddon.get_name = ADDON_GetName;
220 m_instanceData->toAddon.reset = ADDON_Reset;
221 }
222
223 inline static bool ADDON_Open(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData)
224 {
225 return instance->toAddon.addonInstance->Open(*initData);
226 }
227
228 inline static bool ADDON_Reconfigure(const AddonInstance_VideoCodec* instance, VIDEOCODEC_INITDATA *initData)
229 {
230 return instance->toAddon.addonInstance->Reconfigure(*initData);
231 }
232
233 inline static bool ADDON_AddData(const AddonInstance_VideoCodec* instance, const DemuxPacket *packet)
234 {
235 return instance->toAddon.addonInstance->AddData(*packet);
236 }
237
238 inline static VIDEOCODEC_RETVAL ADDON_GetPicture(const AddonInstance_VideoCodec* instance, VIDEOCODEC_PICTURE *picture)
239 {
240 return instance->toAddon.addonInstance->GetPicture(*picture);
241 }
242
243 inline static const char *ADDON_GetName(const AddonInstance_VideoCodec* instance)
244 {
245 return instance->toAddon.addonInstance->GetName();
246 }
247
248 inline static void ADDON_Reset(const AddonInstance_VideoCodec* instance)
249 {
250 return instance->toAddon.addonInstance->Reset();
251 }
252
253 AddonInstance_VideoCodec* m_instanceData;
254 };
255 } // namespace addon
256} // namespace kodi
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h
new file mode 100644
index 0000000..b1ded64
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/addon-instance/Visualization.h
@@ -0,0 +1,766 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Parts with a comment named "internal" are only used inside header and not
24 * used or accessed direct during add-on development!
25 */
26
27#include "../AddonBase.h"
28
29namespace kodi { namespace addon { class CInstanceVisualization; }}
30
31extern "C"
32{
33
34struct AddonInstance_Visualization;
35
36typedef enum VIS_ACTION : unsigned int /* internal */
37{
38 VIS_ACTION_NONE = 0,
39 VIS_ACTION_NEXT_PRESET,
40 VIS_ACTION_PREV_PRESET,
41 VIS_ACTION_LOAD_PRESET,
42 VIS_ACTION_RANDOM_PRESET,
43 VIS_ACTION_LOCK_PRESET,
44 VIS_ACTION_RATE_PRESET_PLUS,
45 VIS_ACTION_RATE_PRESET_MINUS,
46 VIS_ACTION_UPDATE_ALBUMART,
47 VIS_ACTION_UPDATE_TRACK
48} VIS_ACTION;
49
50struct VIS_INFO /* internal */
51{
52 bool bWantsFreq;
53 int iSyncDelay;
54};
55
56typedef struct AddonProps_Visualization /* internal */
57{
58 void *device;
59 int x;
60 int y;
61 int width;
62 int height;
63 float pixelRatio;
64 const char *name;
65 const char *presets;
66 const char *profile;
67} AddonProps_Visualization;
68
69typedef struct AddonToKodiFuncTable_Visualization /* internal */
70{
71 KODI_HANDLE kodiInstance;
72 void (__cdecl* transfer_preset) (void* kodiInstance, const char* preset);
73} AddonToKodiFuncTable_Visualization;
74
75typedef struct KodiToAddonFuncTable_Visualization /* internal */
76{
77 kodi::addon::CInstanceVisualization* addonInstance;
78 bool (__cdecl* start)(const AddonInstance_Visualization* instance, int channels, int samples_per_sec, int bits_per_sample, const char* song_name);
79 void (__cdecl* stop)(const AddonInstance_Visualization* instance);
80 void (__cdecl* audio_data)(const AddonInstance_Visualization* instance, const float* audio_data, int audio_data_length, float *freq_data, int freq_data_length);
81 bool (__cdecl* is_dirty)(const AddonInstance_Visualization* instance);
82 void (__cdecl* render)(const AddonInstance_Visualization* instance);
83 void (__cdecl* get_info)(const AddonInstance_Visualization* instance, VIS_INFO *info);
84 bool (__cdecl* on_action)(const AddonInstance_Visualization* instance, VIS_ACTION action, const void *param);
85 unsigned int (__cdecl *get_presets)(const AddonInstance_Visualization* instance);
86 int (__cdecl *get_active_preset)(const AddonInstance_Visualization* instance);
87 bool (__cdecl* is_locked)(const AddonInstance_Visualization* instance);
88} KodiToAddonFuncTable_Visualization;
89
90typedef struct AddonInstance_Visualization /* internal */
91{
92 AddonProps_Visualization props;
93 AddonToKodiFuncTable_Visualization toKodi;
94 KodiToAddonFuncTable_Visualization toAddon;
95} AddonInstance_Visualization;
96
97//============================================================================
98/// \defgroup cpp_kodi_addon_visualization_VisTrack class VisTrack
99/// \ingroup cpp_kodi_addon_visualization
100/// @brief **Visualization track information structure**
101///
102/// Called from kodi::addon::CInstanceVisualization::UpdateTrack() with the
103/// information of the currently-playing song.
104///
105//@{
106struct VisTrack
107{
108 /// @brief Title of the current song.
109 const char *title;
110
111 /// @brief Artist names, as a single string
112 const char *artist;
113
114 /// @brief Album that the current song is from.
115 const char *album;
116
117 /// @brief Album artist names, as a single string
118 const char *albumArtist;
119
120 /// @brief The genre name from the music tag, if present.
121 const char *genre;
122
123 /// @brief Comment of the current song stored in the ID tag info.
124 const char *comment;
125
126 /// @brief Lyrics of the current song, if available.
127 const char *lyrics;
128
129 const char *reserved1;
130 const char *reserved2;
131
132 /// @brief Track number of the current song.
133 int trackNumber;
134
135 /// @brief Disc number of the current song stored in the ID tag info.
136 int discNumber;
137
138 /// @brief Duration of the current song, in seconds.
139 int duration;
140
141 /// @brief Year that the current song was released.
142 int year;
143
144 /// @brief The user-defined rating of the current song.
145 int rating;
146
147 int reserved3;
148 int reserved4;
149};
150//@}
151//----------------------------------------------------------------------------
152
153} /* extern "C" */
154
155namespace kodi
156{
157namespace addon
158{
159
160 //============================================================================
161 ///
162 /// \addtogroup cpp_kodi_addon_visualization
163 /// @brief \cpp_class{ kodi::addon::CInstanceVisualization }
164 /// **Visualization add-on instance**
165 ///
166 /// [Music visualization](https://en.wikipedia.org/wiki/Music_visualization),
167 /// or music visualisation, is a feature in Kodi that generates animated
168 /// imagery based on a piece of music. The imagery is usually generated and
169 /// rendered in real time synchronized to the music.
170 ///
171 /// Visualization techniques range from simple ones (e.g., a simulation of an
172 /// oscilloscope display) to elaborate ones, which often include a plurality
173 /// of composited effects. The changes in the music's loudness and frequency
174 /// spectrum are among the properties used as input to the visualization.
175 ///
176 /// Include the header \ref Visualization.h "#include <kodi/addon-instance/Visualization.h>"
177 /// to use this class.
178 ///
179 /// This interface allows the creation of visualizations for Kodi, based upon
180 /// **DirectX** or/and **OpenGL** rendering with `C++` code.
181 ///
182 /// Additionally, there are several \ref cpp_kodi_addon_visualization_CB "other functions"
183 /// available in which the child class can ask about the current hardware,
184 /// including the device, display and several other parts.
185 ///
186 /// --------------------------------------------------------------------------
187 ///
188 ///
189 /// **Here is an example of the minimum required code to start a visualization:**
190 /// ~~~~~~~~~~~~~{.cpp}
191 /// #include <kodi/addon-instance/Visualization.h>
192 ///
193 /// class CMyVisualization : public kodi::addon::CAddonBase,
194 /// public kodi::addon::CInstanceVisualization
195 /// {
196 /// public:
197 /// CMyVisualization();
198 ///
199 /// bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) override;
200 /// void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) override;
201 /// void Render() override;
202 /// };
203 ///
204 /// CMyVisualization::CMyVisualization()
205 /// {
206 /// ...
207 /// }
208 ///
209 /// bool CMyVisualization::Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName)
210 /// {
211 /// ...
212 /// return true;
213 /// }
214 ///
215 /// void CMyVisualization::AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength)
216 /// {
217 /// ...
218 /// }
219 ///
220 /// void CMyVisualization::Render()
221 /// {
222 /// ...
223 /// }
224 ///
225 /// ADDONCREATOR(CMyVisualization)
226 /// ~~~~~~~~~~~~~
227 ///
228 ///
229 /// --------------------------------------------------------------------------
230 ///
231 ///
232 /// **Here is another example where the visualization is used together with
233 /// other instance types:**
234 ///
235 /// ~~~~~~~~~~~~~{.cpp}
236 /// #include <kodi/addon-instance/Visualization.h>
237 ///
238 /// class CMyVisualization : public ::kodi::addon::CInstanceVisualization
239 /// {
240 /// public:
241 /// CMyVisualization(KODI_HANDLE instance);
242 ///
243 /// bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) override;
244 /// void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) override;
245 /// void Render() override;
246 /// };
247 ///
248 /// CMyVisualization::CMyVisualization(KODI_HANDLE instance)
249 /// : CInstanceVisualization(instance)
250 /// {
251 /// ...
252 /// }
253 ///
254 /// bool CMyVisualization::Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName)
255 /// {
256 /// ...
257 /// return true;
258 /// }
259 ///
260 /// void CMyVisualization::AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength)
261 /// {
262 /// ...
263 /// }
264 ///
265 /// void CMyVisualization::Render()
266 /// {
267 /// ...
268 /// }
269 ///
270 ///
271 /// /*----------------------------------------------------------------------*/
272 ///
273 /// class CMyAddon : public ::kodi::addon::CAddonBase
274 /// {
275 /// public:
276 /// CMyAddon() { }
277 /// ADDON_STATUS CreateInstance(int instanceType,
278 /// std::string instanceID,
279 /// KODI_HANDLE instance,
280 /// KODI_HANDLE& addonInstance) override;
281 /// };
282 ///
283 /// /* If you use only one instance in your add-on, can be instanceType and
284 /// * instanceID ignored */
285 /// ADDON_STATUS CMyAddon::CreateInstance(int instanceType,
286 /// std::string instanceID,
287 /// KODI_HANDLE instance,
288 /// KODI_HANDLE& addonInstance)
289 /// {
290 /// if (instanceType == ADDON_INSTANCE_VISUALIZATION)
291 /// {
292 /// kodi::Log(ADDON_LOG_NOTICE, "Creating my Visualization");
293 /// addonInstance = new CMyVisualization(instance);
294 /// return ADDON_STATUS_OK;
295 /// }
296 /// else if (...)
297 /// {
298 /// ...
299 /// }
300 /// return ADDON_STATUS_UNKNOWN;
301 /// }
302 ///
303 /// ADDONCREATOR(CMyAddon)
304 /// ~~~~~~~~~~~~~
305 ///
306 /// The destruction of the example class `CMyVisualization` is called from
307 /// Kodi's header. Manually deleting the add-on instance is not required.
308 ///
309 //----------------------------------------------------------------------------
310 class CInstanceVisualization : public IAddonInstance
311 {
312 public:
313 //==========================================================================
314 ///
315 /// @ingroup cpp_kodi_addon_visualization
316 /// @brief Visualization class constructor
317 ///
318 /// Used by an add-on that only supports visualizations.
319 ///
320 CInstanceVisualization()
321 : IAddonInstance(ADDON_INSTANCE_VISUALIZATION),
322 m_presetLockedByUser(false)
323 {
324 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
325 throw std::logic_error("kodi::addon::CInstanceVisualization: Cannot create multiple instances of add-on.");
326
327 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance);
328 CAddonBase::m_interface->globalSingleInstance = this;
329 }
330 //--------------------------------------------------------------------------
331
332 //==========================================================================
333 ///
334 /// @ingroup cpp_kodi_addon_visualization
335 /// @brief Visualization class constructor used to support multiple instance
336 /// types
337 ///
338 /// @param[in] instance The instance value given to
339 /// <b>`kodi::addon::CAddonBase::CreateInstance(...)`</b>.
340 ///
341 /// @warning Only use `instance` from the CreateInstance call
342 ///
343 CInstanceVisualization(KODI_HANDLE instance)
344 : IAddonInstance(ADDON_INSTANCE_VISUALIZATION),
345 m_presetLockedByUser(false)
346 {
347 if (CAddonBase::m_interface->globalSingleInstance != nullptr)
348 throw std::logic_error("kodi::addon::CInstanceVisualization: Creation of multiple together with single instance way is not allowed!");
349
350 SetAddonStruct(instance);
351 }
352 //--------------------------------------------------------------------------
353
354 //==========================================================================
355 ///
356 /// @ingroup cpp_kodi_addon_visualization
357 /// @brief Destructor
358 ///
359 ~CInstanceVisualization() override = default;
360 //--------------------------------------------------------------------------
361
362 //==========================================================================
363 ///
364 /// @ingroup cpp_kodi_addon_visualization
365 /// @brief Used to notify the visualization that a new song has been started
366 ///
367 /// @param[in] channels Number of channels in the stream
368 /// @param[in] samplesPerSec Samples per second of stream
369 /// @param[in] bitsPerSample Number of bits in one sample
370 /// @param[in] songName The name of the currently-playing song
371 /// @return true if start successful done
372 ///
373 virtual bool Start(int channels, int samplesPerSec, int bitsPerSample, std::string songName) { return true; }
374 //--------------------------------------------------------------------------
375
376 //==========================================================================
377 ///
378 /// @ingroup cpp_kodi_addon_visualization
379 /// @brief Used to inform the visualization that the rendering control was
380 /// stopped
381 ///
382 virtual void Stop() {}
383 //--------------------------------------------------------------------------
384
385 //==========================================================================
386 ///
387 /// @ingroup cpp_kodi_addon_visualization
388 /// @brief Pass audio data to the visualization
389 ///
390 /// @param[in] audioData The raw audio data
391 /// @param[in] audioDataLength Length of the audioData array
392 /// @param[in] freqData The [FFT](https://en.wikipedia.org/wiki/Fast_Fourier_transform)
393 /// of the audio data
394 /// @param[in] freqDataLength Length of frequency data array
395 ///
396 /// Values **freqData** and **freqDataLength** are used if GetInfo() returns
397 /// true for the `wantsFreq` parameter. Otherwise, **freqData** is set to
398 /// `nullptr` and **freqDataLength** is `0`.
399 ///
400 virtual void AudioData(const float* audioData, int audioDataLength, float* freqData, int freqDataLength) {}
401 //--------------------------------------------------------------------------
402
403 //==========================================================================
404 ///
405 /// @ingroup cpp_kodi_addon_visualization
406 /// @brief Used to inform Kodi that the rendered region is dirty and need an
407 /// update
408 ///
409 /// @return True if dirty
410 ///
411 virtual bool IsDirty() { return true; }
412 //--------------------------------------------------------------------------
413
414 //==========================================================================
415 ///
416 /// @ingroup cpp_kodi_addon_visualization
417 /// @brief Used to indicate when the add-on should render
418 ///
419 virtual void Render() {}
420 //--------------------------------------------------------------------------
421
422 //==========================================================================
423 ///
424 /// @ingroup cpp_kodi_addon_visualization
425 /// @brief Used to get the number of buffers from the current visualization
426 ///
427 /// @param[out] wantsFreq Indicates whether the add-on wants FFT
428 /// data. If set to true, the **freqData**
429 /// and **freqDataLength** parameters of
430 /// AudioData() are used
431 /// @param[out] syncDelay The number of buffers to delay before
432 /// calling AudioData()
433 ///
434 /// @note If this function is not implemented, it will default to
435 /// `wantsFreq` = false and `syncDelay` = 0.
436 ///
437 virtual void GetInfo(bool& wantsFreq, int& syncDelay) { wantsFreq = false; syncDelay = 0; }
438 //--------------------------------------------------------------------------
439
440 //==========================================================================
441 ///
442 /// @ingroup cpp_kodi_addon_visualization
443 /// @brief Used to get a list of visualization presets the user can select
444 /// from
445 ///
446 /// @param[out] presets The vector list containing the names of
447 /// presets that the user can select
448 /// @return Return true if successful, or false if
449 /// there are no presets to choose from
450 ///
451 virtual bool GetPresets(std::vector<std::string>& presets) { return false; }
452 //--------------------------------------------------------------------------
453
454 //==========================================================================
455 ///
456 /// @ingroup cpp_kodi_addon_visualization
457 /// @brief Get the index of the current preset
458 ///
459 /// @return Index number of the current preset
460 ///
461 virtual int GetActivePreset() { return -1; }
462 //--------------------------------------------------------------------------
463
464 //==========================================================================
465 ///
466 /// @ingroup cpp_kodi_addon_visualization
467 /// @brief Check if the add-on is locked to the current preset
468 ///
469 /// @return True if locked to the current preset
470 ///
471 virtual bool IsLocked() { return false; }
472 //--------------------------------------------------------------------------
473
474 //==========================================================================
475 ///
476 /// @ingroup cpp_kodi_addon_visualization
477 /// @brief Load the previous visualization preset
478 ///
479 /// @return Return true if the previous preset was loaded
480 virtual bool PrevPreset() { return false; }
481 //--------------------------------------------------------------------------
482
483 //==========================================================================
484 ///
485 /// @ingroup cpp_kodi_addon_visualization
486 /// @brief Load the next visualization preset
487 ///
488 /// @return Return true if the next preset was loaded
489 virtual bool NextPreset() { return false; }
490 //--------------------------------------------------------------------------
491
492 //==========================================================================
493 ///
494 /// @ingroup cpp_kodi_addon_visualization
495 /// @brief Load a visualization preset
496 ///
497 /// This function is called after a new preset is selected.
498 ///
499 /// @param[in] select Preset index to use
500 /// @return Return true if the preset is loaded
501 virtual bool LoadPreset(int select) { return false; }
502 //--------------------------------------------------------------------------
503
504 //==========================================================================
505 ///
506 /// @ingroup cpp_kodi_addon_visualization
507 /// @brief Switch to a new random preset
508 ///
509 /// @return Return true if a random preset was loaded
510 virtual bool RandomPreset() { return false; }
511 //--------------------------------------------------------------------------
512
513 //==========================================================================
514 ///
515 /// @ingroup cpp_kodi_addon_visualization
516 /// @brief Lock the current visualization preset, preventing it from changing
517 ///
518 /// @param[in] lockUnlock If set to true, the preset should be locked
519 /// @return Return true if the current preset is locked
520 virtual bool LockPreset(bool lockUnlock) { return false; }
521 //--------------------------------------------------------------------------
522
523 //==========================================================================
524 ///
525 /// @ingroup cpp_kodi_addon_visualization
526 /// @brief Used to increase/decrease the visualization preset rating
527 ///
528 /// @param[in] plusMinus If set to true the rating is increased, otherwise
529 /// decreased
530 /// @return Return true if the rating is modified
531 virtual bool RatePreset(bool plusMinus) { return false; }
532 //--------------------------------------------------------------------------
533
534 //==========================================================================
535 ///
536 /// @ingroup cpp_kodi_addon_visualization
537 /// @brief Inform the visualization of the current album art image
538 ///
539 /// @param[in] albumart Path to the current album art image
540 /// @return Return true if the image is used
541 virtual bool UpdateAlbumart(std::string albumart) { return false; }
542 //--------------------------------------------------------------------------
543
544 //==========================================================================
545 ///
546 /// @ingroup cpp_kodi_addon_visualization
547 /// @brief Inform the visualization of the current track's tag information
548 ///
549 /// @param[in] track Visualization track information structure
550 /// @return Return true if the track information is used
551 virtual bool UpdateTrack(const VisTrack &track) { return false; }
552
553 //==========================================================================
554 ///
555 /// \defgroup cpp_kodi_addon_visualization_CB Information functions
556 /// \ingroup cpp_kodi_addon_visualization
557 /// @brief **To get info about the device, display and several other parts**
558 ///
559 //@{
560
561 //==========================================================================
562 ///
563 /// @ingroup cpp_kodi_addon_visualization_CB
564 /// @brief Device that represents the display adapter
565 ///
566 /// @return A pointer to the used device
567 ///
568 /// @note This is only available on **DirectX**, It us unused (`nullptr`) on
569 /// **OpenGL**
570 ///
571 inline void* Device() { return m_instanceData->props.device; }
572 //--------------------------------------------------------------------------
573
574 //==========================================================================
575 ///
576 /// @ingroup cpp_kodi_addon_visualization_CB
577 /// @brief Returns the X position of the rendering window
578 ///
579 /// @return The X position, in pixels
580 ///
581 inline int X() { return m_instanceData->props.x; }
582 //--------------------------------------------------------------------------
583
584 //==========================================================================
585 ///
586 /// @ingroup cpp_kodi_addon_visualization_CB
587 /// @brief Returns the Y position of the rendering window
588 ///
589 /// @return The Y position, in pixels
590 ///
591 inline int Y() { return m_instanceData->props.y; }
592 //--------------------------------------------------------------------------
593
594 //==========================================================================
595 ///
596 /// @ingroup cpp_kodi_addon_visualization_CB
597 /// @brief Returns the width of the rendering window
598 ///
599 /// @return The width, in pixels
600 ///
601 inline int Width() { return m_instanceData->props.width; }
602 //--------------------------------------------------------------------------
603
604 //==========================================================================
605 ///
606 /// @ingroup cpp_kodi_addon_visualization_CB
607 /// @brief Returns the height of the rendering window
608 ///
609 /// @return The height, in pixels
610 ///
611 inline int Height() { return m_instanceData->props.height; }
612 //--------------------------------------------------------------------------
613
614 //==========================================================================
615 ///
616 /// @ingroup cpp_kodi_addon_visualization_CB
617 /// @brief Pixel aspect ratio (often abbreviated PAR) is a ratio that
618 /// describes how the width of a pixel compares to the height of that pixel.
619 ///
620 /// @return The pixel aspect ratio used by the display
621 ///
622 inline float PixelRatio() { return m_instanceData->props.pixelRatio; }
623 //--------------------------------------------------------------------------
624
625 //==========================================================================
626 ///
627 /// @ingroup cpp_kodi_addon_visualization_CB
628 /// @brief Used to get the name of the add-on defined in `addon.xml`
629 ///
630 /// @return The add-on name
631 ///
632 inline std::string Name() { return m_instanceData->props.name; }
633 //--------------------------------------------------------------------------
634
635 //==========================================================================
636 ///
637 /// @ingroup cpp_kodi_addon_visualization_CB
638 /// @brief Used to get the full path where the add-on is installed
639 ///
640 /// @return The add-on installation path
641 ///
642 inline std::string Presets() { return m_instanceData->props.presets; }
643 //--------------------------------------------------------------------------
644
645 //==========================================================================
646 ///
647 /// @ingroup cpp_kodi_addon_visualization_CB
648 /// @brief Used to get the full path to the add-on's user profile
649 ///
650 /// @note The trailing folder (consisting of the add-on's ID) is not created
651 /// by default. If it is needed, you must call kodi::vfs::CreateDirectory()
652 /// to create the folder.
653 ///
654 /// @return Path to the user profile
655 ///
656 inline std::string Profile() { return m_instanceData->props.profile; }
657 //--------------------------------------------------------------------------
658 //@}
659
660 private:
661 void SetAddonStruct(KODI_HANDLE instance)
662 {
663 if (instance == nullptr)
664 throw std::logic_error("kodi::addon::CInstanceVisualization: Null pointer instance passed.");
665
666 m_instanceData = static_cast<AddonInstance_Visualization*>(instance);
667 m_instanceData->toAddon.addonInstance = this;
668 m_instanceData->toAddon.start = ADDON_Start;
669 m_instanceData->toAddon.stop = ADDON_Stop;
670 m_instanceData->toAddon.audio_data = ADDON_AudioData;
671 m_instanceData->toAddon.render = ADDON_Render;
672 m_instanceData->toAddon.get_info = ADDON_GetInfo;
673 m_instanceData->toAddon.on_action = ADDON_OnAction;
674 m_instanceData->toAddon.get_presets = ADDON_GetPresets;
675 m_instanceData->toAddon.get_active_preset = ADDON_GetActivePreset;
676 m_instanceData->toAddon.is_locked = ADDON_IsLocked;
677 }
678
679 inline static bool ADDON_Start(const AddonInstance_Visualization* addon, int channels, int samplesPerSec, int bitsPerSample, const char* songName)
680 {
681 return addon->toAddon.addonInstance->Start(channels, samplesPerSec, bitsPerSample, songName);
682 }
683
684 inline static void ADDON_Stop(const AddonInstance_Visualization* addon)
685 {
686 addon->toAddon.addonInstance->Stop();
687 }
688
689 inline static void ADDON_AudioData(const AddonInstance_Visualization* addon, const float* audioData, int audioDataLength, float *freqData, int freqDataLength)
690 {
691 addon->toAddon.addonInstance->AudioData(audioData, audioDataLength, freqData, freqDataLength);
692 }
693
694 inline static bool ADDON_IsDirty(const AddonInstance_Visualization* addon)
695 {
696 return addon->toAddon.addonInstance->IsDirty();
697 }
698
699 inline static void ADDON_Render(const AddonInstance_Visualization* addon)
700 {
701 addon->toAddon.addonInstance->Render();
702 }
703
704 inline static void ADDON_GetInfo(const AddonInstance_Visualization* addon, VIS_INFO *info)
705 {
706 addon->toAddon.addonInstance->GetInfo(info->bWantsFreq, info->iSyncDelay);
707 }
708
709 inline static bool ADDON_OnAction(const AddonInstance_Visualization* addon, VIS_ACTION action, const void *param)
710 {
711 switch (action)
712 {
713 case VIS_ACTION_NEXT_PRESET:
714 return addon->toAddon.addonInstance->NextPreset();
715 case VIS_ACTION_PREV_PRESET:
716 return addon->toAddon.addonInstance->PrevPreset();
717 case VIS_ACTION_LOAD_PRESET:
718 return addon->toAddon.addonInstance->LoadPreset(*static_cast<const int*>(param));
719 case VIS_ACTION_RANDOM_PRESET:
720 return addon->toAddon.addonInstance->RandomPreset();
721 case VIS_ACTION_LOCK_PRESET:
722 addon->toAddon.addonInstance->m_presetLockedByUser = !addon->toAddon.addonInstance->m_presetLockedByUser;
723 return addon->toAddon.addonInstance->LockPreset(addon->toAddon.addonInstance->m_presetLockedByUser);
724 case VIS_ACTION_RATE_PRESET_PLUS:
725 return addon->toAddon.addonInstance->RatePreset(true);
726 case VIS_ACTION_RATE_PRESET_MINUS:
727 return addon->toAddon.addonInstance->RatePreset(false);
728 case VIS_ACTION_UPDATE_ALBUMART:
729 return addon->toAddon.addonInstance->UpdateAlbumart(static_cast<const char*>(param));
730 case VIS_ACTION_UPDATE_TRACK:
731 return addon->toAddon.addonInstance->UpdateTrack(*static_cast<const VisTrack*>(param));
732 case VIS_ACTION_NONE:
733 default:
734 break;
735 }
736 return false;
737 }
738
739 inline static unsigned int ADDON_GetPresets(const AddonInstance_Visualization* addon)
740 {
741 std::vector<std::string> presets;
742 if (addon->toAddon.addonInstance->GetPresets(presets))
743 {
744 for (auto it : presets)
745 addon->toAddon.addonInstance->m_instanceData->toKodi.transfer_preset(addon->toKodi.kodiInstance, it.c_str());
746 }
747
748 return presets.size();
749 }
750
751 inline static int ADDON_GetActivePreset(const AddonInstance_Visualization* addon)
752 {
753 return addon->toAddon.addonInstance->GetActivePreset();
754 }
755
756 inline static bool ADDON_IsLocked(const AddonInstance_Visualization* addon)
757 {
758 return addon->toAddon.addonInstance->IsLocked();
759 }
760
761 bool m_presetLockedByUser;
762 AddonInstance_Visualization* m_instanceData;
763 };
764
765} /* namespace addon */
766} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
index a473f28..944b1b9 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/ListItem.h
@@ -91,20 +91,18 @@ namespace gui
91 /// @param[in] label Item label 91 /// @param[in] label Item label
92 /// @param[in] label2 Second Item label (if needed) 92 /// @param[in] label2 Second Item label (if needed)
93 /// @param[in] iconImage Item icon image (if needed) 93 /// @param[in] iconImage Item icon image (if needed)
94 /// @param[in] thumbnailImage Thumbnail Image of item (if needed)
95 /// @param[in] path Path to where item is defined 94 /// @param[in] path Path to where item is defined
96 /// 95 ///
97 CListItem( 96 CListItem(
98 const std::string& label = "", 97 const std::string& label = "",
99 const std::string& label2 = "", 98 const std::string& label2 = "",
100 const std::string& iconImage = "", 99 const std::string& iconImage = "",
101 const std::string& thumbnailImage = "",
102 const std::string& path = "") 100 const std::string& path = "")
103 : CAddonGUIControlBase(nullptr) 101 : CAddonGUIControlBase(nullptr)
104 { 102 {
105 m_controlHandle = m_interface->kodi_gui->listItem->create(m_interface->kodiBase, label.c_str(), 103 m_controlHandle = m_interface->kodi_gui->listItem->create(m_interface->kodiBase, label.c_str(),
106 label2.c_str(), iconImage.c_str(), 104 label2.c_str(), iconImage.c_str(),
107 thumbnailImage.c_str(), path.c_str()); 105 path.c_str());
108 } 106 }
109 107
110 /* 108 /*
@@ -124,7 +122,7 @@ namespace gui
124 /// \ingroup cpp_kodi_gui_CListItem 122 /// \ingroup cpp_kodi_gui_CListItem
125 /// @brief Class destructor 123 /// @brief Class destructor
126 /// 124 ///
127 virtual ~CListItem() 125 ~CListItem() override
128 { 126 {
129 m_interface->kodi_gui->listItem->destroy(m_interface->kodiBase, m_controlHandle); 127 m_interface->kodi_gui->listItem->destroy(m_interface->kodiBase, m_controlHandle);
130 } 128 }
@@ -330,6 +328,86 @@ namespace gui
330 } 328 }
331 //-------------------------------------------------------------------------- 329 //--------------------------------------------------------------------------
332 330
331 //==========================================================================
332 ///
333 /// \ingroup cpp_kodi_gui_CListItem
334 /// @brief Sets a listitem property, similar to an infolabel.
335 ///
336 /// @param[in] key string - property name.
337 /// @param[in] value string or unicode - value of property.
338 ///
339 /// @note Key is NOT case sensitive.
340 /// You can use the above as keywords for arguments and skip certain\n
341 /// optional arguments.\n
342 /// Once you use a keyword, all following arguments require the
343 /// keyword.
344 ///
345 /// Some of these are treated internally by Kodi, such as the
346 /// <b>'StartOffset'</b> property, which is the offset in seconds at which to
347 /// start playback of an item. Others may be used in the skin to add
348 /// extra information, such as <b>'WatchedCount'</b> for tvshow items
349 ///
350 void SetProperty(const std::string& key, const std::string& value)
351 {
352 m_interface->kodi_gui->listItem->set_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str());
353 }
354 //--------------------------------------------------------------------------
355
356 //==========================================================================
357 ///
358 /// \ingroup cpp_kodi_gui_CListItem
359 /// @brief Returns a listitem property as a string, similar to an infolabel.
360 ///
361 /// @param[in] key string - property name.
362 /// @return string - List item property
363 ///
364 /// @note Key is NOT case sensitive.\n
365 /// You can use the above as keywords for arguments and skip certain
366 /// optional arguments.\n
367 /// Once you use a keyword, all following arguments require the
368 /// keyword.
369 ///
370 std::string GetProperty(const std::string& key)
371 {
372 std::string label;
373 char* ret = m_interface->kodi_gui->listItem->get_property(m_interface->kodiBase, m_controlHandle, key.c_str());
374 if (ret != nullptr)
375 {
376 if (std::strlen(ret))
377 label = ret;
378 m_interface->free_string(m_interface->kodiBase, ret);
379 }
380 return label;
381 }
382 //--------------------------------------------------------------------------
383
384 //==========================================================================
385 ///
386 /// \ingroup cpp_kodi_gui_CListItem
387 /// @brief To control selection of item in list (also multiple selection,
388 /// in list on serveral items possible).
389 ///
390 /// @param[in] selected if true becomes set as selected
391 ///
392 void Select(bool selected)
393 {
394 m_interface->kodi_gui->listItem->select(m_interface->kodiBase, m_controlHandle, selected);
395 }
396 //--------------------------------------------------------------------------
397
398 //==========================================================================
399 ///
400 /// \ingroup cpp_kodi_gui_CListItem
401 /// @brief Returns the listitem's selected status.
402 ///
403 /// @return true if selected, otherwise false
404 ///
405 bool IsSelected()
406 {
407 return m_interface->kodi_gui->listItem->is_selected(m_interface->kodiBase, m_controlHandle);
408 }
409 //--------------------------------------------------------------------------
410
333 }; 411 };
334 412
335} /* namespace gui */ 413} /* namespace gui */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
index 7069e63..b78585f 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/Window.h
@@ -110,7 +110,7 @@ namespace gui
110 /// 110 ///
111 /// 111 ///
112 /// 112 ///
113 virtual ~CWindow() 113 ~CWindow() override
114 { 114 {
115 if (m_controlHandle) 115 if (m_controlHandle)
116 m_interface->kodi_gui->window->destroy(m_interface->kodiBase, m_controlHandle); 116 m_interface->kodi_gui->window->destroy(m_interface->kodiBase, m_controlHandle);
@@ -166,6 +166,232 @@ namespace gui
166 //========================================================================== 166 //==========================================================================
167 /// 167 ///
168 /// \ingroup cpp_kodi_gui_CWindow 168 /// \ingroup cpp_kodi_gui_CWindow
169 /// @brief Gives the control with the supplied focus.
170 ///
171 /// @param[in] iControlId On skin defined id of control
172 /// @return Return true if call and focus is successed,
173 /// if false was something failed to get needed
174 /// skin parts.
175 ///
176 ///
177 bool SetFocusId(int iControlId)
178 {
179 return m_interface->kodi_gui->window->set_focus_id(m_interface->kodiBase, m_controlHandle, iControlId);
180 }
181 //--------------------------------------------------------------------------
182
183 //==========================================================================
184 ///
185 /// \ingroup cpp_kodi_gui_CWindow
186 /// @brief Returns the id of the control which is focused.
187 ///
188 /// @return Focused control id
189 ///
190 ///
191 int GetFocusId()
192 {
193 return m_interface->kodi_gui->window->get_focus_id(m_interface->kodiBase, m_controlHandle);
194 }
195 //--------------------------------------------------------------------------
196
197 //==========================================================================
198 ///
199 /// \ingroup cpp_kodi_gui_CWindow
200 /// @brief To set the used label on given control id
201 ///
202 /// @param[in] controlId Control id where label need to set
203 /// @param[in] label Label to use
204 ///
205 ///
206 void SetControlLabel(int controlId, const std::string& label)
207 {
208 m_interface->kodi_gui->window->set_control_label(m_interface->kodiBase, m_controlHandle, controlId, label.c_str());
209 }
210 //--------------------------------------------------------------------------
211
212 //==========================================================================
213 ///
214 /// \ingroup cpp_kodi_gui_CWindow
215 /// @brief Sets a window property, similar to an infolabel.
216 ///
217 /// @param[in] key string - property name.
218 /// @param[in] value string or unicode - value of property.
219 ///
220 /// @note Key is NOT case sensitive. Setting value to an empty string is
221 /// equivalent to clearProperty(key).\n
222 /// You can use the above as keywords for arguments and skip certain
223 /// optional arguments.\n
224 /// Once you use a keyword, all following arguments require the keyword.
225 ///
226 void SetProperty(const std::string& key, const std::string& value)
227 {
228 m_interface->kodi_gui->window->set_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str());
229 }
230 //--------------------------------------------------------------------------
231
232 //==========================================================================
233 ///
234 /// \ingroup cpp_kodi_gui_CWindow
235 /// @brief Returns a window property as a string, similar to an infolabel.
236 ///
237 /// @param[in] key string - property name.
238 /// @return The property as strin (if present)
239 ///
240 /// @note Key is NOT case sensitive. Setting value to an empty string is
241 /// equivalent to clearProperty(key).\n
242 /// You can use the above as keywords for arguments and skip certain
243 /// optional arguments.\n
244 /// Once you use a keyword, all following arguments require the keyword.
245 ///
246 ///
247 std::string GetProperty(const std::string& key) const
248 {
249 std::string label;
250 char* ret = m_interface->kodi_gui->window->get_property(m_interface->kodiBase, m_controlHandle, key.c_str());
251 if (ret != nullptr)
252 {
253 if (std::strlen(ret))
254 label = ret;
255 m_interface->free_string(m_interface->kodiBase, ret);
256 }
257 return label;
258 }
259 //--------------------------------------------------------------------------
260
261 //==========================================================================
262 ///
263 /// \ingroup cpp_kodi_gui_CWindow
264 /// @brief Sets a window property with integer value
265 ///
266 /// @param[in] key string - property name.
267 /// @param[in] value integer value to set
268 ///
269 ///
270 void SetPropertyInt(const std::string& key, int value)
271 {
272 m_interface->kodi_gui->window->set_property_int(m_interface->kodiBase, m_controlHandle, key.c_str(), value);
273 }
274 //--------------------------------------------------------------------------
275
276 //==========================================================================
277 ///
278 /// \ingroup cpp_kodi_gui_CWindow
279 /// @brief Returns a window property with integer value
280 ///
281 /// @param[in] key string - property name.
282 /// @return integer value of property
283 ///
284 int GetPropertyInt(const std::string& key) const
285 {
286 return m_interface->kodi_gui->window->get_property_int(m_interface->kodiBase, m_controlHandle, key.c_str());
287 }
288 //--------------------------------------------------------------------------
289
290 //==========================================================================
291 ///
292 /// \ingroup cpp_kodi_gui_CWindow
293 /// @brief Sets a window property with boolean value
294 ///
295 /// @param[in] key string - property name.
296 /// @param[in] value boolean value to set
297 ///
298 ///
299 void SetPropertyBool(const std::string& key, bool value)
300 {
301 m_interface->kodi_gui->window->set_property_bool(m_interface->kodiBase, m_controlHandle, key.c_str(), value);
302 }
303 //--------------------------------------------------------------------------
304
305 //==========================================================================
306 ///
307 /// \ingroup cpp_kodi_gui_CWindow
308 /// @brief Returns a window property with boolean value
309 ///
310 /// @param[in] key string - property name.
311 /// @return boolean value of property
312 ///
313 bool GetPropertyBool(const std::string& key) const
314 {
315 return m_interface->kodi_gui->window->get_property_bool(m_interface->kodiBase, m_controlHandle, key.c_str());
316 }
317 //--------------------------------------------------------------------------
318
319 //==========================================================================
320 ///
321 /// \ingroup cpp_kodi_gui_CWindow
322 /// @brief Sets a window property with double value
323 ///
324 /// @param[in] key string - property name.
325 /// @param[in] value double value to set
326 ///
327 ///
328 void SetPropertyDouble(const std::string& key, double value)
329 {
330 m_interface->kodi_gui->window->set_property_double(m_interface->kodiBase, m_controlHandle, key.c_str(), value);
331 }
332 //--------------------------------------------------------------------------
333
334 //==========================================================================
335 ///
336 /// \ingroup cpp_kodi_gui_CWindow
337 /// @brief Returns a window property with double value
338 ///
339 /// @param[in] key string - property name.
340 /// @return double value of property
341 ///
342 ///
343 double GetPropertyDouble(const std::string& key) const
344 {
345 return m_interface->kodi_gui->window->get_property_double(m_interface->kodiBase, m_controlHandle, key.c_str());
346 }
347 //--------------------------------------------------------------------------
348
349 //==========================================================================
350 ///
351 /// \ingroup cpp_kodi_gui_CWindow
352 /// @brief Remove all present properties from window
353 ///
354 ///
355 ///
356 void ClearProperties()
357 {
358 m_interface->kodi_gui->window->clear_properties(m_interface->kodiBase, m_controlHandle);
359 }
360 //--------------------------------------------------------------------------
361
362 //==========================================================================
363 ///
364 /// \ingroup cpp_kodi_gui_CWindow
365 /// @brief Clears the specific window property.
366 ///
367 /// @param[in] key string - property name.
368 ///
369 /// @note Key is NOT case sensitive. Equivalent to SetProperty(key, "")
370 /// You can use the above as keywords for arguments and skip certain
371 /// optional arguments.
372 /// Once you use a keyword, all following arguments require the
373 /// keyword.
374 ///
375 ///
376 ///-----------------------------------------------------------------------
377 ///
378 /// **Example:**
379 /// ~~~~~~~~~~~~~{.cpp}
380 /// ..
381 /// ClearProperty('Category')
382 /// ..
383 /// ~~~~~~~~~~~~~
384 ///
385 void ClearProperty(const std::string& key)
386 {
387 m_interface->kodi_gui->window->clear_property(m_interface->kodiBase, m_controlHandle, key.c_str());
388 }
389 //--------------------------------------------------------------------------
390
391 //@{
392 //==========================================================================
393 ///
394 /// \ingroup cpp_kodi_gui_CWindow
169 /// @brief Function delete all entries in integrated list. 395 /// @brief Function delete all entries in integrated list.
170 /// 396 ///
171 /// 397 ///
@@ -209,6 +435,34 @@ namespace gui
209 //========================================================================== 435 //==========================================================================
210 /// 436 ///
211 /// \ingroup cpp_kodi_gui_CWindow 437 /// \ingroup cpp_kodi_gui_CWindow
438 /// @brief Remove list item on position.
439 ///
440 /// @param[in] itemPosition List position to remove
441 ///
442 ///
443 void RemoveListItem(int itemPosition)
444 {
445 m_interface->kodi_gui->window->remove_list_item_from_position(m_interface->kodiBase, m_controlHandle, itemPosition);
446 }
447 //--------------------------------------------------------------------------
448
449 //==========================================================================
450 ///
451 /// \ingroup cpp_kodi_gui_CWindow
452 /// @brief Remove item with given control class from list.
453 ///
454 /// @param[in] item List item control class to remove
455 ///
456 ///
457 void RemoveListItem(ListItemPtr item)
458 {
459 m_interface->kodi_gui->window->remove_list_item(m_interface->kodiBase, m_controlHandle, item->m_controlHandle);
460 }
461 //--------------------------------------------------------------------------
462
463 //==========================================================================
464 ///
465 /// \ingroup cpp_kodi_gui_CWindow
212 /// @brief To get list item control class on wanted position. 466 /// @brief To get list item control class on wanted position.
213 /// 467 ///
214 /// @param[in] listPos Position from where control is needed 468 /// @param[in] listPos Position from where control is needed
@@ -227,6 +481,135 @@ namespace gui
227 //-------------------------------------------------------------------------- 481 //--------------------------------------------------------------------------
228 482
229 //========================================================================== 483 //==========================================================================
484 ///
485 /// \ingroup cpp_kodi_gui_CWindow
486 /// @brief To set position of selected part in list.
487 ///
488 /// @param[in] listPos Position to use
489 ///
490 ///
491 void SetCurrentListPosition(int listPos)
492 {
493 m_interface->kodi_gui->window->set_current_list_position(m_interface->kodiBase, m_controlHandle, listPos);
494 }
495 //--------------------------------------------------------------------------
496
497 //==========================================================================
498 ///
499 /// \ingroup cpp_kodi_gui_CWindow
500 /// @brief To get current selected position in list
501 ///
502 /// @return Current list position
503 ///
504 ///
505 int GetCurrentListPosition()
506 {
507 return m_interface->kodi_gui->window->get_current_list_position(m_interface->kodiBase, m_controlHandle);
508 }
509 //--------------------------------------------------------------------------
510
511 //==========================================================================
512 ///
513 /// \ingroup cpp_kodi_gui_CWindow
514 /// @brief To get the amount of entries in the list.
515 ///
516 /// @return Size of in window integrated control class
517 ///
518 ///
519 int GetListSize()
520 {
521 return m_interface->kodi_gui->window->get_list_size(m_interface->kodiBase, m_controlHandle);
522 }
523 //--------------------------------------------------------------------------
524
525 //==========================================================================
526 ///
527 /// \ingroup cpp_kodi_gui_CWindow
528 /// @brief Sets a container property, similar to an infolabel.
529 ///
530 /// @param[in] key string - property name.
531 /// @param[in] value string or unicode - value of property.
532 ///
533 /// @note Key is NOT case sensitive.\n
534 /// You can use the above as keywords for arguments and skip certain
535 /// optional arguments.\n
536 /// Once you use a keyword, all following arguments require the keyword.
537 ///
538 ///
539 void SetContainerProperty(const std::string& key, const std::string& value)
540 {
541 m_interface->kodi_gui->window->set_container_property(m_interface->kodiBase, m_controlHandle, key.c_str(), value.c_str());
542 }
543 //--------------------------------------------------------------------------
544
545 //==========================================================================
546 ///
547 /// \ingroup cpp_kodi_gui_CWindow
548 /// @brief Sets the content type of the container.
549 ///
550 /// @param[in] value string or unicode - content value.
551 ///
552 /// __Available content types__
553 /// | Name | Media |
554 /// |:-----------:|:-----------------------------------------|
555 /// | actors | Videos
556 /// | addons | Addons, Music, Pictures, Programs, Videos
557 /// | albums | Music, Videos
558 /// | artists | Music, Videos
559 /// | countries | Music, Videos
560 /// | directors | Videos
561 /// | files | Music, Videos
562 /// | games | Games
563 /// | genres | Music, Videos
564 /// | images | Pictures
565 /// | mixed | Music, Videos
566 /// | movies | Videos
567 /// | Musicvideos | Music, Videos
568 /// | playlists | Music, Videos
569 /// | seasons | Videos
570 /// | sets | Videos
571 /// | songs | Music
572 /// | studios | Music, Videos
573 /// | tags | Music, Videos
574 /// | tvshows | Videos
575 /// | videos | Videos
576 /// | years | Music, Videos
577 ///
578 ///
579 void SetContainerContent(const std::string& value)
580 {
581 m_interface->kodi_gui->window->set_container_content(m_interface->kodiBase, m_controlHandle, value.c_str());
582 }
583 //--------------------------------------------------------------------------
584
585 //==========================================================================
586 ///
587 /// \ingroup cpp_kodi_gui_CWindow
588 /// @brief Get the id of the currently visible container.
589 ///
590 /// @return currently visible container id
591 ///
592 ///
593 int GetCurrentContainerId()
594 {
595 return m_interface->kodi_gui->window->get_current_container_id(m_interface->kodiBase, m_controlHandle);
596 }
597 //--------------------------------------------------------------------------
598 //@}
599
600 //==========================================================================
601 ///
602 /// \ingroup cpp_kodi_gui_CWindow
603 /// @brief To inform Kodi that it need to render region new.
604 ///
605 ///
606 void MarkDirtyRegion()
607 {
608 return m_interface->kodi_gui->window->mark_dirty_region(m_interface->kodiBase, m_controlHandle);
609 }
610 //--------------------------------------------------------------------------
611
612 //==========================================================================
230 // 613 //
231 /// @defgroup cpp_kodi_gui_CWindow_callbacks Callback functions from Kodi to add-on 614 /// @defgroup cpp_kodi_gui_CWindow_callbacks Callback functions from Kodi to add-on
232 /// \ingroup cpp_kodi_gui_CWindow 615 /// \ingroup cpp_kodi_gui_CWindow
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
new file mode 100644
index 0000000..5892d24
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Button.h
@@ -0,0 +1,176 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CButton Control Button
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CButton }
37 /// **Standard push button control for window**
38 ///
39 /// The button control is used for creating push buttons in Kodi. You can
40 /// choose the position, size, and look of the button, as well as choosing
41 /// what action(s) should be performed when pushed.
42 ///
43 /// It has the header \ref Button.h "#include <kodi/gui/controls/Button.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref skin_Button_control "button control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CButton : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// @ingroup cpp_kodi_gui_control_CButton
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CButton(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CButton can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// @ingroup cpp_kodi_gui_control_CButton
74 /// @brief Destructor
75 ///
76 ~CButton() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// @ingroup cpp_kodi_gui_control_CButton
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// @ingroup cpp_kodi_gui_control_CButton
95 /// @brief Set's the control's enabled/disabled state
96 ///
97 /// @param[in] enabled If true enabled, otherwise disabled
98 ///
99 void SetEnabled(bool enabled)
100 {
101 m_interface->kodi_gui->control_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// @ingroup cpp_kodi_gui_control_CButton
108 /// @brief To set the text string on button
109 ///
110 /// @param[in] label Text to show
111 ///
112 void SetLabel(const std::string& label)
113 {
114 m_interface->kodi_gui->control_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
115 }
116 //--------------------------------------------------------------------------
117
118 //==========================================================================
119 ///
120 /// @ingroup cpp_kodi_gui_control_CButton
121 /// @brief Get the used text from button
122 ///
123 /// @return Text shown
124 ///
125 std::string GetLabel() const
126 {
127 std::string label;
128 char* ret = m_interface->kodi_gui->control_button->get_label(m_interface->kodiBase, m_controlHandle);
129 if (ret != nullptr)
130 {
131 if (std::strlen(ret))
132 label = ret;
133 m_interface->free_string(m_interface->kodiBase, ret);
134 }
135 return label;
136 }
137 //--------------------------------------------------------------------------
138
139 //==========================================================================
140 ///
141 /// @ingroup cpp_kodi_gui_control_CButton
142 /// @brief If two labels are used for button becomes it set with them
143 ///
144 /// @param[in] label Text for second label
145 ///
146 void SetLabel2(const std::string& label)
147 {
148 m_interface->kodi_gui->control_button->set_label2(m_interface->kodiBase, m_controlHandle, label.c_str());
149 }
150 //--------------------------------------------------------------------------
151
152 //==========================================================================
153 ///
154 /// @ingroup cpp_kodi_gui_control_CButton
155 /// @brief Get the second label if present
156 ///
157 /// @return Second label
158 ///
159 std::string GetLabel2() const
160 {
161 std::string label;
162 char* ret = m_interface->kodi_gui->control_button->get_label2(m_interface->kodiBase, m_controlHandle);
163 if (ret != nullptr)
164 {
165 if (std::strlen(ret))
166 label = ret;
167 m_interface->free_string(m_interface->kodiBase, ret);
168 }
169 return label;
170 }
171 //--------------------------------------------------------------------------
172 };
173
174} /* namespace controls */
175} /* namespace gui */
176} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
new file mode 100644
index 0000000..83eeede
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Edit.h
@@ -0,0 +1,276 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CEdit Control Edit
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CEdit }
37 /// **Editable window text control used as an input control for the osd keyboard
38 /// and other input fields**
39 ///
40 /// The edit control allows a user to input text in Kodi. You can choose the
41 /// font, size, colour, location and header of the text to be displayed.
42 ///
43 /// It has the header \ref Edit.h "#include <kodi/gui/controls/Edit.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref skin_Edit_control
47 /// "edit control".
48 ///
49 /// @note The call of the control is only possible from the corresponding
50 /// window as its class and identification number is required.
51 ///
52
53 //============================================================================
54 // see gui/definition.h for use of group "cpp_kodi_gui_controls_CEdit_Defs"
55 ///
56 /// \defgroup cpp_kodi_gui_controls_CEdit_Defs Definitions, structures and enumerators
57 /// \ingroup cpp_kodi_gui_controls_CEdit
58 /// @brief **Library definition values**
59 ///
60
61} /* namespace controls */
62} /* namespace gui */
63} /* namespace kodi */
64
65//============================================================================
66///
67/// \ingroup cpp_kodi_gui_controls_CEdit_Defs
68/// @{
69/// @anchor AddonGUIInputType
70/// @brief Text input types used on kodi::gui::controls::CEdit
71enum AddonGUIInputType
72{
73 /// Text inside edit control only readable
74 ADDON_INPUT_TYPE_READONLY = -1,
75 /// Normal text entries
76 ADDON_INPUT_TYPE_TEXT = 0,
77 /// To use on edit control only numeric numbers
78 ADDON_INPUT_TYPE_NUMBER,
79 /// To insert seconds
80 ADDON_INPUT_TYPE_SECONDS,
81 /// To insert time
82 ADDON_INPUT_TYPE_TIME,
83 /// To insert a date
84 ADDON_INPUT_TYPE_DATE,
85 /// Used for write in IP addresses
86 ADDON_INPUT_TYPE_IPADDRESS,
87 /// Text field used as password entry field with not visible text
88 ADDON_INPUT_TYPE_PASSWORD,
89 /// Text field used as password entry field with not visible text but
90 /// returned as MD5 value
91 ADDON_INPUT_TYPE_PASSWORD_MD5,
92 /// Use text field for search purpose
93 ADDON_INPUT_TYPE_SEARCH,
94 /// Text field as filter
95 ADDON_INPUT_TYPE_FILTER,
96 ///
97 ADDON_INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW
98};
99/// @}
100//----------------------------------------------------------------------------
101
102namespace kodi
103{
104namespace gui
105{
106namespace controls
107{
108
109 class CEdit : public CAddonGUIControlBase
110 {
111 public:
112 //==========================================================================
113 ///
114 /// \ingroup cpp_kodi_gui_controls_CEdit
115 /// @brief Construct a new control
116 ///
117 /// @param[in] window related window control class
118 /// @param[in] controlId Used skin xml control id
119 ///
120 CEdit(CWindow* window, int controlId)
121 : CAddonGUIControlBase(window)
122 {
123 m_controlHandle = m_interface->kodi_gui->window->get_control_edit(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
124 if (!m_controlHandle)
125 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::control::CEdit can't create control class from Kodi !!!");
126 }
127 //--------------------------------------------------------------------------
128
129 //==========================================================================
130 ///
131 /// \ingroup cpp_kodi_gui_controls_CEdit
132 /// @brief Destructor
133 ///
134 ~CEdit() override = default;
135 //--------------------------------------------------------------------------
136
137 //==========================================================================
138 ///
139 /// \ingroup cpp_kodi_gui_controls_CEdit
140 /// @brief Set the control on window to visible
141 ///
142 /// @param[in] visible If true visible, otherwise hidden
143 ///
144 void SetVisible(bool visible)
145 {
146 m_interface->kodi_gui->control_edit->set_visible(m_interface->kodiBase, m_controlHandle, visible);
147 }
148 //--------------------------------------------------------------------------
149
150 //==========================================================================
151 ///
152 /// \ingroup cpp_kodi_gui_controls_CEdit
153 /// @brief Set's the control's enabled/disabled state
154 ///
155 /// @param[in] enabled If true enabled, otherwise disabled
156 ///
157 void SetEnabled(bool enabled)
158 {
159 m_interface->kodi_gui->control_edit->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
160 }
161 //--------------------------------------------------------------------------
162
163 //==========================================================================
164 ///
165 /// \ingroup cpp_kodi_gui_controls_CEdit
166 /// @brief To set the text string on edit control
167 ///
168 /// @param[in] label Text to show
169 ///
170 void SetLabel(const std::string& label)
171 {
172 m_interface->kodi_gui->control_edit->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
173 }
174 //--------------------------------------------------------------------------
175
176 //==========================================================================
177 ///
178 /// \ingroup cpp_kodi_gui_controls_CEdit
179 /// @brief Returns the text heading for this edit control.
180 ///
181 /// @return Heading text
182 ///
183 std::string GetLabel() const
184 {
185 std::string label;
186 char* ret = m_interface->kodi_gui->control_edit->get_label(m_interface->kodiBase, m_controlHandle);
187 if (ret != nullptr)
188 {
189 if (std::strlen(ret))
190 label = ret;
191 m_interface->free_string(m_interface->kodiBase, ret);
192 }
193 return label;
194 }
195 //--------------------------------------------------------------------------
196
197 //==========================================================================
198 ///
199 /// \ingroup cpp_kodi_gui_controls_CEdit
200 /// @brief Set's text heading for this edit control.
201 ///
202 /// @param[in] text string or unicode - text string.
203 ///
204 void SetText(const std::string& text)
205 {
206 m_interface->kodi_gui->control_edit->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
207 }
208 //--------------------------------------------------------------------------
209
210 //==========================================================================
211 ///
212 /// \ingroup cpp_kodi_gui_controls_CEdit
213 /// @brief Returns the text value for this edit control.
214 ///
215 /// @return Text value of control
216 ///
217 std::string GetText() const
218 {
219 std::string text;
220 char* ret = m_interface->kodi_gui->control_edit->get_text(m_interface->kodiBase, m_controlHandle);
221 if (ret != nullptr)
222 {
223 if (std::strlen(ret))
224 text = ret;
225 m_interface->free_string(m_interface->kodiBase, ret);
226 }
227 return text;
228 }
229 //--------------------------------------------------------------------------
230
231 //==========================================================================
232 ///
233 /// \ingroup cpp_kodi_gui_controls_CEdit
234 /// @brief Set the cursor position on text.
235 ///
236 /// @param[in] iPosition The position to set
237 ///
238 void SetCursorPosition(unsigned int iPosition)
239 {
240 m_interface->kodi_gui->control_edit->set_cursor_position(m_interface->kodiBase, m_controlHandle, iPosition);
241 }
242 //--------------------------------------------------------------------------
243
244 //==========================================================================
245 ///
246 /// \ingroup cpp_kodi_gui_controls_CEdit
247 /// @brief To get current cursor position on text field
248 ///
249 /// @return The current cursor position
250 ///
251 unsigned int GetCursorPosition()
252 {
253 return m_interface->kodi_gui->control_edit->get_cursor_position(m_interface->kodiBase, m_controlHandle);
254 }
255 //--------------------------------------------------------------------------
256
257 //==========================================================================
258 ///
259 /// \ingroup cpp_kodi_gui_controls_CEdit
260 /// @brief To set field input type which are defined on \ref AddonGUIInputType
261 ///
262 /// @param[in] type The \ref AddonGUIInputType "Add-on input type"
263 /// to use
264 /// @param[in] heading The heading text for related keyboard
265 /// dialog
266 ///
267 void SetInputType(AddonGUIInputType type, const std::string& heading)
268 {
269 m_interface->kodi_gui->control_edit->set_input_type(m_interface->kodiBase, m_controlHandle, static_cast<int>(type), heading.c_str());
270 }
271 //--------------------------------------------------------------------------
272 };
273
274} /* namespace controls */
275} /* namespace gui */
276} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
new file mode 100644
index 0000000..82d17ff
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/FadeLabel.h
@@ -0,0 +1,159 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CFadeLabel Control Fade Label
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CFadeLabel }
37 /// **Window control used to show multiple pieces of text in the same position,
38 /// by fading from one to the other**
39 ///
40 /// The fade label control is used for displaying multiple pieces of text in
41 /// the same space in Kodi. You can choose the font, size, colour, location
42 /// and contents of the text to be displayed. The first piece of information
43 /// to display fades in over 50 frames, then scrolls off to the left. Once it
44 /// is finished scrolling off screen, the second piece of information fades
45 /// in and the process repeats. A fade label control is not supported in a
46 /// list container.
47 ///
48 /// It has the header \ref FadeLabel.h "#include <kodi/gui/controls/FadeLabel.h>"
49 /// be included to enjoy it.
50 ///
51 /// Here you find the needed skin part for a \ref Fade_Label_Control "fade label control"
52 ///
53 /// @note The call of the control is only possible from the corresponding
54 /// window as its class and identification number is required.
55 ///
56 class CFadeLabel : public CAddonGUIControlBase
57 {
58 public:
59 //==========================================================================
60 ///
61 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
62 /// @brief Construct a new control.
63 ///
64 /// @param[in] window related window control class
65 /// @param[in] controlId Used skin xml control id
66 ///
67 CFadeLabel(CWindow* window, int controlId)
68 : CAddonGUIControlBase(window)
69 {
70 m_controlHandle = m_interface->kodi_gui->window->get_control_fade_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
71 if (!m_controlHandle)
72 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CFadeLabel can't create control class from Kodi !!!");
73 }
74 //--------------------------------------------------------------------------
75
76 //==========================================================================
77 ///
78 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
79 /// @brief Destructor.
80 ///
81 ~CFadeLabel() override = default;
82 //--------------------------------------------------------------------------
83
84 //==========================================================================
85 ///
86 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
87 /// @brief Set the control on window to visible.
88 ///
89 /// @param[in] visible If true visible, otherwise hidden
90 ///
91 void SetVisible(bool visible)
92 {
93 m_interface->kodi_gui->control_fade_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
100 /// @brief To add additional text string on fade label.
101 ///
102 /// @param[in] label Text to show
103 ///
104 void AddLabel(const std::string& label)
105 {
106 m_interface->kodi_gui->control_fade_label->add_label(m_interface->kodiBase, m_controlHandle, label.c_str());
107 }
108 //--------------------------------------------------------------------------
109
110 //==========================================================================
111 ///
112 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
113 /// @brief Get the used text from button
114 ///
115 /// @return Text shown
116 ///
117 std::string GetLabel() const
118 {
119 std::string label;
120 char* ret = m_interface->kodi_gui->control_fade_label->get_label(m_interface->kodiBase, m_controlHandle);
121 if (ret != nullptr)
122 {
123 if (std::strlen(ret))
124 label = ret;
125 m_interface->free_string(m_interface->kodiBase, ret);
126 }
127 return label;
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
134 /// @brief To enable or disable scrolling on fade label
135 ///
136 /// @param[in] scroll To enable scrolling set to true, otherwise is
137 /// disabled
138 ///
139 void SetScrolling(bool scroll)
140 {
141 m_interface->kodi_gui->control_fade_label->set_scrolling(m_interface->kodiBase, m_controlHandle, scroll);
142 }
143 //--------------------------------------------------------------------------
144
145 //==========================================================================
146 ///
147 /// \ingroup cpp_kodi_gui_controls_CFadeLabel
148 /// @brief To reset al inserted labels.
149 ///
150 void Reset()
151 {
152 m_interface->kodi_gui->control_fade_label->reset(m_interface->kodiBase, m_controlHandle);
153 }
154 //--------------------------------------------------------------------------
155 };
156
157} /* namespace controls */
158} /* namespace gui */
159} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
new file mode 100644
index 0000000..1179fab
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Image.h
@@ -0,0 +1,123 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CImage Control Image
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CImage }
37 /// **Window control used to show an image.**
38 ///
39 /// The image control is used for displaying images in Kodi. You can choose
40 /// the position, size, transparency and contents of the image to be displayed.
41 ///
42 /// It has the header \ref Image.h "#include <kodi/gui/controls/Image.h>"
43 /// be included to enjoy it.
44 ///
45 /// Here you find the needed skin part for a \ref Image_Control "image control"
46 ///
47 /// @note The call of the control is only possible from the corresponding
48 /// window as its class and identification number is required.
49 ///
50 class CImage : public CAddonGUIControlBase
51 {
52 public:
53 //==========================================================================
54 ///
55 /// \ingroup cpp_kodi_gui_controls_CImage
56 /// @brief Construct a new control
57 ///
58 /// @param[in] window related window control class
59 /// @param[in] controlId Used skin xml control id
60 ///
61 CImage(CWindow* window, int controlId)
62 : CAddonGUIControlBase(window)
63 {
64 m_controlHandle = m_interface->kodi_gui->window->get_control_image(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
65 if (!m_controlHandle)
66 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CImage can't create control class from Kodi !!!");
67 }
68 //--------------------------------------------------------------------------
69
70 //==========================================================================
71 ///
72 /// \ingroup cpp_kodi_gui_controls_CImage
73 /// @brief Destructor
74 ///
75 ~CImage() override = default;
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CImage
81 /// @brief Set the control on window to visible
82 ///
83 /// @param[in] visible If true visible, otherwise hidden
84 ///
85 void SetVisible(bool visible)
86 {
87 m_interface->kodi_gui->control_image->set_visible(m_interface->kodiBase, m_controlHandle, visible);
88 }
89 //--------------------------------------------------------------------------
90
91 //==========================================================================
92 ///
93 /// \ingroup cpp_kodi_gui_controls_CImage
94 /// @brief To set the filename used on image control.
95 ///
96 /// @param[in] filename Image file to use
97 /// @param[in] useCache To define storage of image, default is
98 /// in cache, if false becomes it loaded
99 /// always on changes again
100 ///
101 void SetFileName(const std::string& filename, bool useCache = true)
102 {
103 m_interface->kodi_gui->control_image->set_filename(m_interface->kodiBase, m_controlHandle, filename.c_str(), useCache);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CImage
110 /// @brief To set set the diffuse color on image.
111 ///
112 /// @param[in] colorDiffuse Color to use for diffuse
113 ///
114 void SetColorDiffuse(uint32_t colorDiffuse)
115 {
116 m_interface->kodi_gui->control_image->set_color_diffuse(m_interface->kodiBase, m_controlHandle, colorDiffuse);
117 }
118 //--------------------------------------------------------------------------
119 };
120
121} /* namespace controls */
122} /* namespace gui */
123} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
new file mode 100644
index 0000000..f74ac03
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Label.h
@@ -0,0 +1,128 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CLabel Control Label
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CLabel }
37 /// **Window control used to show some lines of text.**
38 ///
39 /// The label control is used for displaying text in Kodi. You can choose
40 /// the font, size, colour, location and contents of the text to be displayed.
41 ///
42 /// It has the header \ref Label.h "#include <kodi/gui/controls/Label.h>"
43 /// be included to enjoy it.
44 ///
45 /// Here you find the needed skin part for a \ref Label_Control "label control"
46 ///
47 /// @note The call of the control is only possible from the corresponding
48 /// window as its class and identification number is required.
49 ///
50 class CLabel : public CAddonGUIControlBase
51 {
52 public:
53 //==========================================================================
54 ///
55 /// \ingroup cpp_kodi_gui_controls_CLabel
56 /// @brief Construct a new control
57 ///
58 /// @param[in] window related window control class
59 /// @param[in] controlId Used skin xml control id
60 ///
61 CLabel(CWindow* window, int controlId)
62 : CAddonGUIControlBase(window)
63 {
64 m_controlHandle = m_interface->kodi_gui->window->get_control_label(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
65 if (!m_controlHandle)
66 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CLabel can't create control class from Kodi !!!");
67 }
68 //--------------------------------------------------------------------------
69
70 //==========================================================================
71 ///
72 /// \ingroup cpp_kodi_gui_controls_CLabel
73 /// @brief Destructor
74 ///
75 ~CLabel() override = default;
76 //--------------------------------------------------------------------------
77
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CLabel
81 /// @brief Set the control on window to visible
82 ///
83 /// @param[in] visible If true visible, otherwise hidden
84 ///
85 void SetVisible(bool visible)
86 {
87 m_interface->kodi_gui->control_label->set_visible(m_interface->kodiBase, m_controlHandle, visible);
88 }
89 //--------------------------------------------------------------------------
90
91 //==========================================================================
92 ///
93 /// \ingroup cpp_kodi_gui_controls_CLabel
94 /// @brief To set the text string on label
95 ///
96 /// @param[in] text Text to show
97 ///
98 void SetLabel(const std::string& text)
99 {
100 m_interface->kodi_gui->control_label->set_label(m_interface->kodiBase, m_controlHandle, text.c_str());
101 }
102 //--------------------------------------------------------------------------
103
104 //==========================================================================
105 ///
106 /// \ingroup cpp_kodi_gui_controls_CLabel
107 /// @brief Get the used text from control
108 ///
109 /// @return Used text on label control
110 ///
111 std::string GetLabel() const
112 {
113 std::string label;
114 char* ret = m_interface->kodi_gui->control_label->get_label(m_interface->kodiBase, m_controlHandle);
115 if (ret != nullptr)
116 {
117 if (std::strlen(ret))
118 label = ret;
119 m_interface->free_string(m_interface->kodiBase, ret);
120 }
121 return label;
122 }
123 //--------------------------------------------------------------------------
124 };
125
126} /* namespace controls */
127} /* namespace gui */
128} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
new file mode 100644
index 0000000..44310ed
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Progress.h
@@ -0,0 +1,121 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CProgress Control Progress
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CProgress }
37 /// **Window control to show the progress of a particular operation**
38 ///
39 /// The progress control is used to show the progress of an item that may take
40 /// a long time, or to show how far through a movie you are. You can choose
41 /// the position, size, and look of the progress control.
42 ///
43 /// It has the header \ref Progress.h "#include <kodi/gui/controls/Progress.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Progress_Control "progress control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CProgress : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CProgress
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CProgress(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_progress(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CProgress can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CProgress
74 /// @brief Destructor
75 ///
76 ~CProgress() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CProgress
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_progress->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CProgress
95 /// @brief To set Percent position of control
96 ///
97 /// @param[in] percent The percent position to use
98 ///
99 void SetPercentage(float percent)
100 {
101 m_interface->kodi_gui->control_progress->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// \ingroup cpp_kodi_gui_controls_CProgress
108 /// @brief Get the active percent position of progress bar
109 ///
110 /// @return Progress position as percent
111 ///
112 float GetPercentage() const
113 {
114 return m_interface->kodi_gui->control_progress->get_percentage(m_interface->kodiBase, m_controlHandle);
115 }
116 //--------------------------------------------------------------------------
117 };
118
119} /* namespace controls */
120} /* namespace gui */
121} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
new file mode 100644
index 0000000..b87920d
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/RadioButton.h
@@ -0,0 +1,171 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CRadioButton Control Radio Button
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CRadioButton }
37 /// **Window control for a radio button (as used for on/off settings)**
38 ///
39 /// The radio button control is used for creating push button on/off settings
40 /// in Kodi. You can choose the position, size, and look of the button. When
41 /// the user clicks on the radio button, the state will change, toggling the
42 /// extra textures (textureradioon and textureradiooff). Used for settings
43 /// controls.
44 ///
45 /// It has the header \ref RadioButton.h "#include <kodi/gui/controls/RadioButton.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Radio_button_control "radio button control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53 class CRadioButton : public CAddonGUIControlBase
54 {
55 public:
56 //==========================================================================
57 ///
58 /// \ingroup cpp_kodi_gui_controls_CRadioButton
59 /// @brief Construct a new control
60 ///
61 /// @param[in] window related window control class
62 /// @param[in] controlId Used skin xml control id
63 ///
64 CRadioButton(CWindow* window, int controlId)
65 : CAddonGUIControlBase(window)
66 {
67 m_controlHandle = m_interface->kodi_gui->window->get_control_radio_button(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
68 if (!m_controlHandle)
69 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CRadioButton can't create control class from Kodi !!!");
70 }
71 //--------------------------------------------------------------------------
72
73 //==========================================================================
74 ///
75 /// \ingroup cpp_kodi_gui_controls_CRadioButton
76 /// @brief Destructor
77 ///
78 ~CRadioButton() override = default;
79 //--------------------------------------------------------------------------
80
81 //==========================================================================
82 ///
83 /// \ingroup cpp_kodi_gui_controls_CRadioButton
84 /// @brief Set the control on window to visible
85 ///
86 /// @param[in] visible If true visible, otherwise hidden
87 ///
88 void SetVisible(bool visible)
89 {
90 m_interface->kodi_gui->control_radio_button->set_visible(m_interface->kodiBase, m_controlHandle, visible);
91 }
92 //--------------------------------------------------------------------------
93
94 //==========================================================================
95 ///
96 /// \ingroup cpp_kodi_gui_controls_CRadioButton
97 /// @brief Set's the control's enabled/disabled state
98 ///
99 /// @param[in] enabled If true enabled, otherwise disabled
100 ///
101 void SetEnabled(bool enabled)
102 {
103 m_interface->kodi_gui->control_radio_button->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CRadioButton
110 /// @brief To set the text string on radio button
111 ///
112 /// @param[in] label Text to show
113 ///
114 void SetLabel(const std::string& label)
115 {
116 m_interface->kodi_gui->control_radio_button->set_label(m_interface->kodiBase, m_controlHandle, label.c_str());
117 }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CRadioButton
123 /// @brief Get the used text from control
124 ///
125 /// @return Text shown
126 ///
127 std::string GetLabel() const
128 {
129 std::string label;
130 char* ret = m_interface->kodi_gui->control_radio_button->get_label(m_interface->kodiBase, m_controlHandle);
131 if (ret != nullptr)
132 {
133 if (std::strlen(ret))
134 label = ret;
135 m_interface->free_string(m_interface->kodiBase, ret);
136 }
137 return label;
138 }
139 //--------------------------------------------------------------------------
140
141 //==========================================================================
142 ///
143 /// \ingroup cpp_kodi_gui_controls_CRadioButton
144 /// @brief To set radio button condition to on or off
145 ///
146 /// @param[in] selected true set radio button to selection on, otherwise
147 /// off
148 ///
149 void SetSelected(bool selected)
150 {
151 m_interface->kodi_gui->control_radio_button->set_selected(m_interface->kodiBase, m_controlHandle, selected);
152 }
153 //--------------------------------------------------------------------------
154
155 //==========================================================================
156 ///
157 /// \ingroup cpp_kodi_gui_controls_CRadioButton
158 /// @brief Get the current selected condition of radio button
159 ///
160 /// @return Selected condition
161 ///
162 bool IsSelected() const
163 {
164 return m_interface->kodi_gui->control_radio_button->is_selected(m_interface->kodiBase, m_controlHandle);
165 }
166 //--------------------------------------------------------------------------
167 };
168
169} /* namespace controls */
170} /* namespace gui */
171} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
new file mode 100644
index 0000000..f80fcfa
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Rendering.h
@@ -0,0 +1,215 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CRendering Control Rendering
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CRendering }
37 /// **Window control for rendering own parts**
38 ///
39 /// This rendering control is used when own parts are needed. You have the
40 /// control over them to render direct OpenGL or DirectX content to the
41 /// screen set by the size of them.
42 ///
43 /// Alternative can be the virtual functions from t his been ignored if the
44 /// callbacks are defined by the \ref CRendering_SetIndependentCallbacks function and
45 /// class is used as single and not as a parent class.
46 ///
47 /// It has the header \ref Rendering.h "#include <kodi/gui/controls/Rendering.h>"
48 /// be included to enjoy it.
49 ///
50 /// Here you find the needed skin part for a \ref Addon_Rendering_control "rendering control"
51 ///
52 /// @note The call of the control is only possible from the corresponding
53 /// window as its class and identification number is required.
54 ///
55
56 //============================================================================
57 ///
58 /// \defgroup cpp_kodi_gui_controls_CRendering_Defs Definitions, structures and enumerators
59 /// \ingroup cpp_kodi_gui_controls_CRendering
60 /// @brief **Library definition values**
61 ///
62
63 class CRendering : public CAddonGUIControlBase
64 {
65 public:
66 //==========================================================================
67 ///
68 /// \ingroup cpp_kodi_gui_controls_CRendering
69 /// @brief Construct a new control
70 ///
71 /// @param[in] window related window control class
72 /// @param[in] controlId Used skin xml control id
73 ///
74 CRendering(CWindow* window, int controlId)
75 : CAddonGUIControlBase(window)
76 {
77 m_controlHandle = m_interface->kodi_gui->window->get_control_render_addon(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
78 if (m_controlHandle)
79 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, this,
80 OnCreateCB, OnRenderCB, OnStopCB, OnDirtyCB);
81 else
82 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::%s can't create control class from Kodi !!!", __FUNCTION__);
83 }
84 //--------------------------------------------------------------------------
85
86 //==========================================================================
87 ///
88 /// \ingroup cpp_kodi_gui_controls_CRendering
89 /// @brief Destructor
90 ///
91 ~CRendering() override
92 {
93 m_interface->kodi_gui->control_rendering->destroy(m_interface->kodiBase, m_controlHandle);
94 }
95 //--------------------------------------------------------------------------
96
97 //==========================================================================
98 ///
99 /// \ingroup cpp_kodi_gui_controls_CRendering
100 /// @brief To create rendering control on Add-on
101 ///
102 /// Function creates the needed rendering control for Kodi which becomes
103 /// handled and processed from Add-on
104 ///
105 /// @note This is callback function from Kodi to Add-on and not to use
106 /// for calls from add-on to this function.
107 ///
108 /// @param[in] x Horizontal position
109 /// @param[in] y Vertical position
110 /// @param[in] w Width of control
111 /// @param[in] h Height of control
112 /// @param[in] device The device to use. For OpenGL is empty
113 /// on Direct X is the needed device send.
114 /// @return Add-on needs to return true if successed,
115 /// otherwise false.
116 ///
117 virtual bool Create(int x, int y, int w, int h, void* device) { return false; }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CRendering
123 /// @brief Render process call from Kodi
124 ///
125 /// @note This is callback function from Kodi to Add-on and not to use
126 /// for calls from add-on to this function.
127 ///
128 virtual void Render() { }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CRendering
134 /// @brief Call from Kodi to stop rendering process
135 ///
136 /// @note This is callback function from Kodi to Add-on and not to use
137 /// for calls from add-on to this function.
138 ///
139 virtual void Stop() { }
140 //--------------------------------------------------------------------------
141
142 //==========================================================================
143 ///
144 /// \ingroup cpp_kodi_gui_controls_CRendering
145 /// @brief Call from Kodi where add-on becomes asked about dirty rendering
146 /// region.
147 ///
148 /// @note This is callback function from Kodi to Add-on and not to use
149 /// for calls from add-on to this function.
150 ///
151 virtual bool Dirty() { return false; }
152 //--------------------------------------------------------------------------
153
154 //==========================================================================
155 ///
156 /// \ingroup cpp_kodi_gui_controls_CRendering
157 /// \anchor CRendering_SetIndependentCallbacks
158 /// @brief If the class is used independent (with "new CRendering")
159 /// and not as parent (with "cCLASS_own : CRendering") from own must
160 /// be the callback from Kodi to add-on overdriven with own functions!
161 ///
162 void SetIndependentCallbacks(
163 GUIHANDLE cbhdl,
164 bool (*CBCreate)(GUIHANDLE cbhdl,
165 int x,
166 int y,
167 int w,
168 int h,
169 void* device),
170 void (*CBRender)(GUIHANDLE cbhdl),
171 void (*CBStop) (GUIHANDLE cbhdl),
172 bool (*CBDirty) (GUIHANDLE cbhdl))
173 {
174 if (!cbhdl ||
175 !CBCreate || !CBRender || !CBStop || !CBDirty)
176 {
177 kodi::Log(ADDON_LOG_ERROR, "kodi::gui::controls::%s called with nullptr !!!", __FUNCTION__);
178 return;
179 }
180
181 m_interface->kodi_gui->control_rendering->set_callbacks(m_interface->kodiBase, m_controlHandle, cbhdl,
182 CBCreate, CBRender, CBStop, CBDirty);
183 }
184 //--------------------------------------------------------------------------
185
186 private:
187 /*
188 * Defined callback functions from Kodi to add-on, for use in parent / child system
189 * (is private)!
190 */
191 static bool OnCreateCB(void* cbhdl, int x, int y, int w, int h, void* device)
192 {
193 return static_cast<CRendering*>(cbhdl)->Create(x, y, w, h, device);
194 }
195
196 static void OnRenderCB(void* cbhdl)
197 {
198 static_cast<CRendering*>(cbhdl)->Render();
199 }
200
201 static void OnStopCB(void* cbhdl)
202 {
203 static_cast<CRendering*>(cbhdl)->Stop();
204 }
205
206 static bool OnDirtyCB(void* cbhdl)
207 {
208 return static_cast<CRendering*>(cbhdl)->Dirty();
209 }
210
211 };
212
213} /* namespace controls */
214} /* namespace gui */
215} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
new file mode 100644
index 0000000..e51433a
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/SettingsSlider.h
@@ -0,0 +1,323 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSettingsSlider Control Settings Slider
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSettingsSlider }
37 /// **Window control for moveable slider with text name**
38 ///
39 /// The settings slider control is used in the settings screens for when an
40 /// option is best specified on a sliding scale. You can choose the position,
41 /// size, and look of the slider control. It is basically a cross between the
42 /// button control and a slider control. It has a label and focus and non
43 /// focus textures, as well as a slider control on the right.
44 ///
45 /// It has the header \ref SettingsSlider.h "#include <kodi/gui/controls/SettingsSlider.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Settings_Slider_Control "settings slider control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53 class CSettingsSlider : public CAddonGUIControlBase
54 {
55 public:
56 //==========================================================================
57 ///
58 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
59 /// @brief Construct a new control
60 ///
61 /// @param[in] window related window control class
62 /// @param[in] controlId Used skin xml control id
63 ///
64 CSettingsSlider(CWindow* window, int controlId)
65 : CAddonGUIControlBase(window)
66 {
67 m_controlHandle = m_interface->kodi_gui->window->get_control_settings_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
68 if (!m_controlHandle)
69 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSettingsSlider can't create control class from Kodi !!!");
70 }
71 //--------------------------------------------------------------------------
72
73 //==========================================================================
74 ///
75 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
76 /// @brief Destructor
77 ///
78 ~CSettingsSlider() override = default;
79 //--------------------------------------------------------------------------
80
81 //==========================================================================
82 ///
83 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
84 /// @brief Set the control on window to visible
85 ///
86 /// @param[in] visible If true visible, otherwise hidden
87 ///
88 void SetVisible(bool visible)
89 {
90 m_interface->kodi_gui->control_settings_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible);
91 }
92 //--------------------------------------------------------------------------
93
94 //==========================================================================
95 ///
96 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
97 /// @brief Set's the control's enabled/disabled state
98 ///
99 /// @param[in] enabled If true enabled, otherwise disabled
100 ///
101 void SetEnabled(bool enabled)
102 {
103 m_interface->kodi_gui->control_settings_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
104 }
105 //--------------------------------------------------------------------------
106
107 //==========================================================================
108 ///
109 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
110 /// @brief To set the text string on settings slider
111 ///
112 /// @param[in] text Text to show
113 ///
114 void SetText(const std::string& text)
115 {
116 m_interface->kodi_gui->control_settings_slider->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
117 }
118 //--------------------------------------------------------------------------
119
120 //==========================================================================
121 ///
122 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
123 /// @brief To reset slider on defaults
124 ///
125 void Reset()
126 {
127 m_interface->kodi_gui->control_settings_slider->reset(m_interface->kodiBase, m_controlHandle);
128 }
129 //--------------------------------------------------------------------------
130
131 //==========================================================================
132 ///
133 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
134 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
135 /// start and e.g. +10 is the from here defined position where it reach the
136 /// end.
137 ///
138 /// Ad default is the range from 0 to 100.
139 ///
140 /// The integer interval is as default 1 and can be changed with
141 /// @ref SetIntInterval.
142 ///
143 /// @param[in] start Integer start value
144 /// @param[in] end Integer end value
145 ///
146 /// @note Percent, floating point or integer are alone possible. Combining
147 /// these different values can be not together and can, therefore, only
148 /// one each can be used.
149 ///
150 void SetIntRange(int start, int end)
151 {
152 m_interface->kodi_gui->control_settings_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
153 }
154 //--------------------------------------------------------------------------
155
156 //==========================================================================
157 ///
158 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
159 /// @brief Set the slider position with the given integer value. The Range
160 /// must be defined with a call from \ref SetIntRange before.
161 ///
162 /// @param[in] value Position in range to set with integer
163 ///
164 /// @note Percent, floating point or integer are alone possible. Combining
165 /// these different values ​​can be not together and can, therefore, only
166 /// one each can be used.
167 ///
168 void SetIntValue(int value)
169 {
170 m_interface->kodi_gui->control_settings_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value);
171 }
172 //--------------------------------------------------------------------------
173
174 //==========================================================================
175 ///
176 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
177 /// @brief To get the current position as integer value.
178 ///
179 /// @return The position as integer
180 ///
181 /// @note Percent, floating point or integer are alone possible. Combining
182 /// these different values ​​can be not together and can, therefore, only
183 /// one each can be used.
184 ///
185 int GetIntValue() const
186 {
187 return m_interface->kodi_gui->control_settings_slider->get_int_value(m_interface->kodiBase, m_controlHandle);
188 }
189 //--------------------------------------------------------------------------
190
191 //==========================================================================
192 ///
193 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
194 /// @brief To set the interval steps of slider, as default is it 1. If it
195 /// becomes changed with this function will a step of the user with the
196 /// value fixed here be executed.
197 ///
198 /// @param[in] interval Intervall step to set.
199 ///
200 /// @note Percent, floating point or integer are alone possible. Combining
201 /// these different values ​​can be not together and can, therefore, only
202 /// one each can be used.
203 ///
204 void SetIntInterval(int interval)
205 {
206 m_interface->kodi_gui->control_settings_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval);
207 }
208 //--------------------------------------------------------------------------
209
210 //==========================================================================
211 ///
212 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
213 /// @brief Sets the percent of the slider.
214 ///
215 /// @param[in] percent float - Percent value of slide
216 ///
217 /// @note Percent, floating point or integer are alone possible. Combining
218 /// these different values ​​can be not together and can, therefore, only
219 /// one each can be used.
220 ///
221 void SetPercentage(float percent)
222 {
223 m_interface->kodi_gui->control_settings_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
224 }
225 //--------------------------------------------------------------------------
226
227 //==========================================================================
228 ///
229 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
230 /// @brief Returns a float of the percent of the slider.
231 ///
232 /// @return float - Percent of slider
233 ///
234 /// @note Percent, floating point or integer are alone possible. Combining
235 /// these different values ​​can be not together and can, therefore, only
236 /// one each can be used.
237 ///
238 float GetPercentage() const
239 {
240 return m_interface->kodi_gui->control_settings_slider->get_percentage(m_interface->kodiBase, m_controlHandle);
241 }
242 //--------------------------------------------------------------------------
243
244 //==========================================================================
245 ///
246 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
247 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
248 /// start and e.g. +25.0 is the from here defined position where it reach
249 /// the end.
250 ///
251 /// As default is the range 0.0 to 1.0.
252 ///
253 /// The float interval is as default 0.1 and can be changed with
254 /// @ref SetFloatInterval.
255 ///
256 /// @param[in] start Integer start value
257 /// @param[in] end Integer end value
258 ///
259 /// @note Percent, floating point or integer are alone possible. Combining
260 /// these different values ​​ can be not together and can, therefore, only
261 /// one each can be used.
262 ///
263 void SetFloatRange(float start, float end)
264 {
265 m_interface->kodi_gui->control_settings_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
266 }
267 //--------------------------------------------------------------------------
268
269 //==========================================================================
270 ///
271 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
272 /// @brief Set the slider position with the given float value. The Range
273 /// can be defined with a call from \ref SetIntRange before, as default it
274 /// is 0.0 to 1.0.
275 ///
276 /// @param[in] value Position in range to set with float
277 ///
278 /// @note Percent, floating point or integer are alone possible. Combining
279 /// these different values ​​can be not together and can, therefore, only
280 /// one each can be used.
281 ///
282 void SetFloatValue(float value)
283 {
284 m_interface->kodi_gui->control_settings_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value);
285 }
286 //--------------------------------------------------------------------------
287
288 //==========================================================================
289 ///
290 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
291 /// @brief To get the current position as float value.
292 ///
293 /// @return The position as float
294 ///
295 float GetFloatValue() const
296 {
297 return m_interface->kodi_gui->control_settings_slider->get_float_value(m_interface->kodiBase, m_controlHandle);
298 }
299 //--------------------------------------------------------------------------
300
301 //==========================================================================
302 ///
303 /// \ingroup cpp_kodi_gui_controls_CSettingsSlider
304 /// @brief To set the interval steps of slider, as default is it 0.1 If it
305 /// becomes changed with this function will a step of the user with the
306 /// value fixed here be executed.
307 ///
308 /// @param[in] interval Intervall step to set.
309 ///
310 /// @note Percent, floating point or integer are alone possible. Combining
311 /// these different values ​​can be not together and can, therefore, only
312 /// one each can be used.
313 ///
314 void SetFloatInterval(float interval)
315 {
316 m_interface->kodi_gui->control_settings_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
317 }
318 //--------------------------------------------------------------------------
319 };
320
321} /* namespace controls */
322} /* namespace gui */
323} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
new file mode 100644
index 0000000..cbb9b8f
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Slider.h
@@ -0,0 +1,336 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSlider Control Slider
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSlider }
37 /// **Window control for moveable slider**
38 ///
39 /// The slider control is used for things where a sliding bar best represents
40 /// the operation at hand (such as a volume control or seek control). You can
41 /// choose the position, size, and look of the slider control.
42 ///
43 /// It has the header \ref Slider.h "#include <kodi/gui/controls/Slider.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Slider_Control "slider control"
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CSlider : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CSlider
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CSlider(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_slider(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSlider can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CSlider
74 /// @brief Destructor
75 ///
76 ~CSlider() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CSlider
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_slider->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CSlider
95 /// @brief Set's the control's enabled/disabled state
96 ///
97 /// @param[in] enabled If true enabled, otherwise disabled
98 ///
99 void SetEnabled(bool enabled)
100 {
101 m_interface->kodi_gui->control_slider->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
102 }
103 //--------------------------------------------------------------------------
104
105 //==========================================================================
106 ///
107 /// \ingroup cpp_kodi_gui_controls_CSlider
108 /// @brief To reset slider on defaults
109 ///
110 void Reset()
111 {
112 m_interface->kodi_gui->control_slider->reset(m_interface->kodiBase, m_controlHandle);
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CSlider
119 /// @brief With GetDescription becomes a string value of position returned.
120 ///
121 /// @return Text string about current slider position
122 ///
123 /// The following are the text definition returned from this:
124 /// | Value | Without range selection | With range selection |
125 /// |:---------:|:------------------------|:-------------------------------|
126 /// | float | <c>%2.2f</c> | <c>[%2.2f, %2.2f]</c> |
127 /// | integer | <c>%i</c> | <c>[%i, %i]</c> |
128 /// | percent | <c>%i%%</c> | <c>[%i%%, %i%%]</c> |
129 ///
130 std::string GetDescription() const
131 {
132 std::string text;
133 char* ret = m_interface->kodi_gui->control_slider->get_description(m_interface->kodiBase, m_controlHandle);
134 if (ret != nullptr)
135 {
136 if (std::strlen(ret))
137 text = ret;
138 m_interface->free_string(m_interface->kodiBase, ret);
139 }
140 return text;
141 }
142 //--------------------------------------------------------------------------
143
144 //==========================================================================
145 ///
146 /// \ingroup cpp_kodi_gui_controls_CSlider
147 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
148 /// start and e.g. +10 is the from here defined position where it reach the
149 /// end.
150 ///
151 /// Ad default is the range from 0 to 100.
152 ///
153 /// The integer interval is as default 1 and can be changed with
154 /// @ref SetIntInterval.
155 ///
156 /// @param[in] start Integer start value
157 /// @param[in] end Integer end value
158 ///
159 /// @note Percent, floating point or integer are alone possible. Combining
160 /// these different values can be not together and can, therefore, only one
161 /// each can be used.
162 ///
163 void SetIntRange(int start, int end)
164 {
165 m_interface->kodi_gui->control_slider->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
166 }
167 //--------------------------------------------------------------------------
168
169 //==========================================================================
170 ///
171 /// \ingroup CSlider
172 /// @brief Set the slider position with the given integer value. The Range
173 /// must be defined with a call from \ref SetIntRange before.
174 ///
175 /// @param[in] value Position in range to set with integer
176 ///
177 /// @note Percent, floating point or integer are alone possible. Combining
178 /// these different values can be not together and can, therefore, only one
179 /// each can be used.
180 ///
181 void SetIntValue(int value)
182 {
183 m_interface->kodi_gui->control_slider->set_int_value(m_interface->kodiBase, m_controlHandle, value);
184 }
185 //--------------------------------------------------------------------------
186
187 //==========================================================================
188 ///
189 /// \ingroup cpp_kodi_gui_controls_CSlider
190 /// @brief To get the current position as integer value.
191 ///
192 /// @return The position as integer
193 ///
194 /// @note Percent, floating point or integer are alone possible. Combining
195 /// these different values can be not together and can, therefore, only
196 /// one each can be used.
197 ///
198 int GetIntValue() const
199 {
200 return m_interface->kodi_gui->control_slider->get_int_value(m_interface->kodiBase, m_controlHandle);
201 }
202 //--------------------------------------------------------------------------
203
204 //==========================================================================
205 ///
206 /// \ingroup cpp_kodi_gui_controls_CSlider
207 /// @brief To set the interval steps of slider, as default is it 1. If it
208 /// becomes changed with this function will a step of the user with the
209 /// value fixed here be executed.
210 ///
211 /// @param[in] interval Intervall step to set.
212 ///
213 /// @note Percent, floating point or integer are alone possible. Combining
214 /// these different values can be not together and can, therefore, only one
215 /// each can be used.
216 ///
217 void SetIntInterval(int interval)
218 {
219 m_interface->kodi_gui->control_slider->set_int_interval(m_interface->kodiBase, m_controlHandle, interval);
220 }
221 //--------------------------------------------------------------------------
222
223 //==========================================================================
224 ///
225 /// \ingroup cpp_kodi_gui_controls_CSlider
226 /// @brief Sets the percent of the slider.
227 ///
228 /// @param[in] percent float - Percent value of slide
229 ///
230 /// @note Percent, floating point or integer are alone possible. Combining
231 /// these different values can be not together and can, therefore, only one
232 /// each can be used.
233 ///
234 void SetPercentage(float percent)
235 {
236 m_interface->kodi_gui->control_slider->set_percentage(m_interface->kodiBase, m_controlHandle, percent);
237 }
238 //--------------------------------------------------------------------------
239
240 //==========================================================================
241 ///
242 /// \ingroup cpp_kodi_gui_controls_CSlider
243 /// @brief Returns a float of the percent of the slider.
244 ///
245 /// @return float - Percent of slider
246 ///
247 /// @note Percent, floating point or integer are alone possible. Combining
248 /// these different values can be not together and can, therefore, only one
249 /// each can be used.
250 ///
251 float GetPercentage() const
252 {
253 return m_interface->kodi_gui->control_slider->get_percentage(m_interface->kodiBase, m_controlHandle);
254 }
255 //--------------------------------------------------------------------------
256
257 //==========================================================================
258 ///
259 /// \ingroup cpp_kodi_gui_controls_CSlider
260 /// @brief To set the the range as float of slider, e.g. -25.0 is the slider
261 /// start and e.g. +25.0 is the from here defined position where it reach
262 /// the end.
263 ///
264 /// As default is the range 0.0 to 1.0.
265 ///
266 /// The float interval is as default 0.1 and can be changed with
267 /// @ref SetFloatInterval.
268 ///
269 /// @param[in] start Integer start value
270 /// @param[in] end Integer end value
271 ///
272 /// @note Percent, floating point or integer are alone possible. Combining
273 /// these different values can be not together and can, therefore, only
274 /// one each can be used.
275 ///
276 void SetFloatRange(float start, float end)
277 {
278 m_interface->kodi_gui->control_slider->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
279 }
280 //--------------------------------------------------------------------------
281
282 //==========================================================================
283 ///
284 /// \ingroup cpp_kodi_gui_controls_CSlider
285 /// @brief Set the slider position with the given float value. The Range
286 /// can be defined with a call from \ref SetIntRange before, as default it
287 /// is 0.0 to 1.0.
288 ///
289 /// @param[in] value Position in range to set with float
290 ///
291 /// @note Percent, floating point or integer are alone possible. Combining
292 /// these different values can be not together and can, therefore, only one
293 /// each can be used.
294 ///
295 void SetFloatValue(float value)
296 {
297 m_interface->kodi_gui->control_slider->set_float_value(m_interface->kodiBase, m_controlHandle, value);
298 }
299 //--------------------------------------------------------------------------
300
301 //==========================================================================
302 ///
303 /// \ingroup cpp_kodi_gui_controls_CSlider
304 /// @brief To get the current position as float value.
305 ///
306 /// @return The position as float
307 ///
308 float GetFloatValue() const
309 {
310 return m_interface->kodi_gui->control_slider->get_float_value(m_interface->kodiBase, m_controlHandle);
311 }
312 //--------------------------------------------------------------------------
313
314 //==========================================================================
315 ///
316 /// \ingroup cpp_kodi_gui_controls_CSlider
317 /// @brief To set the interval steps of slider, as default is it 0.1 If it
318 /// becomes changed with this function will a step of the user with the
319 /// value fixed here be executed.
320 ///
321 /// @param[in] interval Intervall step to set.
322 ///
323 /// @note Percent, floating point or integer are alone possible. Combining
324 /// these different values can be not together and can, therefore, only
325 /// one each can be used.
326 ///
327 void SetFloatInterval(float interval)
328 {
329 m_interface->kodi_gui->control_slider->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
330 }
331 //--------------------------------------------------------------------------
332 };
333
334} /* namespace controls */
335} /* namespace gui */
336} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
new file mode 100644
index 0000000..b39cd06
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/Spin.h
@@ -0,0 +1,376 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CSpin Control Spin
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CSpin }
37 /// **Window control used for cycling up/down controls**
38 ///
39 /// The settings spin control is used in the settings screens for when a list
40 /// of options can be chosen from using up/down arrows. You can choose the
41 /// position, size, and look of the spin control. It is basically a cross
42 /// between the button control and a spin control. It has a label and focus
43 /// and non focus textures, as well as a spin control on the right.
44 ///
45 /// It has the header \ref Spin.h "#include <kodi/gui/controls/Spin.h>"
46 /// be included to enjoy it.
47 ///
48 /// Here you find the needed skin part for a \ref Spin_Control "spin control"
49 ///
50 /// @note The call of the control is only possible from the corresponding
51 /// window as its class and identification number is required.
52 ///
53
54
55 //============================================================================
56 ///
57 /// \ingroup cpp_kodi_gui_controls_CSpin
58 /// @anchor AddonGUISpinControlType
59 /// @brief The values here defines the used value format for steps on
60 /// spin control.
61 ///
62 typedef enum AddonGUISpinControlType
63 {
64 /// One spin step interpreted as integer
65 ADDON_SPIN_CONTROL_TYPE_INT = 1,
66 /// One spin step interpreted as floating point value
67 ADDON_SPIN_CONTROL_TYPE_FLOAT = 2,
68 /// One spin step interpreted as text string
69 ADDON_SPIN_CONTROL_TYPE_TEXT = 3,
70 /// One spin step interpreted as a page change value
71 ADDON_SPIN_CONTROL_TYPE_PAGE = 4
72 } AddonGUISpinControlType;
73 //----------------------------------------------------------------------------
74
75 class CSpin : public CAddonGUIControlBase
76 {
77 public:
78 //==========================================================================
79 ///
80 /// \ingroup cpp_kodi_gui_controls_CSpin
81 /// @brief Construct a new control
82 ///
83 /// @param[in] window related window control class
84 /// @param[in] controlId Used skin xml control id
85 ///
86 CSpin(CWindow* window, int controlId)
87 : CAddonGUIControlBase(window)
88 {
89 m_controlHandle = m_interface->kodi_gui->window->get_control_spin(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
90 if (!m_controlHandle)
91 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CSpin can't create control class from Kodi !!!");
92 }
93 //--------------------------------------------------------------------------
94
95 //==========================================================================
96 ///
97 /// \ingroup cpp_kodi_gui_controls_CSpin
98 /// @brief Destructor
99 ///
100 ~CSpin() override = default;
101 //--------------------------------------------------------------------------
102
103 //==========================================================================
104 ///
105 /// \ingroup cpp_kodi_gui_controls_CSpin
106 /// @brief Set the control on window to visible
107 ///
108 /// @param[in] visible If true visible, otherwise hidden
109 ///
110 void SetVisible(bool visible)
111 {
112 m_interface->kodi_gui->control_spin->set_visible(m_interface->kodiBase, m_controlHandle, visible);
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CSpin
119 /// @brief Set's the control's enabled/disabled state
120 ///
121 /// @param[in] enabled If true enabled, otherwise disabled
122 ///
123 void SetEnabled(bool enabled)
124 {
125 m_interface->kodi_gui->control_spin->set_enabled(m_interface->kodiBase, m_controlHandle, enabled);
126 }
127 //--------------------------------------------------------------------------
128
129 //==========================================================================
130 ///
131 /// \ingroup cpp_kodi_gui_controls_CSpin
132 /// @brief To set the text string on spin control
133 ///
134 /// @param[in] text Text to show as name for spin
135 ///
136 void SetText(const std::string& text)
137 {
138 m_interface->kodi_gui->control_spin->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
139 }
140 //--------------------------------------------------------------------------
141
142 //==========================================================================
143 ///
144 /// \ingroup cpp_kodi_gui_controls_CSpin
145 /// @brief To reset spin control to defaults
146 ///
147 void Reset()
148 {
149 m_interface->kodi_gui->control_spin->reset(m_interface->kodiBase, m_controlHandle);
150 }
151 //--------------------------------------------------------------------------
152
153 //==========================================================================
154 ///
155 /// \ingroup cpp_kodi_gui_controls_CSpin
156 /// @brief To set the with SpinControlType defined types of spin.
157 ///
158 /// @param[in] type The type to use
159 ///
160 /// @note See description of \ref AddonGUISpinControlType for available types.
161 ///
162 void SetType(AddonGUISpinControlType type)
163 {
164 m_interface->kodi_gui->control_spin->set_type(m_interface->kodiBase, m_controlHandle, (int)type);
165 }
166 //--------------------------------------------------------------------------
167
168 //==========================================================================
169 ///
170 /// \ingroup cpp_kodi_gui_controls_CSpin
171 /// @brief To add a label entry in spin defined with a value as string.
172 ///
173 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
174 ///
175 /// @param[in] label Label string to view on skin
176 /// @param[in] value String value to use for selection
177 /// of them.
178 ///
179 void AddLabel(const std::string& label, const std::string& value)
180 {
181 m_interface->kodi_gui->control_spin->add_string_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value.c_str());
182 }
183 //--------------------------------------------------------------------------
184
185 //==========================================================================
186 ///
187 /// \ingroup cpp_kodi_gui_controls_CSpin
188 /// @brief To add a label entry in spin defined with a value as integer.
189 ///
190 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_INT to use this function.
191 ///
192 /// @param[in] label Label string to view on skin
193 /// @param[in] value Integer value to use for selection
194 /// of them.
195 ///
196 void AddLabel(const std::string& label, int value)
197 {
198 m_interface->kodi_gui->control_spin->add_int_label(m_interface->kodiBase, m_controlHandle, label.c_str(), value);
199 }
200 //--------------------------------------------------------------------------
201
202 //==========================================================================
203 ///
204 /// \ingroup cpp_kodi_gui_controls_CSpin
205 /// @brief To change the spin to position with them string as value.
206 ///
207 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
208 ///
209 /// @param[in] value String value to change to
210 ///
211 void SetStringValue(const std::string& value)
212 {
213 m_interface->kodi_gui->control_spin->set_string_value(m_interface->kodiBase, m_controlHandle, value.c_str());
214 }
215 //--------------------------------------------------------------------------
216
217 //==========================================================================
218 ///
219 /// \ingroup cpp_kodi_gui_controls_CSpin
220 /// @brief To get the current spin control position with text string value.
221 ///
222 /// Format must be set to ADDON_SPIN_CONTROL_TYPE_TEXT to use this function.
223 ///
224 /// @return Currently selected string value
225 ///
226 std::string GetStringValue() const
227 {
228 std::string value;
229 char* ret = m_interface->kodi_gui->control_spin->get_string_value(m_interface->kodiBase, m_controlHandle);
230 if (ret != nullptr)
231 {
232 if (std::strlen(ret))
233 value = ret;
234 m_interface->free_string(m_interface->kodiBase, ret);
235 }
236 return value;
237 }
238 //--------------------------------------------------------------------------
239
240 //==========================================================================
241 ///
242 /// \ingroup cpp_kodi_gui_controls_CSpin
243 /// @brief To set the the range as integer of slider, e.g. -10 is the slider
244 /// start and e.g. +10 is the from here defined position where it reach the
245 /// end.
246 ///
247 /// Ad default is the range from 0 to 100.
248 ///
249 /// @param[in] start Integer start value
250 /// @param[in] end Integer end value
251 ///
252 /// @note Percent, floating point or integer are alone possible. Combining
253 /// these different values can be not together and can, therefore, only
254 /// one each can be used and must be defined with \ref SetType before.
255 ///
256 void SetIntRange(int start, int end)
257 {
258 m_interface->kodi_gui->control_spin->set_int_range(m_interface->kodiBase, m_controlHandle, start, end);
259 }
260 //--------------------------------------------------------------------------
261
262 //==========================================================================
263 ///
264 /// \ingroup cpp_kodi_gui_controls_CSpin
265 /// @brief Set the slider position with the given integer value. The Range
266 /// must be defined with a call from \ref SetIntRange before.
267 ///
268 /// @param[in] value Position in range to set with integer
269 ///
270 /// @note Percent, floating point or integer are alone possible. Combining
271 /// these different values can be not together and can, therefore, only
272 /// one each can be used and must be defined with \ref SetType before.
273 ///
274 void SetIntValue(int value)
275 {
276 m_interface->kodi_gui->control_spin->set_int_value(m_interface->kodiBase, m_controlHandle, value);
277 }
278 //--------------------------------------------------------------------------
279
280 //==========================================================================
281 ///
282 /// \ingroup cpp_kodi_gui_controls_CSpin
283 /// @brief To get the current position as integer value.
284 ///
285 /// @return The position as integer
286 ///
287 /// @note Percent, floating point or integer are alone possible. Combining
288 /// these different values can be not together and can, therefore, only
289 /// one each can be used and must be defined with \ref SetType before.
290 ///
291 int GetIntValue() const
292 {
293 return m_interface->kodi_gui->control_spin->get_int_value(m_interface->kodiBase, m_controlHandle);
294 }
295 //--------------------------------------------------------------------------
296
297 //==========================================================================
298 ///
299 /// \ingroup cpp_kodi_gui_controls_CSpin
300 /// @brief To set the the range as float of spin, e.g. -25.0 is the spin
301 /// start and e.g. +25.0 is the from here defined position where it reach
302 /// the end.
303 ///
304 /// As default is the range 0.0 to 1.0.
305 ///
306 /// The float interval is as default 0.1 and can be changed with
307 /// @ref SetFloatInterval.
308 ///
309 /// @param[in] start Integer start value
310 /// @param[in] end Integer end value
311 ///
312 /// @note Percent, floating point or integer are alone possible. Combining
313 /// these different values can be not together and can, therefore, only
314 /// one each can be used and must be defined with \ref SetType before.
315 ///
316 void SetFloatRange(float start, float end)
317 {
318 m_interface->kodi_gui->control_spin->set_float_range(m_interface->kodiBase, m_controlHandle, start, end);
319 }
320 //--------------------------------------------------------------------------
321
322 //==========================================================================
323 ///
324 /// \ingroup cpp_kodi_gui_controls_CSpin
325 /// @brief Set the spin position with the given float value. The Range
326 /// can be defined with a call from \ref SetIntRange before, as default it
327 /// is 0.0 to 1.0.
328 ///
329 /// @param[in] value Position in range to set with float
330 ///
331 /// @note Percent, floating point or integer are alone possible. Combining
332 /// these different values can be not together and can, therefore, only
333 /// one each can be used and must be defined with \ref SetType before.
334 ///
335 void SetFloatValue(float value)
336 {
337 m_interface->kodi_gui->control_spin->set_float_value(m_interface->kodiBase, m_controlHandle, value);
338 }
339 //--------------------------------------------------------------------------
340
341 //==========================================================================
342 ///
343 /// \ingroup cpp_kodi_gui_controls_CSpin
344 /// @brief To get the current position as float value.
345 ///
346 /// @return The position as float
347 ///
348 float GetFloatValue() const
349 {
350 return m_interface->kodi_gui->control_spin->get_float_value(m_interface->kodiBase, m_controlHandle);
351 }
352 //--------------------------------------------------------------------------
353
354 //==========================================================================
355 ///
356 /// \ingroup cpp_kodi_gui_controls_CSpin
357 /// @brief To set the interval steps of spin, as default is it 0.1 If it
358 /// becomes changed with this function will a step of the user with the
359 /// value fixed here be executed.
360 ///
361 /// @param[in] interval Intervall step to set.
362 ///
363 /// @note Percent, floating point or integer are alone possible. Combining
364 /// these different values can be not together and can, therefore, only
365 /// one each can be used and must be defined with \ref SetType before.
366 ///
367 void SetFloatInterval(float interval)
368 {
369 m_interface->kodi_gui->control_spin->set_float_interval(m_interface->kodiBase, m_controlHandle, interval);
370 }
371 //--------------------------------------------------------------------------
372 };
373
374} /* namespace controls */
375} /* namespace gui */
376} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
new file mode 100644
index 0000000..9d8976e
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/controls/TextBox.h
@@ -0,0 +1,176 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include "../../AddonBase.h"
23#include "../Window.h"
24
25namespace kodi
26{
27namespace gui
28{
29namespace controls
30{
31
32 //============================================================================
33 ///
34 /// \defgroup cpp_kodi_gui_controls_CTextBox Control Text Box
35 /// \ingroup cpp_kodi_gui
36 /// @brief \cpp_class{ kodi::gui::controls::CTextBox }
37 /// **Used to show a multi-page piece of text**
38 ///
39 /// The text box control can be used to display descriptions, help texts or
40 /// other larger texts. It corresponds to the representation which is also to
41 /// be seen on the CDialogTextViewer.
42 ///
43 /// It has the header \ref TextBox.h "#include <kodi/gui/controls/TextBox.h>"
44 /// be included to enjoy it.
45 ///
46 /// Here you find the needed skin part for a \ref Text_Box "textbox control".
47 ///
48 /// @note The call of the control is only possible from the corresponding
49 /// window as its class and identification number is required.
50 ///
51 class CTextBox : public CAddonGUIControlBase
52 {
53 public:
54 //==========================================================================
55 ///
56 /// \ingroup cpp_kodi_gui_controls_CTextBox
57 /// @brief Construct a new control
58 ///
59 /// @param[in] window related window control class
60 /// @param[in] controlId Used skin xml control id
61 ///
62 CTextBox(CWindow* window, int controlId)
63 : CAddonGUIControlBase(window)
64 {
65 m_controlHandle = m_interface->kodi_gui->window->get_control_text_box(m_interface->kodiBase, m_Window->GetControlHandle(), controlId);
66 if (!m_controlHandle)
67 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::controls::CTextBox can't create control class from Kodi !!!");
68 }
69 //--------------------------------------------------------------------------
70
71 //==========================================================================
72 ///
73 /// \ingroup cpp_kodi_gui_controls_CTextBox
74 /// @brief Destructor
75 ///
76 ~CTextBox() override = default;
77 //--------------------------------------------------------------------------
78
79 //==========================================================================
80 ///
81 /// \ingroup cpp_kodi_gui_controls_CTextBox
82 /// @brief Set the control on window to visible
83 ///
84 /// @param[in] visible If true visible, otherwise hidden
85 ///
86 void SetVisible(bool visible)
87 {
88 m_interface->kodi_gui->control_text_box->set_visible(m_interface->kodiBase, m_controlHandle, visible);
89 }
90 //--------------------------------------------------------------------------
91
92 //==========================================================================
93 ///
94 /// \ingroup cpp_kodi_gui_controls_CTextBox
95 /// @brief To reset box an remove all the text
96 ///
97 void Reset()
98 {
99 m_interface->kodi_gui->control_text_box->reset(m_controlHandle, m_controlHandle);
100 }
101 //--------------------------------------------------------------------------
102
103 //==========================================================================
104 ///
105 /// \ingroup cpp_kodi_gui_controls_CTextBox
106 /// @brief To set the text on box
107 ///
108 /// @param[in] text Text to show
109 ///
110 void SetText(const std::string& text)
111 {
112 m_interface->kodi_gui->control_text_box->set_text(m_interface->kodiBase, m_controlHandle, text.c_str());
113 }
114 //--------------------------------------------------------------------------
115
116 //==========================================================================
117 ///
118 /// \ingroup cpp_kodi_gui_controls_CTextBox
119 /// @brief Get the used text from control
120 ///
121 /// @return Text shown
122 ///
123 std::string GetText() const
124 {
125 std::string text;
126 char* ret = m_interface->kodi_gui->control_text_box->get_text(m_interface->kodiBase, m_controlHandle);
127 if (ret != nullptr)
128 {
129 if (std::strlen(ret))
130 text = ret;
131 m_interface->free_string(m_interface->kodiBase, ret);
132 }
133 return text;
134 }
135 //--------------------------------------------------------------------------
136
137 //==========================================================================
138 ///
139 /// \ingroup cpp_kodi_gui_controls_CTextBox
140 /// @brief To scroll text on other position
141 ///
142 /// @param[in] position The line position to scroll to
143 ///
144 void Scroll(unsigned int position)
145 {
146 m_interface->kodi_gui->control_text_box->scroll(m_interface->kodiBase, m_controlHandle, position);
147 }
148 //--------------------------------------------------------------------------
149
150 //==========================================================================
151 ///
152 /// \ingroup cpp_kodi_gui_controls_CTextBox
153 /// @brief To set automatic scrolling of textbox
154 ///
155 /// Specifies the timing and conditions of any autoscrolling this textbox
156 /// should have. Times are in milliseconds. The content is delayed for the
157 /// given delay, then scrolls at a rate of one line per time interval until
158 /// the end. If the repeat tag is present, it then delays for the repeat
159 /// time, fades out over 1 second, and repeats. It does not wrap or reset
160 /// to the top at the end of the scroll.
161 ///
162 /// @param[in] delay Content delay
163 /// @param[in] time One line per time interval
164 /// @param[in] repeat Delays with given time, fades out over 1
165 /// second, and repeats
166 ///
167 void SetAutoScrolling(int delay, int time, int repeat)
168 {
169 m_interface->kodi_gui->control_text_box->set_auto_scrolling(m_interface->kodiBase, m_controlHandle, delay, time, repeat);
170 }
171 //--------------------------------------------------------------------------
172 };
173
174} /* namespace controls */
175} /* namespace gui */
176} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
index a4cf963..61af9fe 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/definitions.h
@@ -39,6 +39,145 @@ typedef struct AddonToKodiFuncTable_kodi_gui_general
39 int (*get_current_window_id)(void* kodiBase); 39 int (*get_current_window_id)(void* kodiBase);
40} AddonToKodiFuncTable_kodi_gui_general; 40} AddonToKodiFuncTable_kodi_gui_general;
41 41
42typedef struct AddonToKodiFuncTable_kodi_gui_control_button
43{
44 void (*set_visible)(void* kodiBase, void* handle, bool visible);
45 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
46 void (*set_label)(void* kodiBase, void* handle, const char* label);
47 char* (*get_label)(void* kodiBase, void* handle);
48 void (*set_label2)(void* kodiBase, void* handle, const char *label);
49 char* (*get_label2)(void* kodiBase, void* handle);
50} AddonToKodiFuncTable_kodi_gui_control_button;
51
52typedef struct AddonToKodiFuncTable_kodi_gui_control_edit
53{
54 void (*set_visible)(void* kodiBase, void* handle, bool visible);
55 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
56 void (*set_label)(void* kodiBase, void* handle, const char* label);
57 char* (*get_label)(void* kodiBase, void* handle);
58 void (*set_text)(void* kodiBase, void* handle, const char* text);
59 char* (*get_text)(void* kodiBase, void* handle);
60 void (*set_cursor_position)(void* kodiBase, void* handle, unsigned int position);
61 unsigned int (*get_cursor_position)(void* kodiBase, void* handle);
62 void (*set_input_type)(void* kodiBase, void* handle, int type, const char* heading);
63} AddonToKodiFuncTable_kodi_gui_control_edit;
64
65typedef struct AddonToKodiFuncTable_kodi_gui_control_fade_label
66{
67 void (*set_visible)(void* kodiBase, void* handle, bool visible);
68 void (*add_label)(void* kodiBase, void* handle, const char* text);
69 char* (*get_label)(void* kodiBase, void* handle);
70 void (*set_scrolling)(void* kodiBase, void* handle, bool scroll);
71 void (*reset)(void* kodiBase, void* handle);
72} AddonToKodiFuncTable_kodi_gui_control_fade_label;
73
74typedef struct AddonToKodiFuncTable_kodi_gui_control_image
75{
76 void (*set_visible)(void* kodiBase, void* handle, bool visible);
77 void (*set_filename)(void* kodiBase, void* handle, const char* filename, bool use_cache);
78 void (*set_color_diffuse)(void* kodiBase, void* handle, uint32_t color_diffuse);
79} AddonToKodiFuncTable_kodi_gui_control_image;
80
81typedef struct AddonToKodiFuncTable_kodi_gui_control_label
82{
83 void (*set_visible)(void* kodiBase, void* handle, bool visible);
84 void (*set_label)(void* kodiBase, void* handle, const char* text);
85 char* (*get_label)(void* kodiBase, void* handle);
86} AddonToKodiFuncTable_kodi_gui_control_label;
87
88typedef struct AddonToKodiFuncTable_kodi_gui_control_progress
89{
90 void (*set_visible)(void* kodiBase, void* handle, bool visible);
91 void (*set_percentage)(void* kodiBase, void* handle, float percent);
92 float (*get_percentage)(void* kodiBase, void* handle);
93} AddonToKodiFuncTable_kodi_gui_control_progress;
94
95typedef struct AddonToKodiFuncTable_kodi_gui_control_radio_button
96{
97 void (*set_visible)(void* kodiBase, void* handle, bool visible);
98 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
99 void (*set_label)(void* kodiBase, void* handle, const char* text);
100 char* (*get_label)(void* kodiBase, void* handle);
101 void (*set_selected)(void* kodiBase, void* handle, bool selected);
102 bool (*is_selected)(void* kodiBase, void* handle);
103} AddonToKodiFuncTable_kodi_gui_control_radio_button;
104
105typedef struct AddonToKodiFuncTable_kodi_gui_control_rendering
106{
107 void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle,
108 bool (*createCB)(void*,int,int,int,int,void*),
109 void (*renderCB)(void*),
110 void (*stopCB)(void*),
111 bool (*dirtyCB)(void*));
112 void (*destroy)(void *kodiBase, void* handle);
113} AddonToKodiFuncTable_kodi_gui_control_rendering;
114
115typedef struct AddonToKodiFuncTable_kodi_gui_control_settings_slider
116{
117 void (*set_visible)(void* kodiBase, void* handle, bool visible);
118 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
119 void (*set_text)(void* kodiBase, void* handle, const char* label);
120 void (*reset)(void* kodiBase, void* handle);
121 void (*set_int_range)(void* kodiBase, void* handle, int start, int end);
122 void (*set_int_value)(void* kodiBase, void* handle, int value);
123 int (*get_int_value)(void* kodiBase, void* handle);
124 void (*set_int_interval)(void* kodiBase, void* handle, int interval);
125 void (*set_percentage)(void* kodiBase, void* handle, float percent);
126 float (*get_percentage)(void* kodiBase, void* handle);
127 void (*set_float_range)(void* kodiBase, void* handle, float start, float end);
128 void (*set_float_value)(void* kodiBase, void* handle, float value);
129 float (*get_float_value)(void* kodiBase, void* handle);
130 void (*set_float_interval)(void* kodiBase, void* handle, float interval);
131} AddonToKodiFuncTable_kodi_gui_control_settings_slider;
132
133typedef struct AddonToKodiFuncTable_kodi_gui_control_slider
134{
135 void (*set_visible)(void* kodiBase, void* handle, bool visible);
136 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
137 void (*reset)(void* kodiBase, void* handle);
138 char* (*get_description)(void* kodiBase, void* handle);
139 void (*set_int_range)(void* kodiBase, void* handle, int start, int end);
140 void (*set_int_value)(void* kodiBase, void* handle, int value);
141 int (*get_int_value)(void* kodiBase, void* handle);
142 void (*set_int_interval)(void* kodiBase, void* handle, int interval);
143 void (*set_percentage)(void* kodiBase, void* handle, float percent);
144 float (*get_percentage)(void* kodiBase, void* handle);
145 void (*set_float_range)(void* kodiBase, void* handle, float start, float end);
146 void (*set_float_value)(void* kodiBase, void* handle, float value);
147 float (*get_float_value)(void* kodiBase, void* handle);
148 void (*set_float_interval)(void* kodiBase, void* handle, float interval);
149} AddonToKodiFuncTable_kodi_gui_control_slider;
150
151typedef struct AddonToKodiFuncTable_kodi_gui_control_spin
152{
153 void (*set_visible)(void* kodiBase, void* handle, bool visible);
154 void (*set_enabled)(void* kodiBase, void* handle, bool enabled);
155 void (*set_text)(void* kodiBase, void* handle, const char* text);
156 void (*reset)(void* kodiBase, void* handle);
157 void (*set_type)(void* kodiBase, void* handle, int type);
158 void (*add_string_label)(void* kodiBase, void* handle, const char* label, const char* value);
159 void (*set_string_value)(void* kodiBase, void* handle, const char* value);
160 char* (*get_string_value)(void* kodiBase, void* handle);
161 void (*add_int_label)(void* kodiBase, void* handle, const char* label, int value);
162 void (*set_int_range)(void* kodiBase, void* handle, int start, int end);
163 void (*set_int_value)(void* kodiBase, void* handle, int value);
164 int (*get_int_value)(void* kodiBase, void* handle);
165 void (*set_float_range)(void* kodiBase, void* handle, float start, float end);
166 void (*set_float_value)(void* kodiBase, void* handle, float value);
167 float (*get_float_value)(void* kodiBase, void* handle);
168 void (*set_float_interval)(void* kodiBase, void* handle, float interval);
169} AddonToKodiFuncTable_kodi_gui_control_spin;
170
171typedef struct AddonToKodiFuncTable_kodi_gui_control_text_box
172{
173 void (*set_visible)(void* kodiBase, void* handle, bool visible);
174 void (*reset)(void* kodiBase, void* handle);
175 void (*set_text)(void* kodiBase, void* handle, const char* text);
176 char* (*get_text)(void* kodiBase, void* handle);
177 void (*scroll)(void* kodiBase, void* handle, unsigned int scroll);
178 void (*set_auto_scrolling)(void* kodiBase, void* handle, int delay, int time, int repeat);
179} AddonToKodiFuncTable_kodi_gui_control_text_box;
180
42typedef struct AddonToKodiFuncTable_kodi_gui_dialogContextMenu 181typedef struct AddonToKodiFuncTable_kodi_gui_dialogContextMenu
43{ 182{
44 int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size); 183 int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size);
@@ -122,7 +261,7 @@ typedef struct AddonToKodiFuncTable_kodi_gui_dialogProgress
122 261
123typedef struct AddonToKodiFuncTable_kodi_gui_dialogSelect 262typedef struct AddonToKodiFuncTable_kodi_gui_dialogSelect
124{ 263{
125 int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, bool autoclose); 264 int (*open)(void* kodiBase, const char *heading, const char *entries[], unsigned int size, int selected, unsigned int autoclose);
126} AddonToKodiFuncTable_kodi_gui_dialogSelect; 265} AddonToKodiFuncTable_kodi_gui_dialogSelect;
127 266
128typedef struct AddonToKodiFuncTable_kodi_gui_dialogTextViewer 267typedef struct AddonToKodiFuncTable_kodi_gui_dialogTextViewer
@@ -139,7 +278,7 @@ typedef struct AddonToKodiFuncTable_kodi_gui_dialogYesNo
139 278
140typedef struct AddonToKodiFuncTable_kodi_gui_listItem 279typedef struct AddonToKodiFuncTable_kodi_gui_listItem
141{ 280{
142 void* (*create)(void* kodiBase, const char* label, const char* label2, const char* icon_image, const char* thumbnail_image, const char* path); 281 void* (*create)(void* kodiBase, const char* label, const char* label2, const char* icon_image, const char* path);
143 void (*destroy)(void* kodiBase, void* handle); 282 void (*destroy)(void* kodiBase, void* handle);
144 char* (*get_label)(void* kodiBase, void* handle); 283 char* (*get_label)(void* kodiBase, void* handle);
145 void (*set_label)(void* kodiBase, void* handle, const char* label); 284 void (*set_label)(void* kodiBase, void* handle, const char* label);
@@ -151,6 +290,10 @@ typedef struct AddonToKodiFuncTable_kodi_gui_listItem
151 void (*set_art)(void* kodiBase, void* handle, const char* type, const char* image); 290 void (*set_art)(void* kodiBase, void* handle, const char* type, const char* image);
152 char* (*get_path)(void* kodiBase, void* handle); 291 char* (*get_path)(void* kodiBase, void* handle);
153 void (*set_path)(void* kodiBase, void* handle, const char* path); 292 void (*set_path)(void* kodiBase, void* handle, const char* path);
293 char* (*get_property)(void* kodiBase, void* handle, const char* key);
294 void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value);
295 void (*select)(void* kodiBase, void* handle, bool select);
296 bool (*is_selected)(void* kodiBase, void* handle);
154} AddonToKodiFuncTable_kodi_gui_listItem; 297} AddonToKodiFuncTable_kodi_gui_listItem;
155 298
156#define ADDON_MAX_CONTEXT_ENTRIES 20 299#define ADDON_MAX_CONTEXT_ENTRIES 20
@@ -160,9 +303,10 @@ typedef struct gui_context_menu_pair
160 unsigned int id; 303 unsigned int id;
161 char name[ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH]; 304 char name[ADDON_MAX_CONTEXT_ENTRY_NAME_LENGTH];
162} gui_context_menu_pair; 305} gui_context_menu_pair;
163 306
164typedef struct AddonToKodiFuncTable_kodi_gui_window 307typedef struct AddonToKodiFuncTable_kodi_gui_window
165{ 308{
309 /* Window creation functions */
166 void* (*create)(void* kodiBase, const char* xml_filename, const char* default_skin, bool as_dialog, bool is_media); 310 void* (*create)(void* kodiBase, const char* xml_filename, const char* default_skin, bool as_dialog, bool is_media);
167 void (*destroy)(void* kodiBase, void* handle); 311 void (*destroy)(void* kodiBase, void* handle);
168 void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle, 312 void (*set_callbacks)(void* kodiBase, void* handle, void* clienthandle,
@@ -175,14 +319,90 @@ typedef struct AddonToKodiFuncTable_kodi_gui_window
175 bool (*show)(void* kodiBase, void* handle); 319 bool (*show)(void* kodiBase, void* handle);
176 bool (*close)(void* kodiBase, void* handle); 320 bool (*close)(void* kodiBase, void* handle);
177 bool (*do_modal)(void* kodiBase, void* handle); 321 bool (*do_modal)(void* kodiBase, void* handle);
322
323 /* Window control functions */
324 bool (*set_focus_id)(void* kodiBase, void* handle, int control_id);
325 int (*get_focus_id)(void* kodiBase, void* handle);
326 void (*set_control_label)(void* kodiBase, void* handle, int control_id, const char* label);
327
328 /* Window property functions */
329 void (*set_property)(void* kodiBase, void* handle, const char* key, const char* value);
330 void (*set_property_int)(void* kodiBase, void* handle, const char* key, int value);
331 void (*set_property_bool)(void* kodiBase, void* handle, const char* key, bool value);
332 void (*set_property_double)(void* kodiBase, void* handle, const char* key, double value);
333 char* (*get_property)(void* kodiBase, void* handle, const char* key);
334 int (*get_property_int)(void* kodiBase, void* handle, const char* key);
335 bool (*get_property_bool)(void* kodiBase, void* handle, const char* key);
336 double (*get_property_double)(void* kodiBase, void* handle, const char* key);
337 void (*clear_properties)(void* kodiBase, void* handle);
338 void (*clear_property)(void* kodiBase, void* handle, const char* key);
339
340 /* List item functions */
178 void (*clear_item_list)(void* kodiBase, void* handle); 341 void (*clear_item_list)(void* kodiBase, void* handle);
179 void (*add_list_item)(void* kodiBase, void* handle, void* item, int item_position); 342 void (*add_list_item)(void* kodiBase, void* handle, void* item, int list_position);
180 void* (*get_list_item)(void* kodiBase, void* handle, int listPos); 343 void (*remove_list_item_from_position)(void* kodiBase, void* handle, int list_position);
344 void (*remove_list_item)(void* kodiBase, void* handle, void* item);
345 void* (*get_list_item)(void* kodiBase, void* handle, int list_position);
346 void (*set_current_list_position)(void* kodiBase, void* handle, int list_position);
347 int (*get_current_list_position)(void* kodiBase, void* handle);
348 int (*get_list_size)(void* kodiBase, void* handle);
349 void (*set_container_property)(void* kodiBase, void* handle, const char* key, const char* value);
350 void (*set_container_content)(void* kodiBase, void* handle, const char* value);
351 int (*get_current_container_id)(void* kodiBase, void* handle);
352
353 /* Various functions */
354 void (*mark_dirty_region)(void* kodiBase, void* handle);
355
356 /* GUI control access functions */
357 void* (*get_control_button)(void* kodiBase, void* handle, int control_id);
358 void* (*get_control_edit)(void* kodiBase, void* handle, int control_id);
359 void* (*get_control_fade_label)(void* kodiBase, void* handle, int control_id);
360 void* (*get_control_image)(void* kodiBase, void* handle, int control_id);
361 void* (*get_control_label)(void* kodiBase, void* handle, int control_id);
362 void* (*get_control_progress)(void* kodiBase, void* handle, int control_id);
363 void* (*get_control_radio_button)(void* kodiBase, void* handle, int control_id);
364 void* (*get_control_render_addon)(void* kodiBase, void* handle, int control_id);
365 void* (*get_control_settings_slider)(void* kodiBase, void* handle, int control_id);
366 void* (*get_control_slider)(void* kodiBase, void* handle, int control_id);
367 void* (*get_control_spin)(void* kodiBase, void* handle, int control_id);
368 void* (*get_control_text_box)(void* kodiBase, void* handle, int control_id);
369 void* (*get_control_dummy1)(void* kodiBase, void* handle, int control_id);
370 void* (*get_control_dummy2)(void* kodiBase, void* handle, int control_id);
371 void* (*get_control_dummy3)(void* kodiBase, void* handle, int control_id);
372 void* (*get_control_dummy4)(void* kodiBase, void* handle, int control_id);
373 void* (*get_control_dummy5)(void* kodiBase, void* handle, int control_id);
374 void* (*get_control_dummy6)(void* kodiBase, void* handle, int control_id);
375 void* (*get_control_dummy7)(void* kodiBase, void* handle, int control_id);
376 void* (*get_control_dummy8)(void* kodiBase, void* handle, int control_id);
377 void* (*get_control_dummy9)(void* kodiBase, void* handle, int control_id);
378 void* (*get_control_dummy10)(void* kodiBase, void* handle, int control_id); /* This and above used to add new get_control_* functions */
181} AddonToKodiFuncTable_kodi_gui_window; 379} AddonToKodiFuncTable_kodi_gui_window;
182 380
183typedef struct AddonToKodiFuncTable_kodi_gui 381typedef struct AddonToKodiFuncTable_kodi_gui
184{ 382{
185 AddonToKodiFuncTable_kodi_gui_general* general; 383 AddonToKodiFuncTable_kodi_gui_general* general;
384 AddonToKodiFuncTable_kodi_gui_control_button* control_button;
385 AddonToKodiFuncTable_kodi_gui_control_edit* control_edit;
386 AddonToKodiFuncTable_kodi_gui_control_fade_label* control_fade_label;
387 AddonToKodiFuncTable_kodi_gui_control_label* control_label;
388 AddonToKodiFuncTable_kodi_gui_control_image* control_image;
389 AddonToKodiFuncTable_kodi_gui_control_progress* control_progress;
390 AddonToKodiFuncTable_kodi_gui_control_radio_button* control_radio_button;
391 AddonToKodiFuncTable_kodi_gui_control_rendering* control_rendering;
392 AddonToKodiFuncTable_kodi_gui_control_settings_slider* control_settings_slider;
393 AddonToKodiFuncTable_kodi_gui_control_slider* control_slider;
394 AddonToKodiFuncTable_kodi_gui_control_spin* control_spin;
395 AddonToKodiFuncTable_kodi_gui_control_text_box* control_text_box;
396 void* control_dummy1;
397 void* control_dummy2;
398 void* control_dummy3;
399 void* control_dummy4;
400 void* control_dummy5;
401 void* control_dummy6;
402 void* control_dummy7;
403 void* control_dummy8;
404 void* control_dummy9;
405 void* control_dummy10; /* This and above used to add new controls */
186 AddonToKodiFuncTable_kodi_gui_dialogContextMenu* dialogContextMenu; 406 AddonToKodiFuncTable_kodi_gui_dialogContextMenu* dialogContextMenu;
187 AddonToKodiFuncTable_kodi_gui_dialogExtendedProgress* dialogExtendedProgress; 407 AddonToKodiFuncTable_kodi_gui_dialogExtendedProgress* dialogExtendedProgress;
188 AddonToKodiFuncTable_kodi_gui_dialogFileBrowser* dialogFileBrowser; 408 AddonToKodiFuncTable_kodi_gui_dialogFileBrowser* dialogFileBrowser;
@@ -193,6 +413,16 @@ typedef struct AddonToKodiFuncTable_kodi_gui
193 AddonToKodiFuncTable_kodi_gui_dialogSelect* dialogSelect; 413 AddonToKodiFuncTable_kodi_gui_dialogSelect* dialogSelect;
194 AddonToKodiFuncTable_kodi_gui_dialogTextViewer* dialogTextViewer; 414 AddonToKodiFuncTable_kodi_gui_dialogTextViewer* dialogTextViewer;
195 AddonToKodiFuncTable_kodi_gui_dialogYesNo* dialogYesNo; 415 AddonToKodiFuncTable_kodi_gui_dialogYesNo* dialogYesNo;
416 void* dialog_dummy1;
417 void* dialog_dummy2;
418 void* dialog_dummy3;
419 void* dialog_dummy4;
420 void* dialog_dummy5;
421 void* dialog_dummy6;
422 void* dialog_dummy7;
423 void* dialog_dummy8;
424 void* dialog_dummy9;
425 void* dialog_dummy10; /* This and above used to add new dialogs */
196 AddonToKodiFuncTable_kodi_gui_listItem* listItem; 426 AddonToKodiFuncTable_kodi_gui_listItem* listItem;
197 AddonToKodiFuncTable_kodi_gui_window* window; 427 AddonToKodiFuncTable_kodi_gui_window* window;
198} AddonToKodiFuncTable_kodi_gui; 428} AddonToKodiFuncTable_kodi_gui;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
index 66a1c90..47afc23 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogContextMenu.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h
@@ -19,33 +19,35 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogContextMenu Dialog Context Menu 34 /// \defgroup cpp_kodi_gui_dialogs_ContextMenu Dialog Context Menu
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_namespace{ kodi::gui::DialogContextMenu } 36 /// @brief \cpp_namespace{ kodi::gui::dialogs::ContextMenu }
35 /// **Context menu dialog** 37 /// **Context menu dialog**
36 /// 38 ///
37 /// The function listed below permits the call of a dialogue as context menu to 39 /// The function listed below permits the call of a dialogue as context menu to
38 /// select of an entry as a key 40 /// select of an entry as a key
39 /// 41 ///
40 /// It has the header \ref DialogContextMenu.h "#include <kodi/gui/DialogContextMenu.h>" 42 /// It has the header \ref ContextMenu.h "#include <kodi/gui/dialogs/ContextMenu.h>"
41 /// be included to enjoy it. 43 /// be included to enjoy it.
42 /// 44 ///
43 /// 45 ///
44 namespace DialogContextMenu 46 namespace ContextMenu
45 { 47 {
46 //========================================================================== 48 //==========================================================================
47 /// 49 ///
48 /// \ingroup cpp_kodi_gui_DialogContextMenu 50 /// \ingroup cpp_kodi_gui_dialogs_ContextMenu
49 /// @brief Show a context menu dialog about given parts. 51 /// @brief Show a context menu dialog about given parts.
50 /// 52 ///
51 /// @param[in] heading Dialog heading name 53 /// @param[in] heading Dialog heading name
@@ -57,7 +59,7 @@ namespace gui
57 /// 59 ///
58 /// **Example:** 60 /// **Example:**
59 /// ~~~~~~~~~~~~~{.cpp} 61 /// ~~~~~~~~~~~~~{.cpp}
60 /// #include <kodi/gui/DialogContextMenu.h> 62 /// #include <kodi/gui/dialogs/ContextMenu.h>
61 /// 63 ///
62 /// const std::vector<std::string> entries 64 /// const std::vector<std::string> entries
63 /// { 65 /// {
@@ -68,7 +70,7 @@ namespace gui
68 /// "Test 5" 70 /// "Test 5"
69 /// }; 71 /// };
70 /// 72 ///
71 /// int selected = kodi::gui::DialogContextMenu::Show("Test selection", entries); 73 /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries);
72 /// if (selected < 0) 74 /// if (selected < 0)
73 /// fprintf(stderr, "Item selection canceled\n"); 75 /// fprintf(stderr, "Item selection canceled\n");
74 /// else 76 /// else
@@ -91,5 +93,6 @@ namespace gui
91 //-------------------------------------------------------------------------- 93 //--------------------------------------------------------------------------
92 }; 94 };
93 95
96} /* namespace dialogs */
94} /* namespace gui */ 97} /* namespace gui */
95} /* namespace kodi */ 98} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogExtendedProgress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
index b6f2deb..e9c5a9d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogExtendedProgress.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h
@@ -19,22 +19,24 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_CDialogExtendedProgress Dialog Extended Progress 34 /// \defgroup cpp_kodi_gui_dialogs_CExtendedProgress Dialog Extended Progress
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_class{ kodi::gui::CDialogExtendedProgress } 36 /// @brief \cpp_class{ kodi::gui::dialogs::ExtendedProgress }
35 /// **Progress dialog shown for background work** 37 /// **Progress dialog shown for background work**
36 /// 38 ///
37 /// The with \ref DialogExtendedProgress.h "#include <kodi/gui/DialogExtendedProgress.h>" 39 /// The with \ref ExtendedProgress.h "#include <kodi/gui/dialogs/ExtendedProgress.h>"
38 /// given class are basically used to create Kodi's extended progress. 40 /// given class are basically used to create Kodi's extended progress.
39 /// 41 ///
40 /// 42 ///
@@ -42,9 +44,9 @@ namespace gui
42 /// 44 ///
43 /// **Example:** 45 /// **Example:**
44 /// ~~~~~~~~~~~~~{.cpp} 46 /// ~~~~~~~~~~~~~{.cpp}
45 /// #include <kodi/gui/DialogExtendedProgress.h> 47 /// #include <kodi/gui/dialogs/ExtendedProgress.h>
46 /// 48 ///
47 /// kodi::gui::CDialogExtendedProgress *ext_progress = new kodi::gui::CDialogExtendedProgress("Test Extended progress"); 49 /// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress");
48 /// ext_progress->SetText("Test progress"); 50 /// ext_progress->SetText("Test progress");
49 /// for (unsigned int i = 0; i < 50; i += 10) 51 /// for (unsigned int i = 0; i < 50; i += 10)
50 /// { 52 /// {
@@ -63,17 +65,17 @@ namespace gui
63 /// delete ext_progress; 65 /// delete ext_progress;
64 /// ~~~~~~~~~~~~~ 66 /// ~~~~~~~~~~~~~
65 /// 67 ///
66 class CDialogExtendedProgress 68 class CExtendedProgress
67 { 69 {
68 public: 70 public:
69 //========================================================================== 71 //==========================================================================
70 /// 72 ///
71 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 73 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
72 /// Construct a new dialog 74 /// Construct a new dialog
73 /// 75 ///
74 /// @param[in] title Title string 76 /// @param[in] title Title string
75 /// 77 ///
76 CDialogExtendedProgress(const std::string& title = "") 78 CExtendedProgress(const std::string& title = "")
77 { 79 {
78 using namespace ::kodi::addon; 80 using namespace ::kodi::addon;
79 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase, title.c_str()); 81 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase, title.c_str());
@@ -84,10 +86,10 @@ namespace gui
84 86
85 //========================================================================== 87 //==========================================================================
86 /// 88 ///
87 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 89 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
88 /// Destructor 90 /// Destructor
89 /// 91 ///
90 ~CDialogExtendedProgress() 92 ~CExtendedProgress()
91 { 93 {
92 using namespace ::kodi::addon; 94 using namespace ::kodi::addon;
93 if (m_DialogHandle) 95 if (m_DialogHandle)
@@ -97,7 +99,7 @@ namespace gui
97 99
98 //========================================================================== 100 //==========================================================================
99 /// 101 ///
100 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 102 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
101 /// @brief Get the used title 103 /// @brief Get the used title
102 /// 104 ///
103 /// @return Title string 105 /// @return Title string
@@ -119,7 +121,7 @@ namespace gui
119 121
120 //========================================================================== 122 //==========================================================================
121 /// 123 ///
122 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 124 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
123 /// @brief To set the title of dialog 125 /// @brief To set the title of dialog
124 /// 126 ///
125 /// @param[in] title Title string 127 /// @param[in] title Title string
@@ -133,7 +135,7 @@ namespace gui
133 135
134 //========================================================================== 136 //==========================================================================
135 /// 137 ///
136 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 138 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
137 /// @brief Get the used text information string 139 /// @brief Get the used text information string
138 /// 140 ///
139 /// @return Text string 141 /// @return Text string
@@ -155,7 +157,7 @@ namespace gui
155 157
156 //========================================================================== 158 //==========================================================================
157 /// 159 ///
158 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 160 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
159 /// @brief To set the used text information string 161 /// @brief To set the used text information string
160 /// 162 ///
161 /// @param[in] text information text to set 163 /// @param[in] text information text to set
@@ -169,7 +171,7 @@ namespace gui
169 171
170 //========================================================================== 172 //==========================================================================
171 /// 173 ///
172 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 174 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
173 /// @brief To ask dialog is finished 175 /// @brief To ask dialog is finished
174 /// 176 ///
175 /// @return True if on end 177 /// @return True if on end
@@ -183,7 +185,7 @@ namespace gui
183 185
184 //========================================================================== 186 //==========================================================================
185 /// 187 ///
186 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 188 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
187 /// @brief Mark progress finished 189 /// @brief Mark progress finished
188 /// 190 ///
189 void MarkFinished() 191 void MarkFinished()
@@ -195,7 +197,7 @@ namespace gui
195 197
196 //========================================================================== 198 //==========================================================================
197 /// 199 ///
198 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 200 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
199 /// @brief Get the current progress position as percent 201 /// @brief Get the current progress position as percent
200 /// 202 ///
201 /// @return Position 203 /// @return Position
@@ -209,7 +211,7 @@ namespace gui
209 211
210 //========================================================================== 212 //==========================================================================
211 /// 213 ///
212 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 214 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
213 /// @brief To set the current progress position as percent 215 /// @brief To set the current progress position as percent
214 /// 216 ///
215 /// @param[in] percentage Position to use from 0.0 to 100.0 217 /// @param[in] percentage Position to use from 0.0 to 100.0
@@ -223,7 +225,7 @@ namespace gui
223 225
224 //========================================================================== 226 //==========================================================================
225 /// 227 ///
226 /// \ingroup cpp_kodi_gui_CDialogExtendedProgress 228 /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress
227 /// @brief To set progress position with predefined places 229 /// @brief To set progress position with predefined places
228 /// 230 ///
229 /// @param[in] currentItem Place position to use 231 /// @param[in] currentItem Place position to use
@@ -240,5 +242,6 @@ namespace gui
240 void* m_DialogHandle; 242 void* m_DialogHandle;
241 }; 243 };
242 244
245} /* namespace dialogs */
243} /* namespace gui */ 246} /* namespace gui */
244} /* namespace kodi */ 247} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogFileBrowser.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
index e348125..401a78d 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogFileBrowser.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h
@@ -19,35 +19,37 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogFileBrowser Dialog File Browser 34 /// \defgroup cpp_kodi_gui_dialogs_FileBrowser Dialog File Browser
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_namespace{ kodi::gui::DialogFileBrowser } 36 /// @brief \cpp_namespace{ kodi::gui::dialogs::FileBrowser }
35 /// **File browser dialog** 37 /// **File browser dialog**
36 /// 38 ///
37 /// The functions listed below of the class "DialogFileBrowser" offer 39 /// The functions listed below of the class "FileBrowser" offer
38 /// the possibility to select to a file by the user of the add-on. 40 /// the possibility to select to a file by the user of the add-on.
39 /// 41 ///
40 /// It allows all the options that are possible in Kodi itself and offers all 42 /// It allows all the options that are possible in Kodi itself and offers all
41 /// support file types. 43 /// support file types.
42 /// 44 ///
43 /// It has the header \ref DialogFileBrowser.h "#include <kodi/gui/DialogFileBrowser.h>" 45 /// It has the header \ref FileBrowser.h "#include <kodi/gui/dialogs/FileBrowser.h>"
44 /// be included to enjoy it. 46 /// be included to enjoy it.
45 /// 47 ///
46 namespace DialogFileBrowser 48 namespace FileBrowser
47 { 49 {
48 //========================================================================== 50 //==========================================================================
49 /// 51 ///
50 /// \ingroup cpp_kodi_gui_DialogFileBrowser 52 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
51 /// @brief Directory selection dialog 53 /// @brief Directory selection dialog
52 /// 54 ///
53 /// @param[in] shares With Shares becomes the available start folders 55 /// @param[in] shares With Shares becomes the available start folders
@@ -60,7 +62,7 @@ namespace gui
60 /// 62 ///
61 /// **Example:** 63 /// **Example:**
62 /// ~~~~~~~~~~~~~{.cpp} 64 /// ~~~~~~~~~~~~~{.cpp}
63 /// #include <kodi/gui/DialogFileBrowser.h> 65 /// #include <kodi/gui/dialogs/FileBrowser.h>
64 /// 66 ///
65 /// /* 67 /// /*
66 /// * Example show directory selection dialog with on 'share' (first value) 68 /// * Example show directory selection dialog with on 'share' (first value)
@@ -73,7 +75,7 @@ namespace gui
73 /// * to a start place. 75 /// * to a start place.
74 /// */ 76 /// */
75 /// std::string directory; 77 /// std::string directory;
76 /// bool ret = kodi::gui::DialogFileBrowser::ShowAndGetDirectory("local|network|removable", 78 /// bool ret = kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory("local|network|removable",
77 /// "Test directory selection", 79 /// "Test directory selection",
78 /// directory, 80 /// directory,
79 /// false); 81 /// false);
@@ -98,7 +100,7 @@ namespace gui
98 100
99 //========================================================================== 101 //==========================================================================
100 /// 102 ///
101 /// \ingroup cpp_kodi_gui_DialogFileBrowser 103 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
102 /// @brief File selection dialog 104 /// @brief File selection dialog
103 /// 105 ///
104 /// @param[in] shares With Shares becomes the available start 106 /// @param[in] shares With Shares becomes the available start
@@ -133,7 +135,7 @@ namespace gui
133 135
134 //========================================================================== 136 //==========================================================================
135 /// 137 ///
136 /// \ingroup cpp_kodi_gui_DialogFileBrowser 138 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
137 /// @brief File selection from a directory 139 /// @brief File selection from a directory
138 /// 140 ///
139 /// @param[in] directory The directory name where the dialog 141 /// @param[in] directory The directory name where the dialog
@@ -171,7 +173,7 @@ namespace gui
171 173
172 //========================================================================== 174 //==========================================================================
173 /// 175 ///
174 /// \ingroup cpp_kodi_gui_DialogFileBrowser 176 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
175 /// @brief File selection dialog to get several in to a list 177 /// @brief File selection dialog to get several in to a list
176 /// 178 ///
177 /// @param[in] shares With Shares becomes the available start 179 /// @param[in] shares With Shares becomes the available start
@@ -206,7 +208,7 @@ namespace gui
206 208
207 //========================================================================== 209 //==========================================================================
208 /// 210 ///
209 /// \ingroup cpp_kodi_gui_DialogFileBrowser 211 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
210 /// @brief Source selection dialog 212 /// @brief Source selection dialog
211 /// 213 ///
212 /// @param[in,out] path As in the path to start and Return value 214 /// @param[in,out] path As in the path to start and Return value
@@ -235,7 +237,7 @@ namespace gui
235 237
236 //========================================================================== 238 //==========================================================================
237 /// 239 ///
238 /// \ingroup cpp_kodi_gui_DialogFileBrowser 240 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
239 /// @brief Image selection dialog 241 /// @brief Image selection dialog
240 /// 242 ///
241 /// @param[in] shares With Shares becomes the available start folders be 243 /// @param[in] shares With Shares becomes the available start folders be
@@ -262,7 +264,7 @@ namespace gui
262 264
263 //========================================================================== 265 //==========================================================================
264 /// 266 ///
265 /// \ingroup cpp_kodi_gui_DialogFileBrowser 267 /// \ingroup cpp_kodi_gui_dialogs_FileBrowser
266 /// @brief Image selection dialog to get several in to a list 268 /// @brief Image selection dialog to get several in to a list
267 /// 269 ///
268 /// @param[in] shares With Shares becomes the available start folders 270 /// @param[in] shares With Shares becomes the available start folders
@@ -289,5 +291,6 @@ namespace gui
289 //-------------------------------------------------------------------------- 291 //--------------------------------------------------------------------------
290 }; 292 };
291 293
294} /* namespace dialogs */
292} /* namespace gui */ 295} /* namespace gui */
293} /* namespace kodi */ 296} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogKeyboard.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h
index 9261972..cff30d8 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogKeyboard.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h
@@ -19,19 +19,21 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogKeyboard Dialog Keyboard 34 /// \defgroup cpp_kodi_gui_dialogs_Keyboard Dialog Keyboard
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_namespace{ kodi::gui::DialogKeyboard } 36 /// @brief \cpp_namespace{ kodi::gui::dialogs::Keyboard }
35 /// **Keyboard dialogs** 37 /// **Keyboard dialogs**
36 /// 38 ///
37 /// The functions listed below have to be permitted by the user for the 39 /// The functions listed below have to be permitted by the user for the
@@ -40,14 +42,14 @@ namespace gui
40 /// The class supports several kinds, from an easy text choice up to the 42 /// The class supports several kinds, from an easy text choice up to the
41 /// passport Word production and their confirmation for add-on. 43 /// passport Word production and their confirmation for add-on.
42 /// 44 ///
43 /// It has the header \ref DialogKeyboard.h "#include <kodi/gui/DialogKeyboard.h>" 45 /// It has the header \ref Keyboard.h "#include <kodi/gui/dialogs/Keyboard.h>"
44 /// be included to enjoy it. 46 /// be included to enjoy it.
45 /// 47 ///
46 namespace DialogKeyboard 48 namespace Keyboard
47 { 49 {
48 //========================================================================== 50 //==========================================================================
49 /// 51 ///
50 /// \ingroup cpp_kodi_gui_DialogKeyboard 52 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
51 /// @brief Show keyboard with initial value `text` and replace with result 53 /// @brief Show keyboard with initial value `text` and replace with result
52 /// string. 54 /// string.
53 /// 55 ///
@@ -67,7 +69,7 @@ namespace gui
67 /// 69 ///
68 /// **Example:** 70 /// **Example:**
69 /// ~~~~~~~~~~~~~{.cpp} 71 /// ~~~~~~~~~~~~~{.cpp}
70 /// #include <kodi/gui/DialogKeyboard.h> 72 /// #include <kodi/gui/dialogs/Keyboard.h>
71 /// 73 ///
72 /// /* 74 /// /*
73 /// * The example shows the display of keyboard call dialog at Kodi from the add-on. 75 /// * The example shows the display of keyboard call dialog at Kodi from the add-on.
@@ -76,7 +78,7 @@ namespace gui
76 /// */ 78 /// */
77 /// std::string text = "Please change me to them want you want"; /*< It can be leaved empty or a 79 /// std::string text = "Please change me to them want you want"; /*< It can be leaved empty or a
78 /// entry text added */ 80 /// entry text added */
79 /// bool bRet = ::kodi::gui::DialogKeyboard::ShowAndGetInput(text, 81 /// bool bRet = ::kodi::gui::dialogs::Keyboard::ShowAndGetInput(text,
80 /// "Demonstration text entry", 82 /// "Demonstration text entry",
81 /// true, 83 /// true,
82 /// false, 84 /// false,
@@ -104,7 +106,7 @@ namespace gui
104 106
105 //========================================================================== 107 //==========================================================================
106 /// 108 ///
107 /// \ingroup cpp_kodi_gui_DialogKeyboard 109 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
108 /// @brief The example shows the display of keyboard call dialog at Kodi 110 /// @brief The example shows the display of keyboard call dialog at Kodi
109 /// from the add-on. 111 /// from the add-on.
110 /// 112 ///
@@ -137,7 +139,7 @@ namespace gui
137 139
138 //========================================================================== 140 //==========================================================================
139 /// 141 ///
140 /// \ingroup cpp_kodi_gui_DialogKeyboard 142 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
141 /// @brief Shows keyboard and prompts for a password. Differs from 143 /// @brief Shows keyboard and prompts for a password. Differs from
142 /// `ShowAndVerifyNewPassword()` in that no second verification 144 /// `ShowAndVerifyNewPassword()` in that no second verification
143 /// 145 ///
@@ -170,7 +172,7 @@ namespace gui
170 172
171 //========================================================================== 173 //==========================================================================
172 /// 174 ///
173 /// \ingroup cpp_kodi_gui_DialogKeyboard 175 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
174 /// @brief Shows keyboard and prompts for a password. Differs from 176 /// @brief Shows keyboard and prompts for a password. Differs from
175 /// `ShowAndVerifyNewPassword()` in that no second verification 177 /// `ShowAndVerifyNewPassword()` in that no second verification
176 /// 178 ///
@@ -200,7 +202,7 @@ namespace gui
200 202
201 //========================================================================== 203 //==========================================================================
202 /// 204 ///
203 /// \ingroup cpp_kodi_gui_DialogKeyboard 205 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
204 /// @brief Show keyboard twice to get and confirm a user-entered password 206 /// @brief Show keyboard twice to get and confirm a user-entered password
205 /// string. 207 /// string.
206 /// 208 ///
@@ -220,7 +222,7 @@ namespace gui
220 /// **Example:** 222 /// **Example:**
221 /// ~~~~~~~~~~~~~{.cpp} 223 /// ~~~~~~~~~~~~~{.cpp}
222 /// #include <kodi/General.h> 224 /// #include <kodi/General.h>
223 /// #include <kodi/gui/DialogKeyboard.h> 225 /// #include <kodi/gui/dialogs/Keyboard.h>
224 /// 226 ///
225 /// /* 227 /// /*
226 /// * The example below shows the complete use of keyboard dialog for password 228 /// * The example below shows the complete use of keyboard dialog for password
@@ -246,7 +248,7 @@ namespace gui
246 /// /* 248 /// /*
247 /// * Ask the user about the password. 249 /// * Ask the user about the password.
248 /// */ 250 /// */
249 /// ret = ::kodi::gui::DialogKeyboard::ShowAndVerifyPassword(password, "Demo password call for PW 'kodi'", i, 0); 251 /// ret = ::kodi::gui::dialogs::Keyboard::ShowAndVerifyPassword(password, "Demo password call for PW 'kodi'", i, 0);
250 /// if (ret == 0) 252 /// if (ret == 0)
251 /// { 253 /// {
252 /// fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1); 254 /// fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1);
@@ -283,7 +285,7 @@ namespace gui
283 285
284 //========================================================================== 286 //==========================================================================
285 /// 287 ///
286 /// \ingroup cpp_kodi_gui_DialogKeyboard 288 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
287 /// @brief Show keyboard twice to get and confirm a user-entered password 289 /// @brief Show keyboard twice to get and confirm a user-entered password
288 /// string. 290 /// string.
289 /// 291 ///
@@ -313,7 +315,7 @@ namespace gui
313 315
314 //========================================================================== 316 //==========================================================================
315 /// 317 ///
316 /// \ingroup cpp_kodi_gui_DialogKeyboard 318 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
317 /// @brief Show keyboard and verify user input against `password`. 319 /// @brief Show keyboard and verify user input against `password`.
318 /// 320 ///
319 /// @param[in,out] password Value to compare against user input. 321 /// @param[in,out] password Value to compare against user input.
@@ -347,7 +349,7 @@ namespace gui
347 349
348 //========================================================================== 350 //==========================================================================
349 /// 351 ///
350 /// \ingroup cpp_kodi_gui_DialogKeyboard 352 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
351 /// @brief Shows a filter related keyboard 353 /// @brief Shows a filter related keyboard
352 /// 354 ///
353 /// @param[in,out] text Overwritten with user input if return=true. 355 /// @param[in,out] text Overwritten with user input if return=true.
@@ -381,7 +383,7 @@ namespace gui
381 383
382 //========================================================================== 384 //==========================================================================
383 /// 385 ///
384 /// \ingroup cpp_kodi_gui_DialogKeyboard 386 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
385 /// @brief Send a text to a visible keyboard 387 /// @brief Send a text to a visible keyboard
386 /// 388 ///
387 /// @param[in] text Overwritten with user input if return=true. 389 /// @param[in] text Overwritten with user input if return=true.
@@ -399,7 +401,7 @@ namespace gui
399 401
400 //========================================================================== 402 //==========================================================================
401 /// 403 ///
402 /// \ingroup cpp_kodi_gui_DialogKeyboard 404 /// \ingroup cpp_kodi_gui_dialogs_Keyboard
403 /// @brief Check for visible keyboard on GUI 405 /// @brief Check for visible keyboard on GUI
404 /// 406 ///
405 /// @return true if keyboard present, false if not present 407 /// @return true if keyboard present, false if not present
@@ -412,5 +414,6 @@ namespace gui
412 //-------------------------------------------------------------------------- 414 //--------------------------------------------------------------------------
413 }; 415 };
414 416
417} /* namespace dialogs */
415} /* namespace gui */ 418} /* namespace gui */
416} /* namespace kodi */ 419} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogNumeric.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h
index 8b5c592..dddbf7e 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogNumeric.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h
@@ -19,20 +19,22 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogNumeric Dialog Numeric 34 /// \defgroup cpp_kodi_gui_dialogs_Numeric Dialog Numeric
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @{ 36 /// @{
35 /// @brief \cpp_namespace{ kodi::gui::DialogNumeric } 37 /// @brief \cpp_namespace{ kodi::gui::dialogs::Numeric }
36 /// **Numeric dialogs** 38 /// **Numeric dialogs**
37 /// 39 ///
38 /// The functions listed below have to be permitted by the user for the 40 /// The functions listed below have to be permitted by the user for the
@@ -41,14 +43,14 @@ namespace gui
41 /// The class supports several kinds, from an easy number choice up to the 43 /// The class supports several kinds, from an easy number choice up to the
42 /// passport Word production and their confirmation for add-on. 44 /// passport Word production and their confirmation for add-on.
43 /// 45 ///
44 /// It has the header \ref DialogNumeric.h "#include <kodi/gui/DialogNumeric.h>" 46 /// It has the header \ref Numeric.h "#include <kodi/gui/dialogs/Numeric.h>"
45 /// be included to enjoy it. 47 /// be included to enjoy it.
46 /// 48 ///
47 namespace DialogNumeric 49 namespace Numeric
48 { 50 {
49 //========================================================================== 51 //==========================================================================
50 /// 52 ///
51 /// \ingroup cpp_kodi_gui_DialogNumeric 53 /// \ingroup cpp_kodi_gui_dialogs_Numeric
52 /// @brief Use dialog to get numeric new password 54 /// @brief Use dialog to get numeric new password
53 /// 55 ///
54 /// @param[out] newPassword String to preload into the keyboard 56 /// @param[out] newPassword String to preload into the keyboard
@@ -76,7 +78,7 @@ namespace gui
76 78
77 //========================================================================== 79 //==========================================================================
78 /// 80 ///
79 /// \ingroup cpp_kodi_gui_DialogNumeric 81 /// \ingroup cpp_kodi_gui_dialogs_Numeric
80 /// @brief Use dialog to verify numeric password. 82 /// @brief Use dialog to verify numeric password.
81 /// 83 ///
82 /// @param[in] password Password to compare with user input, need 84 /// @param[in] password Password to compare with user input, need
@@ -97,7 +99,7 @@ namespace gui
97 /// ~~~~~~~~~~~~~{.cpp} 99 /// ~~~~~~~~~~~~~{.cpp}
98 /// #include <stdio.h> /* fprintf */ 100 /// #include <stdio.h> /* fprintf */
99 /// #include <kodi/General.h> 101 /// #include <kodi/General.h>
100 /// #include <kodi/gui/DialogNumeric.h> 102 /// #include <kodi/gui/dialogs/Numeric.h>
101 /// 103 ///
102 /// /* 104 /// /*
103 /// * The example below shows the complete use of keyboard dialog for password 105 /// * The example below shows the complete use of keyboard dialog for password
@@ -123,7 +125,7 @@ namespace gui
123 /// /* 125 /// /*
124 /// * Ask the user about the password. 126 /// * Ask the user about the password.
125 /// */ 127 /// */
126 /// ret = kodi::gui::DialogNumeric::ShowAndVerifyPassword(password, "Demo numeric password call for PW '1234'", i); 128 /// ret = kodi::gui::dialogs::Numeric::ShowAndVerifyPassword(password, "Demo numeric password call for PW '1234'", i);
127 /// if (ret == 0) 129 /// if (ret == 0)
128 /// { 130 /// {
129 /// fprintf(stderr, "Numeric password successfull confirmed after '%i' tries\n", i+1); 131 /// fprintf(stderr, "Numeric password successfull confirmed after '%i' tries\n", i+1);
@@ -151,7 +153,7 @@ namespace gui
151 153
152 //========================================================================== 154 //==========================================================================
153 /// 155 ///
154 /// \ingroup cpp_kodi_gui_DialogNumeric 156 /// \ingroup cpp_kodi_gui_dialogs_Numeric
155 /// @brief Use dialog to verify numeric password 157 /// @brief Use dialog to verify numeric password
156 /// 158 ///
157 /// @param[in,out] toVerify Value to compare against user input. 159 /// @param[in,out] toVerify Value to compare against user input.
@@ -180,7 +182,7 @@ namespace gui
180 182
181 //========================================================================== 183 //==========================================================================
182 /// 184 ///
183 /// \ingroup cpp_kodi_gui_DialogNumeric 185 /// \ingroup cpp_kodi_gui_dialogs_Numeric
184 /// @brief Use dialog to get time value. 186 /// @brief Use dialog to get time value.
185 /// 187 ///
186 /// @param[out] time Overwritten with user input if 188 /// @param[out] time Overwritten with user input if
@@ -197,7 +199,7 @@ namespace gui
197 /// ~~~~~~~~~~~~~{.cpp} 199 /// ~~~~~~~~~~~~~{.cpp}
198 /// #include <stdio.h> /* printf */ 200 /// #include <stdio.h> /* printf */
199 /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */ 201 /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */
200 /// #include <kodi/gui/DialogNumeric.h> 202 /// #include <kodi/gui/dialogs/Numeric.h>
201 /// 203 ///
202 /// time_t rawtime; 204 /// time_t rawtime;
203 /// struct tm * timeinfo; 205 /// struct tm * timeinfo;
@@ -205,7 +207,7 @@ namespace gui
205 /// 207 ///
206 /// time (&rawtime); 208 /// time (&rawtime);
207 /// timeinfo = localtime(&rawtime); 209 /// timeinfo = localtime(&rawtime);
208 /// bool bRet = kodi::gui::DialogNumeric::ShowAndGetTime(*timeinfo, "Selected time test call"); 210 /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetTime(*timeinfo, "Selected time test call");
209 /// strftime(buffer, sizeof(buffer), "%H:%M.", timeinfo); 211 /// strftime(buffer, sizeof(buffer), "%H:%M.", timeinfo);
210 /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); 212 /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
211 /// ~~~~~~~~~~~~~ 213 /// ~~~~~~~~~~~~~
@@ -219,7 +221,7 @@ namespace gui
219 221
220 //========================================================================== 222 //==========================================================================
221 /// 223 ///
222 /// \ingroup cpp_kodi_gui_DialogNumeric 224 /// \ingroup cpp_kodi_gui_dialogs_Numeric
223 /// @brief Use dialog to get date value. 225 /// @brief Use dialog to get date value.
224 /// 226 ///
225 /// @param[in,out] date Overwritten with user input if 227 /// @param[in,out] date Overwritten with user input if
@@ -236,7 +238,7 @@ namespace gui
236 /// ~~~~~~~~~~~~~{.cpp} 238 /// ~~~~~~~~~~~~~{.cpp}
237 /// #include <stdio.h> /* printf */ 239 /// #include <stdio.h> /* printf */
238 /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */ 240 /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */
239 /// #include <kodi/gui/DialogNumeric.h> 241 /// #include <kodi/gui/dialogs/Numeric.h>
240 /// 242 ///
241 /// time_t rawtime; 243 /// time_t rawtime;
242 /// struct tm * timeinfo; 244 /// struct tm * timeinfo;
@@ -244,7 +246,7 @@ namespace gui
244 /// 246 ///
245 /// time (&rawtime); 247 /// time (&rawtime);
246 /// timeinfo = localtime(&rawtime); 248 /// timeinfo = localtime(&rawtime);
247 /// bool bRet = kodi::gui::DialogNumeric::ShowAndGetDate(*timeinfo, "Selected date test call"); 249 /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetDate(*timeinfo, "Selected date test call");
248 /// strftime(buffer, sizeof(buffer), "%Y-%m-%d", timeinfo); 250 /// strftime(buffer, sizeof(buffer), "%Y-%m-%d", timeinfo);
249 /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); 251 /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled");
250 /// ~~~~~~~~~~~~~ 252 /// ~~~~~~~~~~~~~
@@ -258,7 +260,7 @@ namespace gui
258 260
259 //========================================================================== 261 //==========================================================================
260 /// 262 ///
261 /// \ingroup cpp_kodi_gui_DialogNumeric 263 /// \ingroup cpp_kodi_gui_dialogs_Numeric
262 /// @brief Use dialog to get a IP 264 /// @brief Use dialog to get a IP
263 /// 265 ///
264 /// @param[in,out] ipAddress Overwritten with user input if 266 /// @param[in,out] ipAddress Overwritten with user input if
@@ -287,7 +289,7 @@ namespace gui
287 289
288 //========================================================================== 290 //==========================================================================
289 /// 291 ///
290 /// \ingroup cpp_kodi_gui_DialogNumeric 292 /// \ingroup cpp_kodi_gui_dialogs_Numeric
291 /// @brief Use dialog to get normal number. 293 /// @brief Use dialog to get normal number.
292 /// 294 ///
293 /// @param[in,out] input Overwritten with user input if 295 /// @param[in,out] input Overwritten with user input if
@@ -308,10 +310,10 @@ namespace gui
308 /// ~~~~~~~~~~~~~{.cpp} 310 /// ~~~~~~~~~~~~~{.cpp}
309 /// #include <stdio.h> /* printf */ 311 /// #include <stdio.h> /* printf */
310 /// #include <stdlib.h> /* strtoull (C++11) */ 312 /// #include <stdlib.h> /* strtoull (C++11) */
311 /// #include <kodi/gui/DialogNumeric.h> 313 /// #include <kodi/gui/dialogs/Numeric.h>
312 /// 314 ///
313 /// std::string number; 315 /// std::string number;
314 /// bool bRet = kodi::gui::DialogNumeric::ShowAndGetNumber(number, "Number test call"); 316 /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetNumber(number, "Number test call");
315 /// printf("Written number input is : %llu and was %s\n", 317 /// printf("Written number input is : %llu and was %s\n",
316 /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled"); 318 /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled");
317 /// ~~~~~~~~~~~~~ 319 /// ~~~~~~~~~~~~~
@@ -334,7 +336,7 @@ namespace gui
334 336
335 //========================================================================== 337 //==========================================================================
336 /// 338 ///
337 /// \ingroup cpp_kodi_gui_DialogNumeric 339 /// \ingroup cpp_kodi_gui_dialogs_Numeric
338 /// @brief Show numeric keypad to get seconds. 340 /// @brief Show numeric keypad to get seconds.
339 /// 341 ///
340 /// @param[in,out] time Overwritten with user input if return=true and 342 /// @param[in,out] time Overwritten with user input if return=true and
@@ -362,5 +364,6 @@ namespace gui
362 }; 364 };
363 /// @} 365 /// @}
364 366
367} /* namespace dialogs */
365} /* namespace gui */ 368} /* namespace gui */
366} /* namespace kodi */ 369} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogOK.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h
index fa98241..12799b7 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogOK.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h
@@ -19,33 +19,35 @@
19 * 19 *
20 */ 20 */
21 21
22#include "../AddonBase.h" 22#include "../../AddonBase.h"
23#include "definitions.h" 23#include "../definitions.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogOK Dialog OK 34 /// \defgroup cpp_kodi_gui_dialogs_OK Dialog OK
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @{ 36 /// @{
35 /// @brief \cpp_namespace{ kodi::gui::DialogOK } 37 /// @brief \cpp_namespace{ kodi::gui::dialogs::OK }
36 /// **OK dialog** 38 /// **OK dialog**
37 /// 39 ///
38 /// The functions listed below permit the call of a dialogue of information, a 40 /// The functions listed below permit the call of a dialogue of information, a
39 /// confirmation of the user by press from OK required. 41 /// confirmation of the user by press from OK required.
40 /// 42 ///
41 /// It has the header \ref DialogOK.h "#include <kodi/gui/DialogOK.h>" 43 /// It has the header \ref OK.h "#include <kodi/gui/dialogs/OK.h>"
42 /// be included to enjoy it. 44 /// be included to enjoy it.
43 /// 45 ///
44 namespace DialogOK 46 namespace OK
45 { 47 {
46 //========================================================================== 48 //==========================================================================
47 /// 49 ///
48 /// \ingroup cpp_kodi_gui_DialogOK 50 /// \ingroup cpp_kodi_gui_dialogs_OK
49 /// @brief Use dialog to inform user with text and confirmation with OK with continued string. 51 /// @brief Use dialog to inform user with text and confirmation with OK with continued string.
50 /// 52 ///
51 /// @param[in] heading Dialog heading. 53 /// @param[in] heading Dialog heading.
@@ -56,9 +58,9 @@ namespace gui
56 /// 58 ///
57 /// **Example:** 59 /// **Example:**
58 /// ~~~~~~~~~~~~~{.cpp} 60 /// ~~~~~~~~~~~~~{.cpp}
59 /// #include <kodi/gui/DialogOK.h> 61 /// #include <kodi/gui/dialogs/OK.h>
60 /// ... 62 /// ...
61 /// kodi::gui::DialogOK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D"); 63 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D");
62 /// ~~~~~~~~~~~~~ 64 /// ~~~~~~~~~~~~~
63 /// 65 ///
64 inline void ShowAndGetInput(const std::string& heading, const std::string& text) 66 inline void ShowAndGetInput(const std::string& heading, const std::string& text)
@@ -71,7 +73,7 @@ namespace gui
71 73
72 //========================================================================== 74 //==========================================================================
73 /// 75 ///
74 /// \ingroup cpp_kodi_gui_DialogOK 76 /// \ingroup cpp_kodi_gui_dialogs_OK
75 /// @brief Use dialog to inform user with text and confirmation with OK with strings separated to the lines. 77 /// @brief Use dialog to inform user with text and confirmation with OK with strings separated to the lines.
76 /// 78 ///
77 /// @param[in] heading Dialog heading. 79 /// @param[in] heading Dialog heading.
@@ -84,9 +86,9 @@ namespace gui
84 /// 86 ///
85 /// **Example:** 87 /// **Example:**
86 /// ~~~~~~~~~~~~~{.cpp} 88 /// ~~~~~~~~~~~~~{.cpp}
87 /// #include <kodi/gui/DialogOK.h> 89 /// #include <kodi/gui/dialogs/OK.h>
88 /// ... 90 /// ...
89 /// kodi::gui::DialogOK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D"); 91 /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D");
90 /// ~~~~~~~~~~~~~ 92 /// ~~~~~~~~~~~~~
91 /// 93 ///
92 inline void ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2) 94 inline void ShowAndGetInput(const std::string& heading, const std::string& line0, const std::string& line1, const std::string& line2)
@@ -100,5 +102,6 @@ namespace gui
100 } 102 }
101 /// @} 103 /// @}
102 104
105} /* namespace dialogs */
103} /* namespace gui */ 106} /* namespace gui */
104} /* namespace kodi */ 107} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogProgress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h
index e652644..3f18499 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogProgress.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h
@@ -19,30 +19,32 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_CDialogProgress Dialog Progress 34 /// \defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @brief \cpp_class{ kodi::gui::CDialogProgress } 36 /// @brief \cpp_class{ kodi::gui::dialogs::CProgress }
35 /// **Progress dialog shown in center** 37 /// **Progress dialog shown in center**
36 /// 38 ///
37 /// The with \ref DialogProgress.h "#include <kodi/gui/DialogProgress.h>" 39 /// The with \ref DialogProgress.h "#include <kodi/gui/dialogs/Progress.h>"
38 /// given class are basically used to create Kodi's progress dialog with named 40 /// given class are basically used to create Kodi's progress dialog with named
39 /// text fields. 41 /// text fields.
40 /// 42 ///
41 /// **Example:** 43 /// **Example:**
42 /// ~~~~~~~~~~~~~{.cpp} 44 /// ~~~~~~~~~~~~~{.cpp}
43 /// #include <kodi/gui/DialogProgress.h> 45 /// #include <kodi/gui/dialogs/Progress.h>
44 /// 46 ///
45 /// kodi::gui::CDialogProgress *progress = new kodi::gui::CDialogProgress; 47 /// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress;
46 /// progress->SetHeading("Test progress"); 48 /// progress->SetHeading("Test progress");
47 /// progress->SetLine(1, "line 1"); 49 /// progress->SetLine(1, "line 1");
48 /// progress->SetLine(2, "line 2"); 50 /// progress->SetLine(2, "line 2");
@@ -58,29 +60,29 @@ namespace gui
58 /// delete progress; 60 /// delete progress;
59 /// ~~~~~~~~~~~~~ 61 /// ~~~~~~~~~~~~~
60 /// 62 ///
61 class CDialogProgress 63 class CProgress
62 { 64 {
63 public: 65 public:
64 //========================================================================== 66 //==========================================================================
65 /// 67 ///
66 /// \ingroup cpp_kodi_gui_CDialogProgress 68 /// \ingroup cpp_kodi_gui_dialogs_CProgress
67 /// @brief Construct a new dialog 69 /// @brief Construct a new dialog
68 /// 70 ///
69 CDialogProgress() 71 CProgress()
70 { 72 {
71 using namespace ::kodi::addon; 73 using namespace ::kodi::addon;
72 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase); 74 m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog(CAddonBase::m_interface->toKodi->kodiBase);
73 if (!m_DialogHandle) 75 if (!m_DialogHandle)
74 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::CDialogProgress can't create window class from Kodi !!!"); 76 kodi::Log(ADDON_LOG_FATAL, "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!");
75 } 77 }
76 //-------------------------------------------------------------------------- 78 //--------------------------------------------------------------------------
77 79
78 //========================================================================== 80 //==========================================================================
79 /// 81 ///
80 /// \ingroup cpp_kodi_gui_CDialogProgress 82 /// \ingroup cpp_kodi_gui_dialogs_CProgress
81 /// @brief Destructor 83 /// @brief Destructor
82 /// 84 ///
83 ~CDialogProgress() 85 ~CProgress()
84 { 86 {
85 using namespace ::kodi::addon; 87 using namespace ::kodi::addon;
86 if (m_DialogHandle) 88 if (m_DialogHandle)
@@ -90,7 +92,7 @@ namespace gui
90 92
91 //========================================================================== 93 //==========================================================================
92 /// 94 ///
93 /// \ingroup cpp_kodi_gui_CDialogProgress 95 /// \ingroup cpp_kodi_gui_dialogs_CProgress
94 /// @brief To open the dialog 96 /// @brief To open the dialog
95 /// 97 ///
96 void Open() 98 void Open()
@@ -102,7 +104,7 @@ namespace gui
102 104
103 //========================================================================== 105 //==========================================================================
104 /// 106 ///
105 /// \ingroup cpp_kodi_gui_CDialogProgress 107 /// \ingroup cpp_kodi_gui_dialogs_CProgress
106 /// @brief Set the heading title of dialog 108 /// @brief Set the heading title of dialog
107 /// 109 ///
108 /// @param[in] heading Title string to use 110 /// @param[in] heading Title string to use
@@ -116,7 +118,7 @@ namespace gui
116 118
117 //========================================================================== 119 //==========================================================================
118 /// 120 ///
119 /// \ingroup cpp_kodi_gui_CDialogProgress 121 /// \ingroup cpp_kodi_gui_dialogs_CProgress
120 /// @brief To set the line text field on dialog from 0 - 2 122 /// @brief To set the line text field on dialog from 0 - 2
121 /// 123 ///
122 /// @param[in] iLine Line number 124 /// @param[in] iLine Line number
@@ -131,7 +133,7 @@ namespace gui
131 133
132 //========================================================================== 134 //==========================================================================
133 /// 135 ///
134 /// \ingroup cpp_kodi_gui_CDialogProgress 136 /// \ingroup cpp_kodi_gui_dialogs_CProgress
135 /// @brief To enable and show cancel button on dialog 137 /// @brief To enable and show cancel button on dialog
136 /// 138 ///
137 /// @param[in] canCancel if true becomes it shown 139 /// @param[in] canCancel if true becomes it shown
@@ -145,7 +147,7 @@ namespace gui
145 147
146 //========================================================================== 148 //==========================================================================
147 /// 149 ///
148 /// \ingroup cpp_kodi_gui_CDialogProgress 150 /// \ingroup cpp_kodi_gui_dialogs_CProgress
149 /// @brief To check dialog for clicked cancel button 151 /// @brief To check dialog for clicked cancel button
150 /// 152 ///
151 /// @return True if canceled 153 /// @return True if canceled
@@ -159,7 +161,7 @@ namespace gui
159 161
160 //========================================================================== 162 //==========================================================================
161 /// 163 ///
162 /// \ingroup cpp_kodi_gui_CDialogProgress 164 /// \ingroup cpp_kodi_gui_dialogs_CProgress
163 /// @brief Get the current progress position as percent 165 /// @brief Get the current progress position as percent
164 /// 166 ///
165 /// @param[in] percentage Position to use from 0 to 100 167 /// @param[in] percentage Position to use from 0 to 100
@@ -173,7 +175,7 @@ namespace gui
173 175
174 //========================================================================== 176 //==========================================================================
175 /// 177 ///
176 /// \ingroup cpp_kodi_gui_CDialogProgress 178 /// \ingroup cpp_kodi_gui_dialogs_CProgress
177 /// @brief To set the current progress position as percent 179 /// @brief To set the current progress position as percent
178 /// 180 ///
179 /// @return Current Position used from 0 to 100 181 /// @return Current Position used from 0 to 100
@@ -187,7 +189,7 @@ namespace gui
187 189
188 //========================================================================== 190 //==========================================================================
189 /// 191 ///
190 /// \ingroup cpp_kodi_gui_CDialogProgress 192 /// \ingroup cpp_kodi_gui_dialogs_CProgress
191 /// @brief To show or hide progress bar dialog 193 /// @brief To show or hide progress bar dialog
192 /// 194 ///
193 /// @param[in] onOff If true becomes it shown 195 /// @param[in] onOff If true becomes it shown
@@ -201,7 +203,7 @@ namespace gui
201 203
202 //========================================================================== 204 //==========================================================================
203 /// 205 ///
204 /// \ingroup cpp_kodi_gui_CDialogProgress 206 /// \ingroup cpp_kodi_gui_dialogs_CProgress
205 /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used 207 /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used
206 /// 208 ///
207 /// @param[in] max Biggest usable position to use 209 /// @param[in] max Biggest usable position to use
@@ -215,7 +217,7 @@ namespace gui
215 217
216 //========================================================================== 218 //==========================================================================
217 /// 219 ///
218 /// \ingroup cpp_kodi_gui_CDialogProgress 220 /// \ingroup cpp_kodi_gui_dialogs_CProgress
219 /// @brief To increase progress bar by defined step size until reach of maximum position 221 /// @brief To increase progress bar by defined step size until reach of maximum position
220 /// 222 ///
221 /// @param[in] steps Step size to increase, default is 1 223 /// @param[in] steps Step size to increase, default is 1
@@ -229,7 +231,7 @@ namespace gui
229 231
230 //========================================================================== 232 //==========================================================================
231 /// 233 ///
232 /// \ingroup cpp_kodi_gui_CDialogProgress 234 /// \ingroup cpp_kodi_gui_dialogs_CProgress
233 /// @brief To check progress was canceled on work 235 /// @brief To check progress was canceled on work
234 /// 236 ///
235 /// @return True if aborted 237 /// @return True if aborted
@@ -245,5 +247,6 @@ namespace gui
245 void* m_DialogHandle; 247 void* m_DialogHandle;
246 }; 248 };
247 249
250} /* namespace dialogs */
248} /* namespace gui */ 251} /* namespace gui */
249} /* namespace kodi */ 252} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogSelect.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h
index 36433db..963c84c 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogSelect.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h
@@ -19,41 +19,44 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogSelect Dialog Select 34 /// \defgroup cpp_kodi_gui_dialogs_Select Dialog Select
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @{ 36 /// @{
35 /// @brief \cpp_namespace{ kodi::gui::DialogSelect } 37 /// @brief \cpp_namespace{ kodi::gui::dialogs::Select }
36 /// **Selection dialog** 38 /// **Selection dialog**
37 /// 39 ///
38 /// The function listed below permits the call of a dialogue to select of an 40 /// The function listed below permits the call of a dialogue to select of an
39 /// entry as a key 41 /// entry as a key
40 /// 42 ///
41 /// It has the header \ref DialogSelect.h "#include <kodi/gui/DialogSelect.h>" 43 /// It has the header \ref Select.h "#include <kodi/gui/dialogs/Select.h>"
42 /// be included to enjoy it. 44 /// be included to enjoy it.
43 /// 45 ///
44 /// 46 ///
45 namespace DialogSelect 47 namespace Select
46 { 48 {
47 //========================================================================== 49 //==========================================================================
48 /// 50 ///
49 /// \ingroup cpp_kodi_gui_DialogSelect 51 /// \ingroup cpp_kodi_gui_dialogs_Select
50 /// @brief Show a selection dialog about given parts. 52 /// @brief Show a selection dialog about given parts.
51 /// 53 ///
52 /// @param[in] heading Dialog heading name 54 /// @param[in] heading Dialog heading name
53 /// @param[in] entries String list about entries 55 /// @param[in] entries String list about entries
54 /// @param[in] selected [opt] Predefined selection (default is 56 /// @param[in] selected [opt] Predefined selection (default is
55 /// <tt>-1</tt> for the first) 57 /// <tt>-1</tt> for the first)
56 /// @param[in] autoclose [opt] To close dialog automatic after a time 58 /// @param[in] autoclose [opt] To close dialog automatic after the given
59 /// time in ms. As '0' it stays open.
57 /// @return The selected entry, if return <tt>-1</tt> was 60 /// @return The selected entry, if return <tt>-1</tt> was
58 /// nothing selected or canceled 61 /// nothing selected or canceled
59 /// 62 ///
@@ -62,7 +65,7 @@ namespace gui
62 /// 65 ///
63 /// **Example:** 66 /// **Example:**
64 /// ~~~~~~~~~~~~~{.cpp} 67 /// ~~~~~~~~~~~~~{.cpp}
65 /// #include <kodi/gui/DialogSelect.h> 68 /// #include <kodi/gui/dialogs/Select.h>
66 /// 69 ///
67 /// const std::vector<std::string> entries 70 /// const std::vector<std::string> entries
68 /// { 71 /// {
@@ -73,14 +76,14 @@ namespace gui
73 /// "Test 5" 76 /// "Test 5"
74 /// }; 77 /// };
75 /// 78 ///
76 /// int selected = kodi::gui::DialogSelect::Show("Test selection", entries, -1); 79 /// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1);
77 /// if (selected < 0) 80 /// if (selected < 0)
78 /// fprintf(stderr, "Item selection canceled\n"); 81 /// fprintf(stderr, "Item selection canceled\n");
79 /// else 82 /// else
80 /// fprintf(stderr, "Selected item is: %i\n", selected); 83 /// fprintf(stderr, "Selected item is: %i\n", selected);
81 /// ~~~~~~~~~~~~~ 84 /// ~~~~~~~~~~~~~
82 /// 85 ///
83 inline int Show(const std::string& heading, const std::vector<std::string>& entries, int selected = -1, bool autoclose = false) 86 inline int Show(const std::string& heading, const std::vector<std::string>& entries, int selected = -1, unsigned int autoclose = 0)
84 { 87 {
85 using namespace ::kodi::addon; 88 using namespace ::kodi::addon;
86 unsigned int size = entries.size(); 89 unsigned int size = entries.size();
@@ -97,5 +100,6 @@ namespace gui
97 }; 100 };
98 /// @} 101 /// @}
99 102
103} /* namespace dialogs */
100} /* namespace gui */ 104} /* namespace gui */
101} /* namespace kodi */ 105} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogTextViewer.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h
index 09c81bd..c64bc1e 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogTextViewer.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h
@@ -19,20 +19,22 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogTextViewer Dialog Text Viewer 34 /// \defgroup cpp_kodi_gui_dialogs_TextViewer Dialog Text Viewer
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @{ 36 /// @{
35 /// @brief \cpp_namespace{ kodi::gui::DialogTextViewer } 37 /// @brief \cpp_namespace{ kodi::gui::dialogs::TextViewer }
36 /// **Text viewer dialog** 38 /// **Text viewer dialog**
37 /// 39 ///
38 /// The text viewer dialog can be used to display descriptions, help texts or 40 /// The text viewer dialog can be used to display descriptions, help texts or
@@ -42,14 +44,14 @@ namespace gui
42 /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em> 44 /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em>
43 /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>. 45 /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>.
44 /// 46 ///
45 /// It has the header \ref DialogTextViewer.h "#include <kodi/gui/DialogTextViewer.h>" 47 /// It has the header \ref TextViewer.h "#include <kodi/gui/dialogs/TextViewer.h>"
46 /// be included to enjoy it. 48 /// be included to enjoy it.
47 /// 49 ///
48 namespace DialogTextViewer 50 namespace TextViewer
49 { 51 {
50 //========================================================================== 52 //==========================================================================
51 /// 53 ///
52 /// \ingroup cpp_kodi_gui_DialogTextViewer 54 /// \ingroup cpp_kodi_gui_dialogs_TextViewer
53 /// @brief Show info text dialog 55 /// @brief Show info text dialog
54 /// 56 ///
55 /// @param[in] heading Small heading text 57 /// @param[in] heading Small heading text
@@ -60,9 +62,9 @@ namespace gui
60 /// 62 ///
61 /// **Example:** 63 /// **Example:**
62 /// ~~~~~~~~~~~~~{.cpp} 64 /// ~~~~~~~~~~~~~{.cpp}
63 /// #include <kodi/gui/DialogTextViewer.h> 65 /// #include <kodi/gui/dialogs/TextViewer.h>
64 /// 66 ///
65 /// kodi::gui::DialogTextViewer::Show("The Wizard of Oz (1939 film)", 67 /// kodi::gui::dialogs::TextViewer::Show("The Wizard of Oz (1939 film)",
66 /// "The Wizard of Oz is a 1939 American musical comedy-drama fantasy film " 68 /// "The Wizard of Oz is a 1939 American musical comedy-drama fantasy film "
67 /// "produced by Metro-Goldwyn-Mayer, and the most well-known and commercially " 69 /// "produced by Metro-Goldwyn-Mayer, and the most well-known and commercially "
68 /// "successful adaptation based on the 1900 novel The Wonderful Wizard of Oz " 70 /// "successful adaptation based on the 1900 novel The Wonderful Wizard of Oz "
@@ -111,5 +113,6 @@ namespace gui
111 }; 113 };
112 /// @} 114 /// @}
113 115
116} /* namespace dialogs */
114} /* namespace gui */ 117} /* namespace gui */
115} /* namespace kodi */ 118} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogYesNo.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h
index 064bf8c..d9c34ff 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/DialogYesNo.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h
@@ -19,20 +19,22 @@
19 * 19 *
20 */ 20 */
21 21
22#include "definitions.h" 22#include "../definitions.h"
23#include "../AddonBase.h" 23#include "../../AddonBase.h"
24 24
25namespace kodi 25namespace kodi
26{ 26{
27namespace gui 27namespace gui
28{ 28{
29namespace dialogs
30{
29 31
30 //============================================================================ 32 //============================================================================
31 /// 33 ///
32 /// \defgroup cpp_kodi_gui_DialogYesNo Dialog Yes/No 34 /// \defgroup cpp_kodi_gui_dialogs_YesNo Dialog Yes/No
33 /// \ingroup cpp_kodi_gui 35 /// \ingroup cpp_kodi_gui
34 /// @{ 36 /// @{
35 /// @brief \cpp_namespace{ kodi::gui::DialogYesNo } 37 /// @brief \cpp_namespace{ kodi::gui::dialogs::YesNo }
36 /// **Yes / No dialog** 38 /// **Yes / No dialog**
37 /// 39 ///
38 /// The Yes / No dialog can be used to inform the user about questions and get 40 /// The Yes / No dialog can be used to inform the user about questions and get
@@ -42,15 +44,15 @@ namespace gui
42 /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em> 44 /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em>
43 /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>. 45 /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>.
44 /// 46 ///
45 /// It has the header \ref DialogYesNo.h "#include <kodi/gui/DialogYesNo.h>" 47 /// It has the header \ref YesNo.h "#include <kodi/gui/dialogs/YesNo.h>"
46 /// be included to enjoy it. 48 /// be included to enjoy it.
47 /// 49 ///
48 /// 50 ///
49 namespace DialogYesNo 51 namespace YesNo
50 { 52 {
51 //========================================================================== 53 //==========================================================================
52 /// 54 ///
53 /// \ingroup cpp_kodi_gui_DialogYesNo 55 /// \ingroup cpp_kodi_gui_dialogs_YesNo
54 /// @brief Use dialog to get numeric new password with one text string shown 56 /// @brief Use dialog to get numeric new password with one text string shown
55 /// everywhere and cancel return field 57 /// everywhere and cancel return field
56 /// 58 ///
@@ -68,10 +70,10 @@ namespace gui
68 /// 70 ///
69 /// **Example:** 71 /// **Example:**
70 /// ~~~~~~~~~~~~~{.cpp} 72 /// ~~~~~~~~~~~~~{.cpp}
71 /// #include <kodi/gui/DialogYesNo.h> 73 /// #include <kodi/gui/dialogs/YesNo.h>
72 /// 74 ///
73 /// bool canceled; 75 /// bool canceled;
74 /// bool ret = kodi::gui::DialogYesNo::ShowAndGetInput( 76 /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
75 /// "Yes / No test call", /* The Header */ 77 /// "Yes / No test call", /* The Header */
76 /// "You has opened Yes / No dialog for test\n\nIs this OK for you?", 78 /// "You has opened Yes / No dialog for test\n\nIs this OK for you?",
77 /// canceled, /* return value about cancel button */ 79 /// canceled, /* return value about cancel button */
@@ -95,7 +97,7 @@ namespace gui
95 97
96 //========================================================================== 98 //==========================================================================
97 /// 99 ///
98 /// \ingroup cpp_kodi_gui_DialogYesNo 100 /// \ingroup cpp_kodi_gui_dialogs_YesNo
99 /// @brief Use dialog to get numeric new password with separated line strings 101 /// @brief Use dialog to get numeric new password with separated line strings
100 /// 102 ///
101 /// @param[in] heading Dialog heading 103 /// @param[in] heading Dialog heading
@@ -111,9 +113,9 @@ namespace gui
111 /// 113 ///
112 /// **Example:** 114 /// **Example:**
113 /// ~~~~~~~~~~~~~{.cpp} 115 /// ~~~~~~~~~~~~~{.cpp}
114 /// #include <kodi/gui/DialogYesNo.h> 116 /// #include <kodi/gui/dialogs/YesNo.h>
115 /// 117 ///
116 /// bool ret = kodi::gui::DialogYesNo::ShowAndGetInput( 118 /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
117 /// "Yes / No test call", // The Header 119 /// "Yes / No test call", // The Header
118 /// "You has opened Yes / No dialog for test", 120 /// "You has opened Yes / No dialog for test",
119 /// "", 121 /// "",
@@ -137,7 +139,7 @@ namespace gui
137 139
138 //========================================================================== 140 //==========================================================================
139 /// 141 ///
140 /// \ingroup cpp_kodi_gui_DialogYesNo 142 /// \ingroup cpp_kodi_gui_dialogs_YesNo
141 /// @brief Use dialog to get numeric new password with separated line strings and cancel return field 143 /// @brief Use dialog to get numeric new password with separated line strings and cancel return field
142 /// 144 ///
143 /// @param[in] heading Dialog heading 145 /// @param[in] heading Dialog heading
@@ -154,10 +156,10 @@ namespace gui
154 /// 156 ///
155 /// **Example:** 157 /// **Example:**
156 /// ~~~~~~~~~~~~~{.cpp} 158 /// ~~~~~~~~~~~~~{.cpp}
157 /// #include <kodi/gui/DialogYesNo.h> 159 /// #include <kodi/gui/dialogs/YesNo.h>
158 /// 160 ///
159 /// bool canceled; 161 /// bool canceled;
160 /// bool ret = kodi::gui::DialogYesNo::ShowAndGetInput( 162 /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput(
161 /// "Yes / No test call", // The Header 163 /// "Yes / No test call", // The Header
162 /// "You has opened Yes / No dialog for test", 164 /// "You has opened Yes / No dialog for test",
163 /// "", 165 /// "",
@@ -183,5 +185,6 @@ namespace gui
183 }; 185 };
184 /// @} 186 /// @}
185 187
188} /* namespace dialogs */
186} /* namespace gui */ 189} /* namespace gui */
187} /* namespace kodi */ 190} /* namespace kodi */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
deleted file mode 100644
index b0ecb8b..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
+++ /dev/null
@@ -1,529 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23/*!
24 * @file kodi_adsp_dll.h
25 * @section sec1 Basic audio dsp addon interface description
26 * @author Team Kodi
27 * @date 10. May 2014
28 * @version 0.1.5
29 *
30 * @subsection sec1_1 General
31 * @li The basic support on the addon is supplied with the
32 * AE_DSP_ADDON_CAPABILITIES data which becomes asked over
33 * GetAddonCapabilities(...), further the addon must register his available
34 * modes on startup with the RegisterMode(...) callback function (see
35 * libKODI_adsp.h). If one of this two points is not set the addon becomes
36 * ignored for the chain step.
37 *
38 * @subsection sec1_2 Processing
39 * @li On start of new stream the addon becomes called with StreamCreate(...)
40 * to check about given values that it support it basically and can create
41 * his structure, if nothing is supported it can return AE_DSP_ERROR_IGNORE_ME.
42 *
43 * @li As next step StreamIsModeSupported(...) becomes called for every
44 * available and enabled modes, is separated due to more as one available mode
45 * on the addon is possible, if the mode is not supported it can also be return
46 * AE_DSP_ERROR_IGNORE_ME.
47 * - If mode is a resample mode and returns no error it becomes asked with
48 * InputResampleSampleRate(...) or OutputResampleSampleRate(...) (relevant
49 * to his type) about his given sample rate.
50 * - About the from user selected master processing mode the related addon
51 * becomes called now with MasterProcessSetMode(...) to handle it's
52 * selection on the addon given by the own addon type identifier or by
53 * KODI's useddatabase id, also the currently used stream type (e.g.
54 * Music or Video) is send.
55 * - If the addon supports only one master mode it can ignore this function
56 * and return always AE_DSP_ERROR_NO_ERROR.
57 * - If the master mode is set the addon becomes asked about the from him
58 * given output channel layout related to up- or downmix modes, if
59 * nothing becomes changed on the layout it can return -1.
60 * - The MasterProcessSetMode(...) is also called if from user a another
61 * mode becomes selected.
62 *
63 * @li Then as last step shortly before the first process call becomes executed
64 * the addon is called one time with StreamInitialize(...) to inform that
65 * processing is started on the given settings.
66 * - This function becomes also called on all add-ons if the master process
67 * becomes changed.
68 * - Also every process after StreamInitialize on the addon mode becomes asked
69 * with _..._ProcessNeededSamplesize(...) about required memory size for the
70 * output of his data, if no other size is required it can return 0.
71 *
72 * @li From now the processing becomes handled for the different steps with
73 * _..._Process(...).
74 * - Further it becomes asked with _..._GetDelay(...) about his processing
75 * time as float value in seconds, needed for video and audio alignment.
76 *
77 * @li On the end of the processing if the source becomes stopped the
78 * StreamDestroy(...) function becomes called on all active processing add-ons.
79 *
80 * @note
81 * The StreamCreate(...) can be becomes called for a new stream before the
82 * previous was closed with StreamDestroy(...) ! To have a speed improve.
83 */
84
85#include "xbmc_addon_dll.h"
86#include "kodi_adsp_types.h"
87
88/*!
89 * Functions that the Audio DSP add-on must implement, but some can be empty.
90 *
91 * The 'remarks' field indicates which methods should be implemented, and which
92 * ones are optional.
93 */
94
95extern "C"
96{
97 /*! @name Audio DSP add-on methods */
98 //@{
99 /*!
100 * @brief Get the list of features that this add-on provides.
101 * Called by KODI to query the add-ons capabilities.
102 * Used to check which options should be presented in the DSP, which methods
103 * to call, etc.
104 * All capabilities that the add-on supports should be set to true.
105 * @param pCapabilities The add-ons capabilities.
106 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
107 * @remarks Valid implementation required.
108 */
109 AE_DSP_ERROR GetAddonCapabilities(AE_DSP_ADDON_CAPABILITIES *pCapabilities);
110
111 /*!
112 * @return The name reported by the back end that will be displayed in the
113 * UI.
114 * @remarks Valid implementation required.
115 */
116 const char* GetDSPName(void);
117
118 /*!
119 * @return The version string reported by the back end that will be displayed
120 * in the UI.
121 * @remarks Valid implementation required.
122 */
123 const char* GetDSPVersion(void);
124
125 /*!
126 * @brief Call one of the menu hooks (if supported).
127 * Supported AE_DSP_MENUHOOK instances have to be added in ADDON_Create(),
128 * by calling AddMenuHook() on the callback.
129 * @param menuhook The hook to call.
130 * @param item The selected item for which the hook was called.
131 * @return AE_DSP_ERROR_NO_ERROR if the hook was called successfully.
132 * @remarks Optional. Return AE_DSP_ERROR_NOT_IMPLEMENTED if this add-on
133 * won't provide this function.
134 */
135 AE_DSP_ERROR CallMenuHook(const AE_DSP_MENUHOOK& menuhook, const AE_DSP_MENUHOOK_DATA &item);
136 //@}
137
138 /** @name DSP processing control, used to open and close a stream
139 * @remarks Valid implementation required.
140 */
141 //@{
142 /*!
143 * @brief Set up Audio DSP with selected audio settings (use the basic
144 * present audio stream data format).
145 * Used to detect available add-ons for present stream, as example stereo
146 * surround upmix not needed on 5.1 audio stream.
147 * @param addonSettings The add-ons audio settings.
148 * @param pProperties The properties of the currently playing stream.
149 * @param handle On this becomes addon informed about stream id and can set function addresses which need on calls
150 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
151 * and data can be performed. AE_DSP_ERROR_IGNORE_ME if format is not
152 * supported, but without fault.
153 * @remarks Valid implementation required.
154 */
155 AE_DSP_ERROR StreamCreate(const AE_DSP_SETTINGS *addonSettings, const AE_DSP_STREAM_PROPERTIES* pProperties, ADDON_HANDLE handle);
156
157 /*!
158 * Remove the selected id from currently used DSP processes
159 * @param handle identification data for stream
160 * @return AE_DSP_ERROR_NO_ERROR if the becomes found and removed
161 * @remarks Valid implementation required.
162 */
163 AE_DSP_ERROR StreamDestroy(const ADDON_HANDLE handle);
164
165 /*!
166 * @brief Ask the add-on about a requested processing mode that it is
167 * supported on the current stream. Is called about every add-on mode after
168 * successed StreamCreate.
169 * @param handle identification data for stream
170 * @param type The processing mode type, see AE_DSP_MODE_TYPE for definitions
171 * @param mode_id The mode inside add-on which must be performed on call. Id
172 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
173 * RegisterMode callback,
174 * @param unique_db_mode_id The Mode unique id generated from dsp database.
175 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully
176 * or if the stream is not supported the add-on must return
177 * AE_DSP_ERROR_IGNORE_ME.
178 * @remarks Valid implementation required.
179 */
180 AE_DSP_ERROR StreamIsModeSupported(const ADDON_HANDLE handle, AE_DSP_MODE_TYPE type, unsigned int mode_id, int unique_db_mode_id);
181
182 /*!
183 * @brief Set up Audio DSP with selected audio settings (detected on data of
184 * first present audio packet)
185 * @param addonSettings The add-ons audio settings.
186 * @return AE_DSP_ERROR_NO_ERROR if the properties were fetched successfully.
187 * @remarks Valid implementation required.
188 */
189 AE_DSP_ERROR StreamInitialize(const ADDON_HANDLE handle, const AE_DSP_SETTINGS *addonSettings);
190 //@}
191
192 /** @name DSP input processing
193 * @remarks Only used by KODI if bSupportsInputProcess is set to true.
194 */
195 //@{
196 /*!
197 * @brief DSP input processing
198 * Can be used to have unchanged stream..
199 * All DSP add-ons allowed to-do this.
200 * @param handle identification data for stream
201 * @param array_in Pointer to data memory
202 * @param samples Amount of samples inside array_in
203 * @return true if work was OK
204 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
205 * GetAddonCapabilities
206 */
207 bool InputProcess(const ADDON_HANDLE handle, const float **array_in, unsigned int samples);
208 //@}
209
210 /** @name DSP pre-resampling
211 * @remarks Only used by KODI if bSupportsInputResample is set to true.
212 */
213 //@{
214 /*!
215 * @brief If the add-on operate with buffered arrays and the output size can
216 * be higher as the input it becomes asked about needed size before any
217 * InputResampleProcess call.
218 * @param handle identification data for stream
219 * @return The needed size of output array or 0 if no changes within it
220 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
221 * GetAddonCapabilities
222 */
223 unsigned int InputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
224
225 /*!
226 * @brief DSP re sample processing before master.
227 * Here a high quality resample can be performed.
228 * Only one DSP add-on is allowed to-do this!
229 * @param handle identification data for stream
230 * @param array_in Pointer to input data memory
231 * @param array_out Pointer to output data memory
232 * @param samples Amount of samples inside array_in
233 * @return Amount of samples processed
234 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
235 * GetAddonCapabilities
236 */
237 unsigned int InputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
238
239 /*!
240 * @brief Returns the re-sampling generated new sample rate used before the
241 * master process
242 * @param handle identification data for stream
243 * @return The new sample rate
244 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
245 * GetAddonCapabilities
246 */
247 int InputResampleSampleRate(const ADDON_HANDLE handle);
248
249 /*!
250 * @brief Returns the time in seconds that it will take
251 * for the next added packet to be returned to KODI.
252 * @param handle identification data for stream
253 * @return the delay in seconds
254 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
255 * GetAddonCapabilities
256 */
257 float InputResampleGetDelay(const ADDON_HANDLE handle);
258 //@}
259
260 /** @name DSP Pre processing
261 * @remarks Only used by KODI if bSupportsPreProcess is set to true.
262 */
263 //@{
264 /*!
265 * @brief If the addon operate with buffered arrays and the output size can
266 * be higher as the input it becomes asked about needed size before any
267 * PreProcess call.
268 * @param handle identification data for stream
269 * @param mode_id The mode inside add-on which must be performed on call. Id
270 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
271 * RegisterMode callback and can be defined from add-on as a structure
272 * pointer or anything else what is needed to find it.
273 * @return The needed size of output array or 0 if no changes within it
274 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
275 * GetAddonCapabilities
276 */
277 unsigned int PreProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
278
279 /*!
280 * @brief Returns the time in seconds that it will take
281 * for the next added packet to be returned to KODI.
282 * @param handle identification data for stream
283 * @param mode_id The mode inside add-on which must be performed on call. Id
284 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
285 * RegisterMode callback and can be defined from add-on as a structure
286 * pointer or anything else what is needed to find it.
287 * @return the delay in seconds
288 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
289 * GetAddonCapabilities
290 */
291 float PreProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
292
293 /*!
294 * @brief DSP preprocessing
295 * All DSP add-ons allowed to-do this.
296 * @param handle identification data for stream
297 * @param mode_id The mode inside add-on which must be performed on call. Id
298 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
299 * RegisterMode callback and can be defined from add-on as a structure
300 * pointer or anything else what is needed to find it.
301 * @param array_in Pointer to input data memory
302 * @param array_out Pointer to output data memory
303 * @param samples Amount of samples inside array_in
304 * @return Amount of samples processed
305 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
306 * GetAddonCapabilities
307 */
308 unsigned int PreProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples);
309 //@}
310
311 /** @name DSP Master processing
312 * @remarks Only used by KODI if bSupportsMasterProcess is set to true.
313 */
314 //@{
315 /*!
316 * @brief Set the active master process mode
317 * @param handle identification data for stream
318 * @param type Requested stream type for the selected master mode
319 * @param mode_id The Mode identifier.
320 * @param unique_db_mode_id The Mode unique id generated from DSP database.
321 * @return AE_DSP_ERROR_NO_ERROR if the setup was successful
322 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
323 * GetAddonCapabilities
324 */
325 AE_DSP_ERROR MasterProcessSetMode(const ADDON_HANDLE handle, AE_DSP_STREAMTYPE type, unsigned int mode_id, int unique_db_mode_id);
326
327 /*!
328 * @brief If the add-on operate with buffered arrays and the output size can
329 * be higher as the input it becomes asked about needed size before any
330 * MasterProcess call.
331 * @param handle identification data for stream
332 * @return The needed size of output array or 0 if no changes within it
333 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
334 * GetAddonCapabilities
335 */
336 unsigned int MasterProcessNeededSamplesize(const ADDON_HANDLE handle);
337
338 /*!
339 * @brief Returns the time in seconds that it will take
340 * for the next added packet to be returned to KODI.
341 * @param handle identification data for stream
342 * @return the delay in seconds
343 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
344 * GetAddonCapabilities
345 */
346 float MasterProcessGetDelay(const ADDON_HANDLE handle);
347
348 /*!
349 * @brief Returns the from selected master mode performed channel alignment
350 * @param handle identification data for stream
351 * @retval out_channel_present_flags the exact channel present flags after
352 * performed up-/downmix
353 * @return the amount channels
354 * @remarks Optional. Must be used and set if a channel up- or downmix is
355 * processed from the active master mode
356 */
357 int MasterProcessGetOutChannels(const ADDON_HANDLE handle, unsigned long &out_channel_present_flags);
358
359 /*!
360 * @brief Master processing becomes performed with it
361 * Here a channel up-mix/down-mix for stereo surround sound can be performed
362 * Only one DSP add-on is allowed to-do this!
363 * @param handle identification data for stream
364 * @param array_in Pointer to input data memory
365 * @param array_out Pointer to output data memory
366 * @param samples Amount of samples inside array_in
367 * @return Amount of samples processed
368 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
369 * GetAddonCapabilities
370 */
371 unsigned int MasterProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
372
373 /*!
374 * Used to get a information string about the processed work to show on skin
375 * @return A string to show
376 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
377 * GetAddonCapabilities
378 */
379 const char *MasterProcessGetStreamInfoString(const ADDON_HANDLE handle);
380 //@}
381
382 /** @name DSP Post processing
383 * @remarks Only used by KODI if bSupportsPostProcess is set to true.
384 */
385 //@{
386 /*!
387 * If the add-on operate with buffered arrays and the output size can be
388 * higher as the input it becomes asked about needed size before any
389 * PostProcess call.
390 * @param handle identification data for stream
391 * @param mode_id The mode inside add-on which must be performed on call. Id
392 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
393 * RegisterMode callback, and can be defined from add-on as a structure
394 * pointer or anything else what is needed to find it.
395 * @return The needed size of output array or 0 if no changes within it
396 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
397 * GetAddonCapabilities
398 */
399 unsigned int PostProcessNeededSamplesize(const ADDON_HANDLE handle, unsigned int mode_id);
400
401 /*!
402 * Returns the time in seconds that it will take
403 * for the next added packet to be returned to KODI.
404 * @param handle identification data for stream
405 * @param mode_id The mode inside add-on which must be performed on call. Id
406 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
407 * RegisterMode callback, and can be defined from add-on as a structure
408 * pointer or anything else what is needed to find it.
409 * @return the delay in seconds
410 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
411 * GetAddonCapabilities
412 */
413 float PostProcessGetDelay(const ADDON_HANDLE handle, unsigned int mode_id);
414
415 /*!
416 * @brief DSP post processing
417 * On the post processing can be things performed with additional channel
418 * upmix like 6.1 to 7.1
419 * or frequency/volume corrections, speaker distance handling, equalizer... .
420 * All DSP add-ons allowed to-do this.
421 * @param handle identification data for stream
422 * @param mode_id The mode inside add-on which must be performed on call. Id
423 * is set from add-on by iModeNumber on AE_DSP_MODE structure during
424 * RegisterMode callback, and can be defined from add-on as a structure
425 * pointer or anything else what is needed to find it.
426 * @param array_in Pointer to input data memory
427 * @param array_out Pointer to output data memory
428 * @param samples Amount of samples inside array_in
429 * @return Amount of samples processed
430 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
431 * GetAddonCapabilities
432 */
433 unsigned int PostProcess(const ADDON_HANDLE handle, unsigned int mode_id, float **array_in, float **array_out, unsigned int samples);
434 //@}
435
436 /** @name DSP Post re-sampling
437 * @remarks Only used by KODI if bSupportsOutputResample is set to true.
438 */
439 //@{
440 /*!
441 * @brief If the add-on operate with buffered arrays and the output size
442 * can be higher as the input
443 * it becomes asked about needed size before any OutputResampleProcess call.
444 * @param handle identification data for stream
445 * @return The needed size of output array or 0 if no changes within it
446 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
447 * GetAddonCapabilities
448 */
449 unsigned int OutputResampleProcessNeededSamplesize(const ADDON_HANDLE handle);
450
451 /*!
452 * @brief Re-sampling after master processing becomes performed with it if
453 * needed, only
454 * one add-on can perform it.
455 * @param handle identification data for stream
456 * @param array_in Pointer to input data memory
457 * @param array_out Pointer to output data memory
458 * @param samples Amount of samples inside array_in
459 * @return Amount of samples processed
460 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
461 * GetAddonCapabilities
462 */
463 unsigned int OutputResampleProcess(const ADDON_HANDLE handle, float **array_in, float **array_out, unsigned int samples);
464
465 /*!
466 * @brief Returns the re-sampling generated new sample rate used after the
467 * master process.
468 * @param handle identification data for stream
469 * @return The new sample rate
470 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
471 * GetAddonCapabilities
472 */
473 int OutputResampleSampleRate(const ADDON_HANDLE handle);
474
475 /*!
476 * @brief Returns the time in seconds that it will take for the next added
477 * packet to be returned to KODI.
478 * @param handle identification data for stream
479 * @return the delay in seconds
480 * @remarks Optional. Is set by AE_DSP_ADDON_CAPABILITIES and asked with
481 * GetAddonCapabilities
482 */
483 float OutputResampleGetDelay(const ADDON_HANDLE handle);
484 //@}
485
486 // function to export the above structure to KODI
487 void __declspec(dllexport) get_addon(void* ptr)
488 {
489 KodiToAddonFuncTable_AudioDSP* pDSP = static_cast<KodiToAddonFuncTable_AudioDSP*>(ptr);
490
491 pDSP->GetAddonCapabilities = GetAddonCapabilities;
492 pDSP->GetDSPName = GetDSPName;
493 pDSP->GetDSPVersion = GetDSPVersion;
494 pDSP->MenuHook = CallMenuHook;
495
496 pDSP->StreamCreate = StreamCreate;
497 pDSP->StreamDestroy = StreamDestroy;
498 pDSP->StreamIsModeSupported = StreamIsModeSupported;
499 pDSP->StreamInitialize = StreamInitialize;
500
501 pDSP->InputProcess = InputProcess;
502
503 pDSP->InputResampleProcessNeededSamplesize = InputResampleProcessNeededSamplesize;
504 pDSP->InputResampleProcess = InputResampleProcess;
505 pDSP->InputResampleGetDelay = InputResampleGetDelay;
506 pDSP->InputResampleSampleRate = InputResampleSampleRate;
507
508 pDSP->PreProcessNeededSamplesize = PreProcessNeededSamplesize;
509 pDSP->PreProcessGetDelay = PreProcessGetDelay;
510 pDSP->PreProcess = PreProcess;
511
512 pDSP->MasterProcessSetMode = MasterProcessSetMode;
513 pDSP->MasterProcessNeededSamplesize = MasterProcessNeededSamplesize;
514 pDSP->MasterProcessGetDelay = MasterProcessGetDelay;
515 pDSP->MasterProcessGetOutChannels = MasterProcessGetOutChannels;
516 pDSP->MasterProcess = MasterProcess;
517 pDSP->MasterProcessGetStreamInfoString = MasterProcessGetStreamInfoString;
518
519 pDSP->PostProcessNeededSamplesize = PostProcessNeededSamplesize;
520 pDSP->PostProcessGetDelay = PostProcessGetDelay;
521 pDSP->PostProcess = PostProcess;
522
523 pDSP->OutputResampleProcessNeededSamplesize = OutputResampleProcessNeededSamplesize;
524 pDSP->OutputResampleProcess = OutputResampleProcess;
525 pDSP->OutputResampleSampleRate = OutputResampleSampleRate;
526 pDSP->OutputResampleGetDelay = OutputResampleGetDelay;
527 };
528};
529
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h
deleted file mode 100644
index 7dc7ae8..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h
+++ /dev/null
@@ -1,543 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23/*!
24 * Common data structures shared between KODI and KODI's audio DSP add-ons
25 */
26
27#ifndef TARGET_WINDOWS
28#ifndef __cdecl
29#define __cdecl
30#endif
31#ifndef __declspec
32#define __declspec(X)
33#endif
34#endif
35
36#include <cstddef>
37
38#include "xbmc_addon_types.h"
39
40#undef ATTRIBUTE_PACKED
41#undef PRAGMA_PACK_BEGIN
42#undef PRAGMA_PACK_END
43
44#if defined(__GNUC__)
45#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
46#define ATTRIBUTE_PACKED __attribute__ ((packed))
47#define PRAGMA_PACK 0
48#endif
49#endif
50
51#if !defined(ATTRIBUTE_PACKED)
52#define ATTRIBUTE_PACKED
53#define PRAGMA_PACK 1
54#endif
55
56#define AE_DSP_ADDON_STRING_LENGTH 1024
57
58#define AE_DSP_STREAM_MAX_STREAMS 8
59#define AE_DSP_STREAM_MAX_MODES 32
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65 typedef void* ADSPHANDLE;
66 typedef unsigned int AE_DSP_STREAM_ID;
67
68 /*!
69 * @brief Audio DSP add-on error codes
70 */
71 typedef enum
72 {
73 AE_DSP_ERROR_NO_ERROR = 0, /*!< @brief no error occurred */
74 AE_DSP_ERROR_UNKNOWN = -1, /*!< @brief an unknown error occurred */
75 AE_DSP_ERROR_IGNORE_ME = -2, /*!< @brief the used input stream can not processed and add-on want to ignore */
76 AE_DSP_ERROR_NOT_IMPLEMENTED = -3, /*!< @brief the method that KODI called is not implemented by the add-on */
77 AE_DSP_ERROR_REJECTED = -4, /*!< @brief the command was rejected by the DSP */
78 AE_DSP_ERROR_INVALID_PARAMETERS = -5, /*!< @brief the parameters of the method that was called are invalid for this operation */
79 AE_DSP_ERROR_INVALID_SAMPLERATE = -6, /*!< @brief the processed samplerate is not supported */
80 AE_DSP_ERROR_INVALID_IN_CHANNELS = -7, /*!< @brief the processed input channel format is not supported */
81 AE_DSP_ERROR_INVALID_OUT_CHANNELS = -8, /*!< @brief the processed output channel format is not supported */
82 AE_DSP_ERROR_FAILED = -9, /*!< @brief the command failed */
83 } AE_DSP_ERROR;
84
85 /*!
86 * @brief The possible DSP channels (used as pointer inside arrays)
87 */
88 typedef enum
89 {
90 AE_DSP_CH_INVALID = -1,
91 AE_DSP_CH_FL = 0,
92 AE_DSP_CH_FR,
93 AE_DSP_CH_FC,
94 AE_DSP_CH_LFE,
95 AE_DSP_CH_BL,
96 AE_DSP_CH_BR,
97 AE_DSP_CH_FLOC,
98 AE_DSP_CH_FROC,
99 AE_DSP_CH_BC,
100 AE_DSP_CH_SL,
101 AE_DSP_CH_SR,
102 AE_DSP_CH_TFL,
103 AE_DSP_CH_TFR,
104 AE_DSP_CH_TFC,
105 AE_DSP_CH_TC,
106 AE_DSP_CH_TBL,
107 AE_DSP_CH_TBR,
108 AE_DSP_CH_TBC,
109 AE_DSP_CH_BLOC,
110 AE_DSP_CH_BROC,
111
112 AE_DSP_CH_MAX
113 } AE_DSP_CHANNEL;
114
115 /*!
116 * @brief Present channel flags
117 */
118 typedef enum
119 {
120 AE_DSP_PRSNT_CH_UNDEFINED = 0,
121 AE_DSP_PRSNT_CH_FL = 1<<0,
122 AE_DSP_PRSNT_CH_FR = 1<<1,
123 AE_DSP_PRSNT_CH_FC = 1<<2,
124 AE_DSP_PRSNT_CH_LFE = 1<<3,
125 AE_DSP_PRSNT_CH_BL = 1<<4,
126 AE_DSP_PRSNT_CH_BR = 1<<5,
127 AE_DSP_PRSNT_CH_FLOC = 1<<6,
128 AE_DSP_PRSNT_CH_FROC = 1<<7,
129 AE_DSP_PRSNT_CH_BC = 1<<8,
130 AE_DSP_PRSNT_CH_SL = 1<<9,
131 AE_DSP_PRSNT_CH_SR = 1<<10,
132 AE_DSP_PRSNT_CH_TFL = 1<<11,
133 AE_DSP_PRSNT_CH_TFR = 1<<12,
134 AE_DSP_PRSNT_CH_TFC = 1<<13,
135 AE_DSP_PRSNT_CH_TC = 1<<14,
136 AE_DSP_PRSNT_CH_TBL = 1<<15,
137 AE_DSP_PRSNT_CH_TBR = 1<<16,
138 AE_DSP_PRSNT_CH_TBC = 1<<17,
139 AE_DSP_PRSNT_CH_BLOC = 1<<18,
140 AE_DSP_PRSNT_CH_BROC = 1<<19
141 } AE_DSP_CHANNEL_PRESENT;
142
143 /**
144 * @brief The various stream type formats
145 * Used for audio DSP processing to know input audio type
146 */
147 typedef enum
148 {
149 AE_DSP_ASTREAM_INVALID = -1,
150 AE_DSP_ASTREAM_BASIC = 0,
151 AE_DSP_ASTREAM_MUSIC,
152 AE_DSP_ASTREAM_MOVIE,
153 AE_DSP_ASTREAM_GAME,
154 AE_DSP_ASTREAM_APP,
155 AE_DSP_ASTREAM_PHONE,
156 AE_DSP_ASTREAM_MESSAGE,
157
158 AE_DSP_ASTREAM_AUTO,
159 AE_DSP_ASTREAM_MAX
160 } AE_DSP_STREAMTYPE;
161
162 /*!
163 * @brief Add-ons supported audio stream type flags
164 * used on master mode information on AE_DSP_MODES to know
165 * on which audio stream the master mode is supported
166 */
167 typedef enum
168 {
169 AE_DSP_PRSNT_ASTREAM_BASIC = 1<<0,
170 AE_DSP_PRSNT_ASTREAM_MUSIC = 1<<1,
171 AE_DSP_PRSNT_ASTREAM_MOVIE = 1<<2,
172 AE_DSP_PRSNT_ASTREAM_GAME = 1<<3,
173 AE_DSP_PRSNT_ASTREAM_APP = 1<<4,
174 AE_DSP_PRSNT_ASTREAM_MESSAGE = 1<<5,
175 AE_DSP_PRSNT_ASTREAM_PHONE = 1<<6,
176 } AE_DSP_ASTREAM_PRESENT;
177
178 /**
179 * @brief The various base type formats
180 * Used for audio DSP processing to know input audio source
181 */
182 typedef enum
183 {
184 AE_DSP_ABASE_INVALID = -1,
185 AE_DSP_ABASE_STEREO = 0,
186 AE_DSP_ABASE_MONO,
187 AE_DSP_ABASE_MULTICHANNEL,
188 AE_DSP_ABASE_AC3,
189 AE_DSP_ABASE_EAC3,
190 AE_DSP_ABASE_DTS,
191 AE_DSP_ABASE_DTSHD_MA,
192 AE_DSP_ABASE_DTSHD_HRA,
193 AE_DSP_ABASE_TRUEHD,
194 AE_DSP_ABASE_MLP,
195 AE_DSP_ABASE_FLAC,
196
197 AE_DSP_ABASE_MAX
198 } AE_DSP_BASETYPE;
199
200
201 /**
202 * @brief The from KODI in settings requested audio process quality.
203 * The KODI internal used quality levels is translated to this values
204 * for usage on DSP processing add-ons. Is present on iQualityLevel
205 * inside AE_DSP_SETTINGS.
206 */
207 typedef enum
208 {
209 AE_DSP_QUALITY_UNKNOWN = -1, /*!< @brief Unset, unknown or incorrect quality level */
210 AE_DSP_QUALITY_DEFAULT = 0, /*!< @brief Engine's default quality level */
211
212 /* Basic quality levels */
213 AE_DSP_QUALITY_LOW = 20, /*!< @brief Low quality level */
214 AE_DSP_QUALITY_MID = 30, /*!< @brief Standard quality level */
215 AE_DSP_QUALITY_HIGH = 50, /*!< @brief Best sound processing quality */
216
217 /* Optional quality levels */
218 AE_DSP_QUALITY_REALLYHIGH = 100 /*!< @brief Uncompromising optional quality level, usually with unmeasurable and unnoticeable improvement */
219 } AE_DSP_QUALITY;
220
221 /*!
222 * @brief Audio DSP menu hook categories.
223 * Used to identify on AE_DSP_MENUHOOK given add-on related skin dialog/windows.
224 * Except AE_DSP_MENUHOOK_ALL and AE_DSP_MENUHOOK_SETTING are the menus available
225 * from DSP playback dialogue which can be opened over KODI file context menu and over
226 * button on full screen OSD window.
227 *
228 * Menu hook AE_DSP_MENUHOOK_SETTING is available from DSP processing setup dialogue.
229 */
230 typedef enum
231 {
232 AE_DSP_MENUHOOK_UNKNOWN =-1, /*!< @brief unknown menu hook */
233 AE_DSP_MENUHOOK_ALL = 0, /*!< @brief all categories */
234 AE_DSP_MENUHOOK_PRE_PROCESS = 1, /*!< @brief for pre processing */
235 AE_DSP_MENUHOOK_MASTER_PROCESS = 2, /*!< @brief for master processing */
236 AE_DSP_MENUHOOK_POST_PROCESS = 3, /*!< @brief for post processing */
237 AE_DSP_MENUHOOK_RESAMPLE = 4, /*!< @brief for re sample */
238 AE_DSP_MENUHOOK_MISCELLANEOUS = 5, /*!< @brief for miscellaneous dialogues */
239 AE_DSP_MENUHOOK_INFORMATION = 6, /*!< @brief dialogue to show processing information */
240 AE_DSP_MENUHOOK_SETTING = 7, /*!< @brief for settings */
241 } AE_DSP_MENUHOOK_CAT;
242
243 /*!
244 * @brief Menu hooks that are available in the menus while playing a stream via this add-on.
245 */
246 typedef struct AE_DSP_MENUHOOK
247 {
248 unsigned int iHookId; /*!< @brief (required) this hook's identifier */
249 unsigned int iLocalizedStringId; /*!< @brief (required) the id of the label for this hook in g_localizeStrings */
250 AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) category of menu hook */
251 unsigned int iRelevantModeId; /*!< @brief (required) except category AE_DSP_MENUHOOK_SETTING and AE_DSP_MENUHOOK_ALL must be the related mode id present here */
252 bool bNeedPlayback; /*!< @brief (required) set to true if menu hook need playback and active processing */
253 } ATTRIBUTE_PACKED AE_DSP_MENUHOOK;
254
255 /*!
256 * @brief Audio DSP add-on capabilities. All capabilities are set to "false" as default.
257 * If a capability is set to true, then the corresponding methods from kodi_audiodsp_dll.h need to be implemented.
258 */
259 typedef struct AE_DSP_ADDON_CAPABILITIES
260 {
261 bool bSupportsInputProcess; /*!< @brief true if this add-on provides audio input processing */
262 bool bSupportsInputResample; /*!< @brief true if this add-on provides audio resample before master handling */
263 bool bSupportsPreProcess; /*!< @brief true if this add-on provides audio pre processing */
264 bool bSupportsMasterProcess; /*!< @brief true if this add-on provides audio master processing */
265 bool bSupportsPostProcess; /*!< @brief true if this add-on provides audio post processing */
266 bool bSupportsOutputResample; /*!< @brief true if this add-on provides audio re sample after master handling */
267 } ATTRIBUTE_PACKED AE_DSP_ADDON_CAPABILITIES;
268
269 /*!
270 * @brief Audio processing settings for in and out arrays
271 * Send on creation and before first processed audio packet to add-on
272 */
273 typedef struct AE_DSP_SETTINGS
274 {
275 AE_DSP_STREAM_ID iStreamID; /*!< @brief id of the audio stream packets */
276 AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
277 int iInChannels; /*!< @brief the amount of input channels */
278 unsigned long lInChannelPresentFlags; /*!< @brief the exact channel mapping flags of input */
279 int iInFrames; /*!< @brief the input frame size from KODI */
280 unsigned int iInSamplerate; /*!< @brief the basic sample rate of the audio packet */
281 int iProcessFrames; /*!< @brief the processing frame size inside add-on's */
282 unsigned int iProcessSamplerate; /*!< @brief the sample rate after input resample present in master processing */
283 int iOutChannels; /*!< @brief the amount of output channels */
284 unsigned long lOutChannelPresentFlags; /*!< @brief the exact channel mapping flags for output */
285 int iOutFrames; /*!< @brief the final out frame size for KODI */
286 unsigned int iOutSamplerate; /*!< @brief the final sample rate of the audio packet */
287 bool bInputResamplingActive; /*!< @brief if a re-sampling is performed before master processing this flag is set to true */
288 bool bStereoUpmix; /*!< @brief true if the stereo upmix setting on kodi is set */
289 int iQualityLevel; /*!< @brief the from KODI selected quality level for signal processing */
290 /*!
291 * @note about "iProcessSamplerate" and "iProcessFrames" is set from KODI after call of StreamCreate on input re sample add-on, if re-sampling
292 * and processing is handled inside the same add-on, this value must be ignored!
293 */
294 } ATTRIBUTE_PACKED AE_DSP_SETTINGS;
295
296 /*!
297 * @brief Stream profile properties
298 * Can be used to detect best master processing mode and for post processing methods.
299 */
300//@{
301
302 /*!
303 * @brief Dolby profile types. Given from several formats, e.g. Dolby Digital or TrueHD
304 * Used on AE_DSP_PROFILE_AC3_EAC3 and AE_DSP_PROFILE_MLP_TRUEHD
305 */
306 #define AE_DSP_PROFILE_DOLBY_NONE 0
307 #define AE_DSP_PROFILE_DOLBY_SURROUND 1
308 #define AE_DSP_PROFILE_DOLBY_PLII 2
309 #define AE_DSP_PROFILE_DOLBY_PLIIX 3
310 #define AE_DSP_PROFILE_DOLBY_PLIIZ 4
311 #define AE_DSP_PROFILE_DOLBY_EX 5
312 #define AE_DSP_PROFILE_DOLBY_HEADPHONE 6
313
314 /*!
315 * @brief DTS/DTS HD profile types
316 * Used on AE_DSP_PROFILE_DTS_DTSHD
317 */
318 #define AE_DSP_PROFILE_DTS 0
319 #define AE_DSP_PROFILE_DTS_ES 1
320 #define AE_DSP_PROFILE_DTS_96_24 2
321 #define AE_DSP_PROFILE_DTS_HD_HRA 3
322 #define AE_DSP_PROFILE_DTS_HD_MA 4
323
324 /*!
325 * @brief AC3/EAC3 based service types
326 * Used on AE_DSP_PROFILE_AC3_EAC3
327 */
328 #define AE_DSP_SERVICE_TYPE_MAIN 0
329 #define AE_DSP_SERVICE_TYPE_EFFECTS 1
330 #define AE_DSP_SERVICE_TYPE_VISUALLY_IMPAIRED 2
331 #define AE_DSP_SERVICE_TYPE_HEARING_IMPAIRED 3
332 #define AE_DSP_SERVICE_TYPE_DIALOGUE 4
333 #define AE_DSP_SERVICE_TYPE_COMMENTARY 5
334 #define AE_DSP_SERVICE_TYPE_EMERGENCY 6
335 #define AE_DSP_SERVICE_TYPE_VOICE_OVER 7
336 #define AE_DSP_SERVICE_TYPE_KARAOKE 8
337
338 /*!
339 * @brief AC3/EAC3 based room types
340 * Present on AE_DSP_PROFILE_AC3_EAC3 and can be used for frequency corrections
341 * at post processing, e.g. THX Re-Equalization
342 */
343 #define AE_DSP_ROOM_TYPE_UNDEFINED 0
344 #define AE_DSP_ROOM_TYPE_SMALL 1
345 #define AE_DSP_ROOM_TYPE_LARGE 2
346
347 /*!
348 * @brief AC3/EAC3 stream profile properties
349 */
350 //! @todo add handling for it (currently never becomes set)
351 typedef struct AE_DSP_PROFILE_AC3_EAC3
352 {
353 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
354 unsigned int iServiceType; /*!< defined by AE_DSP_SERVICE_TYPE_* */
355 unsigned int iRoomType; /*!< defined by AE_DSP_ROOM_TYPE_* (NOTICE: Information about it currently not supported from ffmpeg and must be implemented) */
356 } ATTRIBUTE_PACKED AE_DSP_PROFILE_AC3_EAC3;
357
358 /*!
359 * @brief MLP/Dolby TrueHD stream profile properties
360 */
361 //! @todo add handling for it (currently never becomes set)
362 typedef struct AE_DSP_PROFILE_MLP_TRUEHD
363 {
364 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DOLBY_* */
365 } ATTRIBUTE_PACKED AE_DSP_PROFILE_MLP_TRUEHD;
366
367 /*!
368 * @brief DTS/DTS HD stream profile properties
369 */
370 //! @todo add handling for it (currently never becomes set)
371 typedef struct AE_DSP_PROFILE_DTS_DTSHD
372 {
373 unsigned int iProfile; /*!< defined by AE_DSP_PROFILE_DTS* */
374 bool bSurroundMatrix; /*!< if set to true given 2.0 stream is surround encoded */
375 } ATTRIBUTE_PACKED AE_DSP_PROFILE_DTS_DTSHD;
376
377 union AE_DSP_PROFILE
378 {
379 AE_DSP_PROFILE_AC3_EAC3 ac3_eac3; /*!< Dolby Digital/Digital+ profile data */
380 AE_DSP_PROFILE_MLP_TRUEHD mlp_truehd; /*!< MLP or Dolby TrueHD profile data */
381 AE_DSP_PROFILE_DTS_DTSHD dts_dtshd; /*!< DTS/DTS-HD profile data */
382 };
383 //@}
384
385 /*!
386 * @brief Audio DSP stream properties
387 * Used to check for the DSP add-on that the stream is supported,
388 * as example Dolby Digital Ex processing is only required on Dolby Digital with 5.1 layout
389 */
390 typedef struct AE_DSP_STREAM_PROPERTIES
391 {
392 AE_DSP_STREAM_ID iStreamID; /*!< @brief stream id of the audio stream packets */
393 AE_DSP_STREAMTYPE iStreamType; /*!< @brief the input stream type source eg, Movie or Music */
394 int iBaseType; /*!< @brief the input stream base type source eg, Dolby Digital */
395 const char* strName; /*!< @brief the audio stream name */
396 const char* strCodecId; /*!< @brief codec id string of the audio stream */
397 const char* strLanguage; /*!< @brief language id of the audio stream */
398 int iIdentifier; /*!< @brief audio stream id inside player */
399 int iChannels; /*!< @brief amount of basic channels */
400 int iSampleRate; /*!< @brief sample rate */
401 AE_DSP_PROFILE Profile; /*!< @brief current running stream profile data */
402 } ATTRIBUTE_PACKED AE_DSP_STREAM_PROPERTIES;
403
404 /*!
405 * @brief Audio DSP mode categories
406 */
407 typedef enum
408 {
409 AE_DSP_MODE_TYPE_UNDEFINED = -1, /*!< @brief undefined type, never be used from add-on! */
410 AE_DSP_MODE_TYPE_INPUT_RESAMPLE = 0, /*!< @brief for input re sample */
411 AE_DSP_MODE_TYPE_PRE_PROCESS = 1, /*!< @brief for preprocessing */
412 AE_DSP_MODE_TYPE_MASTER_PROCESS = 2, /*!< @brief for master processing */
413 AE_DSP_MODE_TYPE_POST_PROCESS = 3, /*!< @brief for post processing */
414 AE_DSP_MODE_TYPE_OUTPUT_RESAMPLE = 4, /*!< @brief for output re sample */
415 AE_DSP_MODE_TYPE_MAX = 5
416 } AE_DSP_MODE_TYPE;
417
418 /*!
419 * @brief Audio DSP master mode information
420 * Used to get all available modes for current input stream
421 */
422 typedef struct AE_DSP_MODES
423 {
424 unsigned int iModesCount; /*!< @brief (required) count of how much modes are in AE_DSP_MODES */
425 struct AE_DSP_MODE
426 {
427 int iUniqueDBModeId; /*!< @brief (required) the inside add-on used identifier for the mode, set by KODI's audio DSP database */
428 AE_DSP_MODE_TYPE iModeType; /*!< @brief (required) the processing mode type, see AE_DSP_MODE_TYPE */
429 char strModeName[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (required) the addon name of the mode, used on KODI's logs */
430
431 unsigned int iModeNumber; /*!< @brief (required) number of this mode on the add-on, is used on process functions with value "mode_id" */
432 unsigned int iModeSupportTypeFlags; /*!< @brief (required) flags about supported input types for this mode, see AE_DSP_ASTREAM_PRESENT */
433 bool bHasSettingsDialog; /*!< @brief (required) if setting dialog(s) are available it must be set to true */
434 bool bIsDisabled; /*!< @brief (optional) true if this mode is marked as disabled and not enabled default, only relevant for master processes, all other types always disabled as default */
435
436 unsigned int iModeName; /*!< @brief (required) the name id of the mode for this hook in g_localizeStrings */
437 unsigned int iModeSetupName; /*!< @brief (optional) the name id of the mode inside settings for this hook in g_localizeStrings */
438 unsigned int iModeDescription; /*!< @brief (optional) the description id of the mode for this hook in g_localizeStrings */
439 unsigned int iModeHelp; /*!< @brief (optional) help string id for inside DSP settings dialog of the mode for this hook in g_localizeStrings */
440
441 char strOwnModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) flag image for the mode */
442 char strOverrideModeImage[AE_DSP_ADDON_STRING_LENGTH]; /*!< @brief (optional) image to override KODI Image for the mode, eg. Dolby Digital with Dolby Digital Ex (only used on master modes) */
443 } mode[AE_DSP_STREAM_MAX_MODES]; /*!< @brief Modes array storage */
444 } ATTRIBUTE_PACKED AE_DSP_MODES;
445
446 /*!
447 * @brief Audio DSP menu hook data
448 */
449 typedef struct AE_DSP_MENUHOOK_DATA
450 {
451 AE_DSP_MENUHOOK_CAT category; /*!< @brief (required) related menuhook data category */
452 union data {
453 AE_DSP_STREAM_ID iStreamId; /*!< @brief currently only stream id is used, is used as union to have extension possibility */
454 } data; /*!< @brief related category related data */
455 } ATTRIBUTE_PACKED AE_DSP_MENUHOOK_DATA;
456
457 /*!
458 * @brief Structure to transfer the methods from kodi_audiodsp_dll.h to KODI
459 */
460
461 typedef struct AddonProps_AudioDSP
462 {
463 const char* strUserPath; /*!< @brief path to the user profile */
464 const char* strAddonPath; /*!< @brief path to this add-on */
465 } AddonProps_AudioDSP;
466
467 typedef AddonProps_AudioDSP AE_DSP_PROPERTIES;
468
469 typedef struct AddonToKodiFuncTable_AudioDSP
470 {
471 KODI_HANDLE kodiInstance;
472
473 void (*AddMenuHook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
474 void (*RemoveMenuHook)(void* kodiInstance, AE_DSP_MENUHOOK *hook);
475 void (*RegisterMode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
476 void (*UnregisterMode)(void* kodiInstance, AE_DSP_MODES::AE_DSP_MODE *mode);
477
478 ADSPHANDLE (*SoundPlay_GetHandle)(void* kodiInstance, const char *filename);
479 void (*SoundPlay_ReleaseHandle)(void* kodiInstance, ADSPHANDLE handle);
480 void (*SoundPlay_Play)(void* kodiInstance, ADSPHANDLE handle);
481 void (*SoundPlay_Stop)(void* kodiInstance, ADSPHANDLE handle);
482 bool (*SoundPlay_IsPlaying)(void* kodiInstance, ADSPHANDLE handle);
483 void (*SoundPlay_SetChannel)(void* kodiInstance, ADSPHANDLE handle, AE_DSP_CHANNEL channel);
484 AE_DSP_CHANNEL (*SoundPlay_GetChannel)(void* kodiInstance, ADSPHANDLE handle);
485 void (*SoundPlay_SetVolume)(void* kodiInstance, ADSPHANDLE handle, float volume);
486 float (*SoundPlay_GetVolume)(void* kodiInstance, ADSPHANDLE handle);
487 } AddonToKodiFuncTable_AudioDSP;
488
489 typedef struct KodiToAddonFuncTable_AudioDSP
490 {
491 const char* (__cdecl* GetAudioDSPAPIVersion) (void);
492 const char* (__cdecl* GetMinimumAudioDSPAPIVersion) (void);
493 const char* (__cdecl* GetGUIAPIVersion) (void);
494 const char* (__cdecl* GetMinimumGUIAPIVersion) (void);
495 AE_DSP_ERROR (__cdecl* GetAddonCapabilities) (AE_DSP_ADDON_CAPABILITIES*);
496 const char* (__cdecl* GetDSPName) (void);
497 const char* (__cdecl* GetDSPVersion) (void);
498 AE_DSP_ERROR (__cdecl* MenuHook) (const AE_DSP_MENUHOOK&, const AE_DSP_MENUHOOK_DATA&);
499
500 AE_DSP_ERROR (__cdecl* StreamCreate) (const AE_DSP_SETTINGS*, const AE_DSP_STREAM_PROPERTIES*, ADDON_HANDLE);
501 AE_DSP_ERROR (__cdecl* StreamDestroy) (const ADDON_HANDLE);
502 AE_DSP_ERROR (__cdecl* StreamIsModeSupported) (const ADDON_HANDLE, AE_DSP_MODE_TYPE, unsigned int, int);
503 AE_DSP_ERROR (__cdecl* StreamInitialize) (const ADDON_HANDLE, const AE_DSP_SETTINGS*);
504
505 bool (__cdecl* InputProcess) (const ADDON_HANDLE, const float**, unsigned int);
506
507 unsigned int (__cdecl* InputResampleProcessNeededSamplesize) (const ADDON_HANDLE);
508 unsigned int (__cdecl* InputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int);
509 float (__cdecl* InputResampleGetDelay) (const ADDON_HANDLE);
510 int (__cdecl* InputResampleSampleRate) (const ADDON_HANDLE);
511
512 unsigned int (__cdecl* PreProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int);
513 float (__cdecl* PreProcessGetDelay) (const ADDON_HANDLE, unsigned int);
514 unsigned int (__cdecl* PreProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int);
515
516 AE_DSP_ERROR (__cdecl* MasterProcessSetMode) (const ADDON_HANDLE, AE_DSP_STREAMTYPE, unsigned int, int);
517 unsigned int (__cdecl* MasterProcessNeededSamplesize) (const ADDON_HANDLE);
518 float (__cdecl* MasterProcessGetDelay) (const ADDON_HANDLE);
519 int (__cdecl* MasterProcessGetOutChannels) (const ADDON_HANDLE, unsigned long&);
520 unsigned int (__cdecl* MasterProcess) (const ADDON_HANDLE, float**, float**, unsigned int);
521 const char* (__cdecl* MasterProcessGetStreamInfoString) (const ADDON_HANDLE);
522
523 unsigned int (__cdecl* PostProcessNeededSamplesize) (const ADDON_HANDLE, unsigned int);
524 float (__cdecl* PostProcessGetDelay) (const ADDON_HANDLE, unsigned int);
525 unsigned int (__cdecl* PostProcess) (const ADDON_HANDLE, unsigned int, float**, float**, unsigned int);
526
527 unsigned int (__cdecl* OutputResampleProcessNeededSamplesize)(const ADDON_HANDLE);
528 unsigned int (__cdecl* OutputResampleProcess) (const ADDON_HANDLE, float**, float**, unsigned int);
529 float (__cdecl* OutputResampleGetDelay) (const ADDON_HANDLE);
530 int (__cdecl* OutputResampleSampleRate) (const ADDON_HANDLE);
531 } KodiToAddonFuncTable_AudioDSP;
532
533 typedef struct AddonInstance_AudioDSP
534 {
535 AddonProps_AudioDSP props;
536 AddonToKodiFuncTable_AudioDSP toKodi;
537 KodiToAddonFuncTable_AudioDSP toAddon;
538 } AddonInstance_AudioDSP;
539
540#ifdef __cplusplus
541}
542#endif
543
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h
deleted file mode 100644
index 5232947..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <stdint.h>
24#include "xbmc_addon_dll.h"
25#include "kodi_audiodec_types.h"
26
27extern "C"
28{
29 //! \copydoc AudioDecoder::Init
30 void* Init(const char* file, unsigned int filecache, int* channels,
31 int* samplerate, int* bitspersample, int64_t* totaltime,
32 int* bitrate, AEDataFormat* format, const AEChannel** channelinfo);
33
34 //! \copydoc AudioDecoder::ReadPCM
35 int ReadPCM(void* context, uint8_t* buffer, int size, int* actualsize);
36
37 //! \copydoc AudioDecoder::Seek
38 int64_t Seek(void* context, int64_t time);
39
40 //! \copydoc AudioDecoder::ReadTag
41 bool ReadTag(const char* file, char* title,
42 char* artist, int* length);
43
44 //! \copydoc AudioDecoder::TrackCount
45 int TrackCount(const char* file);
46
47 //! \copydoc AudioDecoder::DeInit
48 bool DeInit(void* context);
49
50 // function to export the above structure to XBMC
51 void __declspec(dllexport) get_addon(void* ptr)
52 {
53 AddonInstance_AudioDecoder* pScr = static_cast<AddonInstance_AudioDecoder*>(ptr);
54
55 pScr->toAddon.Init = Init;
56 pScr->toAddon.ReadPCM = ReadPCM;
57 pScr->toAddon.Seek = Seek;
58 pScr->toAddon.ReadTag = ReadTag;
59 pScr->toAddon.TrackCount = TrackCount;
60 pScr->toAddon.DeInit = DeInit;
61 };
62};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h
deleted file mode 100644
index 6820b91..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h
+++ /dev/null
@@ -1,113 +0,0 @@
1/*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <stdint.h>
24#ifdef BUILD_KODI_ADDON
25#include "AEChannelData.h"
26#else
27#include "cores/AudioEngine/Utils/AEChannelData.h"
28#endif
29
30extern "C"
31{
32 struct AUDIODEC_INFO
33 {
34 int dummy;
35 };
36
37 typedef struct AddonProps_AudioDecoder
38 {
39 const char* mimetype;
40 } AddonProps_AudioDecoder;
41
42 typedef struct AddonToKodiFuncTable_AudioDecoder
43 {
44 KODI_HANDLE kodiInstance;
45 } AddonToKodiFuncTable_AudioDecoder;
46
47 typedef struct KodiToAddonFuncTable_AudioDecoder
48 {
49 //! \brief Initialize a decoder
50 //! \param file The file to read
51 //! \param filecache The file cache size
52 //! \param channels Number of channels in output stream
53 //! \param samplerate Samplerate of output stream
54 //! \param bitspersample Bits per sample in output stream
55 //! \param totaltime Total time for stream
56 //! \param bitrate Average bitrate of input stream
57 //! \param format Data format for output stream
58 //! \param info Channel mapping for output stream
59 //! \return Context of output stream
60 //! \sa ICodec::Init
61 void* (__cdecl* Init) (const char* file, unsigned int filecache,
62 int* channels, int* samplerate,
63 int* bitspersample, int64_t* totaltime,
64 int* bitrate, AEDataFormat* format,
65 const AEChannel** info);
66
67 //! \brief Produce some noise
68 //! \param context Context of output stream
69 //! \param buffer Output buffer
70 //! \param size Size of output buffer
71 //! \param actualsize Actual number of bytes written to output buffer
72 //! \return 0 on success, -1 on end of stream, 1 on failure
73 //! \sa ICodec::ReadPCM
74 int (__cdecl* ReadPCM) (void* context, uint8_t* buffer, int size, int* actualsize);
75
76
77 //! \brief Seek in output stream
78 //! \param context Context of output stream
79 //! \param time Time position to seek to in milliseconds
80 //! \return Time position seek ended up on
81 //! \sa ICodec::Seek
82 int64_t (__cdecl* Seek) (void* context, int64_t time);
83
84 //! \brief Read tag of a file
85 //! \param file File to read tag for
86 //! \param title Title of file
87 //! \param artist Artist of file
88 //! \param length Length of file
89 //! \return True on success, false on failure
90 //! \sa IMusicInfoTagLoader::ReadTag
91 bool (__cdecl* ReadTag)(const char* file, char* title,
92 char* artist, int* length);
93
94 //! \brief Get number of tracks in a file
95 //! \param file File to read tag for
96 //! \return Number of tracks in file
97 //! \sa CMusicFileDirectory
98 int (__cdecl* TrackCount) (const char* file);
99
100 //! \brief Close down an output stream
101 //! \param context Context of stream
102 //! \return True on success, false on failure
103 //! \sa ICodec::DeInit
104 bool (__cdecl* DeInit)(void* context);
105 } KodiToAddonFuncTable_AudioDecoder;
106
107 typedef struct AddonInstance_AudioDecoder
108 {
109 AddonProps_AudioDecoder props;
110 AddonToKodiFuncTable_AudioDecoder toKodi;
111 KodiToAddonFuncTable_AudioDecoder toAddon;
112 } AddonInstance_AudioDecoder;
113}
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_dll.h
deleted file mode 100644
index a87c9c0..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_dll.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <stdint.h>
24#include "xbmc_addon_dll.h"
25#include "kodi_imagedec_types.h"
26
27extern "C"
28{
29 void* LoadImage(unsigned char* buffer, unsigned int bufSize,
30 unsigned int* width, unsigned int* height);
31
32 bool Decode(void* image, unsigned char* pixels,
33 unsigned int width, unsigned int height,
34 unsigned int pitch, unsigned int format);
35
36 void Close(void* image);
37
38 // function to export the above structure to Kodi
39 void __declspec(dllexport) get_addon(void* ptr)
40 {
41 AddonInstance_ImageDecoder* img = static_cast<AddonInstance_ImageDecoder*>(ptr);
42 img->toAddon.LoadImage = LoadImage;
43 img->toAddon.Decode = Decode;
44 img->toAddon.Close = Close;
45 }
46};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_types.h
deleted file mode 100644
index 7af585c..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_imagedec_types.h
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * Copyright (C) 2005-2013 Team XBMC
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <stdint.h>
24
25#define ADDON_IMG_FMT_A8R8G8B8 1
26#define ADDON_IMG_FMT_A8 2
27#define ADDON_IMG_FMT_RGBA8 3
28#define ADDON_IMG_FMT_RGB8 4
29
30extern "C"
31{
32 typedef struct AddonProps_ImageDecoder
33 {
34 const char* mimetype;
35 } AddonProps_ImageDecoder;
36
37 typedef struct AddonToKodiFuncTable_ImageDecoder
38 {
39 KODI_HANDLE kodiInstance;
40 } AddonToKodiFuncTable_ImageDecoder;
41
42 typedef struct KodiToAddonFuncTable_ImageDecoder
43 {
44 //! \brief Initialize an encoder
45 //! \param buffer The data to read from memory
46 //! \param bufSize The buffer size
47 //! \param width The optimal width of image on entry, obtained width on return
48 //! \param height The optimal height of image, actual obtained height on return
49 //! \return Image or nullptr on error
50 void* (__cdecl* LoadImage) (unsigned char* buffer, unsigned int bufSize,
51 unsigned int* width, unsigned int* height);
52
53 //! \brief Decode previously loaded image
54 //! \param image Image to decode
55 //! \param pixels Output buffer
56 //! \param width Width of output image
57 //! \param height Height of output image
58 //! \param pitch Pitch of output image
59 //! \param format Format of output image
60 bool (__cdecl* Decode) (void* image, unsigned char* pixels,
61 unsigned int width, unsigned int height,
62 unsigned int pitch, unsigned int format);
63
64 //! \brief Close an opened image
65 //! \param image Image to close
66 //! \return True on success, false on failure
67 void (__cdecl* Close)(void* image);
68 } KodiToAddonFuncTable_ImageDecoder;
69
70 typedef struct AddonInstance_ImageDecoder
71 {
72 AddonProps_ImageDecoder props;
73 AddonToKodiFuncTable_ImageDecoder toKodi;
74 KodiToAddonFuncTable_ImageDecoder toAddon;
75 } AddonInstance_ImageDecoder;
76}
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
deleted file mode 100644
index ab8475d..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
+++ /dev/null
@@ -1,256 +0,0 @@
1#pragma once
2
3/*
4* Copyright (C) 2005-2016 Team Kodi
5* http://kodi.tv
6*
7* This Program is free software; you can redistribute it and/or modify
8* it under the terms of the GNU General Public License as published by
9* the Free Software Foundation; either version 2, or (at your option)
10* any later version.
11*
12* This Program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with Kodi; see the file COPYING. If not, see
19* <http://www.gnu.org/licenses/>.
20*
21*/
22
23#include "kodi_inputstream_types.h"
24#include "xbmc_addon_dll.h"
25
26/*!
27* Functions that the InputStream client add-on must implement, but some can be empty.
28*
29* The 'remarks' field indicates which methods should be implemented, and which ones are optional.
30*/
31
32extern "C"
33{
34 /*!
35 * Open a stream.
36 * @param props
37 * @return True if the stream has been opened successfully, false otherwise.
38 * @remarks
39 */
40 bool Open(INPUTSTREAM& props);
41
42 /*!
43 * Close an open stream.
44 * @remarks
45 */
46 void Close(void);
47
48 /*!
49 * Get path/url for this addon.
50 * @remarks
51 */
52 const char* GetPathList(void);
53
54 /*!
55 * Get Capabilities of this addon.
56 * @remarks
57 */
58 struct INPUTSTREAM_CAPABILITIES GetCapabilities();
59
60
61 /*!
62 * Get IDs of available streams
63 * @remarks
64 */
65 INPUTSTREAM_IDS GetStreamIds();
66
67 /*!
68 * Get stream properties of a stream.
69 * @param streamId unique id of stream
70 * @return struc of stream properties
71 * @remarks
72 */
73 INPUTSTREAM_INFO GetStream(int streamid);
74
75 /*!
76 * Enable or disable a stream.
77 * A disabled stream does not send demux packets
78 * @param streamId unique id of stream
79 * @param enable true for enable, false for disable
80 * @remarks
81 */
82 void EnableStream(int streamid, bool enable);
83
84 /*!
85 * Reset the demultiplexer in the add-on.
86 * @remarks Required if bHandlesDemuxing is set to true.
87 */
88 void DemuxReset(void);
89
90 /*!
91 * Abort the demultiplexer thread in the add-on.
92 * @remarks Required if bHandlesDemuxing is set to true.
93 */
94 void DemuxAbort(void);
95
96 /*!
97 * Flush all data that's currently in the demultiplexer buffer in the add-on.
98 * @remarks Required if bHandlesDemuxing is set to true.
99 */
100 void DemuxFlush(void);
101
102 /*!
103 * Read the next packet from the demultiplexer, if there is one.
104 * @return The next packet.
105 * If there is no next packet, then the add-on should return the
106 * packet created by calling AllocateDemuxPacket(0) on the callback.
107 * If the stream changed and XBMC's player needs to be reinitialised,
108 * then, the add-on should call AllocateDemuxPacket(0) on the
109 * callback, and set the streamid to DMX_SPECIALID_STREAMCHANGE and
110 * return the value.
111 * The add-on should return NULL if an error occured.
112 * @remarks Return NULL if this add-on won't provide this function.
113 */
114 DemuxPacket* DemuxRead(void);
115
116 /*!
117 * Notify the InputStream addon/demuxer that XBMC wishes to seek the stream by time
118 * Demuxer is required to set stream to an IDR frame
119 * @param time The absolute time since stream start
120 * @param backwards True to seek to keyframe BEFORE time, else AFTER
121 * @param startpts can be updated to point to where display should start
122 * @return True if the seek operation was possible
123 * @remarks Optional, and only used if addon has its own demuxer.
124 */
125 bool DemuxSeekTime(double time, bool backwards, double *startpts);
126
127 /*!
128 * Notify the InputStream addon/demuxer that XBMC wishes to change playback speed
129 * @param speed The requested playback speed
130 * @remarks Optional, and only used if addon has its own demuxer.
131 */
132 void DemuxSetSpeed(int speed);
133
134 /*!
135 * Sets desired width / height
136 * @param width / hight
137 */
138 void SetVideoResolution(int width, int height);
139
140 /*!
141 * Totel time in ms
142 * @remarks
143 */
144 int GetTotalTime();
145
146 /*!
147 * Playing time in ms
148 * @remarks
149 */
150 int GetTime();
151
152 /*!
153 * Positions inputstream to playing time given in ms
154 * @remarks
155 */
156 bool PosTime(int ms);
157
158
159 /*!
160 * Check if the backend support pausing the currently playing stream
161 * This will enable/disable the pause button in XBMC based on the return value
162 * @return false if the InputStream addon/backend does not support pausing, true if possible
163 */
164 bool CanPauseStream();
165
166 /*!
167 * Check if the backend supports seeking for the currently playing stream
168 * This will enable/disable the rewind/forward buttons in XBMC based on the return value
169 * @return false if the InputStream addon/backend does not support seeking, true if possible
170 */
171 bool CanSeekStream();
172
173
174 /*!
175 * Read from an open stream.
176 * @param pBuffer The buffer to store the data in.
177 * @param iBufferSize The amount of bytes to read.
178 * @return The amount of bytes that were actually read from the stream.
179 * @remarks Return -1 if this add-on won't provide this function.
180 */
181 int ReadStream(uint8_t* pBuffer, unsigned int iBufferSize);
182
183 /*!
184 * Seek in a stream.
185 * @param iPosition The position to seek to.
186 * @param iWhence ?
187 * @return The new position.
188 * @remarks Return -1 if this add-on won't provide this function.
189 */
190 int64_t SeekStream(int64_t iPosition, int iWhence = SEEK_SET);
191
192 /*!
193 * @return The position in the stream that's currently being read.
194 * @remarks Return -1 if this add-on won't provide this function.
195 */
196 int64_t PositionStream(void);
197
198 /*!
199 * @return The total length of the stream that's currently being read.
200 * @remarks Return -1 if this add-on won't provide this function.
201 */
202 int64_t LengthStream(void);
203
204
205 /*!
206 * @brief Notify the InputStream addon that XBMC (un)paused the currently playing stream
207 */
208 void PauseStream(double time);
209
210
211 /*!
212 * Check for real-time streaming
213 * @return true if current stream is real-time
214 */
215 bool IsRealTimeStream();
216
217 /*!
218 * Called by XBMC to assign the function pointers of this add-on to pClient.
219 * @param pClient The struct to assign the function pointers to.
220 */
221 void __declspec(dllexport) get_addon(void* ptr)
222 {
223 AddonInstance_InputStream* pClient = static_cast<AddonInstance_InputStream*>(ptr);
224
225 pClient->toAddon.Open = Open;
226 pClient->toAddon.Close = Close;
227 pClient->toAddon.GetPathList = GetPathList;
228 pClient->toAddon.GetCapabilities = GetCapabilities;
229
230 pClient->toAddon.GetStreamIds = GetStreamIds;
231 pClient->toAddon.GetStream = GetStream;
232 pClient->toAddon.EnableStream = EnableStream;
233 pClient->toAddon.DemuxReset = DemuxReset;
234 pClient->toAddon.DemuxAbort = DemuxAbort;
235 pClient->toAddon.DemuxFlush = DemuxFlush;
236 pClient->toAddon.DemuxRead = DemuxRead;
237 pClient->toAddon.DemuxSeekTime = DemuxSeekTime;
238 pClient->toAddon.DemuxSetSpeed = DemuxSetSpeed;
239 pClient->toAddon.SetVideoResolution = SetVideoResolution;
240
241 pClient->toAddon.GetTotalTime = GetTotalTime;
242 pClient->toAddon.GetTime = GetTime;
243
244 pClient->toAddon.PosTime = PosTime;
245
246 pClient->toAddon.CanPauseStream = CanPauseStream;
247 pClient->toAddon.CanSeekStream = CanSeekStream;
248
249 pClient->toAddon.ReadStream = ReadStream;
250 pClient->toAddon.SeekStream = SeekStream;
251 pClient->toAddon.PositionStream = PositionStream;
252 pClient->toAddon.LengthStream = LengthStream;
253 pClient->toAddon.PauseStream = PauseStream;
254 pClient->toAddon.IsRealTimeStream = IsRealTimeStream;
255 };
256};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
deleted file mode 100644
index 9597e8a..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
+++ /dev/null
@@ -1,187 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2016 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef TARGET_WINDOWS
24#ifndef __cdecl
25#define __cdecl
26#endif
27#ifndef __declspec
28#define __declspec(X)
29#endif
30#endif
31
32#include "xbmc_addon_types.h"
33
34#ifdef BUILD_KODI_ADDON
35#include "DVDDemuxPacket.h"
36#else
37#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h"
38#endif
39
40extern "C" {
41
42 /*!
43 * @brief InputStream add-on capabilities. All capabilities are set to "false" as default.
44 */
45 typedef struct INPUTSTREAM_CAPABILITIES
46 {
47 bool m_supportsIDemux; /*!< @brief supports interface IDemux */
48 bool m_supportsIPosTime; /*!< @brief supports interface IPosTime */
49 bool m_supportsIDisplayTime; /*!< @brief supports interface IDisplayTime */
50 bool m_supportsSeek; /*!< @brief supports seek */
51 bool m_supportsPause; /*!< @brief supports pause */
52 } INPUTSTREAM_CAPABILITIES;
53
54 /*!
55 * @brief structure of key/value pairs passed to addon on Open()
56 */
57 typedef struct INPUTSTREAM
58 {
59 static const unsigned int MAX_INFO_COUNT = 8;
60
61 const char *m_strURL;
62
63 unsigned int m_nCountInfoValues;
64 struct LISTITEMPROPERTY
65 {
66 const char *m_strKey;
67 const char *m_strValue;
68 } m_ListItemProperties[MAX_INFO_COUNT];
69
70 const char *m_libFolder;
71 const char *m_profileFolder;
72 } INPUTSTREAM;
73
74 /*!
75 * @brief Array of stream IDs
76 */
77 typedef struct INPUTSTREAM_IDS
78 {
79 static const unsigned int MAX_STREAM_COUNT = 32;
80 unsigned int m_streamCount;
81 unsigned int m_streamIds[MAX_STREAM_COUNT];
82 } INPUTSTREAM_IDS;
83
84 /*!
85 * @brief stream properties
86 */
87 typedef struct INPUTSTREAM_INFO
88 {
89 enum STREAM_TYPE
90 {
91 TYPE_NONE,
92 TYPE_VIDEO,
93 TYPE_AUDIO,
94 TYPE_SUBTITLE,
95 TYPE_TELETEXT
96 } m_streamType;
97
98 char m_codecName[32]; /*!< @brief (required) name of codec according to ffmpeg */
99 char m_codecInternalName[32]; /*!< @brief (optional) internal name of codec (selectionstream info) */
100 unsigned int m_pID; /*!< @brief (required) physical index */
101
102 const uint8_t *m_ExtraData;
103 unsigned int m_ExtraSize;
104
105 char m_language[4]; /*!< @brief ISO 639 3-letter language code (empty string if undefined) */
106
107 unsigned int m_FpsScale; /*!< @brief Scale of 1000 and a rate of 29970 will result in 29.97 fps */
108 unsigned int m_FpsRate;
109 unsigned int m_Height; /*!< @brief height of the stream reported by the demuxer */
110 unsigned int m_Width; /*!< @brief width of the stream reported by the demuxer */
111 float m_Aspect; /*!< @brief display aspect of stream */
112
113 unsigned int m_Channels; /*!< @brief (required) amount of channels */
114 unsigned int m_SampleRate; /*!< @brief (required) sample rate */
115 unsigned int m_BitRate; /*!< @brief (required) bit rate */
116 unsigned int m_BitsPerSample; /*!< @brief (required) bits per sample */
117 unsigned int m_BlockAlign;
118 } INPUTSTREAM_INFO;
119
120 /*!
121 * @brief Structure to transfer the methods from xbmc_inputstream_dll.h to XBMC
122 */
123
124 // this are properties given to the addon on create
125 // at this time we have no parameters for the addon
126 typedef struct AddonProps_InputStream
127 {
128 int dummy;
129 } AddonProps_InputStream;
130
131 typedef AddonProps_InputStream INPUTSTREAM_PROPS;
132
133 typedef struct AddonToKodiFuncTable_InputStream
134 {
135 KODI_HANDLE kodiInstance;
136 DemuxPacket* (*AllocateDemuxPacket)(void* kodiInstance, int iDataSize);
137 void (*FreeDemuxPacket)(void* kodiInstance, DemuxPacket* pPacket);
138 } AddonToKodiFuncTable_InputStream;
139
140 typedef struct KodiToAddonFuncTable_InputStream
141 {
142 bool (__cdecl* Open)(INPUTSTREAM&);
143 void (__cdecl* Close)(void);
144 const char* (__cdecl* GetPathList)(void);
145 struct INPUTSTREAM_CAPABILITIES (__cdecl* GetCapabilities)(void);
146
147 // IDemux
148 struct INPUTSTREAM_IDS (__cdecl* GetStreamIds)();
149 struct INPUTSTREAM_INFO (__cdecl* GetStream)(int);
150 void (__cdecl* EnableStream)(int, bool);
151 void (__cdecl* DemuxReset)(void);
152 void (__cdecl* DemuxAbort)(void);
153 void (__cdecl* DemuxFlush)(void);
154 DemuxPacket* (__cdecl* DemuxRead)(void);
155 bool (__cdecl* DemuxSeekTime)(double, bool, double*);
156 void (__cdecl* DemuxSetSpeed)(int);
157 void (__cdecl* SetVideoResolution)(int, int);
158
159 // IDisplayTime
160 int (__cdecl* GetTotalTime)(void);
161 int (__cdecl* GetTime)(void);
162
163 // IPosTime
164 bool (__cdecl* PosTime)(int);
165
166 // Seekable (mandatory)
167 bool (__cdecl* CanPauseStream)(void);
168 bool (__cdecl* CanSeekStream)(void);
169
170 int (__cdecl* ReadStream)(uint8_t*, unsigned int);
171 int64_t(__cdecl* SeekStream)(int64_t, int);
172 int64_t (__cdecl* PositionStream)(void);
173 int64_t (__cdecl* LengthStream)(void);
174 void (__cdecl* PauseStream)(double);
175 bool (__cdecl* IsRealTimeStream)(void);
176 } KodiToAddonFuncTable_InputStream;
177
178 typedef struct AddonInstance_InputStream
179 {
180 AddonProps_InputStream props;
181 AddonToKodiFuncTable_InputStream toKodi;
182 KodiToAddonFuncTable_InputStream toAddon;
183 } AddonInstance_InputStream;
184
185}
186
187
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h
deleted file mode 100644
index b353316..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_dll.h
+++ /dev/null
@@ -1,246 +0,0 @@
1/*
2 * Copyright (C) 2014-2017 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef __PERIPHERAL_DLL_H__
21#define __PERIPHERAL_DLL_H__
22
23#include "kodi_peripheral_types.h"
24
25#define PERIPHERAL_ADDON_JOYSTICKS //! @todo
26
27#ifdef __cplusplus
28extern "C"
29{
30#endif
31
32 /// @name Peripheral operations
33 ///{
34 /*!
35 * @brief Get the list of features that this add-on provides
36 * @param pCapabilities The add-on's capabilities.
37 * @return PERIPHERAL_NO_ERROR if the properties were fetched successfully.
38 * @remarks Valid implementation required.
39 *
40 * Called by the frontend to query the add-on's capabilities and supported
41 * peripherals. All capabilities that the add-on supports should be set to true.
42 *
43 */
44 PERIPHERAL_ERROR GetAddonCapabilities(PERIPHERAL_CAPABILITIES *pCapabilities);
45
46 /*!
47 * @brief Perform a scan for joysticks
48 * @param peripheral_count Assigned to the number of peripherals allocated
49 * @param scan_results Assigned to allocated memory
50 * @return PERIPHERAL_NO_ERROR if successful; peripherals must be freed using
51 * FreeScanResults() in this case
52 *
53 * The frontend calls this when a hardware change is detected. If an add-on
54 * detects a hardware change, it can trigger this function using the
55 * TriggerScan() callback.
56 */
57 PERIPHERAL_ERROR PerformDeviceScan(unsigned int* peripheral_count, PERIPHERAL_INFO** scan_results);
58
59 /*!
60 * @brief Free the memory allocated in PerformDeviceScan()
61 *
62 * Must be called if PerformDeviceScan() returns PERIPHERAL_NO_ERROR.
63 *
64 * @param peripheral_count The number of events allocated for the events array
65 * @param scan_results The array of allocated peripherals
66 */
67 void FreeScanResults(unsigned int peripheral_count, PERIPHERAL_INFO* scan_results);
68
69 /*!
70 * @brief Get all events that have occurred since the last call to GetEvents()
71 * @return PERIPHERAL_NO_ERROR if successful; events must be freed using
72 * FreeEvents() in this case
73 */
74 PERIPHERAL_ERROR GetEvents(unsigned int* event_count, PERIPHERAL_EVENT** events);
75
76 /*!
77 * @brief Free the memory allocated in GetEvents()
78 *
79 * Must be called if GetEvents() returns PERIPHERAL_NO_ERROR.
80 *
81 * @param event_count The number of events allocated for the events array
82 * @param events The array of allocated events
83 */
84 void FreeEvents(unsigned int event_count, PERIPHERAL_EVENT* events);
85
86 /*!
87 * @brief Send an input event to the specified peripheral
88 * @param peripheralIndex The index of the device receiving the input event
89 * @param event The input event
90 * @return true if the event was handled, false otherwise
91 */
92 bool SendEvent(const PERIPHERAL_EVENT* event);
93 ///}
94
95 /// @name Joystick operations
96 /*!
97 * @note #define PERIPHERAL_ADDON_JOYSTICKS before including kodi_peripheral_dll.h
98 * in the add-on if the add-on provides joysticks and add provides_joysticks="true"
99 * to the kodi.peripheral extension point node in addon.xml.
100 */
101 ///{
102#ifdef PERIPHERAL_ADDON_JOYSTICKS
103 /*!
104 * @brief Get extended info about an attached joystick
105 * @param index The joystick's driver index
106 * @param info The container for the allocated joystick info
107 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
108 * FreeJoystickInfo() in this case
109 */
110 PERIPHERAL_ERROR GetJoystickInfo(unsigned int index, JOYSTICK_INFO* info);
111
112 /*!
113 * @brief Free the memory allocated in GetJoystickInfo()
114 */
115 void FreeJoystickInfo(JOYSTICK_INFO* info);
116
117 /*!
118 * @brief Get the features that allow translating the joystick into the controller profile
119 * @param joystick The device's joystick properties; unknown values may be left at their default
120 * @param controller_id The controller profile being requested, e.g. game.controller.default
121 * @param feature_count The number of features allocated for the features array
122 * @param features The array of allocated features
123 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
124 * FreeButtonMap() in this case
125 */
126 PERIPHERAL_ERROR GetFeatures(const JOYSTICK_INFO* joystick, const char* controller_id,
127 unsigned int* feature_count, JOYSTICK_FEATURE** features);
128
129 /*!
130 * @brief Free the memory allocated in GetFeatures()
131 *
132 * Must be called if GetFeatures() returns PERIPHERAL_NO_ERROR.
133 *
134 * @param feature_count The number of features allocated for the features array
135 * @param features The array of allocated features
136 */
137 void FreeFeatures(unsigned int feature_count, JOYSTICK_FEATURE* features);
138
139 /*!
140 * @brief Add or update joystick features
141 * @param joystick The device's joystick properties; unknown values may be left at their default
142 * @param controller_id The game controller profile being updated
143 * @param feature_count The number of features in the features array
144 * @param features The array of features
145 * @return PERIPHERAL_NO_ERROR if successful
146 */
147 PERIPHERAL_ERROR MapFeatures(const JOYSTICK_INFO* joystick, const char* controller_id,
148 unsigned int feature_count, const JOYSTICK_FEATURE* features);
149
150 /*!
151 * @brief Get the driver primitives that should be ignored while mapping the device
152 * @param joystick The device's joystick properties; unknown values may be left at their default
153 * @param primitive_count The number of features allocated for the primitives array
154 * @param primitives The array of allocated driver primitives to be ignored
155 * @return PERIPHERAL_NO_ERROR if successful; array must be freed using
156 * FreePrimitives() in this case
157 */
158 PERIPHERAL_ERROR GetIgnoredPrimitives(const JOYSTICK_INFO* joystick,
159 unsigned int* primitive_count,
160 JOYSTICK_DRIVER_PRIMITIVE** primitives);
161
162 /*!
163 * @brief Free the memory allocated in GetIgnoredPrimitives()
164 *
165 * Must be called if GetIgnoredPrimitives() returns PERIPHERAL_NO_ERROR.
166 *
167 * @param primitive_count The number of driver primitives allocated for the primitives array
168 * @param primitives The array of allocated driver primitives
169 */
170 void FreePrimitives(unsigned int primitive_count, JOYSTICK_DRIVER_PRIMITIVE* primitives);
171
172 /*!
173 * @brief Set the list of driver primitives that are ignored for the device
174 * @param joystick The device's joystick properties; unknown values may be left at their default
175 * @param primitive_count The number of driver features in the primitives array
176 * @param primitives The array of driver primitives to ignore
177 * @return PERIPHERAL_NO_ERROR if successful
178 */
179 PERIPHERAL_ERROR SetIgnoredPrimitives(const JOYSTICK_INFO* joystick,
180 unsigned int primitive_count,
181 const JOYSTICK_DRIVER_PRIMITIVE* primitives);
182
183 /*!
184 * @brief Save the button map for the given joystick
185 * @param joystick The device's joystick properties
186 */
187 void SaveButtonMap(const JOYSTICK_INFO* joystick);
188
189 /*!
190 * @brief Revert the button map to the last time it was loaded or committed to disk
191 * @param joystick The device's joystick properties
192 */
193 void RevertButtonMap(const JOYSTICK_INFO* joystick);
194
195 /*!
196 * @brief Reset the button map for the given joystick and controller profile ID
197 * @param joystick The device's joystick properties
198 * @param controller_id The game controller profile being reset
199 */
200 void ResetButtonMap(const JOYSTICK_INFO* joystick, const char* controller_id);
201
202 /*!
203 * @brief Powers off the given joystick if supported
204 * @param index The joystick's driver index
205 */
206 void PowerOffJoystick(unsigned int index);
207#endif
208 ///}
209
210 /*!
211 * Called by the frontend to assign the function pointers of this add-on to
212 * pClient. Note that get_addon() is defined here, so it will be available in
213 * all compiled peripheral add-ons.
214 */
215 void __declspec(dllexport) get_addon(void* ptr)
216 {
217 AddonInstance_Peripheral* pClient = static_cast<AddonInstance_Peripheral*>(ptr);
218
219 pClient->toAddon.GetAddonCapabilities = GetAddonCapabilities;
220 pClient->toAddon.PerformDeviceScan = PerformDeviceScan;
221 pClient->toAddon.FreeScanResults = FreeScanResults;
222 pClient->toAddon.GetEvents = GetEvents;
223 pClient->toAddon.FreeEvents = FreeEvents;
224 pClient->toAddon.SendEvent = SendEvent;
225
226#ifdef PERIPHERAL_ADDON_JOYSTICKS
227 pClient->toAddon.GetJoystickInfo = GetJoystickInfo;
228 pClient->toAddon.FreeJoystickInfo = FreeJoystickInfo;
229 pClient->toAddon.GetFeatures = GetFeatures;
230 pClient->toAddon.FreeFeatures = FreeFeatures;
231 pClient->toAddon.MapFeatures = MapFeatures;
232 pClient->toAddon.GetIgnoredPrimitives = GetIgnoredPrimitives;
233 pClient->toAddon.FreePrimitives = FreePrimitives;
234 pClient->toAddon.SetIgnoredPrimitives = SetIgnoredPrimitives;
235 pClient->toAddon.SaveButtonMap = SaveButtonMap;
236 pClient->toAddon.RevertButtonMap = RevertButtonMap;
237 pClient->toAddon.ResetButtonMap = ResetButtonMap;
238 pClient->toAddon.PowerOffJoystick = PowerOffJoystick;
239#endif
240 }
241
242#ifdef __cplusplus
243}
244#endif
245
246#endif // __PERIPHERAL_DLL_H__
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
deleted file mode 100644
index 0786aa8..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_peripheral_types.h
+++ /dev/null
@@ -1,337 +0,0 @@
1/*
2 * Copyright (C) 2014-2017 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#ifndef __PERIPHERAL_TYPES_H__
21#define __PERIPHERAL_TYPES_H__
22
23#include "versions.h"
24#include "xbmc_addon_types.h"
25
26#ifndef TARGET_WINDOWS
27 #ifndef __cdecl
28 #define __cdecl
29 #endif
30 #ifndef __declspec
31 #define __declspec(X)
32 #endif
33#endif
34
35#include <stdint.h>
36
37#undef ATTRIBUTE_PACKED
38#undef PRAGMA_PACK_BEGIN
39#undef PRAGMA_PACK_END
40
41#if defined(__GNUC__)
42 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
43 #define ATTRIBUTE_PACKED __attribute__ ((packed))
44 #define PRAGMA_PACK 0
45 #endif
46#endif
47
48#if !defined(ATTRIBUTE_PACKED)
49 #define ATTRIBUTE_PACKED
50 #define PRAGMA_PACK 1
51#endif
52
53/* indicates a joystick has no preference for port number */
54#define NO_PORT_REQUESTED (-1)
55
56/* joystick's driver button/hat/axis index is unknown */
57#define DRIVER_INDEX_UNKNOWN (-1)
58
59#ifdef __cplusplus
60extern "C"
61{
62#endif
63
64 /// @name Peripheral types
65 ///{
66 typedef enum PERIPHERAL_ERROR
67 {
68 PERIPHERAL_NO_ERROR = 0, // no error occurred
69 PERIPHERAL_ERROR_UNKNOWN = -1, // an unknown error occurred
70 PERIPHERAL_ERROR_FAILED = -2, // the command failed
71 PERIPHERAL_ERROR_INVALID_PARAMETERS = -3, // the parameters of the method are invalid for this operation
72 PERIPHERAL_ERROR_NOT_IMPLEMENTED = -4, // the method that the frontend called is not implemented
73 PERIPHERAL_ERROR_NOT_CONNECTED = -5, // no peripherals are connected
74 PERIPHERAL_ERROR_CONNECTION_FAILED = -6, // peripherals are connected, but command was interrupted
75 } PERIPHERAL_ERROR;
76
77 typedef enum PERIPHERAL_TYPE
78 {
79 PERIPHERAL_TYPE_UNKNOWN,
80 PERIPHERAL_TYPE_JOYSTICK,
81 PERIPHERAL_TYPE_KEYBOARD,
82 } PERIPHERAL_TYPE;
83
84 typedef struct PERIPHERAL_INFO
85 {
86 PERIPHERAL_TYPE type; /*!< @brief type of peripheral */
87 char* name; /*!< @brief name of peripheral */
88 uint16_t vendor_id; /*!< @brief vendor ID of peripheral, 0x0000 if unknown */
89 uint16_t product_id; /*!< @brief product ID of peripheral, 0x0000 if unknown */
90 unsigned int index; /*!< @brief the order in which the add-on identified this peripheral */
91 } ATTRIBUTE_PACKED PERIPHERAL_INFO;
92
93 /*!
94 * @brief Properties passed to the Create() method of an add-on.
95 */
96 typedef struct PERIPHERAL_PROPERTIES
97 {
98 const char* user_path; /*!< @brief path to the user profile */
99 const char* addon_path; /*!< @brief path to this add-on */
100 } ATTRIBUTE_PACKED PERIPHERAL_PROPERTIES;
101
102 /*!
103 * @brief Peripheral add-on capabilities.
104 * If a capability is set to true, then the corresponding methods from
105 * kodi_peripheral_dll.h need to be implemented.
106 */
107 typedef struct PERIPHERAL_CAPABILITIES
108 {
109 bool provides_joysticks; /*!< @brief true if the add-on provides joysticks */
110 bool provides_joystick_rumble;
111 bool provides_joystick_power_off;
112 bool provides_buttonmaps; /*!< @brief true if the add-on provides button maps */
113 } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES;
114 ///}
115
116 /// @name Event types
117 ///{
118 typedef enum PERIPHERAL_EVENT_TYPE
119 {
120 PERIPHERAL_EVENT_TYPE_NONE, /*!< @brief unknown event */
121 PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON, /*!< @brief state changed for joystick driver button */
122 PERIPHERAL_EVENT_TYPE_DRIVER_HAT, /*!< @brief state changed for joystick driver hat */
123 PERIPHERAL_EVENT_TYPE_DRIVER_AXIS, /*!< @brief state changed for joystick driver axis */
124 PERIPHERAL_EVENT_TYPE_SET_MOTOR, /*!< @brief set the state for joystick rumble motor */
125 } PERIPHERAL_EVENT_TYPE;
126
127 typedef enum JOYSTICK_STATE_BUTTON
128 {
129 JOYSTICK_STATE_BUTTON_UNPRESSED = 0x0, /*!< @brief button is released */
130 JOYSTICK_STATE_BUTTON_PRESSED = 0x1, /*!< @brief button is pressed */
131 } JOYSTICK_STATE_BUTTON;
132
133 typedef enum JOYSTICK_STATE_HAT
134 {
135 JOYSTICK_STATE_HAT_UNPRESSED = 0x0, /*!< @brief no directions are pressed */
136 JOYSTICK_STATE_HAT_LEFT = 0x1, /*!< @brief only left is pressed */
137 JOYSTICK_STATE_HAT_RIGHT = 0x2, /*!< @brief only right is pressed */
138 JOYSTICK_STATE_HAT_UP = 0x4, /*!< @brief only up is pressed */
139 JOYSTICK_STATE_HAT_DOWN = 0x8, /*!< @brief only down is pressed */
140 JOYSTICK_STATE_HAT_LEFT_UP = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_UP,
141 JOYSTICK_STATE_HAT_LEFT_DOWN = JOYSTICK_STATE_HAT_LEFT | JOYSTICK_STATE_HAT_DOWN,
142 JOYSTICK_STATE_HAT_RIGHT_UP = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_UP,
143 JOYSTICK_STATE_HAT_RIGHT_DOWN = JOYSTICK_STATE_HAT_RIGHT | JOYSTICK_STATE_HAT_DOWN,
144 } JOYSTICK_STATE_HAT;
145
146 /*!
147 * @brief value in the closed interval [-1.0, 1.0]
148 *
149 * The axis state uses the XInput coordinate system:
150 * - Negative values signify down or to the left
151 * - Positive values signify up or to the right
152 */
153 typedef float JOYSTICK_STATE_AXIS;
154
155 typedef float JOYSTICK_STATE_MOTOR;
156
157 typedef struct PERIPHERAL_EVENT
158 {
159 unsigned int peripheral_index;
160 PERIPHERAL_EVENT_TYPE type;
161 unsigned int driver_index;
162 JOYSTICK_STATE_BUTTON driver_button_state;
163 JOYSTICK_STATE_HAT driver_hat_state;
164 JOYSTICK_STATE_AXIS driver_axis_state;
165 JOYSTICK_STATE_MOTOR motor_state;
166 } ATTRIBUTE_PACKED PERIPHERAL_EVENT;
167 ///}
168
169 /// @name Joystick types
170 ///{
171 typedef struct JOYSTICK_INFO
172 {
173 PERIPHERAL_INFO peripheral; /*!< @brief peripheral info for this joystick */
174 char* provider; /*!< @brief name of the driver or interface providing the joystick */
175 int requested_port; /*!< @brief requested port number (such as for 360 controllers), or NO_PORT_REQUESTED */
176 unsigned int button_count; /*!< @brief number of buttons reported by the driver */
177 unsigned int hat_count; /*!< @brief number of hats reported by the driver */
178 unsigned int axis_count; /*!< @brief number of axes reported by the driver */
179 unsigned int motor_count; /*!< @brief number of motors reported by the driver */
180 bool supports_poweroff; /*!< @brief whether the joystick supports being powered off */
181 } ATTRIBUTE_PACKED JOYSTICK_INFO;
182
183 typedef enum JOYSTICK_DRIVER_PRIMITIVE_TYPE
184 {
185 JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN,
186 JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON,
187 JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION,
188 JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS,
189 JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR,
190 } JOYSTICK_DRIVER_PRIMITIVE_TYPE;
191
192 typedef struct JOYSTICK_DRIVER_BUTTON
193 {
194 int index;
195 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_BUTTON;
196
197 typedef enum JOYSTICK_DRIVER_HAT_DIRECTION
198 {
199 JOYSTICK_DRIVER_HAT_UNKNOWN,
200 JOYSTICK_DRIVER_HAT_LEFT,
201 JOYSTICK_DRIVER_HAT_RIGHT,
202 JOYSTICK_DRIVER_HAT_UP,
203 JOYSTICK_DRIVER_HAT_DOWN,
204 } JOYSTICK_DRIVER_HAT_DIRECTION;
205
206 typedef struct JOYSTICK_DRIVER_HAT
207 {
208 int index;
209 JOYSTICK_DRIVER_HAT_DIRECTION direction;
210 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_HAT;
211
212 typedef enum JOYSTICK_DRIVER_SEMIAXIS_DIRECTION
213 {
214 JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE = -1, /*!< @brief negative half of the axis */
215 JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN = 0, /*!< @brief unknown direction */
216 JOYSTICK_DRIVER_SEMIAXIS_POSITIVE = 1, /*!< @brief positive half of the axis */
217 } JOYSTICK_DRIVER_SEMIAXIS_DIRECTION;
218
219 typedef struct JOYSTICK_DRIVER_SEMIAXIS
220 {
221 int index;
222 int center;
223 JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction;
224 unsigned int range;
225 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS;
226
227 typedef struct JOYSTICK_DRIVER_MOTOR
228 {
229 int index;
230 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR;
231
232 typedef struct JOYSTICK_DRIVER_PRIMITIVE
233 {
234 JOYSTICK_DRIVER_PRIMITIVE_TYPE type;
235 union
236 {
237 struct JOYSTICK_DRIVER_BUTTON button;
238 struct JOYSTICK_DRIVER_HAT hat;
239 struct JOYSTICK_DRIVER_SEMIAXIS semiaxis;
240 struct JOYSTICK_DRIVER_MOTOR motor;
241 };
242 } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE;
243
244 typedef enum JOYSTICK_FEATURE_TYPE
245 {
246 JOYSTICK_FEATURE_TYPE_UNKNOWN,
247 JOYSTICK_FEATURE_TYPE_SCALAR,
248 JOYSTICK_FEATURE_TYPE_ANALOG_STICK,
249 JOYSTICK_FEATURE_TYPE_ACCELEROMETER,
250 JOYSTICK_FEATURE_TYPE_MOTOR,
251 } JOYSTICK_FEATURE_TYPE;
252
253 typedef enum JOYSTICK_FEATURE_PRIMITIVE
254 {
255 // Scalar feature
256 JOYSTICK_SCALAR_PRIMITIVE = 0,
257
258 // Analog stick
259 JOYSTICK_ANALOG_STICK_UP = 0,
260 JOYSTICK_ANALOG_STICK_DOWN = 1,
261 JOYSTICK_ANALOG_STICK_RIGHT = 2,
262 JOYSTICK_ANALOG_STICK_LEFT = 3,
263
264 // Accelerometer
265 JOYSTICK_ACCELEROMETER_POSITIVE_X = 0,
266 JOYSTICK_ACCELEROMETER_POSITIVE_Y = 1,
267 JOYSTICK_ACCELEROMETER_POSITIVE_Z = 2,
268
269 // Motor
270 JOYSTICK_MOTOR_PRIMITIVE = 0,
271
272 // Maximum number of primitives
273 JOYSTICK_PRIMITIVE_MAX = 4,
274 } JOYSTICK_FEATURE_PRIMITIVE;
275
276 typedef struct JOYSTICK_FEATURE
277 {
278 char* name;
279 JOYSTICK_FEATURE_TYPE type;
280 struct JOYSTICK_DRIVER_PRIMITIVE primitives[JOYSTICK_PRIMITIVE_MAX];
281 } ATTRIBUTE_PACKED JOYSTICK_FEATURE;
282 ///}
283
284 //! @todo Mouse, light gun, multitouch
285
286 /*!
287 * @brief Structure to transfer the methods from kodi_peripheral_dll.h to the frontend
288 */
289
290 typedef PERIPHERAL_PROPERTIES AddonProps_Peripheral;
291
292 typedef struct AddonToKodiFuncTable_Peripheral
293 {
294 KODI_HANDLE kodiInstance;
295 void (*TriggerScan)(void* kodiInstance);
296 void (*RefreshButtonMaps)(void* kodiInstance, const char* deviceName, const char* controllerId);
297 unsigned int (*FeatureCount)(void* kodiInstance, const char* controllerId, JOYSTICK_FEATURE_TYPE type);
298 } AddonToKodiFuncTable_Peripheral;
299
300 typedef struct KodiToAddonFuncTable_Peripheral
301 {
302 PERIPHERAL_ERROR (__cdecl* GetAddonCapabilities)(PERIPHERAL_CAPABILITIES*);
303 PERIPHERAL_ERROR (__cdecl* PerformDeviceScan)(unsigned int*, PERIPHERAL_INFO**);
304 void (__cdecl* FreeScanResults)(unsigned int, PERIPHERAL_INFO*);
305 PERIPHERAL_ERROR (__cdecl* GetEvents)(unsigned int*, PERIPHERAL_EVENT**);
306 void (__cdecl* FreeEvents)(unsigned int, PERIPHERAL_EVENT*);
307 bool (__cdecl* SendEvent)(const PERIPHERAL_EVENT*);
308
309 /// @name Joystick operations
310 ///{
311 PERIPHERAL_ERROR (__cdecl* GetJoystickInfo)(unsigned int, JOYSTICK_INFO*);
312 void (__cdecl* FreeJoystickInfo)(JOYSTICK_INFO*);
313 PERIPHERAL_ERROR (__cdecl* GetFeatures)(const JOYSTICK_INFO*, const char*, unsigned int*, JOYSTICK_FEATURE**);
314 void (__cdecl* FreeFeatures)(unsigned int, JOYSTICK_FEATURE*);
315 PERIPHERAL_ERROR (__cdecl* MapFeatures)(const JOYSTICK_INFO*, const char*, unsigned int, const JOYSTICK_FEATURE*);
316 PERIPHERAL_ERROR (__cdecl* GetIgnoredPrimitives)(const JOYSTICK_INFO*, unsigned int*, JOYSTICK_DRIVER_PRIMITIVE**);
317 void (__cdecl* FreePrimitives)(unsigned int, JOYSTICK_DRIVER_PRIMITIVE*);
318 PERIPHERAL_ERROR (__cdecl* SetIgnoredPrimitives)(const JOYSTICK_INFO*, unsigned int, const JOYSTICK_DRIVER_PRIMITIVE*);
319 void (__cdecl* SaveButtonMap)(const JOYSTICK_INFO*);
320 void (__cdecl* RevertButtonMap)(const JOYSTICK_INFO*);
321 void (__cdecl* ResetButtonMap)(const JOYSTICK_INFO*, const char*);
322 void (__cdecl* PowerOffJoystick)(unsigned int);
323 ///}
324 } KodiToAddonFuncTable_Peripheral;
325
326 typedef struct AddonInstance_Peripheral
327 {
328 AddonProps_Peripheral props;
329 AddonToKodiFuncTable_Peripheral toKodi;
330 KodiToAddonFuncTable_Peripheral toAddon;
331 } AddonInstance_Peripheral;
332
333#ifdef __cplusplus
334}
335#endif
336
337#endif // __PERIPHERAL_TYPES_H__
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_dll.h
deleted file mode 100644
index 30741a6..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_dll.h
+++ /dev/null
@@ -1,126 +0,0 @@
1/*
2 * Copyright (C) 2013 Arne Morten Kvarving
3 *
4 * This Program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This Program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with XBMC; see the file COPYING. If not, see
16 * <http://www.gnu.org/licenses/>.
17 *
18 */
19#pragma once
20
21#include <stdint.h>
22#include "xbmc_addon_dll.h"
23#include "kodi_vfs_types.h"
24
25extern "C"
26{
27 //! \copydoc KodiToAddonFuncTable_VFSEntry::Open
28 void* Open(VFSURL* url);
29
30 //! \copydoc KodiToAddonFuncTable_VFSEntry::OpenForWrite
31 void* OpenForWrite(VFSURL* url, bool bOverWrite);
32
33 //! \copydoc KodiToAddonFuncTable_VFSEntry::Read
34 ssize_t Read(void* context, void* buffer, size_t size);
35
36 //! \copydoc KodiToAddonFuncTable_VFSEntry::Write
37 ssize_t Write(void* context, const void* buffer, size_t size);
38
39 //! \copydoc KodiToAddonFuncTable_VFSEntry::Seek
40 int64_t Seek(void* context, int64_t position, int whence);
41
42 //! \copydoc KodiToAddonFuncTable_VFSEntry::Truncate
43 int Truncate(void* context, int64_t size);
44
45 //! \copydoc KodiToAddonFuncTable_VFSEntry::GetLength
46 int64_t GetLength(void* context);
47
48 //! \copydoc KodiToAddonFuncTable_VFSEntry::GetPosition
49 int64_t GetPosition(void* context);
50
51 //! \copydoc KodiToAddonFuncTable_VFSEntry::GetChunkSize
52 int GetChunkSize(void* context);
53
54 //! \copydoc KodiToAddonFuncTable_VFSEntry::IoControl
55 int IoControl(void* context, XFILE::EIoControl request, void* param);
56
57 //! \copydoc KodiToAddonFuncTable_VFSEntry::Stat
58 int Stat(VFSURL* url, struct __stat64* buffer);
59
60 //! \copydoc KodiToAddonFuncTable_VFSEntry::Close
61 bool Close(void* context);
62
63 //! \copydoc KodiToAddonFuncTable_VFSEntry::Exists
64 bool Exists(VFSURL* url);
65
66 //! \copydoc KodiToAddonFuncTable_VFSEntry::ContainsFiles
67 void* ContainsFiles(VFSURL* url, VFSDirEntry** entries, int* num_entries,
68 char* rootpath);
69
70 //! \copydoc KodiToAddonFuncTable_VFSEntry::ClearOutIdle
71 void ClearOutIdle();
72
73 //! \copydoc KodiToAddonFuncTable_VFSEntry::DisconnectAll
74 void DisconnectAll();
75
76 //! \copydoc KodiToAddonFuncTable_VFSEntry::DirectoryExists
77 bool DirectoryExists(VFSURL* url);
78
79 //! \copydoc KodiToAddonFuncTable_VFSEntry::RemoveDirectory
80 bool RemoveDirectory(VFSURL* url);
81
82 //! \copydoc KodiToAddonFuncTable_VFSEntry::CreateDirectory
83 bool CreateDirectory(VFSURL* url);
84
85 //! \copydoc KodiToAddonFuncTable_VFSEntry::GetDirectory
86 void* GetDirectory(VFSURL* url, VFSDirEntry** entries, int* num_entries,
87 VFSCallbacks* callbacks);
88
89 //! \copydoc KodiToAddonFuncTable_VFSEntry::FreeDirectory
90 void FreeDirectory(void* ctx);
91
92 //! \copydoc KodiToAddonFuncTable_VFSEntry::Delete
93 bool Delete(VFSURL* url);
94
95 //! \copydoc KodiToAddonFuncTable_VFSEntry::Rename
96 bool Rename(VFSURL* url, VFSURL* url2);
97
98 //! \brief Function to export the above structure to Kodi
99 void __declspec(dllexport) get_addon(void* ptr)
100 {
101 AddonInstance_VFSEntry* vfs = static_cast<AddonInstance_VFSEntry*>(ptr);
102 vfs->toAddon.Open = Open;
103 vfs->toAddon.OpenForWrite = OpenForWrite;
104 vfs->toAddon.Read = Read;
105 vfs->toAddon.Write = Write;
106 vfs->toAddon.Seek = Seek;
107 vfs->toAddon.GetLength = GetLength;
108 vfs->toAddon.GetPosition = GetPosition;
109 vfs->toAddon.IoControl = IoControl;
110 vfs->toAddon.Stat = Stat;
111 vfs->toAddon.Close = Close;
112 vfs->toAddon.Exists = Exists;
113 vfs->toAddon.ClearOutIdle = ClearOutIdle;
114 vfs->toAddon.DisconnectAll = DisconnectAll;
115 vfs->toAddon.DirectoryExists = DirectoryExists;
116 vfs->toAddon.GetDirectory = GetDirectory;
117 vfs->toAddon.FreeDirectory = FreeDirectory;
118 vfs->toAddon.Truncate = Truncate;
119 vfs->toAddon.Delete = Delete;
120 vfs->toAddon.Rename = Rename;
121 vfs->toAddon.RemoveDirectory = RemoveDirectory;
122 vfs->toAddon.CreateDirectory = CreateDirectory;
123 vfs->toAddon.ContainsFiles = ContainsFiles;
124 vfs->toAddon.GetChunkSize = GetChunkSize;
125 };
126};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp b/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
deleted file mode 100644
index cebce7e..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_vfs_utils.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Copyright (C) 2015-2016 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#pragma once
21
22/*!
23 * @file kodi_vfs_utils.hpp - C++ wrappers for Kodi's VFS operations
24 */
25
26#include "libXBMC_addon.h"
27#include "kodi_vfs_types.h"
28
29#include <stdint.h>
30#include <string>
31#include <vector>
32
33namespace ADDON
34{
35 class CVFSDirEntry
36 {
37 public:
38 CVFSDirEntry(const std::string& label = "",
39 const std::string& path = "",
40 bool bFolder = false,
41 int64_t size = -1) :
42 m_label(label),
43 m_path(path),
44 m_bFolder(bFolder),
45 m_size(size)
46 {
47 }
48
49 CVFSDirEntry(const VFSDirEntry& dirEntry) :
50 m_label(dirEntry.label ? dirEntry.label : ""),
51 m_path(dirEntry.path ? dirEntry.path : ""),
52 m_bFolder(dirEntry.folder),
53 m_size(dirEntry.size)
54 {
55 }
56
57 const std::string& Label(void) const { return m_label; }
58 const std::string& Path(void) const { return m_path; }
59 bool IsFolder(void) const { return m_bFolder; }
60 int64_t Size(void) const { return m_size; }
61
62 void SetLabel(const std::string& label) { m_label = label; }
63 void SetPath(const std::string& path) { m_path = path; }
64 void SetFolder(bool bFolder) { m_bFolder = bFolder; }
65 void SetSize(int64_t size) { m_size = size; }
66
67 private:
68 std::string m_label;
69 std::string m_path;
70 bool m_bFolder;
71 int64_t m_size;
72 };
73
74 class VFSUtils
75 {
76 public:
77 static bool GetDirectory(ADDON::CHelper_libXBMC_addon* frontend,
78 const std::string& path,
79 const std::string& mask,
80 std::vector<CVFSDirEntry>& items)
81 {
82 VFSDirEntry* dir_list = nullptr;
83 unsigned int num_items = 0;
84 if (frontend->GetDirectory(path.c_str(), mask.c_str(), &dir_list, &num_items))
85 {
86 for (unsigned int i = 0; i < num_items; i++)
87 items.push_back(CVFSDirEntry(dir_list[i]));
88
89 frontend->FreeDirectory(dir_list, num_items);
90
91 return true;
92 }
93 return false;
94 }
95 };
96}
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
deleted file mode 100644
index d4ea283..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
+++ /dev/null
@@ -1,204 +0,0 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2014 Team KODI
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with KODI; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include <string>
23#include <vector>
24#include <string.h>
25#include <stdlib.h>
26#include <stdio.h>
27#include "kodi_adsp_types.h"
28#include "libXBMC_addon.h"
29
30class CAddonSoundPlay
31{
32public:
33 CAddonSoundPlay(AddonCB* hdl, AddonInstance_AudioDSP* cb, const char* filename)
34 : m_Filename(filename),
35 m_Handle(hdl),
36 m_cb(cb)
37 {
38 m_PlayHandle = nullptr;
39 if (!hdl || !cb)
40 fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play is called with NULL handle !!!\n");
41 else
42 {
43 m_PlayHandle = m_cb->toKodi.SoundPlay_GetHandle(m_cb->toKodi.kodiInstance, m_Filename.c_str());
44 if (!m_PlayHandle)
45 fprintf(stderr, "libKODI_adsp-ERROR: ADSP_get_sound_play can't get callback table from KODI !!!\n");
46 }
47 }
48
49 ~CAddonSoundPlay()
50 {
51 if (m_PlayHandle)
52 m_cb->toKodi.SoundPlay_ReleaseHandle(m_cb->toKodi.kodiInstance, m_PlayHandle);
53 }
54
55 /*! play the sound this object represents */
56 void Play()
57 {
58 if (m_PlayHandle)
59 m_cb->toKodi.SoundPlay_Play(m_cb->toKodi.kodiInstance, m_PlayHandle);
60 }
61
62
63 /*! stop playing the sound this object represents */
64 void Stop()
65 {
66 if (m_PlayHandle)
67 m_cb->toKodi.SoundPlay_Stop(m_cb->toKodi.kodiInstance, m_PlayHandle);
68 }
69
70 /*! return true if the sound is currently playing */
71 bool IsPlaying()
72 {
73 if (!m_PlayHandle)
74 return false;
75
76 return m_cb->toKodi.SoundPlay_IsPlaying(m_cb->toKodi.kodiInstance, m_PlayHandle);
77 }
78
79 /*! set the playback channel position of this sound, AE_DSP_CH_INVALID for all */
80 void SetChannel(AE_DSP_CHANNEL channel)
81 {
82 if (m_PlayHandle)
83 m_cb->toKodi.SoundPlay_SetChannel(m_cb->toKodi.kodiInstance, m_PlayHandle, channel);
84 }
85
86 /*! get the current playback volume of this sound, AE_DSP_CH_INVALID for all */
87 AE_DSP_CHANNEL GetChannel()
88 {
89 if (!m_PlayHandle)
90 return AE_DSP_CH_INVALID;
91 return m_cb->toKodi.SoundPlay_GetChannel(m_cb->toKodi.kodiInstance, m_PlayHandle);
92 }
93
94 /*! set the playback volume of this sound */
95 void SetVolume(float volume)
96 {
97 if (m_PlayHandle)
98 m_cb->toKodi.SoundPlay_SetVolume(m_cb->toKodi.kodiInstance, m_PlayHandle, volume);
99 }
100
101 /*! get the current playback volume of this sound */
102 float GetVolume()
103 {
104 if (!m_PlayHandle)
105 return 0.0f;
106
107 return m_cb->toKodi.SoundPlay_GetVolume(m_cb->toKodi.kodiInstance, m_PlayHandle);
108 }
109
110private:
111 std::string m_Filename;
112 AddonCB* m_Handle;
113 AddonInstance_AudioDSP *m_cb;
114 ADSPHANDLE m_PlayHandle;
115};
116
117class CHelper_libKODI_adsp
118{
119public:
120 CHelper_libKODI_adsp(void)
121 {
122 m_Handle = nullptr;
123 m_Callbacks = nullptr;
124 }
125
126 ~CHelper_libKODI_adsp(void)
127 {
128 }
129
130 /*!
131 * @brief Resolve all callback methods
132 * @param handle Pointer to the add-on
133 * @return True when all methods were resolved, false otherwise.
134 */
135 bool RegisterMe(void* handle)
136 {
137 m_Handle = static_cast<AddonCB*>(handle);
138 if (m_Handle)
139 m_Callbacks = (AddonInstance_AudioDSP*)m_Handle->ADSPLib_RegisterMe(m_Handle->addonData);
140 if (!m_Callbacks)
141 fprintf(stderr, "libKODI_adsp-ERROR: ADSLib_RegisterMe can't get callback table from Kodi !!!\n");
142
143 return m_Callbacks != nullptr;
144 }
145
146 /*!
147 * @brief Add or replace a menu hook for the context menu for this add-on
148 * @param hook The hook to add
149 */
150 void AddMenuHook(AE_DSP_MENUHOOK* hook)
151 {
152 return m_Callbacks->toKodi.AddMenuHook(m_Callbacks->toKodi.kodiInstance, hook);
153 }
154
155 /*!
156 * @brief Remove a menu hook for the context menu for this add-on
157 * @param hook The hook to remove
158 */
159 void RemoveMenuHook(AE_DSP_MENUHOOK* hook)
160 {
161 return m_Callbacks->toKodi.RemoveMenuHook(m_Callbacks->toKodi.kodiInstance, hook);
162 }
163
164 /*!
165 * @brief Add or replace master mode information inside audio dsp database.
166 * Becomes identifier written inside mode to iModeID if it was 0 (undefined)
167 * @param mode The master mode to add or update inside database
168 */
169 void RegisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
170 {
171 return m_Callbacks->toKodi.RegisterMode(m_Callbacks->toKodi.kodiInstance, mode);
172 }
173
174 /*!
175 * @brief Remove a master mode from audio dsp database
176 * @param mode The Mode to remove
177 */
178 void UnregisterMode(AE_DSP_MODES::AE_DSP_MODE* mode)
179 {
180 return m_Callbacks->toKodi.UnregisterMode(m_Callbacks->toKodi.kodiInstance, mode);
181 }
182
183 /*!
184 * @brief Open a sound playing class
185 * @param filename The wav filename to open
186 */
187 CAddonSoundPlay* GetSoundPlay(const char *filename)
188 {
189 return new CAddonSoundPlay(m_Handle, m_Callbacks, filename);
190 }
191
192 /*!
193 * @brief Remove a played file class
194 * @param p The playback to remove
195 */
196 void ReleaseSoundPlay(CAddonSoundPlay* p)
197 {
198 delete p;
199 }
200
201private:
202 AddonCB* m_Handle;
203 AddonInstance_AudioDSP *m_Callbacks;
204};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
index d6f0f4f..c844c73 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
@@ -203,7 +203,7 @@ public:
203 m_controlHandle = m_cb->ListItem_Create(m_Handle->addonData, label, label2, iconImage, thumbnailImage, path); 203 m_controlHandle = m_cb->ListItem_Create(m_Handle->addonData, label, label2, iconImage, thumbnailImage, path);
204 } 204 }
205 205
206 virtual ~CAddonListItem() = default; 206 ~CAddonListItem() override = default;
207 207
208 const char *GetLabel() 208 const char *GetLabel()
209 { 209 {
@@ -293,7 +293,7 @@ public:
293 } 293 }
294 } 294 }
295 295
296 virtual ~CAddonGUIWindow() 296 ~CAddonGUIWindow() override
297 { 297 {
298 if (m_Handle && m_cb && m_controlHandle) 298 if (m_Handle && m_cb && m_controlHandle)
299 { 299 {
@@ -506,7 +506,7 @@ public:
506 { 506 {
507 m_controlHandle = m_cb->Window_GetControl_Spin(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 507 m_controlHandle = m_cb->Window_GetControl_Spin(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
508 } 508 }
509 ~CAddonGUISpinControl(void) {} 509 ~CAddonGUISpinControl(void) override = default;
510 510
511 void SetVisible(bool yesNo) 511 void SetVisible(bool yesNo)
512 { 512 {
@@ -555,7 +555,7 @@ public:
555 { 555 {
556 m_controlHandle = m_cb->Window_GetControl_RadioButton(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 556 m_controlHandle = m_cb->Window_GetControl_RadioButton(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
557 } 557 }
558 ~CAddonGUIRadioButton() {} 558 ~CAddonGUIRadioButton() override = default;
559 559
560 void SetVisible(bool yesNo) 560 void SetVisible(bool yesNo)
561 { 561 {
@@ -593,7 +593,7 @@ public:
593 m_controlHandle = m_cb->Window_GetControl_Progress(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 593 m_controlHandle = m_cb->Window_GetControl_Progress(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
594 } 594 }
595 595
596 ~CAddonGUIProgressControl(void) {} 596 ~CAddonGUIProgressControl(void) override = default;
597 597
598 void SetPercentage(float fPercent) 598 void SetPercentage(float fPercent)
599 { 599 {
@@ -641,7 +641,7 @@ public:
641 m_controlHandle = m_cb->Window_GetControl_Slider(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 641 m_controlHandle = m_cb->Window_GetControl_Slider(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
642 } 642 }
643 643
644 ~CAddonGUISliderControl(void) {} 644 ~CAddonGUISliderControl(void) override = default;
645 645
646 void SetVisible(bool yesNo) 646 void SetVisible(bool yesNo)
647 { 647 {
@@ -731,7 +731,7 @@ public:
731 m_controlHandle = m_cb->Window_GetControl_SettingsSlider(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 731 m_controlHandle = m_cb->Window_GetControl_SettingsSlider(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
732 } 732 }
733 733
734 ~CAddonGUISettingsSliderControl(void) {} 734 ~CAddonGUISettingsSliderControl(void) override = default;
735 735
736 void SetVisible(bool yesNo) 736 void SetVisible(bool yesNo)
737 { 737 {
@@ -832,7 +832,7 @@ public:
832 m_controlHandle = m_cb->Window_GetControl_RenderAddon(m_Handle->addonData, m_Window->GetControlHandle(), controlId); 832 m_controlHandle = m_cb->Window_GetControl_RenderAddon(m_Handle->addonData, m_Window->GetControlHandle(), controlId);
833 } 833 }
834 834
835 virtual ~CAddonGUIRenderingControl() 835 ~CAddonGUIRenderingControl() override
836 { 836 {
837 m_cb->RenderAddon_Delete(m_Handle->addonData, m_controlHandle); 837 m_cb->RenderAddon_Delete(m_Handle->addonData, m_controlHandle);
838 } 838 }
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
deleted file mode 100644
index d37d24e..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_inputstream.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * Copyright (C) 2005-2016 Team XBMC
3 * http://www.xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20
21#pragma once
22
23#include <string>
24#include <vector>
25#include <string.h>
26#include <stdlib.h>
27#include <stdio.h>
28
29#include "kodi_inputstream_types.h"
30#include "versions.h"
31
32#ifdef BUILD_KODI_ADDON
33#include "DVDDemuxPacket.h"
34#else
35#include "cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h"
36#endif
37
38class CHelper_libKODI_inputstream
39{
40public:
41 CHelper_libKODI_inputstream(void)
42 {
43 m_Handle = nullptr;
44 m_Callbacks = nullptr;
45 }
46
47 ~CHelper_libKODI_inputstream(void)
48 {
49 }
50
51 /*!
52 * @brief Resolve all callback methods
53 * @param handle Pointer to the add-on
54 * @return True when all methods were resolved, false otherwise.
55 */
56 bool RegisterMe(void* handle)
57 {
58 m_Handle = static_cast<AddonCB*>(handle);
59 if (m_Handle)
60 m_Callbacks = (AddonInstance_InputStream*)m_Handle->INPUTSTREAMLib_RegisterMe(m_Handle->addonData);
61 if (!m_Callbacks)
62 fprintf(stderr, "libKODI_inputstream-ERROR: InputStream_RegisterMe can't get callback table from Kodi !!!\n");
63
64 return m_Callbacks != nullptr;
65 }
66
67 /*!
68 * @brief Allocate a demux packet. Free with FreeDemuxPacket
69 * @param iDataSize The size of the data that will go into the packet
70 * @return The allocated packet
71 */
72 DemuxPacket* AllocateDemuxPacket(int iDataSize)
73 {
74 return m_Callbacks->toKodi.AllocateDemuxPacket(m_Callbacks->toKodi.kodiInstance, iDataSize);
75 }
76
77 /*!
78 * @brief Free a packet that was allocated with AllocateDemuxPacket
79 * @param pPacket The packet to free
80 */
81 void FreeDemuxPacket(DemuxPacket* pPacket)
82 {
83 return m_Callbacks->toKodi.FreeDemuxPacket(m_Callbacks->toKodi.kodiInstance, pPacket);
84 }
85
86private:
87 AddonCB* m_Handle;
88 AddonInstance_InputStream* m_Callbacks;
89};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h
deleted file mode 100644
index d1d8e4b..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_peripheral.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * Copyright (C) 2014-2017 Team Kodi
3 * http://kodi.tv
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this Program; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 */
20#pragma once
21
22#include "libXBMC_addon.h"
23#include "kodi_peripheral_types.h"
24
25#include <string>
26#include <stdio.h>
27
28#if defined(ANDROID)
29 #include <sys/stat.h>
30#endif
31
32namespace ADDON
33{
34
35class CHelper_libKODI_peripheral
36{
37public:
38 CHelper_libKODI_peripheral(void)
39 {
40 m_Handle = nullptr;
41 m_Callbacks = nullptr;
42 }
43
44 ~CHelper_libKODI_peripheral(void)
45 {
46 }
47
48 /*!
49 * @brief Resolve all callback methods
50 * @param handle Pointer to the add-on
51 * @return True when all methods were resolved, false otherwise.
52 */
53 bool RegisterMe(void* handle)
54 {
55 m_Handle = static_cast<AddonCB*>(handle);
56 if (m_Handle)
57 m_Callbacks = (AddonInstance_Peripheral*)m_Handle->PeripheralLib_RegisterMe(m_Handle->addonData);
58 if (!m_Callbacks)
59 fprintf(stderr, "libKODI_peripheral-ERROR: PeripheralLib_register_me can't get callback table from Kodi !!!\n");
60
61 return m_Callbacks != nullptr;
62 }
63
64 /*!
65 * @brief Trigger a scan for peripherals
66 *
67 * The add-on calls this if a change in hardware is detected.
68 */
69 void TriggerScan(void)
70 {
71 return m_Callbacks->toKodi.TriggerScan(m_Callbacks->toKodi.kodiInstance);
72 }
73
74 /*!
75 * @brief Notify the frontend that button maps have changed
76 *
77 * @param[optional] deviceName The name of the device to refresh, or empty/null for all devices
78 * @param[optional] controllerId The controller ID to refresh, or empty/null for all controllers
79 */
80 void RefreshButtonMaps(const std::string& strDeviceName = "", const std::string& strControllerId = "")
81 {
82 return m_Callbacks->toKodi.RefreshButtonMaps(m_Callbacks->toKodi.kodiInstance, strDeviceName.c_str(), strControllerId.c_str());
83 }
84
85 /*!
86 * @brief Return the number of features belonging to the specified controller
87 *
88 * @param controllerId The controller ID to enumerate
89 * @param type[optional] Type to filter by, or JOYSTICK_FEATURE_TYPE_UNKNOWN for all features
90 *
91 * @return The number of features matching the request parameters
92 */
93 unsigned int FeatureCount(const std::string& strControllerId, JOYSTICK_FEATURE_TYPE type = JOYSTICK_FEATURE_TYPE_UNKNOWN)
94 {
95 return m_Callbacks->toKodi.FeatureCount(m_Callbacks->toKodi.kodiInstance, strControllerId.c_str(), type);
96 }
97
98private:
99 AddonCB* m_Handle;
100 AddonInstance_Peripheral* m_Callbacks;
101};
102
103} /* namespace ADDON */
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h
new file mode 100644
index 0000000..232f67d
--- /dev/null
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/tools/DllHelper.h
@@ -0,0 +1,129 @@
1#pragma once
2/*
3 * Copyright (C) 2005-2017 Team Kodi
4 * http://kodi.tv
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Kodi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#include <string>
23#include <kodi/AddonBase.h>
24
25#ifdef _WIN32 // windows
26#include <p8-platform/windows/dlfcn-win32.h>
27#else
28#include <dlfcn.h> // linux+osx
29#endif
30
31#define REGISTER_DLL_SYMBOL(functionPtr) \
32 CDllHelper::RegisterSymbol(functionPtr, #functionPtr)
33
34/// @brief Class to help with load of shared library functions
35///
36/// You can add them as parent to your class and to help with load of shared
37/// library functions.
38///
39/// @note To use on Windows must you also include p8-platform on your addon!
40///
41///
42/// ----------------------------------------------------------------------------
43///
44/// **Example:**
45/// ~~~~~~~~~~~~~{.cpp}
46///
47/// #include <kodi/tools/DllHelper.h>
48///
49/// ...
50/// class CMyInstance : public kodi::addon::CInstanceAudioDecoder,
51/// private CDllHelper
52/// {
53/// public:
54/// CMyInstance(KODI_HANDLE instance);
55/// bool Start();
56///
57/// ...
58///
59/// /* The pointers for on shared library exported functions */
60/// int (*Init)();
61/// void (*Cleanup)();
62/// int (*GetLength)();
63/// };
64///
65/// CMyInstance::CMyInstance(KODI_HANDLE instance)
66/// : CInstanceAudioDecoder(instance)
67/// {
68/// }
69///
70/// bool CMyInstance::Start()
71/// {
72/// std::string lib = kodi::GetAddonPath("myLib.so");
73/// if (!LoadDll(lib)) return false;
74/// if (!REGISTER_DLL_SYMBOL(Init)) return false;
75/// if (!REGISTER_DLL_SYMBOL(Cleanup)) return false;
76/// if (!REGISTER_DLL_SYMBOL(GetLength)) return false;
77///
78/// Init();
79/// return true;
80/// }
81/// ...
82/// ~~~~~~~~~~~~~
83///
84class CDllHelper
85{
86public:
87 CDllHelper() : m_dll(nullptr) { }
88 virtual ~CDllHelper()
89 {
90 if (m_dll)
91 dlclose(m_dll);
92 }
93
94 /// @brief Function to load requested library
95 ///
96 /// @param[in] path The path with filename of shared library to load
97 /// @return true if load was successful done
98 ///
99 bool LoadDll(const std::string& path)
100 {
101 m_dll = dlopen(path.c_str(), RTLD_LAZY);
102 if (m_dll == nullptr)
103 {
104 kodi::Log(ADDON_LOG_ERROR, "Unable to load %s", dlerror());
105 return false;
106 }
107 return true;
108 }
109
110 /// @brief Function to register requested library symbol
111 ///
112 /// @note This function should not be used, use instead the macro
113 /// REGISTER_DLL_SYMBOL to register the symbol pointer.
114 ///
115 template <typename T>
116 bool RegisterSymbol(T& functionPtr, const char* strFunctionPtr)
117 {
118 functionPtr = reinterpret_cast<T>(dlsym(m_dll, strFunctionPtr));
119 if (functionPtr == nullptr)
120 {
121 kodi::Log(ADDON_LOG_ERROR, "Unable to assign function %s", dlerror());
122 return false;
123 }
124 return true;
125 }
126
127private:
128 void* m_dll;
129};
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
index fa90f77..b9d37b4 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/versions.h
@@ -41,8 +41,8 @@
41 * overview. 41 * overview.
42 */ 42 */
43 43
44#define ADDON_GLOBAL_VERSION_MAIN "1.0.7" 44#define ADDON_GLOBAL_VERSION_MAIN "1.0.10"
45#define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.2" 45#define ADDON_GLOBAL_VERSION_MAIN_MIN "1.0.10"
46#define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main" 46#define ADDON_GLOBAL_VERSION_MAIN_XML_ID "kodi.binary.global.main"
47#define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \ 47#define ADDON_GLOBAL_VERSION_MAIN_DEPENDS "AddonBase.h" \
48 "xbmc_addon_dll.h" \ 48 "xbmc_addon_dll.h" \
@@ -50,8 +50,8 @@
50 "libXBMC_addon.h" \ 50 "libXBMC_addon.h" \
51 "addon-instance/" 51 "addon-instance/"
52 52
53#define ADDON_GLOBAL_VERSION_GENERAL "1.0.0" 53#define ADDON_GLOBAL_VERSION_GENERAL "1.0.2"
54#define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.0" 54#define ADDON_GLOBAL_VERSION_GENERAL_MIN "1.0.2"
55#define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general" 55#define ADDON_GLOBAL_VERSION_GENERAL_XML_ID "kodi.binary.global.general"
56#define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h" 56#define ADDON_GLOBAL_VERSION_GENERAL_DEPENDS "General.h"
57 57
@@ -75,24 +75,20 @@
75#define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network" 75#define ADDON_GLOBAL_VERSION_NETWORK_XML_ID "kodi.binary.global.network"
76#define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h" 76#define ADDON_GLOBAL_VERSION_NETWORK_DEPENDS "Network.h"
77 77
78#define ADDON_INSTANCE_VERSION_ADSP "0.1.10" 78#define ADDON_INSTANCE_VERSION_ADSP "0.2.0"
79#define ADDON_INSTANCE_VERSION_ADSP_MIN "0.1.10" 79#define ADDON_INSTANCE_VERSION_ADSP_MIN "0.2.0"
80#define ADDON_INSTANCE_VERSION_ADSP_XML_ID "kodi.binary.instance.adsp" 80#define ADDON_INSTANCE_VERSION_ADSP_XML_ID "kodi.binary.instance.adsp"
81#define ADDON_INSTANCE_VERSION_ADSP_DEPENDS "kodi_adsp_dll.h" \ 81#define ADDON_INSTANCE_VERSION_ADSP_DEPENDS "addon-instance/AudioDSP.h"
82 "kodi_adsp_types.h" \
83 "libKODI_adsp.h"
84 82
85#define ADDON_INSTANCE_VERSION_AUDIODECODER "1.0.1" 83#define ADDON_INSTANCE_VERSION_AUDIODECODER "2.0.0"
86#define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "1.0.1" 84#define ADDON_INSTANCE_VERSION_AUDIODECODER_MIN "2.0.0"
87#define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder" 85#define ADDON_INSTANCE_VERSION_AUDIODECODER_XML_ID "kodi.binary.instance.audiodecoder"
88#define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS "kodi_audiodec_dll.h" \ 86#define ADDON_INSTANCE_VERSION_AUDIODECODER_DEPENDS "addon-instance/AudioDecoder.h"
89 "kodi_audiodec_types.h"
90 87
91#define ADDON_INSTANCE_VERSION_AUDIOENCODER "1.0.1" 88#define ADDON_INSTANCE_VERSION_AUDIOENCODER "2.0.0"
92#define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN "1.0.1" 89#define ADDON_INSTANCE_VERSION_AUDIOENCODER_MIN "2.0.0"
93#define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder" 90#define ADDON_INSTANCE_VERSION_AUDIOENCODER_XML_ID "kodi.binary.instance.audioencoder"
94#define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "xbmc_audioenc_dll.h" \ 91#define ADDON_INSTANCE_VERSION_AUDIOENCODER_DEPENDS "addon-instance/AudioEncoder.h"
95 "xbmc_audioenc_types.h"
96 92
97#define ADDON_INSTANCE_VERSION_GAME "1.0.32" 93#define ADDON_INSTANCE_VERSION_GAME "1.0.32"
98#define ADDON_INSTANCE_VERSION_GAME_MIN "1.0.32" 94#define ADDON_INSTANCE_VERSION_GAME_MIN "1.0.32"
@@ -101,29 +97,24 @@
101 "kodi_game_types.h" \ 97 "kodi_game_types.h" \
102 "libKODI_game.h" 98 "libKODI_game.h"
103 99
104#define ADDON_INSTANCE_VERSION_IMAGEDECODER "1.0.1" 100#define ADDON_INSTANCE_VERSION_IMAGEDECODER "2.0.0"
105#define ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN "1.0.1" 101#define ADDON_INSTANCE_VERSION_IMAGEDECODER_MIN "2.0.0"
106#define ADDON_INSTANCE_VERSION_IMAGEDECODER_XML_ID "kodi.binary.instance.imagedecoder" 102#define ADDON_INSTANCE_VERSION_IMAGEDECODER_XML_ID "kodi.binary.instance.imagedecoder"
107#define ADDON_INSTANCE_VERSION_IMAGEDECODER_DEPENDS "kodi_imagedec_dll.h" \ 103#define ADDON_INSTANCE_VERSION_IMAGEDECODER_DEPENDS "addon-instance/ImageDecoder.h"
108 "kodi_imagedec_types.h"
109 104
110#define ADDON_INSTANCE_VERSION_INPUTSTREAM "1.0.8" 105#define ADDON_INSTANCE_VERSION_INPUTSTREAM "2.0.2"
111#define ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN "1.0.8" 106#define ADDON_INSTANCE_VERSION_INPUTSTREAM_MIN "2.0.2"
112#define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream" 107#define ADDON_INSTANCE_VERSION_INPUTSTREAM_XML_ID "kodi.binary.instance.inputstream"
113#define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "libKODI_inputstream.h" \ 108#define ADDON_INSTANCE_VERSION_INPUTSTREAM_DEPENDS "addon-instance/Inputstream.h"
114 "kodi_inputstream_dll.h" \
115 "kodi_inputstream_types.h"
116 109
117#define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.3" 110#define ADDON_INSTANCE_VERSION_PERIPHERAL "1.3.3"
118#define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "1.3.3" 111#define ADDON_INSTANCE_VERSION_PERIPHERAL_MIN "1.3.3"
119#define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral" 112#define ADDON_INSTANCE_VERSION_PERIPHERAL_XML_ID "kodi.binary.instance.peripheral"
120#define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "kodi_peripheral_dll.h" \ 113#define ADDON_INSTANCE_VERSION_PERIPHERAL_DEPENDS "addon-instance/Peripheral.h" \
121 "kodi_peripheral_types.h" \ 114 "addon-instance/PeripheralUtils.h"
122 "kodi_peripheral_utils.hpp" \
123 "libKODI_peripheral.h"
124 115
125#define ADDON_INSTANCE_VERSION_PVR "5.2.4" 116#define ADDON_INSTANCE_VERSION_PVR "5.3.0"
126#define ADDON_INSTANCE_VERSION_PVR_MIN "5.2.4" 117#define ADDON_INSTANCE_VERSION_PVR_MIN "5.3.0"
127#define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr" 118#define ADDON_INSTANCE_VERSION_PVR_XML_ID "kodi.binary.instance.pvr"
128#define ADDON_INSTANCE_VERSION_PVR_DEPENDS "xbmc_pvr_dll.h" \ 119#define ADDON_INSTANCE_VERSION_PVR_DEPENDS "xbmc_pvr_dll.h" \
129 "xbmc_pvr_types.h" \ 120 "xbmc_pvr_types.h" \
@@ -135,18 +126,22 @@
135#define ADDON_INSTANCE_VERSION_SCREENSAVER_XML_ID "kodi.binary.instance.screensaver" 126#define ADDON_INSTANCE_VERSION_SCREENSAVER_XML_ID "kodi.binary.instance.screensaver"
136#define ADDON_INSTANCE_VERSION_SCREENSAVER_DEPENDS "addon-instance/Screensaver.h" 127#define ADDON_INSTANCE_VERSION_SCREENSAVER_DEPENDS "addon-instance/Screensaver.h"
137 128
138#define ADDON_INSTANCE_VERSION_VFS "1.0.1" 129#define ADDON_INSTANCE_VERSION_VFS "2.0.0"
139#define ADDON_INSTANCE_VERSION_VFS_MIN "1.0.1" 130#define ADDON_INSTANCE_VERSION_VFS_MIN "2.0.0"
140#define ADDON_INSTANCE_VERSION_VFS_XML_ID "kodi.binary.instance.vfs" 131#define ADDON_INSTANCE_VERSION_VFS_XML_ID "kodi.binary.instance.vfs"
141#define ADDON_INSTANCE_VERSION_VFS_DEPENDS "kodi_vfs_dll.h" \ 132#define ADDON_INSTANCE_VERSION_VFS_DEPENDS "addon-instance/VFS.h"
142 "kodi_vfs_types.h" \
143 "kodi_vfs_utils.hpp"
144 133
145#define ADDON_INSTANCE_VERSION_VISUALIZATION "1.0.1" 134#define ADDON_INSTANCE_VERSION_VISUALIZATION "2.0.1"
146#define ADDON_INSTANCE_VERSION_VISUALIZATION_MIN "1.0.1" 135#define ADDON_INSTANCE_VERSION_VISUALIZATION_MIN "2.0.0"
147#define ADDON_INSTANCE_VERSION_VISUALIZATION_XML_ID "kodi.binary.instance.visualization" 136#define ADDON_INSTANCE_VERSION_VISUALIZATION_XML_ID "kodi.binary.instance.visualization"
148#define ADDON_INSTANCE_VERSION_VISUALIZATION_DEPENDS "xbmc_vis_dll.h" \ 137#define ADDON_INSTANCE_VERSION_VISUALIZATION_DEPENDS "addon-instance/Visualization.h"
149 "xbmc_vis_types.h" 138
139#define ADDON_INSTANCE_VERSION_VIDEOCODEC "1.0.1"
140#define ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN "1.0.1"
141#define ADDON_INSTANCE_VERSION_VIDEOCODEC_XML_ID "kodi.binary.instance.videocodec"
142#define ADDON_INSTANCE_VERSION_VIDEOCODEC_DEPENDS "addon-instance/VideoCodec.h" \
143 "StreamCodec.h" \
144 "StreamCrypto.h"
150 145
151/// 146///
152/// The currently available instance types for Kodi add-ons 147/// The currently available instance types for Kodi add-ons
@@ -179,6 +174,7 @@ typedef enum ADDON_TYPE
179 ADDON_INSTANCE_VISUALIZATION = 109, 174 ADDON_INSTANCE_VISUALIZATION = 109,
180 ADDON_INSTANCE_VFS = 110, 175 ADDON_INSTANCE_VFS = 110,
181 ADDON_INSTANCE_IMAGEDECODER = 111, 176 ADDON_INSTANCE_IMAGEDECODER = 111,
177 ADDON_INSTANCE_VIDEOCODEC = 112,
182} ADDON_TYPE; 178} ADDON_TYPE;
183 179
184#ifdef __cplusplus 180#ifdef __cplusplus
@@ -271,6 +267,10 @@ inline const char* GetTypeVersion(int type)
271 case ADDON_INSTANCE_VISUALIZATION: 267 case ADDON_INSTANCE_VISUALIZATION:
272 return ADDON_INSTANCE_VERSION_VISUALIZATION; 268 return ADDON_INSTANCE_VERSION_VISUALIZATION;
273#endif 269#endif
270#if !defined(BUILD_KODI_ADDON) || defined(ADDON_INSTANCE_VERSION_VIDEOCODEC_USED)
271 case ADDON_INSTANCE_VIDEOCODEC:
272 return ADDON_INSTANCE_VERSION_VIDEOCODEC;
273#endif
274 } 274 }
275 return "0.0.0"; 275 return "0.0.0";
276} 276}
@@ -324,6 +324,8 @@ inline const char* GetTypeMinVersion(int type)
324 return ADDON_INSTANCE_VERSION_VFS_MIN; 324 return ADDON_INSTANCE_VERSION_VFS_MIN;
325 case ADDON_INSTANCE_VISUALIZATION: 325 case ADDON_INSTANCE_VISUALIZATION:
326 return ADDON_INSTANCE_VERSION_VISUALIZATION_MIN; 326 return ADDON_INSTANCE_VERSION_VISUALIZATION_MIN;
327 case ADDON_INSTANCE_VIDEOCODEC:
328 return ADDON_INSTANCE_VERSION_VIDEOCODEC_MIN;
327 } 329 }
328 return "0.0.0"; 330 return "0.0.0";
329} 331}
@@ -374,6 +376,8 @@ inline const char* GetTypeName(int type)
374 return "ScreenSaver"; 376 return "ScreenSaver";
375 case ADDON_INSTANCE_VISUALIZATION: 377 case ADDON_INSTANCE_VISUALIZATION:
376 return "Visualization"; 378 return "Visualization";
379 case ADDON_INSTANCE_VIDEOCODEC:
380 return "VideoCodec";
377 } 381 }
378 return "unknown"; 382 return "unknown";
379} 383}
@@ -425,6 +429,8 @@ inline int GetTypeId(const char* name)
425 return ADDON_INSTANCE_VFS; 429 return ADDON_INSTANCE_VFS;
426 else if (strcmp(name, "visualization") == 0) 430 else if (strcmp(name, "visualization") == 0)
427 return ADDON_INSTANCE_VISUALIZATION; 431 return ADDON_INSTANCE_VISUALIZATION;
432 else if (strcmp(name, "videocodec") == 0)
433 return ADDON_INSTANCE_VIDEOCODEC;
428 } 434 }
429 return -1; 435 return -1;
430} 436}
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h
deleted file mode 100644
index 9ba259c..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include <stdint.h>
24#include "xbmc_addon_dll.h"
25#include "xbmc_audioenc_types.h"
26
27extern "C"
28{
29 //! \copydoc AudioEncoder::Create
30 void* Create(audioenc_callbacks *callbacks);
31
32 //! \copydoc AudioEncoder::Start
33 bool Start(void* context, int iInChannels, int iInRate, int iInBits,
34 const char* title, const char* artist,
35 const char* albumartist, const char* album,
36 const char* year, const char* track,
37 const char* genre, const char* comment, int iTrackLength);
38
39 //! \copydoc AudioEncoder::Encode
40 int Encode(void* context, int nNumBytesRead, uint8_t* pbtStream);
41
42 //! \copydoc AudioEncoder::Finish
43 bool Finish(void* context);
44
45 //! \copydoc AudioEncoder::Free
46 void Free(void* context);
47
48 // function to export the above structure to XBMC
49 void __declspec(dllexport) get_addon(void* enc)
50 {
51 AddonInstance_AudioEncoder* pScr = static_cast<AddonInstance_AudioEncoder*>(enc);
52
53 pScr->toAddon.Create = Create;
54 pScr->toAddon.Start = Start;
55 pScr->toAddon.Encode = Encode;
56 pScr->toAddon.Finish = Finish;
57 pScr->toAddon.Free = Free;
58 };
59};
60
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
deleted file mode 100644
index 25142c2..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
+++ /dev/null
@@ -1,121 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef TARGET_WINDOWS
24#ifndef __cdecl
25#define __cdecl
26#endif
27#ifndef __declspec
28#define __declspec(X)
29#endif
30#endif
31
32#include "xbmc_addon_types.h"
33#include <stdint.h>
34
35extern "C"
36{
37 struct AUDIOENC_INFO
38 {
39 int dummy;
40 };
41
42 typedef int (*audioenc_write_callback)(void* opaque, uint8_t* data, int len);
43 typedef int64_t (*audioenc_seek_callback)(void* opaque, int64_t pos, int whence);
44
45 typedef struct
46 {
47 void* opaque;
48 audioenc_write_callback write;
49 audioenc_seek_callback seek;
50 } audioenc_callbacks;
51
52 typedef struct AddonProps_AudioEncoder
53 {
54 int dummy;
55 } AddonProps_AudioEncoder;
56
57 typedef struct AddonToKodiFuncTable_AudioEncoder
58 {
59 KODI_HANDLE kodiInstance;
60 } AddonToKodiFuncTable_AudioEncoder;
61
62 typedef struct KodiToAddonFuncTable_AudioEncoder
63 {
64 /*! \brief Create encoder context
65 \param callbacks Pointer to audioenc_callbacks structure.
66 \return opaque pointer to encoder context, to be passed to other methods.
67 \sa IEncoder::Init
68 */
69 void (*(__cdecl *Create) (audioenc_callbacks* callbacks));
70
71 /*! \brief Start encoder
72 \param context Encoder context from Create.
73 \param iInChannels Number of channels
74 \param iInRate Sample rate of input data
75 \param iInBits Bits per sample in input data
76 \param title The title of the song
77 \param artist The artist of the song
78 \param albumartist The albumartist of the song
79 \param year The year of the song
80 \param track The track number of the song
81 \param genre The genre of the song
82 \param comment A comment to attach to the song
83 \param iTrackLength Total track length in seconds
84 \sa IEncoder::Init
85 */
86 bool (__cdecl* Start) (void* context, int iInChannels, int iInRate, int iInBits,
87 const char* title, const char* artist,
88 const char* albumartist, const char* album,
89 const char* year, const char* track,
90 const char* genre, const char* comment,
91 int iTrackLength);
92
93 /*! \brief Encode a chunk of audio
94 \param context Encoder context from Create.
95 \param nNumBytesRead Number of bytes in input buffer
96 \param pbtStream the input buffer
97 \return Number of bytes consumed
98 \sa IEncoder::Encode
99 */
100 int (__cdecl* Encode) (void* context, int nNumBytesRead, uint8_t* pbtStream);
101
102 /*! \brief Finalize encoding
103 \param context Encoder context from Create.
104 \return True on success, false on failure.
105 */
106 bool (__cdecl* Finish) (void* context);
107
108 /*! \brief Free encoder context
109 \param context Encoder context to free.
110 */
111 void (__cdecl* Free)(void* context);
112 } KodiToAddonFuncTable_AudioEncoder;
113
114 typedef struct AddonInstance_AudioEncoder
115 {
116 AddonProps_AudioEncoder props;
117 AddonToKodiFuncTable_AudioEncoder toKodi;
118 KodiToAddonFuncTable_AudioEncoder toAddon;
119 } AddonInstance_AudioEncoder;
120}
121
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
index d504f4b..11e39f8 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
@@ -262,6 +262,14 @@ extern "C"
262 PVR_ERROR RenameRecording(const PVR_RECORDING& recording); 262 PVR_ERROR RenameRecording(const PVR_RECORDING& recording);
263 263
264 /*! 264 /*!
265 * Set the lifetime of a recording on the backend.
266 * @param recording The recording to change the lifetime for. recording.iLifetime contains the new lieftime value.
267 * @return PVR_ERROR_NO_ERROR if the recording's lifetime has been set successfully.
268 * @remarks Required if bSupportsRecordingsLifetimeChange is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
269 */
270 PVR_ERROR SetRecordingLifetime(const PVR_RECORDING* recording);
271
272 /*!
265 * Set the play count of a recording on the backend. 273 * Set the play count of a recording on the backend.
266 * @param recording The recording to change the play count. 274 * @param recording The recording to change the play count.
267 * @param count Play count. 275 * @param count Play count.
@@ -413,11 +421,19 @@ extern "C"
413 * Get the signal status of the stream that's currently open. 421 * Get the signal status of the stream that's currently open.
414 * @param signalStatus The signal status. 422 * @param signalStatus The signal status.
415 * @return True if the signal status has been read successfully, false otherwise. 423 * @return True if the signal status has been read successfully, false otherwise.
416 * @remarks Optional, and only used if bHandlesInputStream or bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function. 424 * @remarks Optional, and only used if PVR_ADDON_CAPABILITIES::bHandlesInputStream or PVR_ADDON_CAPABILITIES::bHandlesDemuxing is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
417 */ 425 */
418 PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus); 426 PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS& signalStatus);
419 427
420 /*! 428 /*!
429 * Get the descramble information of the stream that's currently open.
430 * @param[out] descrambleInfo The descramble information.
431 * @return True if the decramble information has been read successfully, false otherwise.
432 * @remarks Optional, and only used if PVR_ADDON_CAPABILITIES::bSupportsDescrambleInfo is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
433 */
434 PVR_ERROR GetDescrambleInfo(PVR_DESCRAMBLE_INFO* descrambleInfo);
435
436 /*!
421 * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on. 437 * Get the stream URL for a channel from the backend. Used by the MediaPortal add-on.
422 * @param channel The channel to get the stream URL for. 438 * @param channel The channel to get the stream URL for.
423 * @return The requested URL. 439 * @return The requested URL.
@@ -660,6 +676,7 @@ extern "C"
660 pClient->toAddon.UndeleteRecording = UndeleteRecording; 676 pClient->toAddon.UndeleteRecording = UndeleteRecording;
661 pClient->toAddon.DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash; 677 pClient->toAddon.DeleteAllRecordingsFromTrash = DeleteAllRecordingsFromTrash;
662 pClient->toAddon.RenameRecording = RenameRecording; 678 pClient->toAddon.RenameRecording = RenameRecording;
679 pClient->toAddon.SetRecordingLifetime = SetRecordingLifetime;
663 pClient->toAddon.SetRecordingPlayCount = SetRecordingPlayCount; 680 pClient->toAddon.SetRecordingPlayCount = SetRecordingPlayCount;
664 pClient->toAddon.SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition; 681 pClient->toAddon.SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition;
665 pClient->toAddon.GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition; 682 pClient->toAddon.GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition;
@@ -680,6 +697,7 @@ extern "C"
680 pClient->toAddon.LengthLiveStream = LengthLiveStream; 697 pClient->toAddon.LengthLiveStream = LengthLiveStream;
681 pClient->toAddon.SwitchChannel = SwitchChannel; 698 pClient->toAddon.SwitchChannel = SwitchChannel;
682 pClient->toAddon.SignalStatus = SignalStatus; 699 pClient->toAddon.SignalStatus = SignalStatus;
700 pClient->toAddon.GetDescrambleInfo = GetDescrambleInfo;
683 pClient->toAddon.GetLiveStreamURL = GetLiveStreamURL; 701 pClient->toAddon.GetLiveStreamURL = GetLiveStreamURL;
684 pClient->toAddon.GetChannelSwitchDelay = GetChannelSwitchDelay; 702 pClient->toAddon.GetChannelSwitchDelay = GetChannelSwitchDelay;
685 pClient->toAddon.CanPauseStream = CanPauseStream; 703 pClient->toAddon.CanPauseStream = CanPauseStream;
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
index f3a4ccf..e7fed7b 100644
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
+++ b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
@@ -70,6 +70,9 @@ struct DemuxPacket;
70#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE 512 70#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE 512
71#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL 128 71#define PVR_ADDON_TIMERTYPE_VALUES_ARRAY_SIZE_SMALL 128
72#define PVR_ADDON_TIMERTYPE_STRING_LENGTH 64 72#define PVR_ADDON_TIMERTYPE_STRING_LENGTH 64
73#define PVR_ADDON_ATTRIBUTE_DESC_LENGTH 64
74#define PVR_ADDON_ATTRIBUTE_VALUES_ARRAY_SIZE 512
75#define PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH 64
73 76
74#define XBMC_INVALID_CODEC_ID 0 77#define XBMC_INVALID_CODEC_ID 0
75#define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID } 78#define XBMC_INVALID_CODEC { XBMC_CODEC_TYPE_UNKNOWN, XBMC_INVALID_CODEC_ID }
@@ -155,6 +158,7 @@ extern "C" {
155 const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE = 0x00200000; /*!< @brief this type shold not appear on any create menus which don't provide an associated EPG tag */ 158 const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE = 0x00200000; /*!< @brief this type shold not appear on any create menus which don't provide an associated EPG tag */
156 const unsigned int PVR_TIMER_TYPE_FORBIDS_EPG_TAG_ON_CREATE = 0x00400000; /*!< @brief this type should not appear on any create menus which provide an associated EPG tag */ 159 const unsigned int PVR_TIMER_TYPE_FORBIDS_EPG_TAG_ON_CREATE = 0x00400000; /*!< @brief this type should not appear on any create menus which provide an associated EPG tag */
157 const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_SERIES_ON_CREATE = 0x00800000; /*!< @brief this type should not appear on any create menus unless associated with an EPG tag with 'series' attributes (EPG_TAG.iFlags & EPG_TAG_FLAG_IS_SERIES || EPG_TAG.iSeriesNumber > 0 || EPG_TAG.iEpisodeNumber > 0 || EPG_TAG.iEpisodePartNumber > 0). Implies PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE */ 160 const unsigned int PVR_TIMER_TYPE_REQUIRES_EPG_SERIES_ON_CREATE = 0x00800000; /*!< @brief this type should not appear on any create menus unless associated with an EPG tag with 'series' attributes (EPG_TAG.iFlags & EPG_TAG_FLAG_IS_SERIES || EPG_TAG.iSeriesNumber > 0 || EPG_TAG.iEpisodeNumber > 0 || EPG_TAG.iEpisodePartNumber > 0). Implies PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE */
161 const unsigned int PVR_TIMER_TYPE_SUPPORTS_ANY_CHANNEL = 0x01000000; /*!< @brief this type supports 'any channel', for example when defining a timer rule that should match any channel instaed of a particular channel */
158 162
159 /*! 163 /*!
160 * @brief PVR timer weekdays (PVR_TIMER.iWeekdays values) 164 * @brief PVR timer weekdays (PVR_TIMER.iWeekdays values)
@@ -182,6 +186,11 @@ extern "C" {
182 const int PVR_CHANNEL_INVALID_UID = -1; /*!< @brief denotes that no channel uid is available. */ 186 const int PVR_CHANNEL_INVALID_UID = -1; /*!< @brief denotes that no channel uid is available. */
183 187
184 /*! 188 /*!
189 * @brief special PVR_DESCRAMBLE_INFO value to indicate that a struct member's value is not available.
190 */
191 const int PVR_DESCRAMBLE_INFO_NOT_AVAILABLE = -1;
192
193 /*!
185 * @brief PVR add-on error codes 194 * @brief PVR add-on error codes
186 */ 195 */
187 typedef enum 196 typedef enum
@@ -266,7 +275,16 @@ extern "C" {
266 } PVR_PROPERTIES; 275 } PVR_PROPERTIES;
267 276
268 /*! 277 /*!
269 * @brief PVR add-on capabilities. All capabilities are set to "false" as default. 278 * @brief Representation of a general attribute integer value.
279 */
280 typedef struct PVR_ATTRIBUTE_INT_VALUE
281 {
282 int iValue; /*!< @brief (required) an integer value for a certain attribute */
283 char strDescription[PVR_ADDON_ATTRIBUTE_DESC_LENGTH]; /*!< @brief (optional) a localized string describing the value. If left blank, Kodi will generate a suitable representation (like the integer value as string) */
284 } ATTRIBUTE_PACKED PVR_ATTRIBUTE_INT_VALUE;
285
286 /*!
287 * @brief PVR add-on capabilities. All capabilities are set to "false" or 0 as default
270 * If a capability is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented. 288 * If a capability is set to true, then the corresponding methods from xbmc_pvr_dll.h need to be implemented.
271 */ 289 */
272 typedef struct PVR_ADDON_CAPABILITIES 290 typedef struct PVR_ADDON_CAPABILITIES
@@ -285,6 +303,12 @@ extern "C" {
285 bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */ 303 bool bSupportsRecordingPlayCount; /*!< @brief true if the backend supports play count for recordings. */
286 bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */ 304 bool bSupportsLastPlayedPosition; /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */
287 bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */ 305 bool bSupportsRecordingEdl; /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */
306 bool bSupportsRecordingsRename; /*!< @brief true if the backend supports renaming recordings. */
307 bool bSupportsRecordingsLifetimeChange; /*!< @brief true if the backend supports changing lifetime for recordings. */
308 bool bSupportsDescrambleInfo; /*!< @brief true if the backend supports descramble information for playing channels. */
309
310 unsigned int iRecordingsLifetimesSize; /*!< @brief (required) Count of possible values for PVR_RECORDING.iLifetime. 0 means lifetime is not supported for recordings or no own value definition wanted, but to use Kodi defaults of 1..365. */
311 PVR_ATTRIBUTE_INT_VALUE recordingsLifetimeValues[PVR_ADDON_ATTRIBUTE_VALUES_ARRAY_SIZE]; /*!< @brief (optional) Array containing the possible values for PVR_RECORDING.iLifetime. Must be filled if iLifetimesSize > 0 */
288 } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES; 312 } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES;
289 313
290 /*! 314 /*!
@@ -330,6 +354,22 @@ extern "C" {
330 } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS; 354 } ATTRIBUTE_PACKED PVR_SIGNAL_STATUS;
331 355
332 /*! 356 /*!
357 * @brief descramble information
358 */
359 typedef struct PVR_DESCRAMBLE_INFO
360 {
361 int iPid; /*!< @brief (optional) pid; PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available */
362 int iCaid; /*!< @brief (optional) caid; PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available */
363 int iProvid; /*!< @brief (optional) provid; PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available */
364 int iEcmTime; /*!< @brief (optional) ecm time; PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available */
365 int iHops; /*!< @brief (optional) hops; PVR_DESCRAMBLE_INFO_NOT_AVAILABLE if not available */
366 char strCardSystem[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; /*!< @brief (optional); empty string if not available */
367 char strReader[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; /*!< @brief (optional); empty string if not available */
368 char strFrom[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; /*!< @brief (optional); empty string if not available */
369 char strProtocol[PVR_ADDON_DESCRAMBLE_INFO_STRING_LENGTH]; /*!< @brief (optional); empty string if not available */
370 } ATTRIBUTE_PACKED PVR_DESCRAMBLE_INFO;
371
372 /*!
333 * @brief Menu hooks that are available in the context menus while playing a stream via this add-on. 373 * @brief Menu hooks that are available in the context menus while playing a stream via this add-on.
334 * And in the Live TV settings dialog 374 * And in the Live TV settings dialog
335 */ 375 */
@@ -375,14 +415,9 @@ extern "C" {
375 } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER; 415 } ATTRIBUTE_PACKED PVR_CHANNEL_GROUP_MEMBER;
376 416
377 /*! 417 /*!
378 * @brief Representation of a timer's attribute integer value. 418 * @brief Representation of a timer type's attribute integer value.
379 */ 419 */
380 typedef struct PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE 420 typedef PVR_ATTRIBUTE_INT_VALUE PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE;
381 {
382 int iValue; /*!< @brief (required) an integer value for a certain timer attribute */
383 char strDescription[PVR_ADDON_TIMERTYPE_STRING_LENGTH]; /*!< @brief (optional) a localized string describing the value. If left blank, Kodi will
384 generate a suitable representation (like the integer value as string) */
385 } ATTRIBUTE_PACKED PVR_TIMER_TYPE_ATTRIBUTE_INT_VALUE;
386 421
387 /*! 422 /*!
388 * @brief Representation of a timer type. 423 * @brief Representation of a timer type.
@@ -485,11 +520,11 @@ extern "C" {
485 int iSeriesNumber; /*!< @brief (optional) series number (usually called season). Set to "0" for specials/pilot. For 'invalid' see iEpisodeNumber or set to -1 */ 520 int iSeriesNumber; /*!< @brief (optional) series number (usually called season). Set to "0" for specials/pilot. For 'invalid' see iEpisodeNumber or set to -1 */
486 int iEpisodeNumber; /*!< @brief (optional) episode number within the "iSeriesNumber" season. For 'invalid' set to -1 or iSeriesNumber=iEpisodeNumber=0 to show both are invalid */ 521 int iEpisodeNumber; /*!< @brief (optional) episode number within the "iSeriesNumber" season. For 'invalid' set to -1 or iSeriesNumber=iEpisodeNumber=0 to show both are invalid */
487 int iYear; /*!< @brief (optional) year of first release (use to identify a specific movie re-make) / first airing for TV shows. Set to '0' for invalid. */ 522 int iYear; /*!< @brief (optional) year of first release (use to identify a specific movie re-make) / first airing for TV shows. Set to '0' for invalid. */
488
489 char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */ 523 char strStreamURL[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (required) stream URL to access this recording */
490 char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */ 524 char strDirectory[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) directory of this recording on the client */
491 char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */ 525 char strPlotOutline[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot outline */
492 char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */ 526 char strPlot[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) plot */
527 char strGenreDescription[PVR_ADDON_DESC_STRING_LENGTH]; /*!< @brief (optional) genre. Will be used only when iGenreType = EPG_GENRE_USE_STRING */
493 char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */ 528 char strChannelName[PVR_ADDON_NAME_STRING_LENGTH]; /*!< @brief (optional) channel name */
494 char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */ 529 char strIconPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) icon path */
495 char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */ 530 char strThumbnailPath[PVR_ADDON_URL_STRING_LENGTH]; /*!< @brief (optional) thumbnail path */
@@ -600,6 +635,7 @@ extern "C" {
600 PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&); 635 PVR_ERROR (__cdecl* UndeleteRecording)(const PVR_RECORDING&);
601 PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void); 636 PVR_ERROR (__cdecl* DeleteAllRecordingsFromTrash)(void);
602 PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&); 637 PVR_ERROR (__cdecl* RenameRecording)(const PVR_RECORDING&);
638 PVR_ERROR (__cdecl* SetRecordingLifetime)(const PVR_RECORDING*);
603 PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int); 639 PVR_ERROR (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int);
604 PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int); 640 PVR_ERROR (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int);
605 int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&); 641 int (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&);
@@ -618,6 +654,7 @@ extern "C" {
618 long long (__cdecl* LengthLiveStream)(void); 654 long long (__cdecl* LengthLiveStream)(void);
619 bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&); 655 bool (__cdecl* SwitchChannel)(const PVR_CHANNEL&);
620 PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&); 656 PVR_ERROR (__cdecl* SignalStatus)(PVR_SIGNAL_STATUS&);
657 PVR_ERROR (__cdecl* GetDescrambleInfo)(PVR_DESCRAMBLE_INFO*);
621 const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&); 658 const char* (__cdecl* GetLiveStreamURL)(const PVR_CHANNEL&);
622 bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&); 659 bool (__cdecl* OpenRecordedStream)(const PVR_RECORDING&);
623 void (__cdecl* CloseRecordedStream)(void); 660 void (__cdecl* CloseRecordedStream)(void);
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h
deleted file mode 100644
index 7252721..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#include "xbmc_addon_dll.h"
24#include "xbmc_vis_types.h"
25
26extern "C"
27{
28 // Functions that your visualisation must implement
29 void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName);
30 void Stop();
31 void AudioData(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength);
32 void Render();
33 bool OnAction(long action, const void *param);
34 void GetInfo(VIS_INFO* pInfo);
35 unsigned int GetPresets(char ***presets);
36 unsigned GetPreset();
37 unsigned int GetSubModules(char ***presets);
38 bool IsLocked();
39
40 // function to export the above structure to XBMC
41 void __declspec(dllexport) get_addon(void* ptr)
42 {
43 AddonInstance_Visualization* pVisz = static_cast<AddonInstance_Visualization*>(ptr);
44
45 pVisz->toAddon.Start = Start;
46 pVisz->toAddon.Stop = Stop;
47 pVisz->toAddon.AudioData = AudioData;
48 pVisz->toAddon.Render = Render;
49 pVisz->toAddon.OnAction = OnAction;
50 pVisz->toAddon.GetInfo = GetInfo;
51 pVisz->toAddon.GetPresets = GetPresets;
52 pVisz->toAddon.GetPreset = GetPreset;
53 pVisz->toAddon.GetSubModules = GetSubModules;
54 pVisz->toAddon.IsLocked = IsLocked;
55 };
56};
57
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
deleted file mode 100644
index be11c89..0000000
--- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
+++ /dev/null
@@ -1,124 +0,0 @@
1#pragma once
2
3/*
4 * Copyright (C) 2005-2015 Team Kodi
5 * http://kodi.tv
6 *
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Kodi; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
20 *
21 */
22
23/*
24 Common data structures shared between Kodi and Kodi's visualisations
25 */
26
27#include "xbmc_addon_types.h"
28#include <cstddef>
29
30extern "C"
31{
32 struct VIS_INFO
33 {
34 int bWantsFreq;
35 int iSyncDelay;
36 };
37
38 enum VIS_ACTION
39 {
40 VIS_ACTION_NONE = 0,
41 VIS_ACTION_NEXT_PRESET,
42 VIS_ACTION_PREV_PRESET,
43 VIS_ACTION_LOAD_PRESET,
44 VIS_ACTION_RANDOM_PRESET,
45 VIS_ACTION_LOCK_PRESET,
46 VIS_ACTION_RATE_PRESET_PLUS,
47 VIS_ACTION_RATE_PRESET_MINUS,
48 VIS_ACTION_UPDATE_ALBUMART,
49 VIS_ACTION_UPDATE_TRACK
50 };
51
52 class VisTrack
53 {
54 public:
55 VisTrack()
56 {
57 title = artist = album = albumArtist = NULL;
58 genre = comment = lyrics = reserved1 = reserved2 = NULL;
59 trackNumber = discNumber = duration = year = 0;
60 rating = 0;
61 reserved3 = reserved4 = 0;
62 }
63
64 const char *title;
65 const char *artist;
66 const char *album;
67 const char *albumArtist;
68 const char *genre;
69 const char *comment;
70 const char *lyrics;
71 const char *reserved1;
72 const char *reserved2;
73
74 int trackNumber;
75 int discNumber;
76 int duration;
77 int year;
78 char rating;
79 int reserved3;
80 int reserved4;
81 };
82
83 typedef struct AddonProps_Visualization /* internal */
84 {
85 void *device;
86 int x;
87 int y;
88 int width;
89 int height;
90 float pixelRatio;
91 const char *name;
92 const char *presets;
93 const char *profile;
94 const char *submodule;
95 } AddonProps_Visualization;
96
97 typedef struct AddonToKodiFuncTable_Visualization /* internal */
98 {
99 KODI_HANDLE kodiInstance;
100 } AddonToKodiFuncTable_Visualization;
101
102 typedef struct KodiToAddonFuncTable_Visualization /* internal */
103 {
104 void (__cdecl* Start)(int iChannels, int iSamplesPerSec, int iBitsPerSample, const char* szSongName);
105 void (__cdecl* Stop)();
106 void (__cdecl* AudioData)(const float* pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength);
107 void (__cdecl* Render) ();
108 void (__cdecl* GetInfo)(VIS_INFO *info);
109 bool (__cdecl* OnAction)(long flags, const void *param);
110 int (__cdecl* HasPresets)();
111 unsigned int (__cdecl *GetPresets)(char ***presets);
112 unsigned int (__cdecl *GetPreset)();
113 unsigned int (__cdecl *GetSubModules)(char ***modules);
114 bool (__cdecl* IsLocked)();
115 } KodiToAddonFuncTable_Visualization;
116
117 typedef struct AddonInstance_Visualization /* internal */
118 {
119 AddonProps_Visualization props;
120 AddonToKodiFuncTable_Visualization toKodi;
121 KodiToAddonFuncTable_Visualization toAddon;
122 } AddonInstance_Visualization;
123}
124
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
index a769788..77d796e 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
@@ -30,7 +30,7 @@ struct DemuxCryptoInfo;
30 30
31typedef struct DemuxPacket 31typedef struct DemuxPacket
32{ 32{
33 DemuxPacket() {}; 33 DemuxPacket() = default;
34 34
35 DemuxPacket(unsigned char *pData, int const iSize, double const pts, double const dts) 35 DemuxPacket(unsigned char *pData, int const iSize, double const pts, double const dts)
36 : pData(pData) 36 : pData(pData)
diff --git a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h
index 522def6..59d5fdf 100644
--- a/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h
+++ b/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h
@@ -1,81 +1,85 @@
1/* 1/*
2* Copyright (C) 2005-2016 Team XBMC 2* Copyright (C) 2005-2016 Team XBMC
3* http://xbmc.org 3* http://xbmc.org
4* 4*
5* This Program is free software; you can redistribute it and/or modify 5* This Program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by 6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 2, or (at your option) 7* the Free Software Foundation; either version 2, or (at your option)
8* any later version. 8* any later version.
9* 9*
10* This Program is distributed in the hope that it will be useful, 10* This Program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of 11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details. 13* GNU General Public License for more details.
14* 14*
15* You should have received a copy of the GNU General Public License 15* You should have received a copy of the GNU General Public License
16* along with XBMC; see the file COPYING. If not, see 16* along with XBMC; see the file COPYING. If not, see
17* <http://www.gnu.org/licenses/>. 17* <http://www.gnu.org/licenses/>.
18* 18*
19*/ 19*/
20 20
21#pragma once 21#pragma once
22 22
23#include <inttypes.h> 23#include <inttypes.h>
24#include <string.h> 24#include <string.h>
25 25
26//CryptoSession is usually obtained once per stream, but could change if an key expires 26//CryptoSession is usually obtained once per stream, but could change if an key expires
27 27
28enum CryptoSessionSystem :uint16_t 28enum CryptoSessionSystem :uint8_t
29{ 29{
30 CRYPTO_SESSION_SYSTEM_NONE, 30 CRYPTO_SESSION_SYSTEM_NONE,
31 CRYPTO_SESSION_SYSTEM_WIDEVINE, 31 CRYPTO_SESSION_SYSTEM_WIDEVINE,
32 CRYPTO_SESSION_SYSTEM_PLAYREADY 32 CRYPTO_SESSION_SYSTEM_PLAYREADY
33}; 33};
34 34
35struct DemuxCryptoSession 35struct DemuxCryptoSession
36{ 36{
37 DemuxCryptoSession(const CryptoSessionSystem sys, const uint16_t sSize, const char *sData) 37 DemuxCryptoSession(const CryptoSessionSystem sys, const uint16_t sSize, const char *sData, const uint8_t flags)
38 : sessionId(new char[sSize]) 38 : sessionId(new char[sSize])
39 , sessionIdSize(sSize) 39 , sessionIdSize(sSize)
40 , keySystem(sys) 40 , keySystem(sys)
41 { 41 , flags(flags)
42 memcpy(sessionId, sData, sSize); 42 {
43 }; 43 memcpy(sessionId, sData, sSize);
44 44 };
45 ~DemuxCryptoSession() 45
46 { 46 ~DemuxCryptoSession()
47 delete[] sessionId; 47 {
48 } 48 delete[] sessionId;
49 49 }
50 // encryped stream infos 50
51 char * sessionId; 51 // encryped stream infos
52 uint16_t sessionIdSize; 52 char * sessionId;
53 CryptoSessionSystem keySystem; 53 uint16_t sessionIdSize;
54}; 54 CryptoSessionSystem keySystem;
55 55
56//CryptoInfo stores the information to decrypt a sample 56 static const uint8_t FLAG_SECURE_DECODER = 1;
57 57 uint8_t flags;
58struct DemuxCryptoInfo 58};
59{ 59
60 DemuxCryptoInfo(const unsigned int numSubs) 60//CryptoInfo stores the information to decrypt a sample
61 : numSubSamples(numSubs) 61
62 , flags(0) 62struct DemuxCryptoInfo
63 , clearBytes(new uint16_t[numSubs]) 63{
64 , cipherBytes(new uint32_t[numSubs]) 64 DemuxCryptoInfo(const unsigned int numSubs)
65 {}; 65 : numSubSamples(numSubs)
66 66 , flags(0)
67 ~DemuxCryptoInfo() 67 , clearBytes(new uint16_t[numSubs])
68 { 68 , cipherBytes(new uint32_t[numSubs])
69 delete[] clearBytes; 69 {};
70 delete[] cipherBytes; 70
71 } 71 ~DemuxCryptoInfo()
72 72 {
73 uint16_t numSubSamples; //number of subsamples 73 delete[] clearBytes;
74 uint16_t flags; //flags for later use 74 delete[] cipherBytes;
75 75 }
76 uint16_t *clearBytes; // numSubSamples uint16_t's wich define the size of clear size of a subsample 76
77 uint32_t *cipherBytes; // numSubSamples uint32_t's wich define the size of cipher size of a subsample 77 uint16_t numSubSamples; //number of subsamples
78 78 uint16_t flags; //flags for later use
79 uint8_t iv[16]; // initialization vector 79
80 uint8_t kid[16]; // key id 80 uint16_t *clearBytes; // numSubSamples uint16_t's wich define the size of clear size of a subsample
81}; 81 uint32_t *cipherBytes; // numSubSamples uint32_t's wich define the size of cipher size of a subsample
82
83 uint8_t iv[16]; // initialization vector
84 uint8_t kid[16]; // key id
85};
diff --git a/xbmc/input/ActionIDs.h b/xbmc/input/ActionIDs.h
index ce77ce0..14b8927 100644
--- a/xbmc/input/ActionIDs.h
+++ b/xbmc/input/ActionIDs.h
@@ -272,6 +272,8 @@
272#define ACTION_VOLUME_SET 245 272#define ACTION_VOLUME_SET 245
273#define ACTION_TOGGLE_COMMSKIP 246 273#define ACTION_TOGGLE_COMMSKIP 246
274 274
275#define ACTION_PLAYER_RESET 248 //!< Send a reset command to the active game
276
275// Voice actions 277// Voice actions
276#define ACTION_VOICE_RECOGNIZE 300 278#define ACTION_VOICE_RECOGNIZE 300
277 279