Coverage Report

Created: 2026-06-09 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gpac/include/gpac/constants.h
Line
Count
Source
1
/*
2
 *      GPAC - Multimedia Framework C SDK
3
 *
4
 *      Authors: Jean Le Feuvre
5
 *      Copyright (c) Telecom ParisTech 2000-2025
6
 *          All rights reserved
7
 *
8
 *  This file is part of GPAC / exported constants
9
 *
10
 *  GPAC is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU Lesser General Public License as published by
12
 *  the Free Software Foundation; either version 2, or (at your option)
13
 *  any later version.
14
 *
15
 *  GPAC is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU Lesser General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU Lesser General Public
21
 *  License along with this library; see the file COPYING.  If not, write to
22
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23
 *
24
 */
25
26
#ifndef _GF_CONSTANTS_H_
27
#define _GF_CONSTANTS_H_
28
29
#ifdef __cplusplus
30
extern "C" {
31
#endif
32
33
#include <gpac/setup.h>
34
35
/*!
36
\file <gpac/constants.h>
37
\brief Most constants defined in GPAC are in this file.
38
\addtogroup cst_grp
39
\brief Constants
40
41
This section documents some constants used in the GPAC framework which are not related to any specific sub-project.
42
43
@{
44
*/
45
46
47
/*!
48
\brief Supported media stream types
49
\hideinitializer
50
51
Supported media stream types for media objects.
52
*/
53
typedef enum
54
{
55
  /*!Unknown stream type*/
56
  GF_STREAM_UNKNOWN = 0,
57
  /*!MPEG-4 Object Descriptor Stream*/
58
  GF_STREAM_OD    = 0x01,
59
  /*!MPEG-4 Object Clock Reference Stream*/
60
  GF_STREAM_OCR   = 0x02,
61
  /*!MPEG-4 Scene Description Stream*/
62
  GF_STREAM_SCENE   = 0x03,
63
  /*!Visual Stream (Video, Image or MPEG-4 SNHC Tools)*/
64
  GF_STREAM_VISUAL  = 0x04,
65
  /*!Audio Stream (Audio, MPEG-4 Structured-Audio Tools)*/
66
  GF_STREAM_AUDIO   = 0x05,
67
  /*!MPEG-7 Description Stream*/
68
  GF_STREAM_MPEG7   = 0x06,
69
  /*!MPEG-4 Intellectual Property Management and Protection Stream*/
70
  GF_STREAM_IPMP    = 0x07,
71
  /*!MPEG-4 Object Content Information Stream*/
72
  GF_STREAM_OCI   = 0x08,
73
  /*!MPEG-4 MPEGlet Stream*/
74
  GF_STREAM_MPEGJ   = 0x09,
75
  /*!MPEG-4 User Interaction Stream*/
76
  GF_STREAM_INTERACT  = 0x0A,
77
  /*!MPEG-4 IPMP Tool Stream*/
78
  GF_STREAM_IPMP_TOOL = 0x0B,
79
  /*!MPEG-4 Font Data Stream*/
80
  GF_STREAM_FONT    = 0x0C,
81
  /*!MPEG-4 Streaming Text Stream*/
82
  GF_STREAM_TEXT    = 0x0D,
83
84
  /* From 0x20 to Ox3F, this is the user private range */
85
86
  /*!Nero Digital Subpicture Stream*/
87
  GF_STREAM_ND_SUBPIC = 0x38,
88
89
  /*GPAC internal stream types*/
90
91
92
  /*!GPAC Private Scene streams\n
93
  \n
94
  \note
95
  This stream type (MPEG-4 user-private) is reserved for streams used to create a scene decoder
96
  handling the scene without input streams, as is the case for file readers (BT/VRML/XML..).\n
97
  */
98
  GF_STREAM_PRIVATE_SCENE = 0x20,
99
100
  GF_STREAM_METADATA = 0x21,
101
102
  GF_STREAM_ENCRYPTED   = 0xE0,
103
  /*stream carries files, each file being a complete AU*/
104
  GF_STREAM_FILE    = 0xE1,
105
106
  //other stream types may be declared using their handler 4CC as defined in ISOBMFF
107
} GF_StreamType;
108
109
/*! Gets the stream type name based on stream type
110
\param streamType stream type GF_STREAM_XXX as defined in constants.h
111
\return NULL if unknown, otherwise value
112
 */
113
const char *gf_stream_type_name(u32 streamType);
114
115
/*! Gets the stream type short name based on stream type (usually the lower case value of the stream name)
116
\param streamType stream type GF_STREAM_XXX as defined in constants.h
117
\return NULL if unknown, otherwise value
118
 */
119
const char *gf_stream_type_short_name(u32 streamType);
120
121
/*! Gets the stream type by name
122
\param name name of the stream type to query
123
\return GF_STREAM_UNKNOWN if unknown, otherwise GF_STREAM_XXX value
124
 */
125
u32 gf_stream_type_by_name(const char *name);
126
127
/*! Enumerates defined stream types
128
\param idx index of the stream type, 0-based
129
\param name name of the stream type (used when parsing stream type from textual definition)
130
\param desc description  of the stream type
131
\return stream type, or GF_STREAM_UNKNOWN if no more stream types
132
 */
133
u32 gf_stream_types_enum(u32 *idx, const char **name, const char **desc);
134
135
#ifndef GF_4CC
136
/*! macro for 4CC*/
137
0
#define GF_4CC(a,b,c,d) ((((u32)a)<<24)|(((u32)b)<<16)|(((u32)c)<<8)|(d))
138
#endif
139
140
/*!
141
\brief Pixel Formats
142
143
Supported pixel formats for everything using video
144
*/
145
typedef enum
146
{
147
  /*!8 bit GREY */
148
  GF_PIXEL_GREYSCALE  = GF_4CC('G','R','E','Y'),
149
  /*!16 bit greyscale, first alpha, then grey*/
150
  GF_PIXEL_ALPHAGREY  = GF_4CC('G','R','A','L'),
151
  /*!16 bit greyscale, first grey, then alpha*/
152
  GF_PIXEL_GREYALPHA  = GF_4CC('A','L','G','R'),
153
  /*!8 bit RGB */
154
  GF_PIXEL_RGB_332  = GF_4CC('R','3','3','2'),
155
  /*!12 bit RGB on 16 bits (4096 colors)*/
156
  GF_PIXEL_RGB_444  = GF_4CC('R','4','4','4'),
157
  /*!15 bit RGB*/
158
  GF_PIXEL_RGB_555  = GF_4CC('R','5','5','5'),
159
  /*!16 bit RGB*/
160
  GF_PIXEL_RGB_565  = GF_4CC('R','5','6','5'),
161
  /*!24 bit RGB*/
162
  GF_PIXEL_RGB    = GF_4CC('R','G','B','3'),
163
  /*!24 bit BGR*/
164
  GF_PIXEL_BGR    = GF_4CC('B','G','R','3'),
165
  /*!32 bit RGB. Component ordering in bytes is R-G-B-X.*/
166
  GF_PIXEL_RGBX   = GF_4CC('R','G','B','4'),
167
  /*!32 bit BGR. Component ordering in bytes is B-G-R-X.*/
168
  GF_PIXEL_BGRX   = GF_4CC('B','G','R','4'),
169
  /*!32 bit RGB. Component ordering in bytes is X-R-G-B.*/
170
  GF_PIXEL_XRGB   = GF_4CC('R','G','B','X'),
171
  /*!32 bit BGR. Component ordering in bytes is X-B-G-R.*/
172
  GF_PIXEL_XBGR   = GF_4CC('B','G','R','X'),
173
174
  /*!32 bit ARGB. Component ordering in bytes is A-R-G-B.*/
175
  GF_PIXEL_ARGB   = GF_4CC('A','R','G','B'),
176
  /*!32 bit RGBA (OpenGL like). Component ordering in bytes is R-G-B-A.*/
177
  GF_PIXEL_RGBA   = GF_4CC('R','G','B', 'A'),
178
  /*!32 bit BGRA. Component ordering in bytes is B-G-R-A.*/
179
  GF_PIXEL_BGRA   = GF_4CC('B','G','R','A'),
180
  /*!32 bit ABGR. Component ordering in bytes is A-B-G-R.*/
181
  GF_PIXEL_ABGR   = GF_4CC('A','B','G','R'),
182
183
  /*!RGB24 + depth plane. Component ordering in bytes is R-G-B-D.*/
184
  GF_PIXEL_RGBD   = GF_4CC('R', 'G', 'B', 'D'),
185
  /*!RGB24 + depth plane (7 lower bits) + shape mask. Component ordering in bytes is R-G-B-(S+D).*/
186
  GF_PIXEL_RGBDS    = GF_4CC('3', 'C', 'D', 'S'),
187
188
  /*internal format for OpenGL using packed RGB 24 bit plus planar depth plane at the end of the image*/
189
  GF_PIXEL_RGB_DEPTH = GF_4CC('R', 'G', 'B', 'd'),
190
191
  /*generic pixel format uncv from ISO/IEC 23001-17*/
192
  GF_PIXEL_UNCV = GF_4CC('u', 'n', 'c', 'v'),
193
194
  /*!YUV packed 422 format*/
195
  GF_PIXEL_YUYV   = GF_4CC('Y','U','Y','V'),
196
  /*!YUV packed 422 format*/
197
  GF_PIXEL_YVYU   = GF_4CC('Y','V','Y','U'),
198
  /*!YUV packed 422 format*/
199
  GF_PIXEL_UYVY   = GF_4CC('U','Y','V','Y'),
200
  /*!YUV packed 422 format*/
201
  GF_PIXEL_VYUY   = GF_4CC('V','Y','U','Y'),
202
203
  /*!YUV packed 422 format 10 bits, little endian*/
204
  GF_PIXEL_YUYV_10    = GF_4CC('Y','U','Y','L'),
205
  /*!YUV packed 422 format 10 bits, little endian*/
206
  GF_PIXEL_YVYU_10    = GF_4CC('Y','V','Y','L'),
207
  /*!YUV packed 422 format 10 bits, little endian*/
208
  GF_PIXEL_UYVY_10    = GF_4CC('U','Y','V','L'),
209
  /*!YUV packed 422 format 10 bits, little endian*/
210
  GF_PIXEL_VYUY_10    = GF_4CC('V','Y','U','L'),
211
212
  /*!YUV planar format*/
213
  GF_PIXEL_YUV    = GF_4CC('Y','U','1','2'),
214
  /*!YVU planar format*/
215
  GF_PIXEL_YVU    = GF_4CC('Y','V','1','2'),
216
  /*!YUV420p in 10 bits mode, little endian*/
217
  GF_PIXEL_YUV_10 = GF_4CC('Y','0','1','0'),
218
  /*!YUV420p + Alpha plane*/
219
  GF_PIXEL_YUVA   = GF_4CC('Y', 'U', 'V', 'A'),
220
  /*!YUV420p + Depth plane*/
221
  GF_PIXEL_YUVD   = GF_4CC('Y', 'U', 'V', 'D'),
222
  /*!420 Y planar UV interleaved*/
223
  GF_PIXEL_NV21   = GF_4CC('N','V','2','1'),
224
  /*!420 Y planar UV interleaved, 10 bits, little endian */
225
  GF_PIXEL_NV21_10  = GF_4CC('N','2','1','0'),
226
  /*!420 Y planar VU interleaved (U and V swapped) */
227
  GF_PIXEL_NV12   = GF_4CC('N','V','1','2'),
228
  /*!420 Y planar VU interleaved (U and V swapped), 10 bits, little endian */
229
  GF_PIXEL_NV12_10  = GF_4CC('N','1','2','0'),
230
  /*!422 YUV*/
231
  GF_PIXEL_YUV422   = GF_4CC('Y','4','4','2'),
232
  /*!422 YUV, 10 bits, little endian*/
233
  GF_PIXEL_YUV422_10  = GF_4CC('Y','2','1','0'),
234
  /*!444 YUV+Alpha*/
235
  GF_PIXEL_YUVA444  = GF_4CC('Y','A','4','4'),
236
  /*!444 YUV*/
237
  GF_PIXEL_YUV444   = GF_4CC('Y','4','4','4'),
238
  /*!444 YUV, 10 bits, little endian*/
239
  GF_PIXEL_YUV444_10  = GF_4CC('Y','4','1','0'),
240
  /*!444 YUV packed*/
241
  GF_PIXEL_YUV444_PACK  = GF_4CC('Y','U','V','4'),
242
  /*!444 VYU packed (v308) */
243
  GF_PIXEL_VYU444_PACK  = GF_4CC('V','Y','U','4'),
244
  /*!444 YUV+Alpha packed*/
245
  GF_PIXEL_YUVA444_PACK = GF_4CC('Y','A','4','p'),
246
  /*!444 UYVA packed (v408) */
247
  GF_PIXEL_UYVA444_PACK = GF_4CC('U','Y','V','A'),
248
  /*!444 YUV 10 bit packed little endian (v410)*/
249
  GF_PIXEL_YUV444_10_PACK = GF_4CC('Y','4','1','p'),
250
  /*!422 YUV 10 bit packed in v210 format*/
251
  GF_PIXEL_V210     = GF_4CC('v','2','1','0'),
252
253
  /*!Unknown format exposed a single OpenGL texture to be consumed using samplerExternalOES*/
254
  GF_PIXEL_GL_EXTERNAL  = GF_4CC('E','X','G','L')
255
} GF_PixelFormat;
256
257
258
/*! enumerates GPAC pixel formats
259
\param pf_name name of the pixel format
260
\return pixel format code
261
*/
262
GF_PixelFormat gf_pixel_fmt_parse(const char *pf_name);
263
264
/*! gets name of pixel formats
265
\param pfmt pixel format code
266
\return pixel format name
267
*/
268
const char *gf_pixel_fmt_name(GF_PixelFormat pfmt);
269
270
/*! checks if pixel format is known, does not throw error message
271
\param pf_4cc pixel format code or 0
272
\param pf_name pixel format name or short name or NULL
273
\return GF_TRUE is format is known, GF_FALSE otherwise
274
*/
275
Bool gf_pixel_fmt_probe(GF_PixelFormat pf_4cc, const char *pf_name);
276
277
/*! gets short name of pixel formats, as used for file extensions
278
\param pfmt pixel format code
279
\return pixel format short name, "unknown" if not found
280
*/
281
const char *gf_pixel_fmt_sname(GF_PixelFormat pfmt);
282
283
/*! enumerates pixel formats
284
\param idx index of the pixel format, 0-based
285
\param name name of the pixel format
286
\param fileext file extension of the pixel format
287
\param description description of the pixel format
288
\return pixel format code, 0 if no more pixel formats are available
289
*/
290
GF_PixelFormat gf_pixel_fmt_enum(u32 *idx, const char **name, const char **fileext, const char **description);
291
292
/*! gets the list of all supported pixel format names
293
\return list of supported pixel format names
294
*/
295
const char *gf_pixel_fmt_all_names();
296
297
/*! gets the list of all supported pixel format names
298
\return list of supported pixel format short names
299
*/
300
const char *gf_pixel_fmt_all_shortnames();
301
302
/*! returns size and stride characteristics for the pixel format. If the stride or stride_uv value are not 0, they are used to compute the size. Otherwise no padding at end of line is assumed.
303
\param pixfmt  pixfmt format code
304
\param width target frame width
305
\param height target frame height
306
\param[out] out_size output frame size
307
\param[in,out] out_stride output frame stride for single plane or plane 0
308
\param[in,out] out_stride_uv output frame stride for UV planes
309
\param[out] out_planes output frame plane numbers
310
\param[out] out_plane_uv_height height of UV planes
311
\return error code if any
312
*/
313
Bool gf_pixel_get_size_info(GF_PixelFormat pixfmt, u32 width, u32 height, u32 *out_size, u32 *out_stride, u32 *out_stride_uv, u32 *out_planes, u32 *out_plane_uv_height);
314
315
/*! Gets the number of bytes per pixel on first plane
316
\param pixfmt  pixel format code
317
\return number of bytes per pixel
318
*/
319
u32 gf_pixel_get_bytes_per_pixel(GF_PixelFormat pixfmt);
320
321
/*! Gets the number of bits per component
322
\param pixfmt  pixel format code
323
\return number of bits per component
324
*/
325
u32 gf_pixel_is_wide_depth(GF_PixelFormat pixfmt);
326
327
/*! Gets the number of component per pixel
328
\param pixfmt  pixel format code
329
\return number of bytes per pixel
330
*/
331
u32 gf_pixel_get_nb_comp(GF_PixelFormat pixfmt);
332
333
/*! Gets the downsampling factor for this format
334
\param pixfmt  pixel format code
335
\param downsample_w set to horizontal downsampling, 1 if none
336
\param downsample_h set to vertical downsampling, 1 if none
337
*/
338
void gf_pixel_get_downsampling(GF_PixelFormat pixfmt, u32 *downsample_w, u32 *downsample_h);
339
340
/*! Checks if  pixel format is transparent
341
\param pixfmt  pixel format code
342
\return GF_TRUE if alpha channel is present, GF_FALSE otherwise
343
*/
344
Bool gf_pixel_fmt_is_transparent(GF_PixelFormat pixfmt);
345
346
/*! Checks if format is YUV
347
\param pixfmt  pixel format code
348
\return GF_TRUE is YUV format, GF_FALSE otherwise (greyscale or RGB)
349
*/
350
Bool gf_pixel_fmt_is_yuv(GF_PixelFormat pixfmt);
351
352
/*! gets pixel format associated with a given uncompressed video QT code
353
\param qt_code the desired QT/ISOBMFF uncompressed video code
354
\return the corresponding pixel format, or 0 if unknown code
355
*/
356
GF_PixelFormat gf_pixel_fmt_from_qt_type(u32 qt_code);
357
/*! gets QY code associated with a given pixel format
358
\param pixfmt the desired pixel format
359
\return the corresponding QT code, or 0 if no asociation
360
*/
361
u32 gf_pixel_fmt_to_qt_type(GF_PixelFormat pixfmt);
362
363
/*! gets uncC configuration (ISO 23001-17)  of pixel format. The configuration is made of the boxes uncC and cmpd in full mode, and uncC only in restricted mode
364
\param pixfmt the desired pixel format
365
\param profile_mode if 1, sets profile if known. If 2 and profile is known, use reduced version
366
\param dsi set to the generated configuration, must be freed by user
367
\param dsi_size set to the generated configuration size
368
\return GF_TRU if success, GF_FALSE otherwise
369
*/
370
Bool gf_pixel_fmt_get_uncc(GF_PixelFormat pixfmt, u32 profile_mode, u8 **dsi, u32 *dsi_size);
371
372
/*!
373
\brief Codec IDs
374
375
Codec ID identifies the stream coding type. The enum is divided into values less than 255, which are equivalent to MPEG-4 systems ObjectTypeIndication. Other values are 4CCs, usually matching ISOMEDIA sample entry types.
376
377
Unless specified otherwise the decoder configuration is:
378
- the one specified in MPEG-4 systems if any
379
- or the one defined in ISOBMFF and derived specs (3GPP, dolby, etc) if any
380
- or NULL
381
*/
382
typedef enum
383
{
384
  /*!Never used by PID declarations, but used by filters caps*/
385
  GF_CODECID_NONE = 0,
386
  /*! codecid for BIFS v1*/
387
  GF_CODECID_BIFS = 0x01,
388
  /*! codecid for OD v1*/
389
  GF_CODECID_OD_V1 = 0x01,
390
  /*! codecid for BIFS v2*/
391
  GF_CODECID_BIFS_V2 = 0x02,
392
  /*! codecid for OD v2*/
393
  GF_CODECID_OD_V2 = 0x02,
394
  /*! codecid for BIFS InputSensor streams*/
395
  GF_CODECID_INTERACT = 0x03,
396
  /*! codecid for streams with extended BIFS config*/
397
  GF_CODECID_BIFS_EXTENDED = 0x04,
398
  /*! codecid for AFX streams with AFXConfig*/
399
  GF_CODECID_AFX = 0x05,
400
  /*! codecid for Font data streams */
401
  GF_CODECID_FONT = 0x06,
402
  /*! codecid for synthesized texture streams */
403
  GF_CODECID_SYNTHESIZED_TEXTURE = 0x07,
404
  /*! codecid for streaming text streams */
405
  GF_CODECID_TEXT_MPEG4 = 0x08,
406
  /*! codecid for LASeR streams*/
407
  GF_CODECID_LASER = 0x09,
408
  /*! codecid for SAF streams when stored in MP4 ...*/
409
  GF_CODECID_SAF = 0x0A,
410
411
  /*! codecid for MPEG-4 Video Part 2 streams*/
412
  GF_CODECID_MPEG4_PART2 = 0x20,
413
  /*! codecid for MPEG-4 Video Part 10 (H.264 | AVC ) streams*/
414
  GF_CODECID_AVC = 0x21,
415
  /*! codecid for AVC Parameter sets streams*/
416
  GF_CODECID_AVC_PS = 0x22,
417
  /*! codecid for HEVC video */
418
  GF_CODECID_HEVC = 0x23,
419
  /*! codecid for H264-SVC streams*/
420
  GF_CODECID_SVC = 0x24,
421
  /*! codecid for HEVC layered streams*/
422
  GF_CODECID_LHVC = 0x25,
423
  /*! codecid for H264-SVC streams*/
424
  GF_CODECID_MVC = 0x29,
425
  /*! codecid for MPEG-4 AAC streams*/
426
  GF_CODECID_AAC_MPEG4 = 0x40,
427
  /*! codecid for MPEG-2 Visual Simple Profile streams*/
428
  GF_CODECID_MPEG2_SIMPLE = 0x60,
429
  /*! codecid for MPEG-2 Visual Main Profile streams*/
430
  GF_CODECID_MPEG2_MAIN = 0x61,
431
  /*! codecid for MPEG-2 Visual SNR Profile streams*/
432
  GF_CODECID_MPEG2_SNR = 0x62,
433
  /*! codecid for MPEG-2 Visual SNR Profile streams*/
434
  GF_CODECID_MPEG2_SPATIAL = 0x63,
435
  /*! codecid for MPEG-2 Visual SNR Profile streams*/
436
  GF_CODECID_MPEG2_HIGH = 0x64,
437
  /*! codecid for MPEG-2 Visual SNR Profile streams*/
438
  GF_CODECID_MPEG2_422 = 0x65,
439
  /*! codecid for MPEG-2 AAC Main Profile streams*/
440
  GF_CODECID_AAC_MPEG2_MP = 0x66,
441
  /*! codecid for MPEG-2 AAC Low Complexity Profile streams*/
442
  GF_CODECID_AAC_MPEG2_LCP = 0x67,
443
  /*! codecid for MPEG-2 AAC Scalable Sampling Rate Profile streams*/
444
  GF_CODECID_AAC_MPEG2_SSRP = 0x68,
445
  /*! codecid for MPEG-2 Audio Part 3 streams*/
446
  GF_CODECID_MPEG2_PART3 = 0x69,
447
  /*! codecid for MPEG-1 Video streams*/
448
  GF_CODECID_MPEG1 = 0x6A,
449
  /*! codecid for MPEG-1 Audio streams, layer 3*/
450
  GF_CODECID_MPEG_AUDIO = 0x6B,
451
  /*! codecid for JPEG streams*/
452
  GF_CODECID_JPEG = 0x6C,
453
  /*! codecid for PNG streams*/
454
  GF_CODECID_PNG = 0x6D,
455
456
  GF_CODECID_LAST_MPEG4_MAPPING = 0xFF,
457
458
  /*! codecid for JPEG-2000 streams*/
459
  GF_CODECID_J2K = GF_4CC('j','p','2','k'),
460
461
  /*!H263 visual streams*/
462
  GF_CODECID_S263 = GF_4CC('s','2','6','3'),
463
  GF_CODECID_H263 = GF_4CC('h','2','6','3'),
464
465
  /*! codecid for HEVC tiles */
466
  GF_CODECID_HEVC_TILES = GF_4CC( 'h', 'v', 't', '1' ),
467
  /*! codecid for explicitly loading HEVC merger , internal to gpac */
468
  GF_CODECID_HEVC_MERGE = GF_4CC( 'h', 'v', 'c', 'm' ),
469
470
  /*! codecid for EVRC Voice streams*/
471
  GF_CODECID_EVRC = GF_4CC('s','e','v','c'),
472
  /*! codecid for SMV Voice streams*/
473
  GF_CODECID_SMV    = GF_4CC('s','s','m','v'),
474
  /*! codecid for 13K Voice / QCELP audio streams*/
475
  GF_CODECID_QCELP = GF_4CC('s','q','c','p'),
476
  /*! codecid for AMR*/
477
  GF_CODECID_AMR = GF_4CC('s','a','m','r'),
478
  /*! codecid for AMR-WB*/
479
  GF_CODECID_AMR_WB = GF_4CC('s','a','w','b'),
480
  /*! codecid for EVRC, PacketVideo MUX*/
481
  GF_CODECID_EVRC_PV  = GF_4CC('p','e','v','c'),
482
483
  /*! codecid for SMPTE VC-1 Video streams*/
484
  GF_CODECID_SMPTE_VC1 = GF_4CC('v','c','-','1'),
485
  /*! codecid for Dirac Video streams*/
486
  GF_CODECID_DIRAC = GF_4CC('d','r','a','c'),
487
  /*! codecid for AC-3 audio streams*/
488
  GF_CODECID_AC3 = GF_4CC('a','c','-','3'),
489
  /*! codecid for enhanced AC-3 audio streams*/
490
  GF_CODECID_EAC3 = GF_4CC('e','c','-','3'),
491
  /*! codecid for AC-4 audio streams*/
492
  GF_CODECID_AC4 = GF_4CC('a','c','-','4'),
493
  /*! codecid for Dolby TrueHS audio streams*/
494
  GF_CODECID_TRUEHD = GF_4CC('m','l','p','a'),
495
  /*! codecid for DRA audio streams*/
496
  GF_CODECID_DRA = GF_4CC('d','r','a','1'),
497
  /*! codecid for ITU G719 audio streams*/
498
  GF_CODECID_G719 = GF_4CC('g','7','1','9'),
499
  /*! codecid for DTS Express low bit rate audio*/
500
  GF_CODECID_DTS_EXPRESS_LBR = GF_4CC('d','t','s','e'),
501
  /*! codecid for DTS Coherent Acoustics audio streams*/
502
  GF_CODECID_DTS_CA = GF_4CC('d','t','s','c'),
503
  /*! codecid for DTS-HD High Resolution and Master audio streams*/
504
  GF_CODECID_DTS_HD_HR_MASTER = GF_4CC('d','t','s','h'),
505
  /*! codecid for DTS-HD Lossless (no core)*/
506
  GF_CODECID_DTS_HD_LOSSLESS = GF_4CC('d','t','s','l'),
507
  /*! codecid for DTS-X UHD Profile 2 audio streams*/
508
  GF_CODECID_DTS_X = GF_4CC('d','t','s','x'),
509
  /*! codecid for DTS-X UHD Profile 3 audio streams*/
510
  GF_CODECID_DTS_Y = GF_4CC('d','t','s','y'),
511
512
  /*! codecid for DVB EPG*/
513
  GF_CODECID_DVB_EIT = GF_4CC('e','i','t',' '),
514
515
  /*! codecid for streaming SVG*/
516
  GF_CODECID_SVG = GF_4CC('s','g','g',' '),
517
  /*! codecid for streaming SVG + gz*/
518
  GF_CODECID_SVG_GZ = GF_4CC('s','v','g','z'),
519
  /*! codecid for DIMS (dsi = 3GPP DIMS configuration)*/
520
  GF_CODECID_DIMS = GF_4CC('d','i','m','s'),
521
  /*! codecid for streaming VTT*/
522
  GF_CODECID_WEBVTT = GF_4CC('w','v','t','t'),
523
  /*! codecid for streaming simple text*/
524
  GF_CODECID_SIMPLE_TEXT = GF_4CC('s','t','x','t'),
525
  /*! codecid for meta data streams in text format*/
526
  GF_CODECID_META_TEXT = GF_4CC('m','e','t','t'),
527
  /*! codecid for meta data streams in XML format*/
528
  GF_CODECID_META_XML = GF_4CC('m','e','t','x'),
529
  /*! codecid for subtitle streams in text format*/
530
  GF_CODECID_SUBS_TEXT = GF_4CC('s','b','t','t'),
531
  /*! codecid for subtitle streams in xml format*/
532
  GF_CODECID_SUBS_XML = GF_4CC('s','t','p','p'),
533
534
  /*! codecid for subtitle/text streams in tx3g / apple text format*/
535
  GF_CODECID_TX3G = GF_4CC( 't', 'x', '3', 'g' ),
536
537
  /*! codecid for SSA / ASS text streams (only demux -> tx3f conv)*/
538
  GF_CODECID_SUBS_SSA = GF_4CC( 'a', 's', 's', 'a' ),
539
540
  GF_CODECID_DVB_SUBS = GF_4CC( 'd', 'v', 'b', 's' ),
541
  GF_CODECID_DVB_TELETEXT = GF_4CC( 'd', 'v', 'b', 't' ),
542
543
  /*! codecid for SCTE35 streams (MPEG2-TS Sections payloads as per ANSI/SCTE 67 2017 (13.1.1.3)*/
544
  GF_CODECID_SCTE35 = GF_4CC( 's', 'c', '3', '5' ),
545
546
  /*!
547
    \brief OGG DecoderConfig
548
549
   The DecoderConfig for theora, vorbis and speek contains all initialization ogg packets for the codec
550
    and is formatted as follows:\n
551
   \code
552
    while (dsi_size) {
553
      bit(16) packet_size;
554
      char packet[packet_size];
555
      dsi_size -= packet_size;
556
    }
557
   \endcode
558
559
   The DecoderConfig for FLAC is the full flac header without "fLaC" magic
560
561
   The DecoderConfig for OPUS is the full opus header without "OpusHead" magic
562
563
  */
564
  /*! codecid for theora video streams*/
565
  GF_CODECID_THEORA = GF_4CC('t','h','e','u'),
566
  /*! codecid for vorbis audio streams*/
567
  GF_CODECID_VORBIS = GF_4CC('v','o','r','b'),
568
  /*! codecid for flac audio streams*/
569
  GF_CODECID_FLAC = GF_4CC('f','l','a','c'),
570
  /*! codecid for speex audio streams*/
571
  GF_CODECID_SPEEX = GF_4CC('s','p','e','x'),
572
  /*! codecid for opus audio streams*/
573
  GF_CODECID_OPUS = GF_4CC('O','p','u','s'),
574
  /*! codecid for subpic DVD subtittles - the associated stream type is text*/
575
  GF_CODECID_SUBPIC = GF_4CC('s','u','b','p'),
576
  /*! codecid for ADPCM audio, as used in AVI*/
577
  GF_CODECID_ADPCM = GF_4CC('A','P','C','M'),
578
  /*! codecid for IBM CVSD audio, as used in AVI*/
579
  GF_CODECID_IBM_CVSD = GF_4CC('C','S','V','D'),
580
  /*! codecid for ALAW audio, as used in AVI*/
581
  GF_CODECID_ALAW = GF_4CC('A','L','A','W'),
582
  /*! codecid for MULAW audio, as used in AVI*/
583
  GF_CODECID_MULAW = GF_4CC('M','L','A','W'),
584
  /*! codecid for OKI ADPCM audio, as used in AVI*/
585
  GF_CODECID_OKI_ADPCM = GF_4CC('O','P','C','M'),
586
  /*! codecid for DVI ADPCM audio, as used in AVI*/
587
  GF_CODECID_DVI_ADPCM = GF_4CC('D','P','C','M'),
588
  /*! codecid for DIGISTD audio, as used in AVI*/
589
  GF_CODECID_DIGISTD = GF_4CC('D','S','T','D'),
590
  /*! codecid for Yamaha ADPCM audio, as used in AVI*/
591
  GF_CODECID_YAMAHA_ADPCM = GF_4CC('Y','P','C','M'),
592
  /*! codecid for TrueSpeech audio, as used in AVI*/
593
  GF_CODECID_DSP_TRUESPEECH = GF_4CC('T','S','P','E'),
594
  /*! codecid for GSM 610 audio, as used in AVI*/
595
  GF_CODECID_GSM610 = GF_4CC('G','6','1','0'),
596
  /*! codecid for IBM MULAW audio, as used in AVI*/
597
  GF_CODECID_IBM_MULAW = GF_4CC('I','U','L','W'),
598
  /*! codecid for IBM ALAW audio, as used in AVI*/
599
  GF_CODECID_IBM_ALAW = GF_4CC('I','A','L','W'),
600
  /*! codecid for IBM ADPCM audio, as used in AVI*/
601
  GF_CODECID_IBM_ADPCM = GF_4CC('I','P','C','M'),
602
  /*! codecid for Flash/ShockWave streams*/
603
  GF_CODECID_FLASH = GF_4CC( 'f', 'l', 's', 'h' ),
604
  /*! codecid for RAW media streams. No decoder config associated (config through PID properties)*/
605
  GF_CODECID_RAW = GF_4CC('R','A','W','M'),
606
  /*! codecid for RAW media streams using UNCV  decoder config*/
607
  GF_CODECID_RAW_UNCV = GF_4CC('U','N','C','V'),
608
609
  GF_CODECID_AV1 = GF_4CC('A','V','1',' '),
610
611
  GF_CODECID_VP8 = GF_4CC('V','P','0','8'),
612
  GF_CODECID_VP9 = GF_4CC('V','P','0','9'),
613
  GF_CODECID_VP10 = GF_4CC('V','P','1','0'),
614
615
  /*AVS2/3*/
616
  GF_CODECID_AVS2_VIDEO = GF_4CC('A','V','V','2'),
617
  GF_CODECID_AVS2_AUDIO = GF_4CC('A','V','A','2'),
618
  GF_CODECID_AVS3_VIDEO = GF_4CC('A','V','V','3'),
619
  GF_CODECID_AVS3_AUDIO = GF_4CC('A','V','A','3'),
620
621
  /*MPEG-H audio*/
622
  GF_CODECID_MPHA = GF_4CC('m','p','h','a'),
623
  /*MPEG-H mux audio*/
624
  GF_CODECID_MHAS = GF_4CC('m','h','a','s'),
625
626
  /*QT ProRes*/
627
  GF_CODECID_APCH = GF_4CC( 'a', 'p', 'c', 'h' ),
628
  GF_CODECID_APCO = GF_4CC( 'a', 'p', 'c', 'o' ),
629
  GF_CODECID_APCN = GF_4CC( 'a', 'p', 'c', 'n' ),
630
  GF_CODECID_APCS = GF_4CC( 'a', 'p', 'c', 's' ),
631
  GF_CODECID_AP4X = GF_4CC( 'a', 'p', '4', 'x' ),
632
  GF_CODECID_AP4H = GF_4CC( 'a', 'p', '4', 'h' ),
633
634
  GF_CODECID_TMCD = GF_4CC('t','m','c','d'),
635
636
  /*Event Message Track (contains boxes)*/
637
  GF_CODECID_EVTE = GF_4CC('e','v','t','e'),
638
639
  /*! codecid for FFV1*/
640
  GF_CODECID_FFV1 = GF_4CC('f','f','v','1'),
641
642
  GF_CODECID_FFMPEG = GF_4CC('F','F','I','D'),
643
644
  /*! codecid for VVC video */
645
  GF_CODECID_VVC = GF_4CC('v','v','c',' '),
646
  GF_CODECID_VVC_SUBPIC = GF_4CC('v','v','c','s'),
647
648
  /*! codecid for USAC / xHE-AACv2 audio */
649
  GF_CODECID_USAC = GF_4CC('u','s','a','c'),
650
651
  /*! codecid for MPEG-1 Audio streams, layer 1*/
652
  GF_CODECID_MPEG_AUDIO_L1 = GF_4CC('m','p','a','1'),
653
654
  GF_CODECID_MSPEG4_V3 = GF_4CC('D','I','V','3'),
655
656
  GF_CODECID_ALAC = GF_4CC('A','L','A','C'),
657
  GF_CODECID_DNXHD = GF_4CC('D','N','x','H'),
658
659
  //fake codec IDs for RTP
660
  GF_CODECID_FAKE_MP2T = GF_4CC('M','P','2','T'),
661
662
  /*! codecid for IAMF*/
663
  GF_CODECID_IAMF = GF_4CC('i','a','m','f')
664
} GF_CodecID;
665
666
/*! Gets a textual description for the given codecID
667
\param codecid target codec ID
668
\return textual description of the stream
669
*/
670
const char *gf_codecid_name(GF_CodecID codecid);
671
672
/*! Enumerates supported codec format
673
\param idx 0-based index, to incremented at each call
674
\param short_name pointer for codec name
675
\param long_name pointer for codec description
676
\return codec ID
677
*/
678
GF_CodecID gf_codecid_enum(u32 idx, const char **short_name, const char **long_name);
679
680
/*! Gets the associated streamtype for the given codecID
681
\param codecid target codec ID
682
\return stream type if known, GF_STREAM_UNKNOWN otherwise
683
*/
684
u32 gf_codecid_type(GF_CodecID codecid);
685
686
/*! Gets alternate ID of codec if any
687
\param codecid target codec ID
688
\return alternate codec ID if known, GF_CODECID_NONE otherwise
689
*/
690
GF_CodecID gf_codecid_alt(GF_CodecID codecid);
691
692
/*! Gets the associated ObjectTypeIndication if any for the given codecID
693
\param codecid target codec ID
694
\return ObjectTypeIndication if defined, 0 otherwise
695
*/
696
u8 gf_codecid_oti(GF_CodecID codecid);
697
698
/*! Gets the codecID from a given ObjectTypeIndication
699
\param stream_type stream type of the stream
700
\param oti ObjectTypeIndication of the stream
701
\return the codecID for this OTI
702
*/
703
GF_CodecID gf_codecid_from_oti(u32 stream_type, u32 oti);
704
705
/*! Gets the associated 4CC used by isomedia or RFC6381
706
\param codecid target codec ID
707
\return RFC 4CC of codec, 0 if not mapped/known
708
*/
709
u32 gf_codecid_4cc_type(GF_CodecID codecid);
710
711
/*! Checks if reframer/unframer exists for this codec in gpac
712
\param codecid target codec ID
713
\return GF_TRUE if reframer/unframer exist (bitstream reparse is possible), GF_FALSE otherwise
714
*/
715
Bool gf_codecid_has_unframer(GF_CodecID codecid);
716
717
/*! Gets the codecid given the associated short name
718
\param cname target codec short name
719
\return codecid codec ID
720
*/
721
GF_CodecID gf_codecid_parse(const char *cname);
722
723
/*! Gets the raw file ext (one or more, | separated) for the given codecid
724
\param codecid codec ID
725
\return returns file extension
726
*/
727
const char *gf_codecid_file_ext(GF_CodecID codecid);
728
729
/*! Gets the raw file mime type for the given codecid
730
\param codecid codec ID
731
\return returns file mime type
732
*/
733
const char *gf_codecid_mime(GF_CodecID codecid);
734
735
/*! Gets the codecid from isomedia code point
736
\param isobmftype isomedia code point
737
\return codec ID, 0 if not mapped/known
738
*/
739
GF_CodecID gf_codec_id_from_isobmf(u32 isobmftype);
740
741
/*!
742
\brief AFX Object Code
743
*/
744
enum
745
{
746
  /*!3D Mesh Compression*/
747
  GPAC_AFX_3DMC = 0x00,
748
  /*!Wavelet Subdivision Surface*/
749
  GPAC_AFX_WAVELET_SUBDIVISION = 0x01,
750
  /*!MeshGrid*/
751
  GPAC_AFX_MESHGRID = 0x02,
752
  /*!Coordinate Interpolator*/
753
  GPAC_AFX_COORDINATE_INTERPOLATOR = 0x03,
754
  /*!Orientation Interpolator*/
755
  GPAC_AFX_ORIENTATION_INTERPOLATOR = 0x04,
756
  /*!Position Interpolator*/
757
  GPAC_AFX_POSITION_INTERPOLATOR = 0x05,
758
  /*!Octree Image*/
759
  GPAC_AFX_OCTREE_IMAGE = 0x06,
760
  /*!BBA*/
761
  GPAC_AFX_BBA = 0x07,
762
  /*!PointTexture*/
763
  GPAC_AFX_POINT_TEXTURE = 0x08,
764
  /*!3DMC Extension*/
765
  GPAC_AFX_3DMC_EXT = 0x09,
766
  /*!FootPrint representation*/
767
  GPAC_AFX_FOOTPRINT = 0x0A,
768
  /*!Animated Mesh Compression*/
769
  GPAC_AFX_ANIMATED_MESH = 0x0B,
770
  /*!Scalable Complexity*/
771
  GPAC_AFX_SCALABLE_COMPLEXITY = 0x0C,
772
};
773
/*! Gets a textual description of an AFX stream type
774
\param afx_code target stream type descriptor
775
\return textural description of the AFX stream
776
*/
777
const char *gf_stream_type_afx_name(u8 afx_code);
778
779
780
/*channel cfg flags - DECODERS MUST OUTPUT STEREO/MULTICHANNEL IN THIS ORDER*/
781
782
/*!
783
\brief Audio Channel Configuration
784
785
Audio channel flags for spatialization.
786
 \note Decoders must output stereo/multichannel audio channels in this order in the decoded audio frame.
787
*/
788
enum
789
{
790
  /*!Left Audio Channel*/
791
  GF_AUDIO_CH_FRONT_LEFT = (1),
792
  /*!Right Audio Channel*/
793
  GF_AUDIO_CH_FRONT_RIGHT = (1<<1),
794
  /*!Center Audio Channel - may also be used to signal monophonic audio*/
795
  GF_AUDIO_CH_FRONT_CENTER = (1<<2),
796
  /*!LFE Audio Channel*/
797
  GF_AUDIO_CH_LFE = (1<<3),
798
  /*!Back Left Audio Channel*/
799
  GF_AUDIO_CH_SURROUND_LEFT = (1 << 4),
800
  /*!Back Right Audio Channel*/
801
  GF_AUDIO_CH_SURROUND_RIGHT = (1 << 5),
802
  /*Between left and center in front Audio Channel*/
803
  GF_AUDIO_CH_FRONT_CENTER_LEFT = (1 << 6),
804
  /*Between right and center in front Audio Channel*/
805
  GF_AUDIO_CH_FRONT_CENTER_RIGHT = (1 << 7),
806
  /*!Side Left Audio Channel*/
807
  GF_AUDIO_CH_REAR_SURROUND_LEFT = (1<<8),
808
  /*!Side Right Audio Channel*/
809
  GF_AUDIO_CH_REAR_SURROUND_RIGHT = (1<<9),
810
  /*!Back Center Audio Channel*/
811
  GF_AUDIO_CH_REAR_CENTER = (1 << 10),
812
  /*!Left surround direct Channel*/
813
  GF_AUDIO_CH_SURROUND_DIRECT_LEFT = (1 << 11),
814
  /*!Right surround direct Channel*/
815
  GF_AUDIO_CH_SURROUND_DIRECT_RIGHT = (1 << 12),
816
  /*!Left side surround Channel*/
817
  GF_AUDIO_CH_SIDE_SURROUND_LEFT = (1 << 13),
818
  /*!Right side surround Channel*/
819
  GF_AUDIO_CH_SIDE_SURROUND_RIGHT = (1 << 14),
820
  /*!Left wide front Channel*/
821
  GF_AUDIO_CH_WIDE_FRONT_LEFT = (1 << 15),
822
  /*!Right wide front Channel*/
823
  GF_AUDIO_CH_WIDE_FRONT_RIGHT = (1 << 16),
824
  /*!Left front top Channel*/
825
  GF_AUDIO_CH_FRONT_TOP_LEFT = (1 << 17),
826
  /*!Right front top Channel*/
827
  GF_AUDIO_CH_FRONT_TOP_RIGHT = (1 << 18),
828
  /*!Center front top Channel*/
829
  GF_AUDIO_CH_FRONT_TOP_CENTER = (1 << 19),
830
  /*!Left surround top Channel*/
831
  GF_AUDIO_CH_SURROUND_TOP_LEFT = (1 << 20),
832
  /*!Right surround top Channel*/
833
  GF_AUDIO_CH_SURROUND_TOP_RIGHT = (1 << 21),
834
  /*!Center surround top Channel*/
835
  GF_AUDIO_CH_REAR_CENTER_TOP = (1 << 22),
836
  /*!Left side surround top Channel*/
837
  GF_AUDIO_CH_SIDE_SURROUND_TOP_LEFT = (1 << 23),
838
  /*!Left side surround top Channel*/
839
  GF_AUDIO_CH_SIDE_SURROUND_TOP_RIGHT = (1 << 24),
840
  /*!Center surround top Channel*/
841
  GF_AUDIO_CH_CENTER_SURROUND_TOP = (1 << 25),
842
  /*!LFE 2  Channel*/
843
  GF_AUDIO_CH_LFE2 = (1 << 26),
844
  /*!Left front bottom Channel*/
845
  GF_AUDIO_CH_FRONT_BOTTOM_LEFT = (1 << 27),
846
  /*!Right front bottom Channel*/
847
  GF_AUDIO_CH_FRONT_BOTTOM_RIGHT = (1 << 28),
848
  /*!Center front bottom Channel*/
849
  GF_AUDIO_CH_FRONT_BOTTOM_CENTER = (1 << 29),
850
  /*!Left surround bottom Channel*/
851
  GF_AUDIO_CH_SURROUND_BOTTOM_LEFT = (1 << 30),
852
  /*!Right surround bottom Channel*/
853
  GF_AUDIO_CH_SURROUND_BOTTOM_RIGHT = 0x80000000 //(1 << 31)
854
};
855
/*64 bit flags are defined as macro to avoid msvc compil warnings*/
856
/*!Left edge of screen Channel*/
857
#define GF_AUDIO_CH_SCREEN_EDGE_LEFT  0x2000000000ULL
858
/*!Right edge of screen Channel*/
859
#define GF_AUDIO_CH_SCREEN_EDGE_RIGHT 0x4000000000ULL
860
/*!left back surround Channel*/
861
#define GF_AUDIO_CH_BACK_SURROUND_LEFT  0x20000000000ULL
862
/*!right back surround Channel*/
863
#define GF_AUDIO_CH_BACK_SURROUND_RIGHT 0x40000000000ULL 
864
865
866
/*!
867
\brief Audio Sample format
868
869
 Audio sample bit format.
870
*/
871
typedef enum
872
{
873
  /*! sample = unsigned byte, interleaved channels*/
874
  GF_AUDIO_FMT_U8 = 1,
875
  /*! sample = signed short Little Endian, interleaved channels*/
876
  GF_AUDIO_FMT_S16,
877
  /*! sample = signed short Big Endian, interleaved channels*/
878
  GF_AUDIO_FMT_S16_BE,
879
  /*! sample = signed integer, interleaved channels*/
880
  GF_AUDIO_FMT_S32,
881
  /*! sample = signed integer big-endian, interleaved channels*/
882
  GF_AUDIO_FMT_S32_BE,
883
  /*! sample = 1 float, interleaved channels*/
884
  GF_AUDIO_FMT_FLT,
885
  /*! sample = 1 float bytes in big endian, interleaved channels*/
886
  GF_AUDIO_FMT_FLT_BE,
887
  /*! sample = 1 double, interleaved channels*/
888
  GF_AUDIO_FMT_DBL,
889
  /*! sample = 1 double bytes in big-endian order, interleaved channels*/
890
  GF_AUDIO_FMT_DBL_BE,
891
  /*! sample = signed integer, interleaved channels*/
892
  GF_AUDIO_FMT_S24,
893
  /*! sample = signed integer gig-endian, interleaved channels*/
894
  GF_AUDIO_FMT_S24_BE,
895
  /*! not a format, indicates the value of last packed format*/
896
  GF_AUDIO_FMT_LAST_PACKED,
897
  /*! sample = unsigned byte, planar channels*/
898
  GF_AUDIO_FMT_U8P,
899
  /*! sample = signed short, planar channels*/
900
  GF_AUDIO_FMT_S16P,
901
  /*! sample = signed integer, planar channels*/
902
  GF_AUDIO_FMT_S32P,
903
  /*! sample = 1 float, planar channels*/
904
  GF_AUDIO_FMT_FLTP,
905
  /*! sample = 1 double, planar channels*/
906
  GF_AUDIO_FMT_DBLP,
907
  /*! sample = signed integer, planar channels*/
908
  GF_AUDIO_FMT_S24P,
909
} GF_AudioFormat;
910
911
912
/*! enumerates GPAC audio formats
913
\param af_name name of the audio format
914
\return audio format code
915
*/
916
GF_AudioFormat gf_audio_fmt_parse(const char *af_name);
917
918
/*! gets name of audio formats
919
\param afmt audio format code
920
\return audio format name
921
*/
922
const char *gf_audio_fmt_name(GF_AudioFormat afmt);
923
924
/*! gets short name of audio formats, as used for file extensions
925
\param afmt audio format code
926
\return audio format short name
927
*/
928
const char *gf_audio_fmt_sname(GF_AudioFormat afmt);
929
930
931
/*! gets the list of all supported audio format names
932
\return list of supported audio format names
933
*/
934
const char *gf_audio_fmt_all_names();
935
936
/*! gets the list of all supported audio format names
937
\return list of supported audio format short names
938
*/
939
const char *gf_audio_fmt_all_shortnames();
940
941
/*! returns number of bits per sample for the given format
942
\param afmt desired audio format
943
\return bit depth of format
944
*/
945
u32 gf_audio_fmt_bit_depth(GF_AudioFormat afmt);
946
947
/*! Check if a given audio format is planar
948
\param afmt desired audio format
949
\return GF_TRUE if the format is planar, false otherwise
950
*/
951
Bool gf_audio_fmt_is_planar(GF_AudioFormat afmt);
952
953
/*! Returns audio format for raw audio ISOBMFF sample description type
954
\param msubtype ISOBMFF sample description type
955
\return the associated audio format or 0 if not known
956
 */
957
GF_AudioFormat gf_audio_fmt_from_isobmf(u32 msubtype);
958
959
/*! Returns QTFF/ISOBMFF sample description 4CC of an audio format
960
\param afmt audio format to query
961
\return the associated 4CC or 0 if not known
962
 */
963
u32 gf_audio_fmt_to_isobmf(GF_AudioFormat afmt);
964
965
/*! enumerates audio formats
966
\param idx index of the audio format, 0-based
967
\param name name of the audio format
968
\param fileext file extension of the pixel format
969
\param desc audio format description
970
\return audio format or 0 if no more audio formats are available
971
*/
972
GF_AudioFormat gf_audio_fmt_enum(u32 *idx, const char **name, const char **fileext, const char **desc);
973
974
/*! get CICP layout code point from audio configuration
975
\param nb_chan total number of channels
976
\param nb_surr number of surround channels
977
\param nb_lfe number of LFE channels
978
\return CICP layout code point format or 0 if unknown
979
*/
980
u32 gf_audio_fmt_get_cicp_layout(u32 nb_chan, u32 nb_surr, u32 nb_lfe);
981
982
/*! get channel layout mask  from CICP layout
983
\param cicp_layout channel layout CICP code point
984
\return layout mask or 0 if unknown
985
*/
986
u64 gf_audio_fmt_get_layout_from_cicp(u32 cicp_layout);
987
988
/*! get CICP layout name
989
\param cicp_layout channel layout CICP code point
990
\return name of layout of "unknown" if unknown
991
*/
992
const char *gf_audio_fmt_get_layout_name_from_cicp(u32 cicp_layout);
993
994
/*! get channel layout name
995
\param chan_layout channel layout mask
996
\return name of layout of "unknown" if unknown
997
*/
998
const char *gf_audio_fmt_get_layout_name(u64 chan_layout);
999
1000
1001
/*! get channel layout from name
1002
\param name channel layout name
1003
\return channel layout mask
1004
*/
1005
u64 gf_audio_fmt_get_layout_from_name(const char *name);
1006
1007
/*! get CICP layout value from channel layout mask 
1008
\param chan_layout channel layout mask
1009
\return CICP code point or 255 if unknown
1010
*/
1011
u32 gf_audio_fmt_get_cicp_from_layout(u64 chan_layout);
1012
1013
/*! get channel count from channel  layout
1014
\param chan_layout channel layout mask
1015
\return number of channels in this layout
1016
*/
1017
u32 gf_audio_fmt_get_num_channels_from_layout(u64 chan_layout);
1018
1019
/*! get dolby chanmap value from cicp layout
1020
\param cicp_layout channel CICP layout
1021
\return dolby chanmap
1022
*/
1023
u16 gf_audio_fmt_get_dolby_chanmap(u32 cicp_layout);
1024
1025
/*! get dolby chanmap value from channel layout
1026
\param channel_layout channel layout mask
1027
\return dolby chanmap
1028
*/
1029
u16 gf_audio_fmt_get_dolby_chanmap_from_layout(u64 channel_layout);
1030
1031
/*! get dolby AudioChannelConfiguration value from ac4 presentation_channel_mask_v1
1032
\param mask presentation channel mask v1
1033
\return dolby AudioChannelConfiguration value
1034
*/
1035
u32 gf_audio_get_dolby_channel_config_value_from_mask(u32 mask);
1036
1037
/*! get dolby channel count for HLS from ac4 presentation_channel_mask_v1
1038
\param mask presentation channel mask v1
1039
\return dolby channel count
1040
*/
1041
u32 gf_ac4_dolby_channel_count_from_channel_mask_v1(u32 mask);
1042
1043
/*! enumerates CICP channel layout
1044
\param idx index of cicp layout value to query
1045
\param short_name set t o CICP name as used in GPAC - may be NULL
1046
\param ch_mask set t o audio channel mask, as used in GPAC - may be NULL
1047
\return CICP code point, or 0 if no more to enumerate*/
1048
u32 gf_audio_fmt_cicp_enum(u32 idx, const char **short_name, u64 *ch_mask);
1049
1050
/*! get CICP code  from name
1051
\param name channel layout name
1052
\return channel CICP code
1053
*/
1054
u32 gf_audio_fmt_get_cicp_from_name(const char *name);
1055
1056
/*! get CICP name from code
1057
\param cicp_code channel cicp code
1058
\return channel CICP name
1059
*/
1060
const char *gf_audio_fmt_get_cicp_name(u32 cicp_code);
1061
1062
/*! get all CICP layout names
1063
\return CICP names separated with '|'
1064
*/
1065
const char *gf_audio_fmt_cicp_all_names();
1066
1067
1068
/*! Color primaries as defined by ISO/IEC 23001-8 / 23091-2
1069
  */
1070
typedef enum
1071
{
1072
  GF_COLOR_PRIM_RESERVED0   = 0,
1073
  GF_COLOR_PRIM_BT709       = 1,
1074
  GF_COLOR_PRIM_UNSPECIFIED = 2,
1075
  GF_COLOR_PRIM_RESERVED    = 3,
1076
  GF_COLOR_PRIM_BT470M      = 4,
1077
  GF_COLOR_PRIM_BT470BG     = 5,
1078
  GF_COLOR_PRIM_SMPTE170M   = 6,
1079
  GF_COLOR_PRIM_SMPTE240M   = 7,
1080
  GF_COLOR_PRIM_FILM        = 8,
1081
  GF_COLOR_PRIM_BT2020      = 9,
1082
  GF_COLOR_PRIM_SMPTE428    = 10,
1083
  GF_COLOR_PRIM_SMPTE431    = 11,
1084
  GF_COLOR_PRIM_SMPTE432    = 12,
1085
  GF_COLOR_PRIM_EBU3213     = 22
1086
} GF_ColorPrimaries;
1087
1088
/*! Color Transfer Characteristics as defined by ISO/IEC 23001-8 / 23091-2
1089
*/
1090
typedef enum
1091
{
1092
  GF_COLOR_TRC_RESERVED0    = 0,
1093
  GF_COLOR_TRC_BT709        = 1,
1094
  GF_COLOR_TRC_UNSPECIFIED  = 2,
1095
  GF_COLOR_TRC_RESERVED     = 3,
1096
  GF_COLOR_TRC_GAMMA22      = 4,
1097
  GF_COLOR_TRC_GAMMA28      = 5,
1098
  GF_COLOR_TRC_SMPTE170M    = 6,
1099
  GF_COLOR_TRC_SMPTE240M    = 7,
1100
  GF_COLOR_TRC_LINEAR       = 8,
1101
  GF_COLOR_TRC_LOG          = 9,
1102
  GF_COLOR_TRC_LOG_SQRT     = 10,
1103
  GF_COLOR_TRC_IEC61966_2_4 = 11,
1104
  GF_COLOR_TRC_BT1361_ECG   = 12,
1105
  GF_COLOR_TRC_IEC61966_2_1 = 13,
1106
  GF_COLOR_TRC_BT2020_10    = 14,
1107
  GF_COLOR_TRC_BT2020_12    = 15,
1108
  GF_COLOR_TRC_SMPTE2084    = 16,
1109
  GF_COLOR_TRC_SMPTE428     = 17,
1110
  GF_COLOR_TRC_ARIB_STD_B67 = 18
1111
} GF_ColorTransferCharacteristic;
1112
1113
/*! MatrixCoefficients as defined by ISO/IEC 23001-8 / 23091-2
1114
*/
1115
typedef enum
1116
{
1117
    GF_COLOR_MX_RGB         = 0,
1118
    GF_COLOR_MX_BT709       = 1,
1119
    GF_COLOR_MX_UNSPECIFIED = 2,
1120
    GF_COLOR_MX_RESERVED    = 3,
1121
    GF_COLOR_MX_FCC47         = 4,
1122
    GF_COLOR_MX_BT470BG     = 5,
1123
    GF_COLOR_MX_SMPTE170M   = 6,
1124
    GF_COLOR_MX_SMPTE240M   = 7,
1125
    GF_COLOR_MX_YCGCO       = 8,
1126
    GF_COLOR_MX_BT2020_NCL  = 9,
1127
    GF_COLOR_MX_BT2020_CL   = 10,
1128
    GF_COLOR_MX_SMPTE2085   = 11,
1129
} GF_ColorMatrixCoefficients;
1130
1131
/*! Chroma location values, semantics from CoreVideo - direct match of values  to FFmpeg*/
1132
typedef enum {
1133
  /*! Chroma location is not known*/
1134
    GF_CHROMALOC_UNKNOWN=0,
1135
  /*! Chroma sample is horizontally co-sited with the left column of luma samples, but centered vertically (MPEG-2/4 4:2:0, H.264 default for 4:2:0)*/
1136
    GF_CHROMALOC_LEFT,
1137
    /*! The chroma sample is fully centered ( MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0)*/
1138
    GF_CHROMALOC_CENTER,
1139
    /*! The chroma sample is co-sited with the top-left luma sample (ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2)*/
1140
    GF_CHROMALOC_TOPLEFT,
1141
    /*! The chroma sample is horizontally centered, but is co-sited with the top row of luma samples*/
1142
    GF_CHROMALOC_TOP,
1143
    /*! The chroma sample is co-sited with the bottom-left luma sample*/
1144
    GF_CHROMALOC_BOTTOMLEFT,
1145
    /*! The chroma sample is horizontally centered, but is co-sited with the bottom row of luma samples*/
1146
    GF_CHROMALOC_BOTTOM,
1147
    /*! The Cr and Cb samples are alternatingly co-sited with the left luma samples of the same field */
1148
    GF_CHROMALOC_DV420,
1149
} GF_ChromaLocation;
1150
1151
1152
/*DIMS unit flags */
1153
/*!
1154
\brief DIMS Unit header flags
1155
1156
DIMS Unit header flags as 3GPP TS 26.142.
1157
 */
1158
enum
1159
{
1160
  /*!S: is-Scene: DIMS unit contains a complete document (svg)*/
1161
  GF_DIMS_UNIT_S = 1,
1162
  /*!M: is-RAP: DIMS unit is a random access point*/
1163
  GF_DIMS_UNIT_M = 1<<1,
1164
  /*!I: is-Redundant: DIMS unit is made of redundant data*/
1165
  GF_DIMS_UNIT_I = 1<<2,
1166
  /*!D: redundant-exit: DIMS unit is the end of redundant data*/
1167
  GF_DIMS_UNIT_D = 1<<3,
1168
  /*!P: priority: DIMS unit is high priority*/
1169
  GF_DIMS_UNIT_P = 1<<4,
1170
  /*!C: compressed: DIMS unit is compressed*/
1171
  GF_DIMS_UNIT_C = 1<<5
1172
};
1173
1174
1175
/*! AVC NAL unit types */
1176
enum
1177
{
1178
  /*! Non IDR AVC slice*/
1179
  GF_AVC_NALU_NON_IDR_SLICE = 1,
1180
  /*! DP_A AVC slice*/
1181
  GF_AVC_NALU_DP_A_SLICE = 2,
1182
  /*! DP_B AVC slice*/
1183
  GF_AVC_NALU_DP_B_SLICE = 3,
1184
  /*! DP_C AVC slice*/
1185
  GF_AVC_NALU_DP_C_SLICE = 4,
1186
  /*! IDR AVC slice*/
1187
  GF_AVC_NALU_IDR_SLICE = 5,
1188
  /*! SEI Message*/
1189
  GF_AVC_NALU_SEI = 6,
1190
  /*! Sequence Parameter Set */
1191
  GF_AVC_NALU_SEQ_PARAM = 7,
1192
  /*! Picture Parameter Set*/
1193
  GF_AVC_NALU_PIC_PARAM = 8,
1194
  /*! Access Unit delimiter*/
1195
  GF_AVC_NALU_ACCESS_UNIT = 9,
1196
  /*! End of Sequence*/
1197
  GF_AVC_NALU_END_OF_SEQ = 10,
1198
  /*! End of stream*/
1199
  GF_AVC_NALU_END_OF_STREAM = 11,
1200
  /*! Filler data*/
1201
  GF_AVC_NALU_FILLER_DATA = 12,
1202
  /*! Sequence Parameter Set Extension*/
1203
  GF_AVC_NALU_SEQ_PARAM_EXT = 13,
1204
  /*! SVC preffix*/
1205
  GF_AVC_NALU_SVC_PREFIX_NALU = 14,
1206
  /*! SVC subsequence parameter set*/
1207
  GF_AVC_NALU_SVC_SUBSEQ_PARAM = 15,
1208
  /*! Auxiliary slice*/
1209
  GF_AVC_NALU_SLICE_AUX = 19,
1210
  /*! SVC slice*/
1211
  GF_AVC_NALU_SVC_SLICE = 20,
1212
  /*! View and dependency representation delimiter */
1213
  GF_AVC_NALU_VDRD = 24,
1214
  /*! Dolby Vision RPU */
1215
  GF_AVC_NALU_DV_RPU = 28,
1216
  /*! Dolby Vision EL */
1217
  GF_AVC_NALU_DV_EL = 30,
1218
1219
  /*! NALU-FF extractor */
1220
  GF_AVC_NALU_FF_AGGREGATOR=30,
1221
  /*! NALU-FF aggregator */
1222
  GF_AVC_NALU_FF_EXTRACTOR=31,
1223
};
1224
1225
1226
/*! AVC slice types */
1227
enum
1228
{
1229
  /*! P slice*/
1230
  GF_AVC_TYPE_P = 0,
1231
  /*! B slice*/
1232
  GF_AVC_TYPE_B = 1,
1233
  /*! I slice*/
1234
  GF_AVC_TYPE_I = 2,
1235
  /*! SP slice*/
1236
  GF_AVC_TYPE_SP = 3,
1237
  /*! SI slice*/
1238
  GF_AVC_TYPE_SI = 4,
1239
  /*! Type2 P slice*/
1240
  GF_AVC_TYPE2_P = 5,
1241
  /*! Type2 B slice*/
1242
  GF_AVC_TYPE2_B = 6,
1243
  /*! Type2 I slice*/
1244
  GF_AVC_TYPE2_I = 7,
1245
  /*! Type2 SP slice*/
1246
  GF_AVC_TYPE2_SP = 8,
1247
  /*! Type2 SI slice*/
1248
  GF_AVC_TYPE2_SI = 9
1249
};
1250
1251
/*! Scheme Type only used internally to signal HLS sample AES in TS */
1252
0
#define GF_HLS_SAMPLE_AES_SCHEME  GF_4CC('s','a','e','s')
1253
1254
1255
/*! HEVC NAL unit types */
1256
enum
1257
{
1258
  /*! Trail N HEVC slice*/
1259
  GF_HEVC_NALU_SLICE_TRAIL_N = 0,
1260
  /*! Trail R HEVC slice*/
1261
  GF_HEVC_NALU_SLICE_TRAIL_R = 1,
1262
  /*! TSA N HEVC slice*/
1263
  GF_HEVC_NALU_SLICE_TSA_N = 2,
1264
  /*! TSA R HEVC slice*/
1265
  GF_HEVC_NALU_SLICE_TSA_R = 3,
1266
  /*! STSA N HEVC slice*/
1267
  GF_HEVC_NALU_SLICE_STSA_N = 4,
1268
  /*! STSA R HEVC slice*/
1269
  GF_HEVC_NALU_SLICE_STSA_R = 5,
1270
  /*! RADL N HEVC slice*/
1271
  GF_HEVC_NALU_SLICE_RADL_N = 6,
1272
  /*! RADL R HEVC slice*/
1273
  GF_HEVC_NALU_SLICE_RADL_R = 7,
1274
  /*! RASL N HEVC slice*/
1275
  GF_HEVC_NALU_SLICE_RASL_N = 8,
1276
  /*! RASL R HEVC slice*/
1277
  GF_HEVC_NALU_SLICE_RASL_R = 9,
1278
  /*! Reserved non-IRAP SLNR VCL NAL unit types*/
1279
  GF_HEVC_NALU_SLICE_RSV_VCL_N10 = 10,
1280
  GF_HEVC_NALU_SLICE_RSV_VCL_N12 = 12,
1281
  GF_HEVC_NALU_SLICE_RSV_VCL_N14 = 14,
1282
  /*! Reserved non-IRAP sub-layer reference VCL NAL unit types*/
1283
  GF_HEVC_NALU_SLICE_RSV_VCL_R11 = 11,
1284
  GF_HEVC_NALU_SLICE_RSV_VCL_R13 = 13,
1285
  GF_HEVC_NALU_SLICE_RSV_VCL_R15 = 15,
1286
  /*! BLA LP HEVC slice*/
1287
  GF_HEVC_NALU_SLICE_BLA_W_LP = 16,
1288
  /*! BLA DLP HEVC slice*/
1289
  GF_HEVC_NALU_SLICE_BLA_W_DLP = 17,
1290
  /*! BLA no LP HEVC slice*/
1291
  GF_HEVC_NALU_SLICE_BLA_N_LP = 18,
1292
  /*! IDR DLP HEVC slice*/
1293
  GF_HEVC_NALU_SLICE_IDR_W_DLP = 19,
1294
  /*! IDR HEVC slice*/
1295
  GF_HEVC_NALU_SLICE_IDR_N_LP = 20,
1296
  /*! CRA HEVC slice*/
1297
  GF_HEVC_NALU_SLICE_CRA = 21,
1298
  /*! Video Parameter Set*/
1299
  GF_HEVC_NALU_VID_PARAM = 32,
1300
  /*! Sequence Parameter Set*/
1301
  GF_HEVC_NALU_SEQ_PARAM = 33,
1302
  /*! Picture Parameter Set*/
1303
  GF_HEVC_NALU_PIC_PARAM = 34,
1304
  /*! AU delimiter*/
1305
  GF_HEVC_NALU_ACCESS_UNIT = 35,
1306
  /*! End of sequence*/
1307
  GF_HEVC_NALU_END_OF_SEQ = 36,
1308
  /*! End of stream*/
1309
  GF_HEVC_NALU_END_OF_STREAM = 37,
1310
  /*! Filler Data*/
1311
  GF_HEVC_NALU_FILLER_DATA = 38,
1312
  /*! prefix SEI message*/
1313
  GF_HEVC_NALU_SEI_PREFIX = 39,
1314
  /*! suffix SEI message*/
1315
  GF_HEVC_NALU_SEI_SUFFIX = 40,
1316
1317
  /*! NALU-FF aggregator */
1318
  GF_HEVC_NALU_FF_AGGREGATOR=48,
1319
  /*! NALU-FF extractor */
1320
  GF_HEVC_NALU_FF_EXTRACTOR=49,
1321
1322
  /*! Dolby Vision RPU */
1323
  GF_HEVC_NALU_DV_RPU = 62,
1324
  /*! Dolby Vision EL */
1325
  GF_HEVC_NALU_DV_EL = 63
1326
};
1327
1328
1329
1330
/*! VVC NAL unit types - vtm10) */
1331
enum
1332
{
1333
  /*! Trail N VVC slice*/
1334
  GF_VVC_NALU_SLICE_TRAIL = 0,
1335
  /*! STSA N VVC slice*/
1336
  GF_VVC_NALU_SLICE_STSA = 1,
1337
  /*! STSA N VVC slice*/
1338
  GF_VVC_NALU_SLICE_RADL = 2,
1339
  /*! STSA N VVC slice*/
1340
  GF_VVC_NALU_SLICE_RASL = 3,
1341
  /*! IDR with RADL VVC slice*/
1342
  GF_VVC_NALU_SLICE_IDR_W_RADL = 7,
1343
  /*! IDR DLP VVC slice*/
1344
  GF_VVC_NALU_SLICE_IDR_N_LP = 8,
1345
  /*! CRA VVC slice*/
1346
  GF_VVC_NALU_SLICE_CRA = 9,
1347
  /*! CRA VVC slice*/
1348
  GF_VVC_NALU_SLICE_GDR = 10,
1349
1350
  /*! Operation Point Info */
1351
  GF_VVC_NALU_OPI = 12,
1352
  /*! Decode Parameter Set*/
1353
  GF_VVC_NALU_DEC_PARAM = 13,
1354
  /*! Video Parameter Set*/
1355
  GF_VVC_NALU_VID_PARAM = 14,
1356
  /*! Sequence Parameter Set*/
1357
  GF_VVC_NALU_SEQ_PARAM = 15,
1358
  /*! Picture Parameter Set*/
1359
  GF_VVC_NALU_PIC_PARAM = 16,
1360
  /*! APS prefix */
1361
  GF_VVC_NALU_APS_PREFIX = 17,
1362
  /*! APS suffix */
1363
  GF_VVC_NALU_APS_SUFFIX = 18,
1364
  /*! Picture Header*/
1365
  GF_VVC_NALU_PIC_HEADER = 19,
1366
  /*! AU delimiter*/
1367
  GF_VVC_NALU_ACCESS_UNIT = 20,
1368
  /*! End of sequence*/
1369
  GF_VVC_NALU_END_OF_SEQ = 21,
1370
  /*! End of stream*/
1371
  GF_VVC_NALU_END_OF_STREAM = 22,
1372
  /*! prefix SEI message*/
1373
  GF_VVC_NALU_SEI_PREFIX = 23,
1374
  /*! suffix SEI message*/
1375
  GF_VVC_NALU_SEI_SUFFIX = 24,
1376
  /*! Filler Data*/
1377
  GF_VVC_NALU_FILLER_DATA = 25,
1378
};
1379
/*! Number of defined QCELP rate sizes*/
1380
static const unsigned int GF_QCELP_RATE_TO_SIZE_NB = 7;
1381
/*! QCELP rate sizes - note that these sizes INCLUDE the rate_type header byte*/
1382
static const unsigned int GF_QCELP_RATE_TO_SIZE [] = {0, 1, 1, 4, 2, 8, 3, 17, 4, 35, 5, 8, 14, 1};
1383
1384
/*! Number of defined EVRC rate sizes*/
1385
static const unsigned int GF_SMV_EVRC_RATE_TO_SIZE_NB = 6;
1386
/*! EVRC rate sizes - note that these sizes INCLUDE the rate_type header byte*/
1387
static const unsigned int GF_SMV_EVRC_RATE_TO_SIZE [] = {0, 1, 1, 3, 2, 6, 3, 11, 4, 23, 5, 1};
1388
1389
/*! AMR frame sizes*/
1390
static const unsigned int GF_AMR_FRAME_SIZE[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 };
1391
/*! AMR WB frame sizes*/
1392
static const unsigned int GF_AMR_WB_FRAME_SIZE[16] = { 17, 23, 32, 36, 40, 46, 50, 58, 60, 5, 5, 0, 0, 0, 0, 0 };
1393
1394
1395
/*! out-of-band sample description index for 3GPP (128 and 255 reserved in RFC)*/
1396
0
#define GF_RTP_TX3G_SIDX_OFFSET 129
1397
1398
1399
/*! RFC6381 codec name max length*/
1400
0
#define RFC6381_CODEC_NAME_SIZE_MAX 100
1401
1402
1403
/*! ID3v2 tags*/
1404
typedef enum {
1405
  GF_ID3V2_FRAME_AENC = GF_4CC('A','E','N','C'),
1406
  GF_ID3V2_FRAME_APIC = GF_4CC('A','P','I','C'),
1407
  GF_ID3V2_FRAME_COMM = GF_4CC('C','O','M','M'),
1408
  GF_ID3V2_FRAME_COMR = GF_4CC('C','O','M','R'),
1409
  GF_ID3V2_FRAME_ENCR = GF_4CC('E','N','C','R'),
1410
  GF_ID3V2_FRAME_EQUA = GF_4CC('E','Q','U','A'),
1411
  GF_ID3V2_FRAME_ETCO = GF_4CC('E','T','C','O'),
1412
  GF_ID3V2_FRAME_GEOB = GF_4CC('G','E','O','B'),
1413
  GF_ID3V2_FRAME_GRID = GF_4CC('G','R','I','D'),
1414
  GF_ID3V2_FRAME_IPLS = GF_4CC('I','P','L','S'),
1415
  GF_ID3V2_FRAME_LINK = GF_4CC('L','I','N','K'),
1416
  GF_ID3V2_FRAME_MCDI = GF_4CC('M','C','D','I'),
1417
  GF_ID3V2_FRAME_MLLT = GF_4CC('M','L','L','T'),
1418
  GF_ID3V2_FRAME_OWNE = GF_4CC('O','W','N','E'),
1419
  GF_ID3V2_FRAME_PRIV = GF_4CC('P','R','I','V'),
1420
  GF_ID3V2_FRAME_PCNT = GF_4CC('P','C','N','T'),
1421
  GF_ID3V2_FRAME_POPM = GF_4CC('P','O','P','M'),
1422
  GF_ID3V2_FRAME_POSS = GF_4CC('P','O','S','S'),
1423
  GF_ID3V2_FRAME_RBUF = GF_4CC('R','B','U','F'),
1424
  GF_ID3V2_FRAME_RVAD = GF_4CC('R','V','A','D'),
1425
  GF_ID3V2_FRAME_RVRB = GF_4CC('R','V','R','B'),
1426
  GF_ID3V2_FRAME_SYLT = GF_4CC('S','Y','L','T'),
1427
  GF_ID3V2_FRAME_SYTC = GF_4CC('S','Y','T','C'),
1428
  GF_ID3V2_FRAME_TALB = GF_4CC('T','A','L','B'),
1429
  GF_ID3V2_FRAME_TBPM = GF_4CC('T','B','P','M'),
1430
  GF_ID3V2_FRAME_TCAT = GF_4CC('T','C','A','T'),
1431
  GF_ID3V2_FRAME_TCMP = GF_4CC('T','C','M','P'),
1432
  GF_ID3V2_FRAME_TCOM = GF_4CC('T','C','O','M'),
1433
  GF_ID3V2_FRAME_TCON = GF_4CC('T','C','O','N'),
1434
  GF_ID3V2_FRAME_TCOP = GF_4CC('T','C','O','P'),
1435
  GF_ID3V2_FRAME_TDAT = GF_4CC('T','D','A','T'),
1436
  GF_ID3V2_FRAME_TDES = GF_4CC('T','D','E','S'),
1437
  GF_ID3V2_FRAME_TDLY = GF_4CC('T','D','L','Y'),
1438
  GF_ID3V2_FRAME_TDRC = GF_4CC('T','D','R','C'),
1439
  GF_ID3V2_FRAME_TENC = GF_4CC('T','E','N','C'),
1440
  GF_ID3V2_FRAME_TEXT = GF_4CC('T','E','X','T'),
1441
  GF_ID3V2_FRAME_TFLT = GF_4CC('T','F','L','T'),
1442
  GF_ID3V2_FRAME_TIME = GF_4CC('T','I','M','E'),
1443
  GF_ID3V2_FRAME_TIT1 = GF_4CC('T','I','T','1'),
1444
  GF_ID3V2_FRAME_TIT2 = GF_4CC('T','I','T','2'),
1445
  GF_ID3V2_FRAME_TIT3 = GF_4CC('T','I','T','3'),
1446
  GF_ID3V2_FRAME_TKEY = GF_4CC('T','K','E','Y'),
1447
  GF_ID3V2_FRAME_TKWD = GF_4CC('T','K','W','D'),
1448
  GF_ID3V2_FRAME_TLAN = GF_4CC('T','L','A','N'),
1449
  GF_ID3V2_FRAME_TLEN = GF_4CC('T','L','E','N'),
1450
  GF_ID3V2_FRAME_TMED = GF_4CC('T','M','E','D'),
1451
  GF_ID3V2_FRAME_TOAL = GF_4CC('T','O','A','L'),
1452
  GF_ID3V2_FRAME_TOFN = GF_4CC('T','O','F','N'),
1453
  GF_ID3V2_FRAME_TOLY = GF_4CC('T','O','L','Y'),
1454
  GF_ID3V2_FRAME_TOPE = GF_4CC('T','O','P','E'),
1455
  GF_ID3V2_FRAME_TORY = GF_4CC('T','O','R','Y'),
1456
  GF_ID3V2_FRAME_TOWN = GF_4CC('T','O','W','N'),
1457
  GF_ID3V2_FRAME_TPE1 = GF_4CC('T','P','E','1'),
1458
  GF_ID3V2_FRAME_TPE2 = GF_4CC('T','P','E','2'),
1459
  GF_ID3V2_FRAME_TPE3 = GF_4CC('T','P','E','3'),
1460
  GF_ID3V2_FRAME_TPE4 = GF_4CC('T','P','E','4'),
1461
  GF_ID3V2_FRAME_TPOS = GF_4CC('T','P','E','5'),
1462
  GF_ID3V2_FRAME_TPUB = GF_4CC('T','P','U','B'),
1463
  GF_ID3V2_FRAME_TRCK = GF_4CC('T','R','C','K'),
1464
  GF_ID3V2_FRAME_TRDA = GF_4CC('T','R','D','A'),
1465
  GF_ID3V2_FRAME_TRSN = GF_4CC('T','R','S','N'),
1466
  GF_ID3V2_FRAME_TRSO = GF_4CC('T','R','S','O'),
1467
  GF_ID3V2_FRAME_TSIZ = GF_4CC('T','S','I','Z'),
1468
  GF_ID3V2_FRAME_TSO2 = GF_4CC('T','S','O','2'),
1469
  GF_ID3V2_FRAME_TSOA = GF_4CC('T','S','O','A'),
1470
  GF_ID3V2_FRAME_TSOC = GF_4CC('T','S','O','C'),
1471
  GF_ID3V2_FRAME_TSOT = GF_4CC('T','S','O','T'),
1472
  GF_ID3V2_FRAME_TSOP = GF_4CC('T','S','O','P'),
1473
  GF_ID3V2_FRAME_TSRC = GF_4CC('T','S','R','C'),
1474
  GF_ID3V2_FRAME_TSSE = GF_4CC('T','S','S','E'),
1475
  GF_ID3V2_FRAME_TYER = GF_4CC('T','Y','E','R'),
1476
  GF_ID3V2_FRAME_TXXX = GF_4CC('T','X','X','X'),
1477
  GF_ID3V2_FRAME_UFID = GF_4CC('U','F','I','D'),
1478
  GF_ID3V2_FRAME_USER = GF_4CC('U','S','E','R'),
1479
  GF_ID3V2_FRAME_USLT = GF_4CC('U','S','L','T'),
1480
  GF_ID3V2_FRAME_WCOM = GF_4CC('W','C','O','M'),
1481
  GF_ID3V2_FRAME_WCOP = GF_4CC('W','C','O','P'),
1482
  GF_ID3V2_FRAME_WOAF = GF_4CC('W','O','A','F'),
1483
  GF_ID3V2_FRAME_WOAR = GF_4CC('W','O','A','R'),
1484
  GF_ID3V2_FRAME_WOAS = GF_4CC('W','O','A','S'),
1485
  GF_ID3V2_FRAME_WORS = GF_4CC('W','O','R','S'),
1486
  GF_ID3V2_FRAME_WPAY = GF_4CC('W','P','A','Y'),
1487
  GF_ID3V2_FRAME_WPUB = GF_4CC('W','P','U','B'),
1488
  GF_ID3V2_FRAME_WXXX = GF_4CC('W','X','X','X'),
1489
} GF_ID3v2FrameType;
1490
1491
/*! tag base types*/
1492
enum
1493
{
1494
  /*! tag is a string*/
1495
  GF_ITAG_STR=0,
1496
  /*! tag is an 8 bit int*/
1497
  GF_ITAG_INT8,
1498
  /*! tag is a 16 bit int*/
1499
  GF_ITAG_INT16,
1500
  /*! tag is a 32 bit int*/
1501
  GF_ITAG_INT32,
1502
  /*! tag is an 64 bits int*/
1503
  GF_ITAG_INT64,
1504
  /*! tag is a boolean (8bit) */
1505
  GF_ITAG_BOOL,
1506
  /*! tag is ID3 genre tag, either 32 bit int or string*/
1507
  GF_ITAG_ID3_GENRE,
1508
  /*! tag is an fraction on 6 bytes (first 2 unused)*/
1509
  GF_ITAG_FRAC6,
1510
  /*! tag is an fraction on 8 bytes (first 2 and last 2 unused)*/
1511
  GF_ITAG_FRAC8,
1512
  /*! tag is a file*/
1513
  GF_ITAG_FILE,
1514
};
1515
/*! finds a tag by its ID3 value
1516
 \param id3tag ID3 tag value
1517
 \return corresponding tag index, -1 if not found
1518
*/
1519
s32 gf_itags_find_by_id3tag(u32 id3tag);
1520
1521
/*! finds a tag by its itunes value
1522
 \param itag itunes tag value
1523
 \return corresponding tag index, -1 if not found
1524
*/
1525
s32 gf_itags_find_by_itag(u32 itag);
1526
1527
/*! finds a tag by its name
1528
 \param tag_name tag name
1529
 \return corresponding tag index, -1 if not found
1530
*/
1531
s32 gf_itags_find_by_name(const char *tag_name);
1532
1533
/*! gets tag associated type
1534
 \param tag_idx tag index
1535
 \return corresponding tag type, -1 if error
1536
*/
1537
s32 gf_itags_get_type(u32 tag_idx);
1538
1539
/*! gets tag associated name
1540
 \param tag_idx tag index
1541
 \return corresponding tag name, NULL if error
1542
*/
1543
const char *gf_itags_get_name(u32 tag_idx);
1544
1545
/*! gets tag associated alternative names
1546
 \param tag_idx tag index
1547
 \return corresponding tag name, NULL if none
1548
*/
1549
const char *gf_itags_get_alt_name(u32 tag_idx);
1550
1551
/*! gets tag associated itunes tag
1552
 \param tag_idx tag index
1553
 \return corresponding itunes tag, 0 if error
1554
*/
1555
u32 gf_itags_get_itag(u32 tag_idx);
1556
1557
/*! gets tag associated id3 tag
1558
 \param tag_idx tag index
1559
 \return corresponding id3 tag, 0 if error
1560
*/
1561
u32 gf_itags_get_id3tag(u32 tag_idx);
1562
1563
/*! enumerates tags
1564
 \param tag_idx tag index, increased at each call
1565
 \param itag set to itunes tag value - may be NULL
1566
 \param id3tag set to ID3 tag value - may be NULL
1567
 \param type set to tag type - may be NULL
1568
 \return tag name, NULL if error
1569
*/
1570
const char *gf_itags_enum_tags(u32 *tag_idx, u32 *itag, u32 *id3tag, u32 *type);
1571
1572
/*! gets genre name by genre tag
1573
\param tag genre tag (from 1 to max number of ID3 genres)
1574
\return genre name, NULL if not found*/
1575
const char *gf_id3_get_genre(u32 tag);
1576
1577
/*! gets genre tag by genre name
1578
\param name genre name
1579
\return genre tag, 0 if not found*/
1580
u32 gf_id3_get_genre_tag(const char *name);
1581
1582
1583
/*! meta types from box_code_meta.c - fileimport.c */
1584
enum {
1585
1586
  GF_META_ITEM_TYPE_MIME  = GF_4CC('m', 'i', 'm', 'e'),
1587
  GF_META_ITEM_TYPE_URI   = GF_4CC('u', 'r', 'i', ' '),
1588
  GF_META_ITEM_TYPE_PICT  = GF_4CC('p', 'i', 'c', 't'),
1589
1590
  GF_META_TYPE_SVG  = GF_4CC('s','v','g',' '),
1591
  GF_META_TYPE_SVGZ   = GF_4CC('s','v','g','z'),
1592
  GF_META_TYPE_SMIL   = GF_4CC('s','m','i','l'),
1593
  GF_META_TYPE_SMLZ   = GF_4CC('s','m','l','z'),
1594
  GF_META_TYPE_X3D  = GF_4CC('x','3','d',' '),
1595
  GF_META_TYPE_X3DZ   = GF_4CC('x','3','d','z'),
1596
  GF_META_TYPE_XMTA   = GF_4CC('x','m','t','a'),
1597
  GF_META_TYPE_XMTZ   = GF_4CC('x','m','t','z'),
1598
1599
  GF_META_TYPE_RVCI   = GF_4CC('r','v','c','i'),
1600
1601
};
1602
1603
1604
/*! meta types from box_code_meta.c - fileimport.c */
1605
enum {
1606
1607
  GF_S4CC_MPEG4 = GF_4CC('m', 'p', '4', 's'),
1608
  GF_S4CC_LASER = GF_4CC('l', 's', 'r', '1'),
1609
};
1610
1611
1612
/*! CICP code points for color primaries */
1613
enum
1614
{
1615
  GF_CICP_PRIM_RESERVED_0 = 0,
1616
  GF_CICP_PRIM_BT709,
1617
  GF_CICP_PRIM_UNSPECIFIED,
1618
  GF_CICP_PRIM_RESERVED_3,
1619
  GF_CICP_PRIM_BT470M,
1620
  GF_CICP_PRIM_BT470G,
1621
  GF_CICP_PRIM_SMPTE170,
1622
  GF_CICP_PRIM_SMPTE240,
1623
  GF_CICP_PRIM_FILM,
1624
  GF_CICP_PRIM_BT2020,
1625
  GF_CICP_PRIM_SMPTE428,
1626
  GF_CICP_PRIM_SMPTE431,
1627
  GF_CICP_PRIM_SMPTE432,
1628
1629
  GF_CICP_PRIM_EBU3213=22,
1630
1631
  GF_CICP_PRIM_LAST
1632
};
1633
1634
/*! CICP code points for color transfer */
1635
enum
1636
{
1637
  GF_CICP_TRANSFER_RESERVED_0 = 0,
1638
  GF_CICP_TRANSFER_BT709,
1639
  GF_CICP_TRANSFER_UNSPECIFIED,
1640
  GF_CICP_TRANSFER_RESERVED_3,
1641
  GF_CICP_TRANSFER_BT470M,
1642
  GF_CICP_TRANSFER_BT470BG,
1643
  GF_CICP_TRANSFER_SMPTE170,
1644
  GF_CICP_TRANSFER_SMPTE240,
1645
  GF_CICP_TRANSFER_LINEAR,
1646
  GF_CICP_TRANSFER_LOG100,
1647
  GF_CICP_TRANSFER_LOG316,
1648
  GF_CICP_TRANSFER_IEC61966,
1649
  GF_CICP_TRANSFER_BT1361,
1650
  GF_CICP_TRANSFER_SRGB,
1651
  GF_CICP_TRANSFER_BT2020_10,
1652
  GF_CICP_TRANSFER_BT2020_12,
1653
  GF_CICP_TRANSFER_SMPTE2084,
1654
  GF_CICP_TRANSFER_SMPTE428,
1655
  GF_CICP_TRANSFER_STDB67, //prores only
1656
1657
  GF_CICP_TRANSFER_LAST
1658
};
1659
1660
1661
/*! CICP code points for matrix coefficients */
1662
enum
1663
{
1664
  GF_CICP_MX_IDENTITY = 0,
1665
  GF_CICP_MX_BT709,
1666
  GF_CICP_MX_UNSPECIFIED,
1667
  GF_CICP_MX_RESERVED_3,
1668
  GF_CICP_MX_FCC47,
1669
  GF_CICP_MX_BT601_625,
1670
  GF_CICP_MX_SMPTE170,
1671
  GF_CICP_MX_SMPTE240,
1672
  GF_CICP_MX_YCgCo,
1673
  GF_CICP_MX_BT2020,
1674
  GF_CICP_MX_BT2020_CL,
1675
  GF_CICP_MX_YDzDx,
1676
1677
  GF_CICP_MX_LAST
1678
  //the rest is reserved
1679
};
1680
1681
/*! parse CICP color primaries
1682
 \param val CICP color primaries name
1683
\return 0xFFFFFFFF if error , value otherwise
1684
*/
1685
u32 gf_cicp_parse_color_primaries(const char *val);
1686
1687
/*! get CICP color primaries name
1688
\param cicp_prim CICP color primaries code
1689
\return name or "unknown"" if error
1690
*/
1691
const char *gf_cicp_color_primaries_name(u32 cicp_prim);
1692
1693
/*! get CICP color primaries names
1694
\return coma-separated list of GPAC names for CICP color primaries
1695
*/
1696
const char *gf_cicp_color_primaries_all_names();
1697
1698
/*! parse CICP color transfer
1699
 \param val CICP color transfer name
1700
\return 0xFFFFFFFF if error , value otherwise
1701
*/
1702
u32 gf_cicp_parse_color_transfer(const char *val);
1703
1704
/*! get CICP color transfer name
1705
\param cicp_trans CICP color transfer code
1706
\return name or "unknown"" if error
1707
*/
1708
const char *gf_cicp_color_transfer_name(u32 cicp_trans);
1709
1710
/*! get CICP color transfer names
1711
\return coma-separated list of GPAC names for CICP color transfer
1712
*/
1713
const char *gf_cicp_color_transfer_all_names();
1714
1715
/*! parse CICP color matrix coefficients
1716
 \param val CICP color matrix coefficients name
1717
\return 0xFFFFFFFF if error , value otherwise
1718
*/
1719
u32 gf_cicp_parse_color_matrix(const char *val);
1720
1721
/*! get CICP color matrix coefficients name
1722
\param cicp_mx CICP color matrix coefficients code
1723
\return name or "unknown"" if error
1724
*/
1725
const char *gf_cicp_color_matrix_name(u32 cicp_mx);
1726
1727
/*! get CICP color matrix names
1728
\return coma-separated list of GPAC names for CICP color matrix
1729
*/
1730
const char *gf_cicp_color_matrix_all_names();
1731
1732
1733
/*! stereo frame packing types */
1734
enum
1735
{
1736
  /*! monoscopic video*/
1737
  GF_STEREO_NONE = 0,
1738
  /*! left eye in top half of video, right eye in bottom half of video*/
1739
  GF_STEREO_TOP_BOTTOM,
1740
  /*! left eye in left half of video, right eye in right half of video*/
1741
  GF_STEREO_LEFT_RIGHT,
1742
  /*! stereo mapped through mesh*/
1743
  GF_STEREO_CUSTOM,
1744
  /*! left eye in right half of video, right eye in left half of video*/
1745
  GF_STEREO_RIGHT_LEFT,
1746
  /*! left eye in bottom half of video, right eye in top half of video*/
1747
  GF_STEREO_BOTTOM_TOP,
1748
};
1749
1750
/*! 360 projection types */
1751
enum
1752
{
1753
  /*! flat video*/
1754
  GF_PROJ360_NONE = 0,
1755
  /*! cube map projection video is upper half: right, left, up, lower half: down, front, back*/
1756
  GF_PROJ360_CUBE_MAP,
1757
  /*! Equirectangular projection / video*/
1758
  GF_PROJ360_EQR,
1759
  /*! Mesh projection (not supported yet)*/
1760
  GF_PROJ360_MESH
1761
};
1762
1763
/*! Low latency HTTP adaptive streaming mode, set by dasher filter and used by other filter */
1764
enum
1765
{
1766
  /*! no low-latency profile*/
1767
  GF_LLHAS_NONE = 0,
1768
  /*! LL-HLS using byte ranges */
1769
  GF_LLHAS_BYTERANGES = 1,
1770
  /*! LL-HLS using separate parts  */
1771
  GF_LLHAS_PARTS = 2,
1772
  /*! DASH SSR mode (only sub-parts are generated  */
1773
  GF_LLHAS_SUBSEG = 3
1774
};
1775
1776
1777
/*! user data used by GPAC to store SRD info*/
1778
0
#define GF_ISOM_UDTA_GPAC_SRD GF_4CC('G','S','R','D')
1779
1780
/*! @} */
1781
1782
#ifdef __cplusplus
1783
}
1784
#endif
1785
1786
#endif  /*_GF_CONSTANTS_H_*/