Kodi Development  20.0
for Binary and Script based Add-Ons
visualization.h
1 /*
2  * Copyright (C) 2005-2020 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #ifndef C_API_ADDONINSTANCE_VISUALIZATION_H
10 #define C_API_ADDONINSTANCE_VISUALIZATION_H
11 
12 #include "../addon_base.h"
13 
14 #define VIZ_LYRICS_SIZE 32768
15 
16 #ifdef __cplusplus
17 extern "C"
18 {
19 #endif /* __cplusplus */
20 
21  struct VIS_INFO
22  {
23  bool bWantsFreq;
24  int iSyncDelay;
25  };
26 
27  struct VIS_TRACK
28  {
29  const char *title;
30  const char *artist;
31  const char *album;
32  const char *albumArtist;
33  const char *genre;
34  const char *comment;
35  const char *lyrics;
36 
37  const char *reserved1;
38  const char *reserved2;
39 
40  int trackNumber;
41  int discNumber;
42  int duration;
43  int year;
44  int rating;
45 
46  int reserved3;
47  int reserved4;
48  };
49 
50  typedef struct AddonProps_Visualization
51  {
52  ADDON_HARDWARE_CONTEXT device;
53  int x;
54  int y;
55  int width;
56  int height;
57  float pixelRatio;
58  const char* name;
59  const char* presets;
60  const char* profile;
62 
64  {
65  KODI_HANDLE kodiInstance;
66  void(__cdecl* transfer_preset)(KODI_HANDLE kodiInstance, const char* preset);
67  void(__cdecl* clear_presets)(KODI_HANDLE kodiInstance);
69 
71 
73  {
74  KODI_HANDLE addonInstance;
75  bool(__cdecl* start)(const struct AddonInstance_Visualization* instance,
76  int channels,
77  int samples_per_sec,
78  int bits_per_sample,
79  const char* song_name);
80  void(__cdecl* stop)(const struct AddonInstance_Visualization* instance);
81 
82  void(__cdecl* get_info)(const struct AddonInstance_Visualization* instance,
83  struct VIS_INFO* info);
84 
85  void(__cdecl* audio_data)(const struct AddonInstance_Visualization* instance,
86  const float* audio_data,
87  int audio_data_length,
88  float* freq_data,
89  int freq_data_length);
90  bool(__cdecl* is_dirty)(const struct AddonInstance_Visualization* instance);
91  void(__cdecl* render)(const struct AddonInstance_Visualization* instance);
92 
93  unsigned int(__cdecl* get_presets)(const struct AddonInstance_Visualization* instance);
94  int(__cdecl* get_active_preset)(const struct AddonInstance_Visualization* instance);
95  bool(__cdecl* prev_preset)(const struct AddonInstance_Visualization* instance);
96  bool(__cdecl* next_preset)(const struct AddonInstance_Visualization* instance);
97  bool(__cdecl* load_preset)(const struct AddonInstance_Visualization* instance, int select);
98  bool(__cdecl* random_preset)(const struct AddonInstance_Visualization* instance);
99  bool(__cdecl* lock_preset)(const struct AddonInstance_Visualization* instance);
100  bool(__cdecl* rate_preset)(const struct AddonInstance_Visualization* instance, bool plus_minus);
101  bool(__cdecl* is_locked)(const struct AddonInstance_Visualization* instance);
102 
103  bool(__cdecl* update_albumart)(const struct AddonInstance_Visualization* instance,
104  const char* albumart);
105  bool(__cdecl* update_track)(const struct AddonInstance_Visualization* instance,
106  const struct VIS_TRACK* track);
108 
110  {
111  struct AddonProps_Visualization* props;
112  struct AddonToKodiFuncTable_Visualization* toKodi;
113  struct KodiToAddonFuncTable_Visualization* toAddon;
115 
116 #ifdef __cplusplus
117 } /* extern "C" */
118 #endif /* __cplusplus */
119 
120 #endif /* !C_API_ADDONINSTANCE_VISUALIZATION_H */
Definition: visualization.h:110
Definition: visualization.h:51
Definition: visualization.h:64
Definition: visualization.h:73
Definition: visualization.h:22
Definition: visualization.h:28