Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
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
18extern "C"
19{
20#endif /* __cplusplus */
21
22 //============================================================================
30
31 //============================================================================
51 //----------------------------------------------------------------------------
52
53 //============================================================================
58 {
62
65
69
70 VIDEOCODEC_FORMAT_YUV420P9,
71 VIDEOCODEC_FORMAT_YUV420P10,
72 VIDEOCODEC_FORMAT_YUV420P12,
75 VIDEOCODEC_FORMAT_YUV422P9,
76 VIDEOCODEC_FORMAT_YUV422P10,
77 VIDEOCODEC_FORMAT_YUV422P12,
80 VIDEOCODEC_FORMAT_YUV444P9,
81 VIDEOCODEC_FORMAT_YUV444P10,
82 VIDEOCODEC_FORMAT_YUV444P12,
83
92
106
109 };
110 //----------------------------------------------------------------------------
111
112 //============================================================================
151 //----------------------------------------------------------------------------
152
153 //============================================================================
176 //----------------------------------------------------------------------------
177
178 //============================================================================
198 //----------------------------------------------------------------------------
199
200 //============================================================================
224 //----------------------------------------------------------------------------
225
226 //============================================================================
233 {
237
242 uint32_t flags;
243
245 uint32_t width;
246
248 uint32_t height;
249
251 uint8_t* decodedData;
252
255
261
267
269 int64_t pts;
270
276 KODI_HANDLE videoBufferHandle;
277
287
294
301 char strDVELType[8];
302 };
304 //----------------------------------------------------------------------------
305
306 //============================================================================
336 //----------------------------------------------------------------------------
337
338 //============================================================================
350#define KODI_DRM_MAX_PLANES 4
351
354 {
356 uint32_t object_index;
358 uint32_t offset;
360 uint32_t pitch;
361 };
362
365 {
367 int32_t fd;
369 uint32_t size;
373 };
374
378 {
380 uint32_t format;
382 uint32_t nb_planes;
383 struct KODI_DRM_PLANE planes[KODI_DRM_MAX_PLANES];
384 };
385
388 {
389 uint32_t nb_objects;
390 struct KODI_DRM_OBJECT objects[KODI_DRM_MAX_PLANES];
391 uint32_t nb_layers;
392 struct KODI_DRM_LAYER layers[KODI_DRM_MAX_PLANES];
393 };
395 //----------------------------------------------------------------------------
396
397 //============================================================================
417 //----------------------------------------------------------------------------
419 {
420 enum VIDEOCODEC_TYPE codec;
421 enum STREAMCODEC_PROFILE codecProfile;
422 enum VIDEOCODEC_FORMAT* videoFormats;
423 uint32_t width;
424 uint32_t height;
425 const uint8_t* extraData;
426 unsigned int extraDataSize;
427 struct STREAM_CRYPTO_SESSION cryptoSession;
428 };
429
430 // this are properties given to the addon on create
431 // at this time we have no parameters for the addon
433 {
434 int dummy;
436
439 {
440 KODI_HANDLE addonInstance;
441
443 bool(__cdecl* open)(const struct AddonInstance_VideoCodec* instance,
444 struct VIDEOCODEC_INITDATA* initData);
445
447 bool(__cdecl* reconfigure)(const struct AddonInstance_VideoCodec* instance,
448 struct VIDEOCODEC_INITDATA* initData);
449
451 bool(__cdecl* add_data)(const struct AddonInstance_VideoCodec* instance,
452 const struct DEMUX_PACKET* packet);
453
455 enum VIDEOCODEC_RETVAL(__cdecl* get_picture)(const struct AddonInstance_VideoCodec* instance,
456 struct VIDEOCODEC_PICTURE* picture);
457
459 const char*(__cdecl* get_name)(const struct AddonInstance_VideoCodec* instance);
460
462 void(__cdecl* reset)(const struct AddonInstance_VideoCodec* instance);
464
466 {
467 KODI_HANDLE kodiInstance;
468 bool (*get_frame_buffer)(void* kodiInstance, struct VIDEOCODEC_PICTURE* picture);
469 void (*release_frame_buffer)(void* kodiInstance, void* buffer);
470 bool (*get_frame_buffer_platform_handle)(void* kodiInstance,
471 KODI_HANDLE videoBufferHandle,
472 struct VIDEOCODEC_PLATFORM_BUFFER* platformBuffer);
474
476 {
477 struct AddonProps_VideoCodec* props;
478 struct AddonToKodiFuncTable_VideoCodec* toKodi;
479 struct KodiToAddonFuncTable_VideoCodec* toAddon;
481
482#ifdef __cplusplus
483} /* extern "C" */
484#endif /* __cplusplus */
485
486#endif /* !C_API_ADDONINSTANCE_VIDEOCODEC_H */
Definition demux_packet.h:46
STREAMCODEC_PROFILE
Definition stream_codec.h:25
uint32_t pitch
Row stride in bytes.
Definition video_codec.h:360
int32_t fd
DMA-BUF file descriptor. Owned by Kodi; do not close.
Definition video_codec.h:367
uint32_t nb_planes
Number of planes used (up to KODI_DRM_MAX_PLANES).
Definition video_codec.h:382
uint32_t format
DRM fourcc (DRM_FORMAT_* from <drm_fourcc.h>).
Definition video_codec.h:380
uint64_t format_modifier
DRM format modifier (DRM_FORMAT_MOD_* from <drm_fourcc.h>); DRM_FORMAT_MOD_INVALID when unknown.
Definition video_codec.h:372
uint32_t offset
Byte offset within that object where this plane begins.
Definition video_codec.h:358
uint32_t size
Total size of the DMA-BUF in bytes.
Definition video_codec.h:369
uint32_t object_index
Index into KODI_DRM_FRAME_DESCRIPTOR::objects.
Definition video_codec.h:356
Full descriptor: which objects back which layers, and how.
Definition video_codec.h:388
One image layer. Most buffers have a single layer; multi-layer (e.g. planar YUV with separately alloc...
Definition video_codec.h:378
One backing object (DMA-BUF) underlying one or more layers/planes.
Definition video_codec.h:365
One plane of a DRM layer: which object holds its data, and where.
Definition video_codec.h:354
uint32_t stride[VIDEOCODEC_PICTURE_MAXPLANES]
YUV color stride calculation array.
Definition video_codec.h:266
uint32_t width
Picture width.
Definition video_codec.h:245
int64_t pts
Picture presentation time stamp (PTS).
Definition video_codec.h:269
size_t decodedDataSize
Size of the data given with decodedData.
Definition video_codec.h:254
uint32_t height
Picture height.
Definition video_codec.h:248
uint32_t flags
Video coded process flags, used to perform special operations in stream calls.
Definition video_codec.h:242
uint32_t planeOffsets[VIDEOCODEC_PICTURE_MAXPLANES]
YUV color plane calculation array.
Definition video_codec.h:260
enum VIDEOCODEC_FORMAT videoFormat
The video format declared with VIDEOCODEC_FORMAT and to be used on the addon.
Definition video_codec.h:236
KODI_HANDLE videoBufferHandle
This is used to save the related handle from Kodi.
Definition video_codec.h:276
char strDVELType[8]
Dolby Vision enhancement layer type.
Definition video_codec.h:301
uint8_t * decodedData
Data to be decoded in the addon.
Definition video_codec.h:251
enum VIDEOCODEC_HDR_TYPE hdrType
HDR type of this picture.
Definition video_codec.h:286
enum VIDEOCODEC_HDR_TYPE hdrTypeAlt
Alternate HDR type carried alongside hdrType.
Definition video_codec.h:293
VIDEOCODEC_PICTURE_FLAG
Video coded process flags, used to perform special operations in stream calls.
Definition video_codec.h:188
VIDEOCODEC_HDR_TYPE
HDR type reported per decoded picture.
Definition video_codec.h:208
VIDEOCODEC_PLANE
YUV Plane identification pointers.
Definition video_codec.h:163
@ VIDEOCODEC_PICTURE_FLAG_DRAIN
Squeeze out pictured without feeding new packets.
Definition video_codec.h:196
@ VIDEOCODEC_PICTURE_FLAG_DROP
Drop in decoder.
Definition video_codec.h:193
@ VIDEOCODEC_PICTURE_FLAG_NONE
Empty and nothing defined.
Definition video_codec.h:190
@ VIDEOCODEC_HDR_TYPE_DOLBYVISION
Dolby Vision.
Definition video_codec.h:216
@ VIDEOCODEC_HDR_TYPE_HLG
Hybrid Log-Gamma (ARIB STD-B67)
Definition video_codec.h:219
@ VIDEOCODEC_HDR_TYPE_NONE
No HDR (SDR content)
Definition video_codec.h:210
@ VIDEOCODEC_HDR_TYPE_HDR10
HDR10 (SMPTE ST 2084 / PQ transfer, static metadata)
Definition video_codec.h:213
@ VIDEOCODEC_HDR_TYPE_HDR10PLUS
HDR10+ (SMPTE ST 2094-40 dynamic metadata)
Definition video_codec.h:222
@ VIDEOCODEC_PICTURE_V_PLANE
"chrominance" component V (red projection)
Definition video_codec.h:171
@ VIDEOCODEC_PICTURE_U_PLANE
"chrominance" component U (blue projection)
Definition video_codec.h:168
@ VIDEOCODEC_PICTURE_Y_PLANE
"luminance" component Y (equivalent to grey scale)
Definition video_codec.h:165
@ VIDEOCODEC_PICTURE_MAXPLANES
The maximum value to use in a list.
Definition video_codec.h:174
Definition video_codec.h:233
enum VIDEOCODEC_PLATFORM_BUFFER_TYPE type
Type of the native handle. Determines how to interpret handle.
Definition video_codec.h:410
void * handle
Opaque pointer to the platform-native buffer object. The addon must cast based on type....
Definition video_codec.h:414
Definition video_codec.h:408
VIDEOCODEC_TYPE
Video codec types that can be requested from Kodi.
Definition video_codec.h:117
VIDEOCODEC_FORMAT
The video stream representations requested by Kodi.
Definition video_codec.h:58
@ VIDEOCODEC_H264
Advanced Video Coding (AVC), also referred to as H.264 or MPEG-4 Part 10, Advanced Video Coding (MPEG...
Definition video_codec.h:129
@ VIDEOCODEC_AV1
AV1 video coding format AV1 is the successor to VP9 and competes mainly with MPEG's High Efficiency ...
Definition video_codec.h:143
@ VIDEOCODEC_HEVC
HEVC/H.265.
Definition video_codec.h:146
@ VIDEOCODEC_VP8
VP8 video coding format
Definition video_codec.h:124
@ VIDEOCODEC_UNKNOWN
Unknown or other type requested.
Definition video_codec.h:120
@ VIDEOCODEC_VP9
VP9 video coding format VP9 is the successor to VP8 and competes mainly with MPEG's High Efficiency ...
Definition video_codec.h:136
@ VIDEOCODEC_RAWVIDEO
Raw uncompressed video.
Definition video_codec.h:149
@ VIDEOCODEC_FORMAT_YUYV422
YUYV 4:2:2 packed (Y0 U Y1 V)
Definition video_codec.h:89
@ VIDEOCODEC_FORMAT_YUV422P
YUV 4:2:2 planar 8-bit.
Definition video_codec.h:74
@ VIDEOCODEC_FORMAT_YUV444P
YUV 4:4:4 planar 8-bit.
Definition video_codec.h:79
@ VIDEOCODEC_FORMAT_I420
These formats are identical to YV12 except that the U and V plane order is reversed.
Definition video_codec.h:68
@ VIDEOCODEC_FORMAT_XRGB16161616
Packed RGB 16:16:16, 64 bpp, X in the high 16 bits. In memory (little-endian): B, G,...
Definition video_codec.h:102
@ VIDEOCODEC_FORMAT_UYVY422
UYVY 4:2:2 packed (U Y0 V Y1)
Definition video_codec.h:91
@ VIDEOCODEC_FORMAT_XRGB16161616F
Packed RGB 16:16:16, 64 bpp half-float (IEEE 754 binary16), X in the high 16 bits....
Definition video_codec.h:105
@ VIDEOCODEC_FORMAT_MAXFORMATS
The maximum value to use in a list.
Definition video_codec.h:108
@ VIDEOCODEC_FORMAT_XRGB8888
Packed RGB 8:8:8:8, 32 bpp, X (padding) in the high byte. In memory (little-endian): B,...
Definition video_codec.h:95
@ VIDEOCODEC_FORMAT_NV12
NV12 4:2:0 semi-planar (Y + interleaved UV)
Definition video_codec.h:85
@ VIDEOCODEC_FORMAT_P010
P010 4:2:0 10-bit semi-planar (Y + interleaved UV, 16-bit samples)
Definition video_codec.h:87
@ VIDEOCODEC_FORMAT_XRGB2101010
Packed RGB 10:10:10, 32 bpp, 2-bit X (padding) in the top bits. In memory: little-endian dword 0xXXRR...
Definition video_codec.h:98
@ VIDEOCODEC_FORMAT_YV12
YV12 4:2:0 YCrCb planar format.
Definition video_codec.h:64
@ VIDEOCODEC_FORMAT_UNKNOWN
Unknown types, this is used to declare the end of a list of requested types.
Definition video_codec.h:61
VIDEOCODEC_RETVAL
Changes since 2.1.0 (ABI 2.2.0)
Definition video_codec.h:35
VIDEOCODEC_PLATFORM_BUFFER_TYPE
Platform-native buffer type, used to identify the meaning of the handle field in VIDEOCODEC_PLATFORM_...
Definition video_codec.h:317
@ VC_EOF
The decoder signals EOF.
Definition video_codec.h:49
@ VC_NONE
Noop.
Definition video_codec.h:37
@ VC_ERROR
An error occurred, no other messages will be returned.
Definition video_codec.h:40
@ VC_PICTURE
The decoder got a picture.
Definition video_codec.h:46
@ VC_BUFFER
The decoder needs more data.
Definition video_codec.h:43
@ VIDEOCODEC_PLATFORM_BUFFER_D3D11_TEXTURE
Windows D3D11. handle is ID3D11Texture2D*. Reserved – not implemented yet.
Definition video_codec.h:328
@ VIDEOCODEC_PLATFORM_BUFFER_DRM_PRIME
Linux DMA-BUF. handle points at a KODI_DRM_FRAME_DESCRIPTOR which carries DMA-BUF fd(s),...
Definition video_codec.h:325
@ VIDEOCODEC_PLATFORM_BUFFER_AHARDWAREBUFFER
Android. handle is AHardwareBuffer*. Reserved – not implemented yet.
Definition video_codec.h:334
@ VIDEOCODEC_PLATFORM_BUFFER_NONE
No native handle available, addon must use the CPU-mapped pointer in VIDEOCODEC_PICTURE::decodedData.
Definition video_codec.h:320
@ VIDEOCODEC_PLATFORM_BUFFER_IOSURFACE
macOS/iOS. handle is IOSurfaceRef. Reserved – not implemented yet.
Definition video_codec.h:331
Definition video_codec.h:476
Definition video_codec.h:433
Definition video_codec.h:466
Definition video_codec.h:439
const char *__cdecl * get_name(const struct AddonInstance_VideoCodec *instance)
Get the name of this video decoder.
void(__cdecl *reset)(const struct AddonInstance_VideoCodec *instance)
Reset the codec.
bool(__cdecl *add_data)(const struct AddonInstance_VideoCodec *instance
Feed codec if requested from GetPicture() (return VC_BUFFER)
bool(__cdecl *open)(const struct AddonInstance_VideoCodec *instance
Opens a codec.
bool(__cdecl *reconfigure)(const struct AddonInstance_VideoCodec *instance
Reconfigures a codec.
Definition stream_crypto.h:121
Definition video_codec.h:419