UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
10/*
11 * Copyright (c) 2013-2023 CESNET z.s.p.o.
12 * All rights reserved.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, is permitted provided that the following conditions
16 * are met:
17 *
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 *
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * 3. Neither the name of CESNET nor the names of its contributors may be
26 * used to endorse or promote products derived from this software without
27 * specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
31 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
32 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
33 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
34 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
36 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
39 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
40 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 */
42
43#ifndef TYPES_H_
44#define TYPES_H_
45
46#ifndef __cplusplus
47#include <stdbool.h>
48#endif
49#include <stddef.h>
50#include <stdint.h>
51
52#ifdef __cplusplus
53#include <string>
54extern "C" {
55#endif
56
113
124
125enum depth {
130};
131
133 SUBS_420 = 4200,
134 SUBS_422 = 4220,
135 SUBS_444 = 4440,
136 SUBS_4444 = 4444,
137};
138
145
146enum {
147 kHz8 = 8000,
148 kHz48 = 48000,
149 kHz90 = 90000,
150};
151
171
179 unsigned int width;
180 unsigned int height;
181
183 double fps;
185 unsigned int tile_count;
186#ifdef __cplusplus
187 bool operator==(video_desc const &) const;
188 bool operator!=(video_desc const &) const;
189 bool operator!() const;
190 operator std::string() const;
191#endif
192};
193
199
206
207struct fec_desc {
209 unsigned int k, m, c;
210 unsigned int seed;
211 unsigned int symbol_size;
212#ifdef __cplusplus
213 fec_desc() = default;
214 inline fec_desc(enum fec_type type_, unsigned int k_ = 0, unsigned int m_ = 0,
215 unsigned int c_ = 0,
216 unsigned int seed_ = 0,
217 unsigned int ss_ = 0) : type(type_), k(k_), m(m_), c(c_), seed(seed_), symbol_size(ss_) {}
218#endif
219};
220
225
226struct video_frame;
245 void (*dispose)(struct video_frame *);
251
256 void (*data_deleter)(struct video_frame *);
257
263 void (*recycle)(struct video_frame *);
264
271 void (*copy)(struct video_frame *);
272};
273
279struct tile {
280 unsigned int width;
281 unsigned int height;
282
287 char *data;
288 unsigned int data_len;
289
292 unsigned int offset;
293};
294
295#define FLEXIBLE_ARRAY_MEMBER 0
296
301
308 double fps;
311
315 unsigned int fragment:1;
317 unsigned int last_fragment:1;
319 unsigned int frame_fragment_id:14;
321
323
325
326 // metadata follow
327#define VF_METADATA_START fec_params
329 int flags;
330 uint32_t ssrc;
331 int64_t timestamp;
333 uint32_t seq;
334 union {
335 uint32_t timecode;
336 uint32_t duration;
337 };
339 int64_t compress_end;
340#define VF_METADATA_END tile_count
341
344 unsigned int tile_count;
346};
347
348#define VF_METADATA_SIZE (offsetof(struct video_frame, VF_METADATA_END) - offsetof(struct video_frame, VF_METADATA_START))
349
362
367
369 char display_name[512]; //Name displayed to user
370 char display_desc[512]; //Description displayed to user
371
372 /* internal name of option, options that are used in the same way should
373 * have the same key (e.g. both bitrate for libavcodec and quality for jpeg
374 * should have the same key). This allows using different labels displayed
375 * to user */
376 char key[512];
377 char opt_str[512]; //Option string to pass to ug (e.g. ":bitrate=")
378
379 bool is_boolean; //If true, GUI shows a checkbox instead of text edit
380};
381
383 char dev[1024];
385 char name[1024];
389 char extra[1024];
391 struct mode {
392 char id[1024];
395 char name[1024];
396 } modes[512];
397
399};
400
401//Impl in video_display.c
402void dev_add_option(struct device_info *dev, const char *name, const char *desc, const char *key, const char *opt_str, bool is_boolean);
403
404typedef void (*device_probe_func)(struct device_info **available_cards, int *count, void (**deleter)(void *));
405
406#ifdef __cplusplus
407}
408#endif
409
410#endif // TYPES_H_
411
struct video_desc desc
int void(** deleter)(void *))
int count
Definition hd-rum.c:44
const char * name
Definition settings.cpp:193
char name[1024]
human readable name of the mode
Definition types.h:395
bool repeatable
Definition types.h:386
char extra[1024]
Definition types.h:389
char name[1024]
human readable name of the device
Definition types.h:385
struct device_info::mode modes[512]
char dev[1024]
Definition types.h:383
char display_name[512]
Definition types.h:369
char key[512]
Definition types.h:376
char display_desc[512]
Definition types.h:370
char opt_str[512]
Definition types.h:377
bool is_boolean
Definition types.h:379
unsigned int k
Definition types.h:209
enum fec_type type
Definition types.h:208
unsigned int m
Definition types.h:209
fec_desc()=default
unsigned int symbol_size
Definition types.h:211
unsigned int c
Definition types.h:209
fec_desc(enum fec_type type_, unsigned int k_=0, unsigned int m_=0, unsigned int c_=0, unsigned int seed_=0, unsigned int ss_=0)
Definition types.h:214
unsigned int seed
Definition types.h:210
Definition rtp.c:253
int depth
bit depth; 0 means that whole struct is undefined
Definition types.h:140
enum hw_accel_type accel_type
Definition types.h:143
bool rgb
Definition types.h:142
int subsampling
in 'JabA' format, eg. '4444'
Definition types.h:141
Struct tile is an area of video_frame.
Definition types.h:279
unsigned int width
Definition types.h:280
char * data
Raw tile data. Pointer must be at least 4B aligned.
Definition types.h:287
unsigned int data_len
length of the data
Definition types.h:288
unsigned int offset
Fragment offset from tile beginning (in bytes). Used only if frame is fragmented.
Definition types.h:292
unsigned int height
Definition types.h:281
bool operator!=(video_desc const &) const
Definition video.cpp:223
unsigned int tile_count
Definition types.h:185
codec_t color_spec
Definition types.h:182
enum interlacing_t interlacing
Definition types.h:184
double fps
Definition types.h:183
bool operator==(video_desc const &) const
Definition video.cpp:217
unsigned int width
width of every tile (!)
Definition types.h:179
unsigned int height
height of every tile (!)
Definition types.h:180
bool operator!() const
Definition video.cpp:229
Struct containing callbacks of a video_frame.
Definition types.h:230
void(* data_deleter)(struct video_frame *)
Definition types.h:256
void(* recycle)(struct video_frame *)
Definition types.h:263
void(* dispose)(struct video_frame *)
Definition types.h:245
Struct video_frame represents a video frame and contains video description.
Definition types.h:305
unsigned int decoder_overrides_data_len
Definition types.h:322
enum interlacing_t interlacing
Definition types.h:307
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
Definition types.h:345
frame_type_t frame_type
Definition types.h:309
int64_t compress_start
in ns from epoch
Definition types.h:338
uint32_t ssrc
Definition types.h:330
uint32_t seq
seq num, used internally by JPEG enc, file cap
Definition types.h:333
int64_t timestamp
Definition types.h:331
double fps
Definition types.h:308
uint32_t duration
used by file cap
Definition types.h:336
unsigned int tile_count
Definition types.h:344
int flags
Definition types.h:329
unsigned int frame_fragment_id
Used only if (fragment == 1). ID of the frame. Fragments of same frame must have the same ID.
Definition types.h:319
unsigned int fragment
Indicates that the tile is fragmented. Normally not used (only for Bluefish444).
Definition types.h:315
struct video_frame_callbacks callbacks
Definition types.h:324
int64_t compress_end
in ns from epoch
Definition types.h:339
struct fec_desc fec_params
Definition types.h:328
enum mem_location_t mem_location
Definition types.h:310
codec_t color_spec
Definition types.h:306
uint32_t timecode
BCD timecode (hrs, min, sec, frm num)
Definition types.h:335
unsigned int last_fragment
Used only if (fragment == 1). Indicates this is the last fragment.
Definition types.h:317
hw_accel_type
Definition types.h:114
@ HWACCEL_NONE
Definition types.h:115
@ HWACCEL_VULKAN
Definition types.h:120
@ HWACCEL_VDPAU
Definition types.h:116
@ HWACCEL_COUNT
Definition types.h:122
@ HWACCEL_CUDA
Definition types.h:119
@ HWACCEL_VAAPI
Definition types.h:117
@ HWACCEL_DRM_PRIME
Definition types.h:121
@ HWACCEL_VIDEOTOOLBOX
Definition types.h:118
enum frame_type frame_type_t
mem_location_t
Definition types.h:297
@ CUDA_MEM
Definition types.h:299
@ CPU_MEM
Definition types.h:298
video_mode
Definition types.h:354
@ VIDEO_STEREO
stereoscopic 3D video (full left and right eye)
Definition types.h:358
@ VIDEO_UNKNOWN
unspecified video mode
Definition types.h:355
@ VIDEO_NORMAL
normal video (one tile)
Definition types.h:356
@ VIDEO_4K
tiled 4K video
Definition types.h:359
@ VIDEO_DUAL
1x2 video grid (is this ever used?)
Definition types.h:357
@ VIDEO_3X1
3x1 video
Definition types.h:360
frame_type
Definition types.h:194
@ INTRA
Definition types.h:195
@ BFRAME
Definition types.h:196
@ OTHER
Definition types.h:197
depth
Definition types.h:125
@ DEPTH16
Definition types.h:129
@ DEPTH10
Definition types.h:127
@ DEPTH12
Definition types.h:128
@ DEPTH8
Definition types.h:126
tx_media_type
Definition types.h:363
@ TX_MEDIA_AUDIO
Definition types.h:364
@ TX_MEDIA_VIDEO
Definition types.h:365
fec_type
Definition types.h:200
@ FEC_LDGM
Definition types.h:203
@ FEC_MULT
Definition types.h:202
@ FEC_RS
Definition types.h:204
@ FEC_NONE
Definition types.h:201
frame_flags_common
flags common for both audio and video frame
Definition types.h:222
@ TIMESTAMP_VALID
timestamp set by source (in 90 kHz clock)
Definition types.h:223
void dev_add_option(struct device_info *dev, const char *name, const char *desc, const char *key, const char *opt_str, bool is_boolean)
void(* device_probe_func)(struct device_info **available_cards, int *count, void(**deleter)(void *))
Definition types.h:404
@ kHz8
Definition types.h:147
@ kHz48
Definition types.h:148
@ kHz90
timestamp time base
Definition types.h:149
subsampling
Definition types.h:132
@ SUBS_444
Definition types.h:135
@ SUBS_4444
Definition types.h:136
@ SUBS_420
Definition types.h:133
@ SUBS_422
Definition types.h:134
#define FLEXIBLE_ARRAY_MEMBER
Definition types.h:295
interlacing_t
Definition types.h:163
@ LOWER_FIELD_FIRST
First stored field is bottom, followed by top.
Definition types.h:166
@ UPPER_FIELD_FIRST
First stored field is top, followed by bottom.
Definition types.h:165
@ INTERLACING_MAX
Definition types.h:169
@ PROGRESSIVE
progressive frame
Definition types.h:164
@ SEGMENTED_FRAME
Segmented frame. Contains the same data as progressive frame.
Definition types.h:168
@ INTERLACED_MERGED
Columngs of both fields are interlaced together.
Definition types.h:167
codec_t
Definition types.h:65
@ YUYV
YCbCr 422 8-bit - Y0 Cb Y1 Cr.
Definition types.h:72
@ VP8
VP8 frame.
Definition types.h:86
@ DXT1
S3 Texture Compression DXT1.
Definition types.h:77
@ PRORES_422_LT
Apple ProRes 422 (LT)
Definition types.h:106
@ R10k
RGB 10-bit packed - RGBX, big-endian (2 bit padding)
Definition types.h:73
@ RGB
RGB 8-bit (packed into 24-bit word)
Definition types.h:80
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
Definition types.h:71
@ VIDEO_CODEC_NONE
dummy color spec
Definition types.h:66
@ PRORES
abstract Apple ProRes, must not be used in transmit
Definition types.h:100
@ PRORES_422_PROXY
Apple ProRes 422 (Proxy)
Definition types.h:105
@ BGR
8-bit BGR
Definition types.h:88
@ HW_VDPAU
VDPAU hardware surface.
Definition types.h:91
@ VC_FIRST
Definition types.h:69
@ VIDEO_CODEC_FIRST
Definition types.h:68
@ RG48
16-bit RGB little-endian (RlRhGl...)
Definition types.h:95
@ AV1
AOMedia Video 1.
Definition types.h:96
@ Y416
interleaved little-endian YCbCr 4444 16-bit - UYVA
Definition types.h:99
@ VC_NONE
Definition types.h:67
@ J2KR
JPEG 2000 RGB.
Definition types.h:90
@ CFHD
Cineform.
Definition types.h:94
@ VIDEO_CODEC_END
Definition types.h:111
@ J2K
JPEG 2000.
Definition types.h:89
@ PRORES_422_HQ
Apple ProRes 422 (HQ)
Definition types.h:103
@ Y216
YCbCr 422 16-bit little-endian - Y0 Cb Y1 Cr.
Definition types.h:98
@ PRORES_4444
Apple ProRes 4444.
Definition types.h:101
@ JPEG
JPEG image, restart intervals may be used. Compatible with GPUJPEG.
Definition types.h:81
@ HFYU
HuffYUV.
Definition types.h:92
@ MJPG
JPEG image, without restart intervals.
Definition types.h:85
@ VIDEO_CODEC_COUNT
count of known video codecs (including VIDEO_CODEC_NONE)
Definition types.h:108
@ R12L
RGB 12-bit packed, little-endian.
Definition types.h:74
@ FFV1
FFV1.
Definition types.h:93
@ PRORES_422
Apple ProRes 422.
Definition types.h:104
@ DRM_PRIME
DRM Prime buffer, data contains struct drm_prime_frame.
Definition types.h:107
@ RAW
RAW HD-SDI frame.
Definition types.h:82
@ VC_COUNT
Definition types.h:109
@ H264
H.264 frame.
Definition types.h:83
@ DVS10
DVS 10-bit format.
Definition types.h:76
@ VP9
VP9 frame.
Definition types.h:87
@ H265
H.264 frame.
Definition types.h:84
@ DXT5
S3 Texture Compression DXT5.
Definition types.h:79
@ I420
planar YCbCr 4:2:0
Definition types.h:97
@ PRORES_4444_XQ
Apple ProRes 4444 (XQ)
Definition types.h:102
@ DXT1_YUV
Structure same as DXT1, instead of RGB, YCbCr values are stored.
Definition types.h:78
@ RGBA
RGBA 8-bit, big-endian.
Definition types.h:70
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
Definition types.h:75
@ VC_END
Definition types.h:110
const char * opt_str
Definition cineform.cpp:127
const char * key
Definition cineform.cpp:125
const bool is_boolean