xbmc
video_codec.h
1 /*
2  * Copyright (C) 2017-2018 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_VIDEOCODEC_H
10 #define C_API_ADDONINSTANCE_VIDEOCODEC_H
11 
12 #include "../addon_base.h"
13 #include "inputstream/demux_packet.h"
14 #include "inputstream/stream_codec.h"
15 #include "inputstream/stream_crypto.h"
16 
17 #ifdef __cplusplus
18 extern "C"
19 {
20 #endif /* __cplusplus */
21 
22  //============================================================================
25  enum VIDEOCODEC_RETVAL
26  {
28  VC_NONE = 0,
29 
31  VC_ERROR,
32 
34  VC_BUFFER,
35 
37  VC_PICTURE,
38 
40  VC_EOF,
41  };
42  //----------------------------------------------------------------------------
43 
44  //============================================================================
48  enum VIDEOCODEC_FORMAT
49  {
52  VIDEOCODEC_FORMAT_UNKNOWN = 0,
53 
55  VIDEOCODEC_FORMAT_YV12,
56 
59  VIDEOCODEC_FORMAT_I420,
60 
62  VIDEOCODEC_FORMAT_MAXFORMATS
63  };
64  //----------------------------------------------------------------------------
65 
66  //============================================================================
70  enum VIDEOCODEC_TYPE
71  {
74  VIDEOCODEC_UNKNOWN = 0,
75 
78  VIDEOCODEC_VP8,
79 
83  VIDEOCODEC_H264,
84 
90  VIDEOCODEC_VP9,
91 
97  VIDEOCODEC_AV1,
98  };
99  //----------------------------------------------------------------------------
100 
101  //============================================================================
111  {
114 
117 
120 
123  };
124  //----------------------------------------------------------------------------
125 
126  //============================================================================
136  {
139 
142 
145  };
146  //----------------------------------------------------------------------------
147 
148  //============================================================================
155  {
158  enum VIDEOCODEC_FORMAT videoFormat;
159 
164  uint32_t flags;
165 
167  uint32_t width;
168 
170  uint32_t height;
171 
173  uint8_t* decodedData;
174 
177 
183 
189 
191  int64_t pts;
192 
198  KODI_HANDLE videoBufferHandle;
199  };
201  //----------------------------------------------------------------------------
202 
204  {
205  enum VIDEOCODEC_TYPE codec;
206  enum STREAMCODEC_PROFILE codecProfile;
207  enum VIDEOCODEC_FORMAT* videoFormats;
208  uint32_t width;
209  uint32_t height;
210  const uint8_t* extraData;
211  unsigned int extraDataSize;
212  struct STREAM_CRYPTO_SESSION cryptoSession;
213  };
214 
215  // this are properties given to the addon on create
216  // at this time we have no parameters for the addon
217  typedef struct AddonProps_VideoCodec
218  {
219  int dummy;
221 
224  {
225  KODI_HANDLE addonInstance;
226 
228  bool(__cdecl* open)(const struct AddonInstance_VideoCodec* instance,
229  struct VIDEOCODEC_INITDATA* initData);
230 
232  bool(__cdecl* reconfigure)(const struct AddonInstance_VideoCodec* instance,
233  struct VIDEOCODEC_INITDATA* initData);
234 
236  bool(__cdecl* add_data)(const struct AddonInstance_VideoCodec* instance,
237  const struct DEMUX_PACKET* packet);
238 
240  enum VIDEOCODEC_RETVAL(__cdecl* get_picture)(const struct AddonInstance_VideoCodec* instance,
241  struct VIDEOCODEC_PICTURE* picture);
242 
244  const char*(__cdecl* get_name)(const struct AddonInstance_VideoCodec* instance);
245 
247  void(__cdecl* reset)(const struct AddonInstance_VideoCodec* instance);
249 
251  {
252  KODI_HANDLE kodiInstance;
253  bool (*get_frame_buffer)(void* kodiInstance, struct VIDEOCODEC_PICTURE* picture);
254  void (*release_frame_buffer)(void* kodiInstance, void* buffer);
256 
258  {
259  struct AddonProps_VideoCodec* props;
260  struct AddonToKodiFuncTable_VideoCodec* toKodi;
261  struct KodiToAddonFuncTable_VideoCodec* toAddon;
263 
264 #ifdef __cplusplus
265 } /* extern "C" */
266 #endif /* __cplusplus */
267 
268 #endif /* !C_API_ADDONINSTANCE_VIDEOCODEC_H */
Empty and nothing defined.
Definition: video_codec.h:138
"chrominance" component V (red projection)
Definition: video_codec.h:119
Definition: video_codec.h:250
Definition: video_codec.h:154
enum VIDEOCODEC_FORMAT videoFormat
The video format declared with VIDEOCODEC_FORMAT and to be used on the addon.
Definition: video_codec.h:158
Definition: stream_crypto.h:117
uint32_t height
Picture height.
Definition: video_codec.h:170
uint32_t flags
Video coded process flags, used to perform special operations in stream calls.
Definition: video_codec.h:164
"chrominance" component U (blue projection)
Definition: video_codec.h:116
Definition: addon_base.h:267
Definition: video_codec.h:217
Definition: video_codec.h:257
"luminance" component Y (equivalent to grey scale)
Definition: video_codec.h:113
uint32_t width
Picture width.
Definition: video_codec.h:167
uint8_t * decodedData
Data to be decoded in the addon.
Definition: video_codec.h:173
VIDEOCODEC_PICTURE_FLAG
Video coded process flags, used to perform special operations in stream calls.
Definition: video_codec.h:135
VIDEOCODEC_PLANE
YUV Plane identification pointers.
Definition: video_codec.h:110
Squeeze out pictured without feeding new packets.
Definition: video_codec.h:144
Drop in decoder.
Definition: video_codec.h:141
Definition: demux_packet.h:45
The maximum value to use in a list.
Definition: video_codec.h:122
uint32_t planeOffsets[VIDEOCODEC_PICTURE_MAXPLANES]
YUV color plane calculation array.
Definition: video_codec.h:182
int64_t pts
Picture presentation time stamp (PTS).
Definition: video_codec.h:191
KODI_HANDLE videoBufferHandle
This is used to save the related handle from Kodi.
Definition: video_codec.h:198
STREAMCODEC_PROFILE
Definition: stream_codec.h:24
Definition: video_codec.h:223
Definition: video_codec.h:203
size_t decodedDataSize
Size of the data given with decodedData.
Definition: video_codec.h:176
uint32_t stride[VIDEOCODEC_PICTURE_MAXPLANES]
YUV color stride calculation array.
Definition: video_codec.h:188