gavl: gavl.h Source File

gavl

gavl.h
Go to the documentation of this file.
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2024 Members of the Gmerlin project
5 * http://github.com/bplaum
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * *****************************************************************/
20
21
22
27
28#ifndef GAVL_H_INCLUDED
29#define GAVL_H_INCLUDED
30
31#include <inttypes.h>
32
33#include <gavl/gavldefs.h>
34#include <gavl/gavltime.h>
35#include <gavl/timecode.h>
36#include <gavl/threadpool.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/* Forward declarations */
43
49
50 typedef struct gavl_video_source_s gavl_video_source_t;
51
57
58 typedef struct gavl_audio_source_s gavl_audio_source_t;
59
65
66 typedef struct gavl_packet_source_s gavl_packet_source_t;
67
73
74typedef struct
75gavl_audio_sink_s gavl_audio_sink_t;
76
82
83typedef struct
84gavl_video_sink_s gavl_video_sink_t;
85
91
92typedef struct
93gavl_packet_sink_s gavl_packet_sink_t;
94
95typedef struct
96 gavl_packet_s gavl_packet_t;
97
101
102 typedef struct gavl_video_format_s gavl_video_format_t;
103
104typedef struct gavl_video_frame_s gavl_video_frame_t;
105
106
107
111
112
113
114/* Quality levels */
115
129
130
131
138
139#define GAVL_QUALITY_FASTEST 1
140
146
147#define GAVL_QUALITY_BEST 5
148
154
155#define GAVL_QUALITY_DEFAULT 2
156
167
168#define GAVL_ACCEL_MMX (1<<0)
169#define GAVL_ACCEL_MMXEXT (1<<1)
170#define GAVL_ACCEL_SSE (1<<2)
171#define GAVL_ACCEL_SSE2 (1<<3)
172#define GAVL_ACCEL_SSE3 (1<<4)
173#define GAVL_ACCEL_3DNOW (1<<5)
174#define GAVL_ACCEL_3DNOWEXT (1<<6)
175#define GAVL_ACCEL_SSSE3 (1<<7)
176#define GAVL_ACCEL_AVX (1<<8)
177#define GAVL_ACCEL_AVX2 (1<<9)
178#define GAVL_ACCEL_NEON (1<<10)
179
183
184GAVL_PUBLIC int gavl_accel_supported(void);
185
189
193
194/* Sample formats: all multibyte numbers are native endian */
195
201
202
208#define GAVL_MAX_CHANNELS 128
209
215
216 typedef enum
217 {
218 GAVL_SAMPLE_NONE = 0,
219 GAVL_SAMPLE_U8 = 1,
220 GAVL_SAMPLE_S8 = 2,
221 GAVL_SAMPLE_U16 = 3,
222 GAVL_SAMPLE_S16 = 4,
223 GAVL_SAMPLE_S32 = 5,
224 GAVL_SAMPLE_FLOAT = 6,
225 GAVL_SAMPLE_DOUBLE = 7
226 } gavl_sample_format_t;
227
232
233 typedef enum
234 {
235 GAVL_INTERLEAVE_NONE = 0,
236 GAVL_INTERLEAVE_2 = 1,
237 GAVL_INTERLEAVE_ALL = 2
238 } gavl_interleave_mode_t;
239
246
247 typedef enum
248 {
249 GAVL_CHID_NONE = 0,
250 GAVL_CHID_FRONT_CENTER,
251 GAVL_CHID_FRONT_LEFT,
252 GAVL_CHID_FRONT_RIGHT,
253 GAVL_CHID_FRONT_CENTER_LEFT,
254 GAVL_CHID_FRONT_CENTER_RIGHT,
255 GAVL_CHID_REAR_LEFT,
256 GAVL_CHID_REAR_RIGHT,
257 GAVL_CHID_REAR_CENTER,
258 GAVL_CHID_SIDE_LEFT,
259 GAVL_CHID_SIDE_RIGHT,
260 GAVL_CHID_LFE,
261 GAVL_CHID_AUX,
262 } gavl_channel_id_t;
263
271
272 typedef struct
273 {
274 uint32_t samples_per_frame;
275 uint32_t samplerate;
276 uint32_t num_channels;
277 gavl_sample_format_t sample_format;
278 gavl_interleave_mode_t interleave_mode;
279
280 float center_level;
281 float rear_level;
282
283 gavl_channel_id_t channel_locations[GAVL_MAX_CHANNELS];
284
285 } gavl_audio_format_t;
286
287
288/* Audio format -> string conversions */
289
296
297GAVL_PUBLIC
298 const char * gavl_sample_format_to_string(gavl_sample_format_t format);
299
306
307GAVL_PUBLIC
308 const char * gavl_sample_format_to_short_string(gavl_sample_format_t format);
309
317
318GAVL_PUBLIC
319 gavl_sample_format_t gavl_string_to_sample_format(const char * str);
320
327
328GAVL_PUBLIC
329 gavl_sample_format_t gavl_short_string_to_sample_format(const char * format);
330
331
336
337GAVL_PUBLIC
338 int gavl_num_sample_formats(void);
339
345
346GAVL_PUBLIC
347 gavl_sample_format_t gavl_get_sample_format(int index);
348
355
356GAVL_PUBLIC
357 const char * gavl_channel_id_to_string(gavl_channel_id_t id);
358
365
366GAVL_PUBLIC
367 const char * gavl_channel_id_to_short_string(gavl_channel_id_t id);
368
375
376GAVL_PUBLIC
377 gavl_channel_id_t gavl_short_string_to_channel_id(const char * id);
378
379
380
387
388GAVL_PUBLIC
389 const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode);
390
397
398GAVL_PUBLIC
399 const char * gavl_interleave_mode_to_short_string(gavl_interleave_mode_t mode);
400
407
408GAVL_PUBLIC
409 gavl_interleave_mode_t gavl_short_string_to_interleave_mode(const char * mode);
410
416
417GAVL_PUBLIC
418 void gavl_audio_format_dump(const gavl_audio_format_t * format);
419
420GAVL_PUBLIC
421int gavl_audio_format_buffer_size(const gavl_audio_format_t * format);
422
423
435
436GAVL_PUBLIC
437 void gavl_audio_format_dumpi(const gavl_audio_format_t * format, int indent);
438
446
447GAVL_PUBLIC
448 int gavl_channel_index(const gavl_audio_format_t * format, gavl_channel_id_t id);
449
455
456GAVL_PUBLIC
457 int gavl_front_channels(const gavl_audio_format_t * format);
458
464
465GAVL_PUBLIC
466 int gavl_rear_channels(const gavl_audio_format_t * format);
467
473
474GAVL_PUBLIC
475 int gavl_side_channels(const gavl_audio_format_t * format);
476
482
483GAVL_PUBLIC
484 int gavl_aux_channels(const gavl_audio_format_t * format);
485
486
487
493
494GAVL_PUBLIC
495 int gavl_lfe_channels(const gavl_audio_format_t * format);
496
503
504GAVL_PUBLIC
505 void gavl_audio_format_copy(gavl_audio_format_t * dst,
506 const gavl_audio_format_t * src);
507
515
516GAVL_PUBLIC
517 int gavl_audio_formats_equal(const gavl_audio_format_t * format_1,
518 const gavl_audio_format_t * format_2);
519
530
531GAVL_PUBLIC
532 void gavl_set_channel_setup(gavl_audio_format_t * format);
533
539
540GAVL_PUBLIC
541 int gavl_bytes_per_sample(gavl_sample_format_t format);
542
552
553GAVL_PUBLIC
554 int gavl_nearest_samplerate(int in_rate, const int * supported);
555
556
564
565
570
571 typedef union
572 {
573 uint8_t * u_8;
574 int8_t * s_8;
575
576 uint16_t * u_16;
577 int16_t * s_16;
578
579 uint32_t * u_32;
580 int32_t * s_32;
581
582 float * f;
583 double * d;
584 } gavl_audio_samples_t;
585
590
591 typedef union
592 {
593 uint8_t * u_8[GAVL_MAX_CHANNELS];
594 int8_t * s_8[GAVL_MAX_CHANNELS];
595
596 uint16_t * u_16[GAVL_MAX_CHANNELS];
597 int16_t * s_16[GAVL_MAX_CHANNELS];
598
599 uint32_t * u_32[GAVL_MAX_CHANNELS];
600 int32_t * s_32[GAVL_MAX_CHANNELS];
601
602 float * f[GAVL_MAX_CHANNELS];
603 double * d[GAVL_MAX_CHANNELS];
604
605 } gavl_audio_channels_t;
606
622
623 typedef struct
624 {
625 gavl_audio_samples_t samples;
626 gavl_audio_channels_t channels;
627 int valid_samples;
628 int64_t timestamp;
629 int channel_stride;
630
631 int buf_idx;
632 } gavl_audio_frame_t;
633
644
645GAVL_PUBLIC
646 gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t* format);
647
658
659GAVL_PUBLIC
660 void gavl_audio_frame_null(gavl_audio_frame_t * frame);
661
670
671GAVL_PUBLIC
672 void gavl_audio_frame_destroy(gavl_audio_frame_t * frame);
673
682
683GAVL_PUBLIC
684 void gavl_audio_frame_mute(gavl_audio_frame_t * frame,
685 const gavl_audio_format_t * format);
686
696
697GAVL_PUBLIC
698 void gavl_audio_frame_mute_samples(gavl_audio_frame_t * frame,
699 const gavl_audio_format_t * format,
700 int num_samples);
701
702
703
713
714GAVL_PUBLIC
715 void gavl_audio_frame_mute_channel(gavl_audio_frame_t * frame,
716 const gavl_audio_format_t * format,
717 int channel);
718
738
739GAVL_PUBLIC
740 int gavl_audio_frame_copy(const gavl_audio_format_t * format,
741 gavl_audio_frame_t * dst,
742 const gavl_audio_frame_t * src,
743 int dst_pos,
744 int src_pos,
745 int dst_size,
746 int src_size);
747
759
760GAVL_PUBLIC
761 void gavl_audio_frame_copy_ptrs(const gavl_audio_format_t * format,
762 gavl_audio_frame_t * dst,
763 const gavl_audio_frame_t * src);
764
780
781
782GAVL_PUBLIC
783 void gavl_audio_frame_get_subframe(const gavl_audio_format_t * format,
784 gavl_audio_frame_t * src,
785 gavl_audio_frame_t * dst,
786 int start, int len);
787
798
799
800GAVL_PUBLIC
801 int gavl_audio_frames_equal(const gavl_audio_format_t * format,
802 const gavl_audio_frame_t * f1,
803 const gavl_audio_frame_t * f2);
804
814
815
816GAVL_PUBLIC
817 int gavl_audio_frame_continuous(const gavl_audio_format_t * format,
818 const gavl_audio_frame_t * f);
819
820
830
831GAVL_PUBLIC
832 void gavl_audio_frame_set_channels(gavl_audio_frame_t * f,
833 const gavl_audio_format_t * format,
834 uint8_t * data);
843
844GAVL_PUBLIC
845 void gavl_audio_frame_from_data(gavl_audio_frame_t * f,
846 const gavl_audio_format_t * format,
847 uint8_t * data, int len);
848
849
850GAVL_PUBLIC
851void gavl_audio_frame_to_packet_metadata(const gavl_audio_frame_t * frame,
852 gavl_packet_t * pkt);
853
854GAVL_PUBLIC
855void gavl_packet_to_audio_frame_metadata(const gavl_packet_t * p, gavl_audio_frame_t * frame);
856
857GAVL_PUBLIC
858void gavl_audio_frame_set_from_packet(gavl_audio_frame_t * frame,
859 const gavl_audio_format_t * format,
860 gavl_packet_t * p);
861
862
863
880
881
882GAVL_PUBLIC
883 int gavl_audio_frame_skip(const gavl_audio_format_t * format,
884 gavl_audio_frame_t * f, int num_samples);
885
886
905
906GAVL_PUBLIC
907 int gavl_audio_frame_plot(const gavl_audio_format_t * format,
908 const gavl_audio_frame_t * frame,
909 const char * name_base);
910
911
916
922
925
926#define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
927
930
931#define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
932
935
936#define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
937
940
941#define GAVL_AUDIO_FRONT_TO_REAR_MASK \
942(GAVL_AUDIO_FRONT_TO_REAR_COPY | \
943GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
944 GAVL_AUDIO_FRONT_TO_REAR_DIFF)
945
946/* Options for mixing stereo to mono */
947
950#define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
953#define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
956#define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
957
960#define GAVL_AUDIO_STEREO_TO_MONO_MASK \
961(GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
962GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
963GAVL_AUDIO_STEREO_TO_MONO_MIX)
964
967
968#define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
969
970
974
975 typedef enum
976 {
977 GAVL_AUDIO_DITHER_NONE = 0,
978 GAVL_AUDIO_DITHER_AUTO = 1,
979 GAVL_AUDIO_DITHER_RECT = 2,
980 GAVL_AUDIO_DITHER_TRI = 3,
981 GAVL_AUDIO_DITHER_SHAPED = 4,
982 } gavl_audio_dither_mode_t;
983
987
988 typedef enum
989 {
990 GAVL_RESAMPLE_AUTO = 0,
991 GAVL_RESAMPLE_ZOH = 1,
992 GAVL_RESAMPLE_LINEAR = 2,
993 GAVL_RESAMPLE_SINC_FAST = 3,
994 GAVL_RESAMPLE_SINC_MEDIUM = 4,
995 GAVL_RESAMPLE_SINC_BEST = 5
996 } gavl_resample_mode_t;
997
1003
1004 typedef struct gavl_audio_options_s gavl_audio_options_t;
1005
1011
1012GAVL_PUBLIC
1013 void gavl_audio_options_set_quality(gavl_audio_options_t * opt, int quality);
1014
1020
1021GAVL_PUBLIC
1022 int gavl_audio_options_get_quality(const gavl_audio_options_t * opt);
1023
1029
1030GAVL_PUBLIC
1031 void gavl_audio_options_set_dither_mode(gavl_audio_options_t * opt, gavl_audio_dither_mode_t mode);
1032
1038
1039GAVL_PUBLIC
1040 gavl_audio_dither_mode_t
1041gavl_audio_options_get_dither_mode(const gavl_audio_options_t * opt);
1042
1043
1049
1050GAVL_PUBLIC
1051 void gavl_audio_options_set_resample_mode(gavl_audio_options_t * opt, gavl_resample_mode_t mode);
1052
1058
1059GAVL_PUBLIC
1060 gavl_resample_mode_t
1061gavl_audio_options_get_resample_mode(const gavl_audio_options_t * opt);
1062
1068
1069GAVL_PUBLIC
1070 void gavl_audio_options_set_conversion_flags(gavl_audio_options_t * opt,
1071 int flags);
1072
1078
1079GAVL_PUBLIC
1080 int gavl_audio_options_get_conversion_flags(const gavl_audio_options_t * opt);
1081
1086
1087GAVL_PUBLIC
1088 void gavl_audio_options_set_defaults(gavl_audio_options_t * opt);
1089
1105
1106GAVL_PUBLIC
1107 void gavl_audio_options_set_mix_matrix(gavl_audio_options_t * opt,
1108 const double ** matrix);
1109
1117
1118GAVL_PUBLIC
1119const double **
1120gavl_audio_options_get_mix_matrix(const gavl_audio_options_t * opt);
1121
1130
1131GAVL_PUBLIC
1132 gavl_audio_options_t * gavl_audio_options_create(void);
1133
1139
1140GAVL_PUBLIC
1141 void gavl_audio_options_copy(gavl_audio_options_t * dst,
1142 const gavl_audio_options_t * src);
1143
1148
1149GAVL_PUBLIC
1150 void gavl_audio_options_destroy(gavl_audio_options_t * opt);
1151
1152
1153
1154/* Audio converter */
1155
1182
1188
1189 typedef struct gavl_audio_converter_s gavl_audio_converter_t;
1190
1195
1196GAVL_PUBLIC
1197 gavl_audio_converter_t * gavl_audio_converter_create(void);
1198
1203
1204GAVL_PUBLIC
1205 void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv);
1206
1214
1215GAVL_PUBLIC
1216 gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t*cnv);
1217
1218
1232
1233GAVL_PUBLIC
1234 int gavl_audio_converter_init(gavl_audio_converter_t* cnv,
1235 const gavl_audio_format_t * input_format,
1236 const gavl_audio_format_t * output_format);
1237
1251
1252GAVL_PUBLIC
1253 int gavl_audio_converter_init_resample(gavl_audio_converter_t * cnv,
1254 const gavl_audio_format_t * format);
1255
1268
1269
1270GAVL_PUBLIC
1271 int gavl_audio_converter_reinit(gavl_audio_converter_t* cnv);
1272
1273
1286
1287GAVL_PUBLIC
1288 void gavl_audio_convert(gavl_audio_converter_t * cnv,
1289 const gavl_audio_frame_t * input_frame,
1290 gavl_audio_frame_t * output_frame);
1291
1292
1310
1311GAVL_PUBLIC
1312 int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t * cnv,
1313 double ratio ) ;
1314
1315
1330
1331GAVL_PUBLIC
1332 void gavl_audio_converter_resample(gavl_audio_converter_t * cnv,
1333 gavl_audio_frame_t * input_frame,
1334 gavl_audio_frame_t * output_frame,
1335 double ratio);
1336
1337
1344
1350
1351 typedef struct gavl_volume_control_s gavl_volume_control_t;
1352
1353/* Create / destroy */
1354
1359
1360GAVL_PUBLIC
1361 gavl_volume_control_t * gavl_volume_control_create(void);
1362
1367
1368GAVL_PUBLIC
1369 void gavl_volume_control_destroy(gavl_volume_control_t *ctrl);
1370
1377
1378GAVL_PUBLIC
1379 void gavl_volume_control_set_format(gavl_volume_control_t *ctrl,
1380 const gavl_audio_format_t * format);
1381
1387
1388GAVL_PUBLIC
1389 void gavl_volume_control_set_volume(gavl_volume_control_t * ctrl,
1390 float volume);
1391
1397
1398GAVL_PUBLIC
1399 void gavl_volume_control_apply(gavl_volume_control_t *ctrl,
1400 gavl_audio_frame_t * frame);
1401
1409
1410GAVL_PUBLIC
1411 int gavl_volume_to_int(float volume, float one, int steps);
1412
1420
1421GAVL_PUBLIC
1422 float gavl_volume_to_float(int volume, float one, int steps);
1423
1428
1432
1433#define GAVL_MAX_PLANES 4
1434
1440
1444
1445 typedef struct
1446 {
1447 int32_t x;
1448 int32_t y;
1449 int32_t w;
1450 int32_t h;
1451 } gavl_rectangle_i_t;
1452
1456
1457 typedef struct
1458 {
1459 double x;
1460 double y;
1461 double w;
1462 double h;
1463 } gavl_rectangle_f_t;
1464
1465GAVL_PUBLIC
1466void gavl_rectangle_i_init(gavl_rectangle_i_t * r);
1467
1468GAVL_PUBLIC
1469void gavl_rectangle_f_init(gavl_rectangle_f_t * r);
1470
1471
1477
1478GAVL_PUBLIC
1479 void gavl_rectangle_i_crop_to_format(gavl_rectangle_i_t * r,
1480 const gavl_video_format_t * format);
1481
1487
1488GAVL_PUBLIC
1489 void gavl_rectangle_f_crop_to_format(gavl_rectangle_f_t * r,
1490 const gavl_video_format_t * format);
1491
1505
1506GAVL_PUBLIC
1507 void gavl_rectangle_crop_to_format_noscale(gavl_rectangle_i_t * src_rect,
1508 gavl_rectangle_i_t * dst_rect,
1509 const gavl_video_format_t * src_format,
1510 const gavl_video_format_t * dst_format);
1511
1522
1523GAVL_PUBLIC
1524 void gavl_rectangle_crop_to_format_scale(gavl_rectangle_f_t * src_rect,
1525 gavl_rectangle_i_t * dst_rect,
1526 const gavl_video_format_t * src_format,
1527 const gavl_video_format_t * dst_format);
1528
1529GAVL_PUBLIC
1530void gavl_rectangle_crop_to_format_scale_f(gavl_rectangle_f_t * src_rect,
1531 gavl_rectangle_f_t * dst_rect,
1532 const gavl_video_format_t * src_format,
1533 const gavl_video_format_t * dst_format);
1534
1535
1536
1537
1543
1544GAVL_PUBLIC
1545 void gavl_rectangle_i_set_all(gavl_rectangle_i_t * r, const gavl_video_format_t * format);
1546
1552
1553GAVL_PUBLIC
1554 void gavl_rectangle_f_set_all(gavl_rectangle_f_t * r, const gavl_video_format_t * format);
1555
1561
1562GAVL_PUBLIC
1563 void gavl_rectangle_i_crop_left(gavl_rectangle_i_t * r, int num_pixels);
1564
1570
1571GAVL_PUBLIC
1572 void gavl_rectangle_i_crop_right(gavl_rectangle_i_t * r, int num_pixels);
1573
1579
1580GAVL_PUBLIC
1581 void gavl_rectangle_i_crop_top(gavl_rectangle_i_t * r, int num_pixels);
1582
1588
1589GAVL_PUBLIC
1590 void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t * r, int num_pixels);
1591
1597
1598GAVL_PUBLIC
1599 void gavl_rectangle_f_crop_left(gavl_rectangle_f_t * r, double num_pixels);
1600
1606
1607GAVL_PUBLIC
1608 void gavl_rectangle_f_crop_right(gavl_rectangle_f_t * r, double num_pixels);
1609
1615
1616GAVL_PUBLIC
1617 void gavl_rectangle_f_crop_top(gavl_rectangle_f_t * r, double num_pixels);
1618
1624
1625GAVL_PUBLIC
1626 void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t * r, double num_pixels);
1627
1640
1641GAVL_PUBLIC
1642 void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1643
1652
1653GAVL_PUBLIC
1654 void gavl_rectangle_i_align_to_format(gavl_rectangle_i_t * r,
1655 const gavl_video_format_t * format);
1656
1657
1663
1664GAVL_PUBLIC
1665 void gavl_rectangle_i_copy(gavl_rectangle_i_t * dst, const gavl_rectangle_i_t * src);
1666
1672
1673GAVL_PUBLIC
1674 void gavl_rectangle_f_copy(gavl_rectangle_f_t * dst, const gavl_rectangle_f_t * src);
1675
1676
1677
1683
1684GAVL_PUBLIC
1685 void gavl_rectangle_i_to_f(gavl_rectangle_f_t * dst, const gavl_rectangle_i_t * src);
1686
1692
1693GAVL_PUBLIC
1694 void gavl_rectangle_f_to_i(gavl_rectangle_i_t * dst, const gavl_rectangle_f_t * src);
1695
1703
1704GAVL_PUBLIC
1705 int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t * r);
1706
1714
1715GAVL_PUBLIC
1716 int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t * r);
1717
1744
1745GAVL_PUBLIC
1746 void gavl_rectangle_fit_aspect(gavl_rectangle_i_t * dst_rect,
1747 const gavl_video_format_t * src_format,
1748 const gavl_rectangle_f_t * src_rect,
1749 const gavl_video_format_t * dst_format,
1750 float zoom, float squeeze);
1751
1752GAVL_PUBLIC
1753void gavl_rectangle_fit_aspect_f(gavl_rectangle_f_t * r,
1754 const gavl_video_format_t * src_format,
1755 const gavl_rectangle_f_t * src_rect,
1756 const gavl_video_format_t * dst_format,
1757 float zoom, float squeeze, int do_orient);
1758
1759
1764GAVL_PUBLIC
1765 void gavl_rectangle_i_dump(const gavl_rectangle_i_t * r);
1766
1771GAVL_PUBLIC
1772 void gavl_rectangle_f_dump(const gavl_rectangle_f_t * r);
1773
1774
1780
1784#define GAVL_PIXFMT_PLANAR (1<<8)
1785
1789#define GAVL_PIXFMT_RGB (1<<9)
1790
1794#define GAVL_PIXFMT_YUV (1<<10)
1795
1799#define GAVL_PIXFMT_YUVJ (1<<11)
1800
1804#define GAVL_PIXFMT_ALPHA (1<<12)
1805
1809#define GAVL_PIXFMT_GRAY (1<<13)
1810
1814
1815 enum gavl_pixelformat_e
1816 {
1819 GAVL_PIXELFORMAT_NONE = 0,
1820
1823 GAVL_GRAY_8 = 1 | GAVL_PIXFMT_GRAY,
1824
1827 GAVL_GRAY_16 = 2 | GAVL_PIXFMT_GRAY,
1828
1831 GAVL_GRAY_FLOAT = 3 | GAVL_PIXFMT_GRAY,
1832
1835 GAVL_GRAYA_16 = 1 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1836
1839 GAVL_GRAYA_32 = 2 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1840
1843 GAVL_GRAYA_FLOAT = 3 | GAVL_PIXFMT_GRAY | GAVL_PIXFMT_ALPHA,
1844
1848 GAVL_RGB_15 = 1 | GAVL_PIXFMT_RGB,
1852 GAVL_BGR_15 = 2 | GAVL_PIXFMT_RGB,
1856 GAVL_RGB_16 = 3 | GAVL_PIXFMT_RGB,
1860 GAVL_BGR_16 = 4 | GAVL_PIXFMT_RGB,
1863 GAVL_RGB_24 = 5 | GAVL_PIXFMT_RGB,
1866 GAVL_BGR_24 = 6 | GAVL_PIXFMT_RGB,
1869 GAVL_RGB_32 = 7 | GAVL_PIXFMT_RGB,
1872 GAVL_BGR_32 = 8 | GAVL_PIXFMT_RGB,
1875 GAVL_RGBA_32 = 9 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1876
1879 GAVL_RGB_48 = 10 | GAVL_PIXFMT_RGB,
1882 GAVL_RGBA_64 = 11 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1883
1886 GAVL_RGB_FLOAT = 12 | GAVL_PIXFMT_RGB,
1889 GAVL_RGBA_FLOAT = 13 | GAVL_PIXFMT_RGB | GAVL_PIXFMT_ALPHA,
1890
1893 GAVL_YUY2 = 1 | GAVL_PIXFMT_YUV,
1896 GAVL_UYVY = 2 | GAVL_PIXFMT_YUV,
1898
1899 GAVL_YUVA_32 = 3 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1901
1902 GAVL_YUVA_64 = 4 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1905 GAVL_YUV_FLOAT = 5 | GAVL_PIXFMT_YUV,
1906
1909 GAVL_YUVA_FLOAT = 6 | GAVL_PIXFMT_YUV | GAVL_PIXFMT_ALPHA,
1910
1913
1914 GAVL_YUV_420_P = 1 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1917 GAVL_YUV_422_P = 2 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1920 GAVL_YUV_444_P = 3 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1923 GAVL_YUV_411_P = 4 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1926 GAVL_YUV_410_P = 5 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1927
1930 GAVL_YUVJ_420_P = 6 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1933 GAVL_YUVJ_422_P = 7 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1936 GAVL_YUVJ_444_P = 8 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV | GAVL_PIXFMT_YUVJ,
1937
1940 GAVL_YUV_444_P_16 = 9 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1943 GAVL_YUV_422_P_16 = 10 | GAVL_PIXFMT_PLANAR | GAVL_PIXFMT_YUV,
1944
1945 };
1946
1950
1951 typedef enum gavl_pixelformat_e gavl_pixelformat_t;
1952
1955#define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1958#define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1961#define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1964#define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1965
1968#define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1971#define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1974#define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1977#define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1978
1981#define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1984#define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1987#define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1990#define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1991
1997
1998 typedef enum
1999 {
2000 GAVL_CCH_NONE = 0,
2001 GAVL_CCH_RED,
2002 GAVL_CCH_GREEN,
2003 GAVL_CCH_BLUE,
2004 GAVL_CCH_Y,
2005 GAVL_CCH_CB,
2006 GAVL_CCH_CR,
2007 GAVL_CCH_ALPHA,
2008 } gavl_color_channel_t;
2009
2010/*
2011 * Colormodel related functions
2012 */
2013
2019
2020#define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
2021
2022
2028
2029#define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
2030
2036
2037#define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
2038
2044
2045#define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
2046
2052
2053#define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
2054
2060
2061#define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
2062
2063
2069
2070GAVL_PUBLIC
2071 int gavl_pixelformat_num_channels(gavl_pixelformat_t pixelformat);
2072
2079
2080GAVL_PUBLIC gavl_color_channel_t
2081gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index);
2082
2083
2089
2090GAVL_PUBLIC
2091 int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat);
2092
2101
2102GAVL_PUBLIC
2103 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
2104
2110
2111GAVL_PUBLIC
2112 int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat);
2113
2119
2120GAVL_PUBLIC
2121 int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat);
2122
2128
2129GAVL_PUBLIC
2130 int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat);
2131
2145
2146GAVL_PUBLIC
2147 int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src,
2148 gavl_pixelformat_t dst);
2149
2162
2163GAVL_PUBLIC gavl_pixelformat_t
2164gavl_pixelformat_get_best(gavl_pixelformat_t src,
2165 const gavl_pixelformat_t * dst_supported,
2166 int * penalty);
2167
2168
2169
2175
2176GAVL_PUBLIC
2177 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat);
2178
2187
2188GAVL_PUBLIC
2189 const char * gavl_pixelformat_to_short_string(gavl_pixelformat_t pixelformat);
2190
2191
2197
2198GAVL_PUBLIC
2199 gavl_pixelformat_t gavl_string_to_pixelformat(const char * name);
2200
2206
2207GAVL_PUBLIC
2208 gavl_pixelformat_t gavl_short_string_to_pixelformat(const char * name);
2209
2215
2216GAVL_PUBLIC
2217 const uint32_t * gavl_pixelformat_get_masks(gavl_pixelformat_t pixelformat);
2218
2219
2220
2225
2226GAVL_PUBLIC
2227 int gavl_num_pixelformats(void);
2228
2234
2235GAVL_PUBLIC
2236 gavl_pixelformat_t gavl_get_pixelformat(int index);
2237
2238/* */
2239
2247
2248 typedef enum
2249 {
2250 GAVL_CHROMA_PLACEMENT_DEFAULT = 0,
2251 GAVL_CHROMA_PLACEMENT_MPEG2,
2252 GAVL_CHROMA_PLACEMENT_DVPAL
2253 } gavl_chroma_placement_t;
2254
2260
2261GAVL_PUBLIC
2262 const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode);
2263
2269
2270GAVL_PUBLIC
2271 const char * gavl_chroma_placement_to_short_string(gavl_chroma_placement_t mode);
2272
2278
2279GAVL_PUBLIC
2280 gavl_chroma_placement_t gavl_short_string_to_chroma_placement(const char * mode);
2281
2282
2286
2287/* Changing the values alters the gmerlin-avdecoder index format */
2288
2289 typedef enum
2290 {
2291 GAVL_FRAMERATE_UNKNOWN = -1,
2292 GAVL_FRAMERATE_CONSTANT = 0,
2293 GAVL_FRAMERATE_VARIABLE = 1,
2294 GAVL_FRAMERATE_STILL = 2,
2295 } gavl_framerate_mode_t;
2296
2302
2303GAVL_PUBLIC
2304 const char * gavl_framerate_mode_to_string(gavl_framerate_mode_t mode);
2305
2311
2312GAVL_PUBLIC
2313 const char * gavl_framerate_mode_to_short_string(gavl_framerate_mode_t mode);
2314
2320
2321GAVL_PUBLIC
2322 gavl_framerate_mode_t gavl_short_string_to_framerate_mode(const char * mode);
2323
2327
2328/* Changing the values alters the gmerlin-avdecoder index format */
2329
2330 typedef enum
2331 {
2332 GAVL_INTERLACE_UNKNOWN = -1,
2333 GAVL_INTERLACE_NONE = 0,
2334 GAVL_INTERLACE_TOP_FIRST = 1,
2335 GAVL_INTERLACE_BOTTOM_FIRST = 2,
2336 GAVL_INTERLACE_MIXED = (0x10 | 1),
2337 GAVL_INTERLACE_MIXED_TOP = (0x10 | 2),
2338 GAVL_INTERLACE_MIXED_BOTTOM = (0x10 | 3),
2339 } gavl_interlace_mode_t;
2340
2346
2347GAVL_PUBLIC
2348 const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode);
2349
2355
2356GAVL_PUBLIC
2357 const char * gavl_interlace_mode_to_short_string(gavl_interlace_mode_t mode);
2358
2364
2365GAVL_PUBLIC
2366 gavl_interlace_mode_t gavl_short_string_to_interlace_mode(const char * mode);
2367
2375
2376GAVL_PUBLIC
2377 int gavl_interlace_mode_is_mixed(gavl_interlace_mode_t mode);
2378
2379#include <gavl/hw.h> // Needs forward declarations
2380
2381/* Video format structure */
2382
2383#define GAVL_IMAGE_ORIENT_FLIP_H (1<<2)
2384
2385typedef enum
2386 {
2387
2388 GAVL_IMAGE_ORIENT_NORMAL = 0, // EXIF: 1
2389 GAVL_IMAGE_ORIENT_ROT90_CW = 1, // EXIF: 8
2390 GAVL_IMAGE_ORIENT_ROT180_CW = 2, // EXIF: 3
2391 GAVL_IMAGE_ORIENT_ROT270_CW = 3, // EXIF: 6
2392
2393 GAVL_IMAGE_ORIENT_FH = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_NORMAL), // EXIF: 2
2394 GAVL_IMAGE_ORIENT_FH_ROT90_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT90_CW), // EXIF: 7
2395 GAVL_IMAGE_ORIENT_FH_ROT180_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT180_CW), // EXIF: 4
2396 GAVL_IMAGE_ORIENT_FH_ROT270_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT270_CW), // EXIF: 5
2397
2398 } gavl_image_orientation_t;
2399
2403
2404 struct gavl_video_format_s
2405 {
2406 uint32_t frame_width;
2407 uint32_t frame_height;
2408
2409 uint32_t image_width;
2410 uint32_t image_height;
2411
2412 /* Support for nonsquare pixels */
2413
2414 uint32_t pixel_width;
2415 uint32_t pixel_height;
2416
2417 gavl_pixelformat_t pixelformat;
2418
2419 uint32_t frame_duration;
2421 uint32_t timescale;
2422
2423 gavl_framerate_mode_t framerate_mode;
2424 gavl_chroma_placement_t chroma_placement;
2425
2426 gavl_interlace_mode_t interlace_mode;
2427
2428 gavl_timecode_format_t timecode_format;
2429
2430 gavl_hw_context_t * hwctx;
2431
2432 gavl_image_orientation_t orientation;
2433 };
2434
2441
2442GAVL_PUBLIC
2443 void gavl_video_format_copy(gavl_video_format_t * dst,
2444 const gavl_video_format_t * src);
2445
2453
2454GAVL_PUBLIC
2455 int gavl_video_formats_equal(const gavl_video_format_t * format_1,
2456 const gavl_video_format_t * format_2);
2457
2458
2468
2469GAVL_PUBLIC
2470 void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2471 float * off_x, float * off_y);
2472
2473
2474
2486
2487GAVL_PUBLIC
2488 void gavl_video_format_fit_to_source(gavl_video_format_t * dst,
2489 const gavl_video_format_t * src);
2490
2497
2498GAVL_PUBLIC
2499 int gavl_video_format_get_image_size(const gavl_video_format_t * format);
2500
2501GAVL_PUBLIC
2502void gavl_video_format_get_frame_layout(const gavl_video_format_t * format,
2503 int * offsets,
2504 int * strides,
2505 int * buffersizes,
2506 int multiplane);
2507
2508
2524
2525GAVL_PUBLIC
2526 void gavl_video_format_set_frame_size(gavl_video_format_t * format,
2527 int pad_h, int pad_v);
2528
2529
2544
2545GAVL_PUBLIC
2546 int gavl_get_color_channel_format(const gavl_video_format_t * frame_format,
2547 gavl_video_format_t * channel_format,
2548 gavl_color_channel_t ch);
2549
2550
2563
2564GAVL_PUBLIC
2565 void gavl_get_field_format(const gavl_video_format_t * frame_format,
2566 gavl_video_format_t * field_format,
2567 int field);
2568
2569
2575
2576GAVL_PUBLIC
2577 void gavl_video_format_dump(const gavl_video_format_t * format);
2578
2590
2591GAVL_PUBLIC
2592 void gavl_video_format_dumpi(const gavl_video_format_t * format, int indent);
2593
2594GAVL_PUBLIC
2595void gavl_video_format_normalize_orientation(gavl_video_format_t * in_format,
2596 gavl_video_format_t * out_format);
2597
2598
2599GAVL_PUBLIC const char *
2600gavl_image_orientation_to_string(gavl_image_orientation_t orient);
2601
2602GAVL_PUBLIC int
2603gavl_image_orientation_is_transposed(gavl_image_orientation_t orient);
2604
2605
2623
2627
2628 struct gavl_video_frame_s
2629 {
2630 uint8_t * planes[GAVL_MAX_PLANES];
2631 int strides[GAVL_MAX_PLANES];
2632
2633 void * client_data;
2634 int64_t timestamp;
2635 int64_t duration;
2636 gavl_interlace_mode_t interlace_mode;
2637 gavl_timecode_t timecode;
2638
2639 int dummy; // !< Used to be reference count. Was renamed to keep ABI compatibility
2640
2641 gavl_rectangle_i_t src_rect;
2642 int32_t dst_x;
2643 int32_t dst_y;
2644
2645 gavl_hw_context_t * hwctx;
2646 void * storage;
2647
2648 int buf_idx;
2649 };
2650
2651
2662
2663GAVL_PUBLIC
2664gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t * format);
2665
2675
2676GAVL_PUBLIC
2677gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t*format);
2678
2679
2680
2689
2690GAVL_PUBLIC
2691 void gavl_video_frame_destroy(gavl_video_frame_t*frame);
2692
2703
2704GAVL_PUBLIC
2705 void gavl_video_frame_null(gavl_video_frame_t*frame);
2706
2714
2715GAVL_PUBLIC
2716 void gavl_video_frame_clear(gavl_video_frame_t * frame,
2717 const gavl_video_format_t * format);
2718
2727
2728GAVL_PUBLIC
2729 void gavl_video_frame_fill(gavl_video_frame_t * frame,
2730 const gavl_video_format_t * format,
2731 const float * color);
2732
2744
2745GAVL_PUBLIC
2746 void gavl_video_frame_absdiff(gavl_video_frame_t * dst,
2747 const gavl_video_frame_t * src1,
2748 const gavl_video_frame_t * src2,
2749 const gavl_video_format_t * format);
2750
2762
2763GAVL_PUBLIC
2764 void gavl_video_frame_psnr(double * psnr,
2765 const gavl_video_frame_t * src1,
2766 const gavl_video_frame_t * src2,
2767 const gavl_video_format_t * format);
2768
2794
2795GAVL_PUBLIC
2796 int gavl_video_frame_ssim(const gavl_video_frame_t * src1,
2797 const gavl_video_frame_t * src2,
2798 gavl_video_frame_t * dst,
2799 const gavl_video_format_t * format);
2800
2813
2814GAVL_PUBLIC
2815 void gavl_video_frame_copy(const gavl_video_format_t * format,
2816 gavl_video_frame_t * dst,
2817 const gavl_video_frame_t * src);
2818
2830
2831GAVL_PUBLIC
2832 void gavl_video_frame_copy_plane(const gavl_video_format_t * format,
2833 gavl_video_frame_t * dst,
2834 const gavl_video_frame_t * src, int plane);
2835
2846
2847GAVL_PUBLIC
2848 void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format,
2849 gavl_video_frame_t * dst,
2850 const gavl_video_frame_t * src);
2851
2862
2863GAVL_PUBLIC
2864 void gavl_video_frame_copy_flip_y(const gavl_video_format_t * format,
2865 gavl_video_frame_t * dst,
2866 const gavl_video_frame_t * src);
2867
2878
2879GAVL_PUBLIC
2880 void gavl_video_frame_copy_flip_xy(const gavl_video_format_t * format,
2881 gavl_video_frame_t * dst,
2882 const gavl_video_frame_t * src);
2883
2895
2896GAVL_PUBLIC
2897 void gavl_video_frame_copy_metadata(gavl_video_frame_t * dst,
2898 const gavl_video_frame_t * src);
2899
2900
2917
2918GAVL_PUBLIC
2919 void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat,
2920 const gavl_video_frame_t * src,
2921 gavl_video_frame_t * dst,
2922 const gavl_rectangle_i_t * src_rect);
2923
2938
2939GAVL_PUBLIC
2940 void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat,
2941 const gavl_video_frame_t * src,
2942 gavl_video_frame_t * dst,
2943 int field);
2944
2945
2946
2958
2959GAVL_PUBLIC
2960 void gavl_video_frame_dump(gavl_video_frame_t * frame,
2961 const gavl_video_format_t * format,
2962 const char * namebase);
2963
2973
2974GAVL_PUBLIC
2975 void gavl_video_frame_dump_metadata(const gavl_video_format_t * format,
2976 const gavl_video_frame_t * frame);
2977
2987
2988GAVL_PUBLIC
2989 void gavl_video_frame_set_strides(gavl_video_frame_t * frame,
2990 const gavl_video_format_t * format);
2991
3002
3003
3004GAVL_PUBLIC
3005 void gavl_video_frame_set_planes(gavl_video_frame_t * frame,
3006 const gavl_video_format_t * format,
3007 uint8_t * buffer);
3008
3019
3020GAVL_PUBLIC
3021 int gavl_video_frame_continuous(const gavl_video_format_t * format,
3022 const gavl_video_frame_t * frame);
3023
3024
3038
3039GAVL_PUBLIC
3040 int gavl_video_frame_extract_channel(const gavl_video_format_t * format,
3041 gavl_color_channel_t ch,
3042 const gavl_video_frame_t * src,
3043 gavl_video_frame_t * dst);
3044
3058
3059
3060GAVL_PUBLIC
3061 int gavl_video_frame_insert_channel(const gavl_video_format_t * format,
3062 gavl_color_channel_t ch,
3063 const gavl_video_frame_t * src,
3064 gavl_video_frame_t * dst);
3065
3066
3077
3078GAVL_PUBLIC
3079 int gavl_video_frames_equal(const gavl_video_format_t * format,
3080 const gavl_video_frame_t * f1,
3081 const gavl_video_frame_t * f2);
3082
3083GAVL_PUBLIC
3084void gavl_video_frame_normalize_orientation(const gavl_video_format_t * in_format,
3085 const gavl_video_format_t * out_format,
3086 const gavl_video_frame_t * in_frame,
3087 gavl_video_frame_t * out_frame);
3088
3089GAVL_PUBLIC
3090void gavl_video_frame_to_packet_metadata(const gavl_video_frame_t * frame,
3091 gavl_packet_t * pkt);
3092
3093GAVL_PUBLIC
3094void gavl_packet_to_video_frame_metadata(const gavl_packet_t * p, gavl_video_frame_t * frame);
3095
3096GAVL_PUBLIC
3097void gavl_video_frame_set_from_packet(gavl_video_frame_t * frame,
3098 const gavl_video_format_t * format,
3099 gavl_packet_t * p);
3100
3101/*****************************
3102 Conversion options
3103******************************/
3104
3108
3112
3119
3120#define GAVL_FORCE_DEINTERLACE (1<<0)
3121
3125
3126#define GAVL_CONVOLVE_CHROMA (1<<1)
3127
3131
3132#define GAVL_CONVOLVE_NORMALIZE (1<<2)
3133
3140
3141#define GAVL_RESAMPLE_CHROMA (1<<3)
3142
3148
3149#define GAVL_FORCE_SW (1<<4)
3150
3157
3158 typedef enum
3159 {
3160 GAVL_ALPHA_IGNORE = 0,
3161 GAVL_ALPHA_BLEND_COLOR
3162 } gavl_alpha_mode_t;
3163
3169
3170 typedef enum
3171 {
3172 GAVL_DEINTERLACE_NONE = 0,
3173 GAVL_DEINTERLACE_COPY = 1,
3174 GAVL_DEINTERLACE_SCALE = 2,
3175 GAVL_DEINTERLACE_BLEND = 3
3176 } gavl_deinterlace_mode_t;
3177
3183
3184 typedef enum
3185 {
3186 GAVL_DEINTERLACE_DROP_TOP,
3187 GAVL_DEINTERLACE_DROP_BOTTOM,
3188 } gavl_deinterlace_drop_mode_t;
3189
3193
3194 typedef enum
3195 {
3196 GAVL_SCALE_AUTO,
3197 GAVL_SCALE_NEAREST,
3198 GAVL_SCALE_BILINEAR,
3199 GAVL_SCALE_QUADRATIC,
3200 GAVL_SCALE_CUBIC_BSPLINE,
3201 GAVL_SCALE_CUBIC_MITCHELL,
3202 GAVL_SCALE_CUBIC_CATMULL,
3203 GAVL_SCALE_SINC_LANCZOS,
3204 GAVL_SCALE_NONE,
3205 } gavl_scale_mode_t;
3206
3215
3216 typedef enum
3217 {
3218 GAVL_DOWNSCALE_FILTER_AUTO = 0,
3219 GAVL_DOWNSCALE_FILTER_NONE,
3220 GAVL_DOWNSCALE_FILTER_WIDE,
3221 GAVL_DOWNSCALE_FILTER_GAUSS,
3222 } gavl_downscale_filter_t;
3223
3229
3230 typedef struct gavl_video_options_s gavl_video_options_t;
3231
3232/* Default Options */
3233
3238
3239GAVL_PUBLIC
3240 void gavl_video_options_set_defaults(gavl_video_options_t * opt);
3241
3250
3251GAVL_PUBLIC
3252 gavl_video_options_t * gavl_video_options_create(void);
3253
3259
3260GAVL_PUBLIC
3261 void gavl_video_options_copy(gavl_video_options_t * dst,
3262 const gavl_video_options_t * src);
3263
3268
3269GAVL_PUBLIC
3270 void gavl_video_options_destroy(gavl_video_options_t * opt);
3271
3272
3286
3287GAVL_PUBLIC
3288 void gavl_video_options_set_rectangles(gavl_video_options_t * opt,
3289 const gavl_rectangle_f_t * src_rect,
3290 const gavl_rectangle_i_t * dst_rect);
3291
3298
3299GAVL_PUBLIC
3300 void gavl_video_options_get_rectangles(const gavl_video_options_t * opt,
3301 gavl_rectangle_f_t * src_rect,
3302 gavl_rectangle_i_t * dst_rect);
3303
3309
3310GAVL_PUBLIC
3311 void gavl_video_options_set_quality(gavl_video_options_t * opt, int quality);
3312
3318
3319GAVL_PUBLIC
3320 int gavl_video_options_get_quality(const gavl_video_options_t * opt);
3321
3322
3328
3329GAVL_PUBLIC
3330 void gavl_video_options_set_conversion_flags(gavl_video_options_t * opt,
3331 int conversion_flags);
3332
3338
3339GAVL_PUBLIC
3340 int gavl_video_options_get_conversion_flags(const gavl_video_options_t * opt);
3341
3347
3348GAVL_PUBLIC
3349 void gavl_video_options_set_alpha_mode(gavl_video_options_t * opt,
3350 gavl_alpha_mode_t alpha_mode);
3351
3357
3358GAVL_PUBLIC gavl_alpha_mode_t
3359gavl_video_options_get_alpha_mode(const gavl_video_options_t * opt);
3360
3361
3367
3368GAVL_PUBLIC
3369 void gavl_video_options_set_scale_mode(gavl_video_options_t * opt,
3370 gavl_scale_mode_t scale_mode);
3371
3377
3378GAVL_PUBLIC gavl_scale_mode_t
3379gavl_video_options_get_scale_mode(const gavl_video_options_t * opt);
3380
3381
3387
3388GAVL_PUBLIC
3389 void gavl_video_options_set_scale_order(gavl_video_options_t * opt,
3390 int order);
3391
3397
3398GAVL_PUBLIC
3399 int gavl_video_options_get_scale_order(const gavl_video_options_t * opt);
3400
3401
3407
3408GAVL_PUBLIC
3409 void gavl_video_options_set_background_color(gavl_video_options_t * opt,
3410 const double * color);
3411
3417
3418GAVL_PUBLIC
3419 void gavl_video_options_get_background_color(const gavl_video_options_t * opt,
3420 double * color);
3421
3427
3428GAVL_PUBLIC
3429 void gavl_video_options_set_deinterlace_mode(gavl_video_options_t * opt,
3430 gavl_deinterlace_mode_t deinterlace_mode);
3431
3437
3438GAVL_PUBLIC gavl_deinterlace_mode_t
3439gavl_video_options_get_deinterlace_mode(const gavl_video_options_t * opt);
3440
3446
3447GAVL_PUBLIC
3448 void gavl_video_options_set_deinterlace_drop_mode(gavl_video_options_t * opt,
3449 gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3450
3456
3457GAVL_PUBLIC gavl_deinterlace_drop_mode_t
3458gavl_video_options_get_deinterlace_drop_mode(const gavl_video_options_t * opt);
3459
3467
3468GAVL_PUBLIC
3469 void gavl_video_options_set_downscale_filter(gavl_video_options_t * opt,
3470 gavl_downscale_filter_t f);
3471
3472
3480
3481GAVL_PUBLIC gavl_downscale_filter_t
3482gavl_video_options_get_downscale_filter(const gavl_video_options_t * opt);
3483
3500
3501GAVL_PUBLIC
3502 void gavl_video_options_set_downscale_blur(gavl_video_options_t * opt,
3503 float f);
3504
3512
3513GAVL_PUBLIC
3514 float gavl_video_options_get_downscale_blur(const gavl_video_options_t * opt);
3515
3516/* Set an externally created thread pool. If this is not called, a private thread pool will be created if needed.
3517 This function has the advantage that one thread pool can be shared among different elements of a video
3518 pipeline, which will reduce the overhead */
3519
3520GAVL_PUBLIC
3521void gavl_video_options_set_thread_pool(gavl_video_options_t * opt, gavl_thread_pool_t * tp);
3522
3523GAVL_PUBLIC
3524gavl_thread_pool_t * gavl_video_options_get_thread_pool(const gavl_video_options_t * opt);
3525
3526/***************************************************
3527 * Create and destroy video converters
3528 ***************************************************/
3529
3555
3561
3562 typedef struct gavl_video_converter_s gavl_video_converter_t;
3563
3568
3569GAVL_PUBLIC
3570 gavl_video_converter_t * gavl_video_converter_create(void);
3571
3576
3577GAVL_PUBLIC
3578 void gavl_video_converter_destroy(gavl_video_converter_t*cnv);
3579
3580/**************************************************
3581 * Get options. Change the options with the gavl_video_options_set_*
3582 * functions above
3583 **************************************************/
3584
3592
3593GAVL_PUBLIC gavl_video_options_t *
3594gavl_video_converter_get_options(gavl_video_converter_t*cnv);
3595
3596
3609
3610GAVL_PUBLIC
3611 int gavl_video_converter_init(gavl_video_converter_t* cnv,
3612 const gavl_video_format_t * input_format,
3613 const gavl_video_format_t * output_format);
3614
3626
3627GAVL_PUBLIC
3628 int gavl_video_converter_reinit(gavl_video_converter_t* cnv);
3629
3630
3631/***************************************************
3632 * Convert a frame
3633 ***************************************************/
3634
3641
3642GAVL_PUBLIC
3643 void gavl_video_convert(gavl_video_converter_t * cnv,
3644 const gavl_video_frame_t * input_frame,
3645 gavl_video_frame_t * output_frame);
3646
3647
3672
3678
3679 typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3680
3685
3686GAVL_PUBLIC
3687 gavl_video_scaler_t * gavl_video_scaler_create(void);
3688
3693
3694GAVL_PUBLIC
3695 void gavl_video_scaler_destroy(gavl_video_scaler_t * scaler);
3696
3704
3705GAVL_PUBLIC gavl_video_options_t *
3706gavl_video_scaler_get_options(gavl_video_scaler_t * scaler);
3707
3718
3719
3720GAVL_PUBLIC
3721 int gavl_video_scaler_init(gavl_video_scaler_t * scaler,
3722 const gavl_video_format_t * src_format,
3723 const gavl_video_format_t * dst_format);
3724
3744
3745
3746GAVL_PUBLIC
3747 int gavl_video_scaler_init_convolve(gavl_video_scaler_t * scaler,
3748 const gavl_video_format_t * format,
3749 int h_radius, const float * h_coeffs,
3750 int v_radius, const float * v_coeffs);
3751
3758
3759GAVL_PUBLIC
3760 void gavl_video_scaler_scale(gavl_video_scaler_t * scaler,
3761 const gavl_video_frame_t * input_frame,
3762 gavl_video_frame_t * output_frame);
3763
3771
3777
3778
3779 typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3780
3785
3786GAVL_PUBLIC
3787 gavl_video_deinterlacer_t * gavl_video_deinterlacer_create(void);
3788
3793
3794GAVL_PUBLIC
3795 void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t * deinterlacer);
3796
3804
3805GAVL_PUBLIC gavl_video_options_t *
3806gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t * deinterlacer);
3807
3817
3818GAVL_PUBLIC
3819 int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t * deinterlacer,
3820 const gavl_video_format_t * src_format);
3821
3822
3829
3830GAVL_PUBLIC
3831 void gavl_video_deinterlacer_deinterlace(gavl_video_deinterlacer_t * deinterlacer,
3832 const gavl_video_frame_t * input_frame,
3833 gavl_video_frame_t * output_frame);
3834
3835
3836
3837/**************************************************
3838 * Transparent overlays
3839 **************************************************/
3840
3841/* Overlay struct */
3842
3862
3869
3870 typedef gavl_video_frame_t gavl_overlay_t;
3871
3877
3878 typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3879
3884
3885GAVL_PUBLIC
3886 gavl_overlay_blend_context_t * gavl_overlay_blend_context_create(void);
3887
3892
3893GAVL_PUBLIC
3894 void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t * ctx);
3895
3901
3902GAVL_PUBLIC gavl_video_options_t *
3903gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t * ctx);
3904
3919
3920GAVL_PUBLIC
3921 int gavl_overlay_blend_context_init(gavl_overlay_blend_context_t * ctx,
3922 const gavl_video_format_t * frame_format,
3923 gavl_video_format_t * overlay_format);
3924
3933
3934GAVL_PUBLIC
3935 void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t * ctx,
3936 gavl_overlay_t * ovl);
3937
3943
3944GAVL_PUBLIC
3945 void gavl_overlay_blend(gavl_overlay_blend_context_t * ctx,
3946 gavl_video_frame_t * dst_frame);
3947
3953
3954GAVL_PUBLIC gavl_video_sink_t *
3955gavl_overlay_blend_context_get_sink(gavl_overlay_blend_context_t * ctx);
3956
3972
3977
3978 typedef struct gavl_image_transform_s gavl_image_transform_t;
3979
3992
3993 typedef void (*gavl_image_transform_func)(void * priv,
3994 double xdst,
3995 double ydst,
3996 double * xsrc,
3997 double * ysrc);
3998
3999
4005
4006GAVL_PUBLIC
4007 gavl_image_transform_t * gavl_image_transform_create(void);
4008
4013
4014GAVL_PUBLIC
4015 void gavl_image_transform_destroy(gavl_image_transform_t * t);
4016
4033
4034
4035GAVL_PUBLIC
4036 int gavl_image_transform_init(gavl_image_transform_t * t,
4037 gavl_video_format_t * format,
4038 gavl_image_transform_func func, void * priv);
4039
4046
4047GAVL_PUBLIC
4048 void gavl_image_transform_transform(gavl_image_transform_t * t,
4049 gavl_video_frame_t * in_frame,
4050 gavl_video_frame_t * out_frame);
4051
4061
4062GAVL_PUBLIC gavl_video_options_t *
4063gavl_image_transform_get_options(gavl_image_transform_t * t);
4064
4068
4081
4086
4087 typedef struct
4088 {
4089 int64_t offset;
4090 /* Primary */
4091 int64_t num_entries;
4092 int64_t entries_alloc;
4093
4094 struct
4095 {
4096 int64_t num_frames;
4097 int64_t duration;
4098 } * entries;
4099
4100 int num_timecodes;
4101 int timecodes_alloc;
4102
4103 struct
4104 {
4105 int64_t pts;
4106 gavl_timecode_t tc;
4107 } * timecodes;
4108
4109 /* Secondary */
4110
4111 } gavl_frame_table_t;
4112
4118GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create(void);
4119
4129
4130GAVL_PUBLIC gavl_frame_table_t *
4131gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
4132 gavl_timecode_format_t * fmt_ret);
4133
4143
4144GAVL_PUBLIC gavl_frame_table_t *
4145gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
4146 int64_t num_frames,
4147 gavl_timecode_t start_timecode);
4148
4155
4156GAVL_PUBLIC gavl_frame_table_t *
4157gavl_frame_table_copy(const gavl_frame_table_t * tab);
4158
4159
4160
4166
4167GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t * t);
4168
4175
4176GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
4177
4185
4186GAVL_PUBLIC void
4187gavl_frame_table_append_timecode(gavl_frame_table_t * t,
4188 int64_t pts, gavl_timecode_t tc);
4189
4199
4200GAVL_PUBLIC int64_t
4201gavl_frame_table_frame_to_time(const gavl_frame_table_t * t,
4202 int64_t frame, int * duration);
4203
4213
4214GAVL_PUBLIC int64_t
4215gavl_frame_table_time_to_frame(const gavl_frame_table_t * t,
4216 int64_t time,
4217 int64_t * start_time);
4218
4228
4229GAVL_PUBLIC gavl_timecode_t
4230gavl_frame_table_time_to_timecode(const gavl_frame_table_t * t,
4231 int64_t time,
4232 int64_t * start_time,
4233 const gavl_timecode_format_t * fmt);
4234
4243
4244GAVL_PUBLIC int64_t
4245gavl_frame_table_timecode_to_time(const gavl_frame_table_t * t,
4246 gavl_timecode_t tc,
4247 const gavl_timecode_format_t * fmt);
4248
4249
4259
4260GAVL_PUBLIC gavl_timecode_t
4261gavl_frame_table_frame_to_timecode(const gavl_frame_table_t * t,
4262 int64_t frame,
4263 int64_t * start_time,
4264 const gavl_timecode_format_t * fmt);
4265
4266
4267
4274
4275GAVL_PUBLIC int64_t
4276gavl_frame_table_num_frames(const gavl_frame_table_t * t);
4277
4284
4285GAVL_PUBLIC int64_t
4286gavl_frame_table_duration(const gavl_frame_table_t * t);
4287
4294
4295GAVL_PUBLIC int64_t
4296gavl_frame_table_end_time(const gavl_frame_table_t * t);
4297
4305
4306GAVL_PUBLIC
4307 int gavl_frame_table_save(const gavl_frame_table_t * t,
4308 const char * filename);
4309
4316
4317GAVL_PUBLIC
4318 gavl_frame_table_t * gavl_frame_table_load(const char * filename);
4319
4325
4326GAVL_PUBLIC void
4327gavl_frame_table_dump(const gavl_frame_table_t * t);
4328
4332
4350
4355
4356 typedef struct gavl_video_frame_pool_s gavl_video_frame_pool_t;
4357
4363
4364GAVL_PUBLIC
4365 gavl_video_frame_pool_t *
4366gavl_video_frame_pool_create(gavl_hw_context_t * hwctx);
4367
4372
4373GAVL_PUBLIC
4374gavl_video_frame_t * gavl_video_frame_pool_get(gavl_video_frame_pool_t *p);
4375
4376GAVL_PUBLIC
4377void gavl_video_frame_pool_release(gavl_video_frame_t * frame);
4378
4379GAVL_PUBLIC
4380int gavl_video_frame_pool_set_format(gavl_video_frame_pool_t *p, const gavl_video_format_t * fmt);
4381
4382GAVL_PUBLIC
4383const gavl_video_format_t * gavl_video_frame_pool_get_format(const gavl_video_frame_pool_t *p);
4384
4391
4392GAVL_PUBLIC
4393 void gavl_video_frame_pool_destroy(gavl_video_frame_pool_t *p);
4394
4401
4402GAVL_PUBLIC
4403 void gavl_video_frame_pool_reset(gavl_video_frame_pool_t *p);
4404
4405/* Debayer routines */
4406
4407#define GAVL_BAYER_GREEN_FIRST (1<<0)
4408#define GAVL_BAYER_BLUE_LINE (1<<1)
4409
4410// GB
4411// RG
4412#define GAVL_BAYER_GBRG (GAVL_BAYER_GREEN_FIRST|GAVL_BAYER_BLUE_LINE)
4413
4414// GR
4415// BG
4416#define GAVL_BAYER_GRBG (GAVL_BAYER_GREEN_FIRST)
4417
4418// BG
4419// GR
4420#define GAVL_BAYER_BGGR (GAVL_BAYER_BLUE_LINE)
4421
4422// RG
4423// GB
4424#define GAVL_BAYER_RGGB 0
4425
4426GAVL_PUBLIC
4427void gavl_video_frame_debayer(gavl_video_options_t * opt,
4428 gavl_video_frame_t * src, gavl_video_frame_t * dst,
4429 int bayer_format, gavl_video_format_t * dst_format);
4430
4431
4435
4436
4437#ifdef __cplusplus
4438}
4439#endif
4440
4441#endif /* GAVL_H_INCLUDED */
gavl_video_options_get_deinterlace_mode
GAVL_PUBLIC gavl_deinterlace_mode_t gavl_video_options_get_deinterlace_mode(const gavl_video_options_t *opt)
Get the deinterlace mode.
gavl_video_options_set_deinterlace_mode
GAVL_PUBLIC void gavl_video_options_set_deinterlace_mode(gavl_video_options_t *opt, gavl_deinterlace_mode_t deinterlace_mode)
Set the deinterlace mode.
gavl_accel_supported
GAVL_PUBLIC int gavl_accel_supported(void)
Get the supported acceleration flags.
gavl_audio_converter_get_options
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t *cnv)
gets options of an audio converter
gavl_audio_converter_resample
GAVL_PUBLIC void gavl_audio_converter_resample(gavl_audio_converter_t *cnv, gavl_audio_frame_t *input_frame, gavl_audio_frame_t *output_frame, double ratio)
Convert audio.
gavl_audio_converter_destroy
GAVL_PUBLIC void gavl_audio_converter_destroy(gavl_audio_converter_t *cnv)
Destroys an audio converter and frees all associated memory.
gavl_audio_converter_t
struct gavl_audio_converter_s gavl_audio_converter_t
Opaque audio converter structure.
Definition gavl.h:1189
gavl_audio_converter_create
GAVL_PUBLIC gavl_audio_converter_t * gavl_audio_converter_create(void)
Creates an audio converter.
gavl_audio_convert
GAVL_PUBLIC void gavl_audio_convert(gavl_audio_converter_t *cnv, const gavl_audio_frame_t *input_frame, gavl_audio_frame_t *output_frame)
Convert audio.
gavl_audio_converter_init
GAVL_PUBLIC int gavl_audio_converter_init(gavl_audio_converter_t *cnv, const gavl_audio_format_t *input_format, const gavl_audio_format_t *output_format)
Initialize an audio converter.
gavl_audio_converter_init_resample
GAVL_PUBLIC int gavl_audio_converter_init_resample(gavl_audio_converter_t *cnv, const gavl_audio_format_t *format)
Initialize an audio converter just for resampling.
gavl_audio_converter_set_resample_ratio
GAVL_PUBLIC int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t *cnv, double ratio)
Set samplerate conversion ratio.
gavl_audio_converter_reinit
GAVL_PUBLIC int gavl_audio_converter_reinit(gavl_audio_converter_t *cnv)
Reinitialize an audio converter.
gavl_channel_id_t
gavl_channel_id_t
Audio channel setup.
Definition gavl.h:248
gavl_sample_format_t
gavl_sample_format_t
Format of one audio sample.
Definition gavl.h:217
gavl_interleave_mode_to_short_string
GAVL_PUBLIC const char * gavl_interleave_mode_to_short_string(gavl_interleave_mode_t mode)
Convert a gavl_interleave_mode_t to a short string.
gavl_audio_format_copy
GAVL_PUBLIC void gavl_audio_format_copy(gavl_audio_format_t *dst, const gavl_audio_format_t *src)
Copy one audio format to another.
gavl_channel_index
GAVL_PUBLIC int gavl_channel_index(const gavl_audio_format_t *format, gavl_channel_id_t id)
Get the index of a particular channel for a given format.
gavl_side_channels
GAVL_PUBLIC int gavl_side_channels(const gavl_audio_format_t *format)
Get number of side channels for a given format.
gavl_set_channel_setup
GAVL_PUBLIC void gavl_set_channel_setup(gavl_audio_format_t *format)
Set the default channel setup and indices.
gavl_lfe_channels
GAVL_PUBLIC int gavl_lfe_channels(const gavl_audio_format_t *format)
Get number of LFE channels for a given format.
gavl_get_sample_format
GAVL_PUBLIC gavl_sample_format_t gavl_get_sample_format(int index)
Get the sample format from index.
gavl_channel_id_to_string
GAVL_PUBLIC const char * gavl_channel_id_to_string(gavl_channel_id_t id)
Convert a gavl_channel_id_t to a human readable string.
gavl_audio_format_dumpi
GAVL_PUBLIC void gavl_audio_format_dumpi(const gavl_audio_format_t *format, int indent)
Dump an audio format to stderr.
gavl_nearest_samplerate
GAVL_PUBLIC int gavl_nearest_samplerate(int in_rate, const int *supported)
Get the nearest samplerate out of a list of supported rates.
gavl_short_string_to_sample_format
GAVL_PUBLIC gavl_sample_format_t gavl_short_string_to_sample_format(const char *format)
Convert a short string to a gavl_sample_format_t.
gavl_sample_format_to_string
GAVL_PUBLIC const char * gavl_sample_format_to_string(gavl_sample_format_t format)
Convert a gavl_sample_format_t to a human readable string.
gavl_interleave_mode_t
gavl_interleave_mode_t
Definition gavl.h:234
gavl_string_to_sample_format
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format(const char *str)
Convert a string to a sample format.
gavl_front_channels
GAVL_PUBLIC int gavl_front_channels(const gavl_audio_format_t *format)
Get number of front channels for a given format.
gavl_sample_format_to_short_string
GAVL_PUBLIC const char * gavl_sample_format_to_short_string(gavl_sample_format_t format)
Convert a gavl_sample_format_t to a human readable string.
gavl_bytes_per_sample
GAVL_PUBLIC int gavl_bytes_per_sample(gavl_sample_format_t format)
Get the number of bytes per sample for a given sample format.
gavl_audio_format_dump
GAVL_PUBLIC void gavl_audio_format_dump(const gavl_audio_format_t *format)
Dump an audio format to stderr.
gavl_aux_channels
GAVL_PUBLIC int gavl_aux_channels(const gavl_audio_format_t *format)
Get number of aux channels for a given format.
gavl_rear_channels
GAVL_PUBLIC int gavl_rear_channels(const gavl_audio_format_t *format)
Get number of rear channels for a given format.
gavl_short_string_to_channel_id
GAVL_PUBLIC gavl_channel_id_t gavl_short_string_to_channel_id(const char *id)
Convert short string to a gavl_channel_id_t.
gavl_num_sample_formats
GAVL_PUBLIC int gavl_num_sample_formats(void)
Get total number of supported sample formats.
gavl_interleave_mode_to_string
GAVL_PUBLIC const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode)
Convert a gavl_interleave_mode_t to a human readable string.
gavl_channel_id_to_short_string
GAVL_PUBLIC const char * gavl_channel_id_to_short_string(gavl_channel_id_t id)
Convert a gavl_channel_id_t to a short string.
gavl_short_string_to_interleave_mode
GAVL_PUBLIC gavl_interleave_mode_t gavl_short_string_to_interleave_mode(const char *mode)
Convert a short string to a gavl_interleave_mode_t.
gavl_audio_formats_equal
GAVL_PUBLIC int gavl_audio_formats_equal(const gavl_audio_format_t *format_1, const gavl_audio_format_t *format_2)
Compare 2 audio formats.
GAVL_MAX_CHANNELS
#define GAVL_MAX_CHANNELS
Maximum number of audio channels.
Definition gavl.h:208
GAVL_CHID_SIDE_RIGHT
@ GAVL_CHID_SIDE_RIGHT
Definition gavl.h:259
GAVL_CHID_FRONT_RIGHT
@ GAVL_CHID_FRONT_RIGHT
Definition gavl.h:252
GAVL_CHID_FRONT_LEFT
@ GAVL_CHID_FRONT_LEFT
Definition gavl.h:251
GAVL_CHID_REAR_LEFT
@ GAVL_CHID_REAR_LEFT
Definition gavl.h:255
GAVL_CHID_SIDE_LEFT
@ GAVL_CHID_SIDE_LEFT
Definition gavl.h:258
GAVL_CHID_NONE
@ GAVL_CHID_NONE
Definition gavl.h:249
GAVL_CHID_FRONT_CENTER_LEFT
@ GAVL_CHID_FRONT_CENTER_LEFT
Definition gavl.h:253
GAVL_CHID_REAR_CENTER
@ GAVL_CHID_REAR_CENTER
Definition gavl.h:257
GAVL_CHID_LFE
@ GAVL_CHID_LFE
Definition gavl.h:260
GAVL_CHID_REAR_RIGHT
@ GAVL_CHID_REAR_RIGHT
Definition gavl.h:256
GAVL_CHID_AUX
@ GAVL_CHID_AUX
Definition gavl.h:261
GAVL_CHID_FRONT_CENTER_RIGHT
@ GAVL_CHID_FRONT_CENTER_RIGHT
Definition gavl.h:254
GAVL_CHID_FRONT_CENTER
@ GAVL_CHID_FRONT_CENTER
Definition gavl.h:250
GAVL_SAMPLE_FLOAT
@ GAVL_SAMPLE_FLOAT
Definition gavl.h:224
GAVL_SAMPLE_NONE
@ GAVL_SAMPLE_NONE
Definition gavl.h:218
GAVL_SAMPLE_U8
@ GAVL_SAMPLE_U8
Definition gavl.h:219
GAVL_SAMPLE_S8
@ GAVL_SAMPLE_S8
Definition gavl.h:220
GAVL_SAMPLE_U16
@ GAVL_SAMPLE_U16
Definition gavl.h:221
GAVL_SAMPLE_S16
@ GAVL_SAMPLE_S16
Definition gavl.h:222
GAVL_SAMPLE_DOUBLE
@ GAVL_SAMPLE_DOUBLE
Definition gavl.h:225
GAVL_SAMPLE_S32
@ GAVL_SAMPLE_S32
Definition gavl.h:223
GAVL_INTERLEAVE_2
@ GAVL_INTERLEAVE_2
Definition gavl.h:236
GAVL_INTERLEAVE_ALL
@ GAVL_INTERLEAVE_ALL
Definition gavl.h:237
GAVL_INTERLEAVE_NONE
@ GAVL_INTERLEAVE_NONE
Definition gavl.h:235
gavl_audio_frame_destroy
GAVL_PUBLIC void gavl_audio_frame_destroy(gavl_audio_frame_t *frame)
Destroy an audio frame.
gavl_audio_frame_from_data
GAVL_PUBLIC void gavl_audio_frame_from_data(gavl_audio_frame_t *f, const gavl_audio_format_t *format, uint8_t *data, int len)
Set the channel pointers of an audio frame.
gavl_audio_frame_mute
GAVL_PUBLIC void gavl_audio_frame_mute(gavl_audio_frame_t *frame, const gavl_audio_format_t *format)
Mute an audio frame.
gavl_audio_frame_null
GAVL_PUBLIC void gavl_audio_frame_null(gavl_audio_frame_t *frame)
Zero all pointers in the audio frame.
gavl_audio_frame_set_channels
GAVL_PUBLIC void gavl_audio_frame_set_channels(gavl_audio_frame_t *f, const gavl_audio_format_t *format, uint8_t *data)
Set the channel pointers of an audio frame.
gavl_audio_frame_mute_samples
GAVL_PUBLIC void gavl_audio_frame_mute_samples(gavl_audio_frame_t *frame, const gavl_audio_format_t *format, int num_samples)
Mute a number of samples at the start of an audio frame.
gavl_audio_frame_copy
GAVL_PUBLIC int gavl_audio_frame_copy(const gavl_audio_format_t *format, gavl_audio_frame_t *dst, const gavl_audio_frame_t *src, int dst_pos, int src_pos, int dst_size, int src_size)
Copy audio data from one frame to another.
gavl_audio_frame_skip
GAVL_PUBLIC int gavl_audio_frame_skip(const gavl_audio_format_t *format, gavl_audio_frame_t *f, int num_samples)
Skip samples in am audio frame.
gavl_audio_frame_create
GAVL_PUBLIC gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t *format)
Create audio frame.
gavl_audio_frame_get_subframe
GAVL_PUBLIC void gavl_audio_frame_get_subframe(const gavl_audio_format_t *format, gavl_audio_frame_t *src, gavl_audio_frame_t *dst, int start, int len)
Set an audio frame to a subframe of another frame.
gavl_audio_frame_mute_channel
GAVL_PUBLIC void gavl_audio_frame_mute_channel(gavl_audio_frame_t *frame, const gavl_audio_format_t *format, int channel)
Mute a single channel of an audio frame.
gavl_audio_frame_plot
GAVL_PUBLIC int gavl_audio_frame_plot(const gavl_audio_format_t *format, const gavl_audio_frame_t *frame, const char *name_base)
Plot an audio frame to an ASCII file.
gavl_audio_frames_equal
GAVL_PUBLIC int gavl_audio_frames_equal(const gavl_audio_format_t *format, const gavl_audio_frame_t *f1, const gavl_audio_frame_t *f2)
Check if 2 audio frames are bit-identical.
gavl_audio_frame_copy_ptrs
GAVL_PUBLIC void gavl_audio_frame_copy_ptrs(const gavl_audio_format_t *format, gavl_audio_frame_t *dst, const gavl_audio_frame_t *src)
Copy audio data from one frame to another.
gavl_audio_frame_continuous
GAVL_PUBLIC int gavl_audio_frame_continuous(const gavl_audio_format_t *format, const gavl_audio_frame_t *f)
Check if an audio frames is continuous in memory.
gavl_audio_options_t
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition gavl.h:1004
gavl_audio_options_set_resample_mode
GAVL_PUBLIC void gavl_audio_options_set_resample_mode(gavl_audio_options_t *opt, gavl_resample_mode_t mode)
Set the resample mode for the converter.
gavl_audio_options_create
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_options_create(void)
Create an options container.
gavl_audio_options_copy
GAVL_PUBLIC void gavl_audio_options_copy(gavl_audio_options_t *dst, const gavl_audio_options_t *src)
Copy audio options.
gavl_audio_dither_mode_t
gavl_audio_dither_mode_t
Dither mode.
Definition gavl.h:976
gavl_audio_options_set_conversion_flags
GAVL_PUBLIC void gavl_audio_options_set_conversion_flags(gavl_audio_options_t *opt, int flags)
Set the conversion flags.
gavl_audio_options_get_dither_mode
GAVL_PUBLIC gavl_audio_dither_mode_t gavl_audio_options_get_dither_mode(const gavl_audio_options_t *opt)
Get the dither mode for the converter.
gavl_audio_options_set_defaults
GAVL_PUBLIC void gavl_audio_options_set_defaults(gavl_audio_options_t *opt)
Set all options to their defaults.
gavl_audio_options_set_mix_matrix
GAVL_PUBLIC void gavl_audio_options_set_mix_matrix(gavl_audio_options_t *opt, const double **matrix)
Set a user defined mix matrix.
gavl_audio_options_set_dither_mode
GAVL_PUBLIC void gavl_audio_options_set_dither_mode(gavl_audio_options_t *opt, gavl_audio_dither_mode_t mode)
Set the dither mode for the converter.
gavl_resample_mode_t
gavl_resample_mode_t
Resample mode.
Definition gavl.h:989
gavl_audio_options_get_mix_matrix
GAVL_PUBLIC const double ** gavl_audio_options_get_mix_matrix(const gavl_audio_options_t *opt)
Get the mix matrix.
gavl_audio_options_get_quality
GAVL_PUBLIC int gavl_audio_options_get_quality(const gavl_audio_options_t *opt)
Get the quality level for a converter.
gavl_audio_options_get_resample_mode
GAVL_PUBLIC gavl_resample_mode_t gavl_audio_options_get_resample_mode(const gavl_audio_options_t *opt)
Get the resample mode for the converter.
gavl_audio_options_destroy
GAVL_PUBLIC void gavl_audio_options_destroy(gavl_audio_options_t *opt)
Destroy audio options.
gavl_audio_options_get_conversion_flags
GAVL_PUBLIC int gavl_audio_options_get_conversion_flags(const gavl_audio_options_t *opt)
Get the conversion flags.
gavl_audio_options_set_quality
GAVL_PUBLIC void gavl_audio_options_set_quality(gavl_audio_options_t *opt, int quality)
Set the quality level for the converter.
GAVL_RESAMPLE_SINC_BEST
@ GAVL_RESAMPLE_SINC_BEST
Definition gavl.h:995
GAVL_RESAMPLE_ZOH
@ GAVL_RESAMPLE_ZOH
Definition gavl.h:991
GAVL_RESAMPLE_LINEAR
@ GAVL_RESAMPLE_LINEAR
Definition gavl.h:992
GAVL_RESAMPLE_AUTO
@ GAVL_RESAMPLE_AUTO
Definition gavl.h:990
GAVL_RESAMPLE_SINC_MEDIUM
@ GAVL_RESAMPLE_SINC_MEDIUM
Definition gavl.h:994
GAVL_RESAMPLE_SINC_FAST
@ GAVL_RESAMPLE_SINC_FAST
Definition gavl.h:993
gavl_frame_table_save
GAVL_PUBLIC int gavl_frame_table_save(const gavl_frame_table_t *t, const char *filename)
Save a frame table to a file.
gavl_frame_table_end_time
GAVL_PUBLIC int64_t gavl_frame_table_end_time(const gavl_frame_table_t *t)
get the end time of the last frame
gavl_frame_table_load
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_load(const char *filename)
Load a frame table from a file.
gavl_frame_table_frame_to_time
GAVL_PUBLIC int64_t gavl_frame_table_frame_to_time(const gavl_frame_table_t *t, int64_t frame, int *duration)
Convert a frame index to a timestamp.
gavl_frame_table_create
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create(void)
Create a frame table.
gavl_frame_table_frame_to_timecode
GAVL_PUBLIC gavl_timecode_t gavl_frame_table_frame_to_timecode(const gavl_frame_table_t *t, int64_t frame, int64_t *start_time, const gavl_timecode_format_t *fmt)
Convert a frame index to a timecode.
gavl_frame_table_dump
GAVL_PUBLIC void gavl_frame_table_dump(const gavl_frame_table_t *t)
Dump a frame table to stderr for debugging.
gavl_frame_table_time_to_timecode
GAVL_PUBLIC gavl_timecode_t gavl_frame_table_time_to_timecode(const gavl_frame_table_t *t, int64_t time, int64_t *start_time, const gavl_timecode_format_t *fmt)
Convert a timestamp to a timecode.
gavl_frame_table_time_to_frame
GAVL_PUBLIC int64_t gavl_frame_table_time_to_frame(const gavl_frame_table_t *t, int64_t time, int64_t *start_time)
Convert a timestamp to a frame index.
gavl_frame_table_duration
GAVL_PUBLIC int64_t gavl_frame_table_duration(const gavl_frame_table_t *t)
get the total duration of all frames
gavl_frame_table_destroy
GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t *t)
Destroy a frame table and free all memory.
gavl_frame_table_num_frames
GAVL_PUBLIC int64_t gavl_frame_table_num_frames(const gavl_frame_table_t *t)
get the total number of frames
gavl_frame_table_create_cfr
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration, int64_t num_frames, gavl_timecode_t start_timecode)
Create a frame table for constant framerate video.
gavl_frame_table_append_entry
GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t *t, int64_t duration)
Append an entry.
gavl_frame_table_append_timecode
GAVL_PUBLIC void gavl_frame_table_append_timecode(gavl_frame_table_t *t, int64_t pts, gavl_timecode_t tc)
Append a timecodes.
gavl_frame_table_create_audio
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration, gavl_timecode_format_t *fmt_ret)
Create a frame table for an audio stream.
gavl_frame_table_timecode_to_time
GAVL_PUBLIC int64_t gavl_frame_table_timecode_to_time(const gavl_frame_table_t *t, gavl_timecode_t tc, const gavl_timecode_format_t *fmt)
Convert a timecode to a timestamp.
gavl_frame_table_copy
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_copy(const gavl_frame_table_t *tab)
Copy a frame table to another.
gavl_rectangle_f_crop_bottom
GAVL_PUBLIC void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the bottom border.
gavl_rectangle_f_is_empty
GAVL_PUBLIC int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t *r)
Check if a float rectangle is empty.
gavl_rectangle_i_is_empty
GAVL_PUBLIC int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t *r)
Check if an integer rectangle is empty.
gavl_rectangle_f_crop_left
GAVL_PUBLIC void gavl_rectangle_f_crop_left(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the left border.
gavl_rectangle_i_align
GAVL_PUBLIC void gavl_rectangle_i_align(gavl_rectangle_i_t *r, int h_align, int v_align)
Align a rectangle.
gavl_rectangle_crop_to_format_scale
GAVL_PUBLIC void gavl_rectangle_crop_to_format_scale(gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Crop 2 rectangles to their formats when scaling is available.
gavl_rectangle_i_copy
GAVL_PUBLIC void gavl_rectangle_i_copy(gavl_rectangle_i_t *dst, const gavl_rectangle_i_t *src)
Copy an integer rectangle.
gavl_rectangle_f_crop_right
GAVL_PUBLIC void gavl_rectangle_f_crop_right(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the right border.
gavl_rectangle_i_dump
GAVL_PUBLIC void gavl_rectangle_i_dump(const gavl_rectangle_i_t *r)
Dump a rectangle to stderr.
gavl_rectangle_i_crop_top
GAVL_PUBLIC void gavl_rectangle_i_crop_top(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the top border.
gavl_rectangle_i_crop_to_format
GAVL_PUBLIC void gavl_rectangle_i_crop_to_format(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Crop an integer rectangle so it fits into the image size of a video format.
gavl_rectangle_crop_to_format_noscale
GAVL_PUBLIC void gavl_rectangle_crop_to_format_noscale(gavl_rectangle_i_t *src_rect, gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Set 2 rectangles as source and destination when no scaling is available.
gavl_rectangle_fit_aspect
GAVL_PUBLIC void gavl_rectangle_fit_aspect(gavl_rectangle_i_t *dst_rect, const gavl_video_format_t *src_format, const gavl_rectangle_f_t *src_rect, const gavl_video_format_t *dst_format, float zoom, float squeeze)
Calculate a destination rectangle for scaling.
gavl_rectangle_i_to_f
GAVL_PUBLIC void gavl_rectangle_i_to_f(gavl_rectangle_f_t *dst, const gavl_rectangle_i_t *src)
Convert an integer rectangle to a floating point rectangle.
gavl_rectangle_i_set_all
GAVL_PUBLIC void gavl_rectangle_i_set_all(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Let an integer rectangle span the whole image size of a video format.
gavl_rectangle_f_set_all
GAVL_PUBLIC void gavl_rectangle_f_set_all(gavl_rectangle_f_t *r, const gavl_video_format_t *format)
Let a float rectangle span the whole image size of a video format.
gavl_rectangle_f_copy
GAVL_PUBLIC void gavl_rectangle_f_copy(gavl_rectangle_f_t *dst, const gavl_rectangle_f_t *src)
Copy a float rectangle.
gavl_rectangle_f_to_i
GAVL_PUBLIC void gavl_rectangle_f_to_i(gavl_rectangle_i_t *dst, const gavl_rectangle_f_t *src)
Convert a floating point rectangle to an integer rectangle.
gavl_rectangle_f_crop_top
GAVL_PUBLIC void gavl_rectangle_f_crop_top(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the top border.
gavl_rectangle_f_dump
GAVL_PUBLIC void gavl_rectangle_f_dump(const gavl_rectangle_f_t *r)
Dump a floating point rectangle to stderr.
gavl_rectangle_i_crop_bottom
GAVL_PUBLIC void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the bottom border.
gavl_rectangle_i_align_to_format
GAVL_PUBLIC void gavl_rectangle_i_align_to_format(gavl_rectangle_i_t *r, const gavl_video_format_t *format)
Align a rectangle to a format.
gavl_rectangle_f_crop_to_format
GAVL_PUBLIC void gavl_rectangle_f_crop_to_format(gavl_rectangle_f_t *r, const gavl_video_format_t *format)
Crop a floating point rectangle so it fits into the image size of a video format.
gavl_rectangle_i_crop_left
GAVL_PUBLIC void gavl_rectangle_i_crop_left(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the left border.
gavl_rectangle_i_crop_right
GAVL_PUBLIC void gavl_rectangle_i_crop_right(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the right border.
gavl_video_sink_t
struct gavl_video_sink_s gavl_video_sink_t
Video sink.
Definition gavl.h:83
gavl_audio_sink_t
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:74
gavl_packet_sink_t
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition gavl.h:92
gavl_video_source_t
struct gavl_video_source_s gavl_video_source_t
Forward declaration of the video source.
Definition gavl.h:50
gavl_audio_source_t
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition gavl.h:58
gavl_packet_source_t
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition gavl.h:66
gavl_timecode_t
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition timecode.h:44
gavl_overlay_blend
GAVL_PUBLIC void gavl_overlay_blend(gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
Blend overlay onto video frame.
gavl_overlay_blend_context_create
GAVL_PUBLIC gavl_overlay_blend_context_t * gavl_overlay_blend_context_create(void)
Create a blend context.
gavl_overlay_blend_context_set_overlay
GAVL_PUBLIC void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t *ctx, gavl_overlay_t *ovl)
Set a new overlay.
gavl_overlay_t
gavl_video_frame_t gavl_overlay_t
Overlay structure.
Definition gavl.h:3870
gavl_overlay_blend_context_init
GAVL_PUBLIC int gavl_overlay_blend_context_init(gavl_overlay_blend_context_t *ctx, const gavl_video_format_t *frame_format, gavl_video_format_t *overlay_format)
Initialize the blend context.
gavl_overlay_blend_context_t
struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t
Opaque blend context.
Definition gavl.h:3878
gavl_overlay_blend_context_destroy
GAVL_PUBLIC void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t *ctx)
Destroy a blend context and free all associated memory.
gavl_overlay_blend_context_get_sink
GAVL_PUBLIC gavl_video_sink_t * gavl_overlay_blend_context_get_sink(gavl_overlay_blend_context_t *ctx)
Get the sink for overlays.
gavl_overlay_blend_context_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t *ctx)
Get options from a blend context.
gavl_video_converter_init
GAVL_PUBLIC int gavl_video_converter_init(gavl_video_converter_t *cnv, const gavl_video_format_t *input_format, const gavl_video_format_t *output_format)
Initialize a video converter.
gavl_video_converter_create
GAVL_PUBLIC gavl_video_converter_t * gavl_video_converter_create(void)
Creates a video converter.
gavl_video_converter_t
struct gavl_video_converter_s gavl_video_converter_t
Opaque video converter structure.
Definition gavl.h:3562
gavl_video_convert
GAVL_PUBLIC void gavl_video_convert(gavl_video_converter_t *cnv, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Convert video.
gavl_video_converter_reinit
GAVL_PUBLIC int gavl_video_converter_reinit(gavl_video_converter_t *cnv)
Reinitialize a video converter.
gavl_video_converter_destroy
GAVL_PUBLIC void gavl_video_converter_destroy(gavl_video_converter_t *cnv)
Destroys a video converter and frees all associated memory.
gavl_video_converter_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_converter_get_options(gavl_video_converter_t *cnv)
gets options of a video converter
gavl_video_deinterlacer_init
GAVL_PUBLIC int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_format_t *src_format)
Initialize a video deinterlacer.
gavl_video_deinterlacer_create
GAVL_PUBLIC gavl_video_deinterlacer_t * gavl_video_deinterlacer_create(void)
Create a video deinterlacer.
gavl_video_deinterlacer_t
struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t
Opaque deinterlacer structure.
Definition gavl.h:3779
gavl_video_deinterlacer_destroy
GAVL_PUBLIC void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t *deinterlacer)
Destroy a video deinterlacer.
gavl_video_deinterlacer_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t *deinterlacer)
gets options of a deinterlacer
gavl_video_deinterlacer_deinterlace
GAVL_PUBLIC void gavl_video_deinterlacer_deinterlace(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Deinterlace video.
gavl_video_format_set_frame_size
GAVL_PUBLIC void gavl_video_format_set_frame_size(gavl_video_format_t *format, int pad_h, int pad_v)
Set the frame size from the image size.
GAVL_PIXFMT_PLANAR
#define GAVL_PIXFMT_PLANAR
Definition gavl.h:1784
GAVL_PIXFMT_ALPHA
#define GAVL_PIXFMT_ALPHA
Definition gavl.h:1804
gavl_video_format_t
struct gavl_video_format_s gavl_video_format_t
Video format.
Definition gavl.h:102
gavl_pixelformat_conversion_penalty
GAVL_PUBLIC int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src, gavl_pixelformat_t dst)
Get the conversion penalty for pixelformat conversions.
gavl_pixelformat_bytes_per_pixel
GAVL_PUBLIC int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat)
Get bytes per pixel for packed formats.
gavl_chroma_placement_t
gavl_chroma_placement_t
Chroma placement.
Definition gavl.h:2249
GAVL_PIXFMT_GRAY
#define GAVL_PIXFMT_GRAY
Definition gavl.h:1809
gavl_get_color_channel_format
GAVL_PUBLIC int gavl_get_color_channel_format(const gavl_video_format_t *frame_format, gavl_video_format_t *channel_format, gavl_color_channel_t ch)
Get the video format for extracting/merging one channel.
gavl_framerate_mode_t
gavl_framerate_mode_t
Framerate mode.
Definition gavl.h:2290
gavl_pixelformat_e
gavl_pixelformat_e
Pixelformat definition.
Definition gavl.h:1816
gavl_short_string_to_framerate_mode
GAVL_PUBLIC gavl_framerate_mode_t gavl_short_string_to_framerate_mode(const char *mode)
Translate a short string into a framerate mode.
gavl_video_formats_equal
GAVL_PUBLIC int gavl_video_formats_equal(const gavl_video_format_t *format_1, const gavl_video_format_t *format_2)
Compare 2 video formats.
gavl_video_format_get_chroma_offset
GAVL_PUBLIC void gavl_video_format_get_chroma_offset(const gavl_video_format_t *format, int field, int plane, float *off_x, float *off_y)
Get the chroma offsets relative to the luma samples.
gavl_pixelformat_to_string
GAVL_PUBLIC const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a human readable string.
gavl_num_pixelformats
GAVL_PUBLIC int gavl_num_pixelformats(void)
Get total number of supported pixelformats.
gavl_video_format_dump
GAVL_PUBLIC void gavl_video_format_dump(const gavl_video_format_t *format)
Dump a video format to stderr.
gavl_video_format_get_image_size
GAVL_PUBLIC int gavl_video_format_get_image_size(const gavl_video_format_t *format)
Get the unpadded image size.
gavl_get_pixelformat
GAVL_PUBLIC gavl_pixelformat_t gavl_get_pixelformat(int index)
Get the pixelformat from index.
gavl_interlace_mode_to_short_string
GAVL_PUBLIC const char * gavl_interlace_mode_to_short_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a short string.
gavl_pixelformat_get_channel
GAVL_PUBLIC gavl_color_channel_t gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index)
Get the color channel.
gavl_interlace_mode_to_string
GAVL_PUBLIC const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a human readable string.
gavl_pixelformat_t
enum gavl_pixelformat_e gavl_pixelformat_t
Pixelformat.
Definition gavl.h:1951
gavl_short_string_to_pixelformat
GAVL_PUBLIC gavl_pixelformat_t gavl_short_string_to_pixelformat(const char *name)
Translate a short pixelformat name into a pixelformat.
gavl_chroma_placement_to_string
GAVL_PUBLIC const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode)
Translate a chroma placement into a human readable string.
gavl_pixelformat_get_masks
GAVL_PUBLIC const uint32_t * gavl_pixelformat_get_masks(gavl_pixelformat_t pixelformat)
Get the masks for the components.
gavl_chroma_placement_to_short_string
GAVL_PUBLIC const char * gavl_chroma_placement_to_short_string(gavl_chroma_placement_t mode)
Translate a chroma placement into a short string.
gavl_string_to_pixelformat
GAVL_PUBLIC gavl_pixelformat_t gavl_string_to_pixelformat(const char *name)
Translate a pixelformat name into a pixelformat.
gavl_interlace_mode_t
gavl_interlace_mode_t
Interlace mode.
Definition gavl.h:2331
GAVL_PIXFMT_RGB
#define GAVL_PIXFMT_RGB
Definition gavl.h:1789
gavl_framerate_mode_to_string
GAVL_PUBLIC const char * gavl_framerate_mode_to_string(gavl_framerate_mode_t mode)
Translate a framerate mode into a human readable string.
gavl_pixelformat_bits_per_pixel
GAVL_PUBLIC int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat)
Get the effective number of bits for one pixel.
GAVL_PIXFMT_YUV
#define GAVL_PIXFMT_YUV
Definition gavl.h:1794
gavl_pixelformat_num_planes
GAVL_PUBLIC int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat)
Get the number of planes.
gavl_color_channel_t
gavl_color_channel_t
Color channel definitions.
Definition gavl.h:1999
GAVL_PIXFMT_YUVJ
#define GAVL_PIXFMT_YUVJ
Definition gavl.h:1799
gavl_video_format_fit_to_source
GAVL_PUBLIC void gavl_video_format_fit_to_source(gavl_video_format_t *dst, const gavl_video_format_t *src)
Set the image size of a destination format from a source format.
gavl_pixelformat_to_short_string
GAVL_PUBLIC const char * gavl_pixelformat_to_short_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a short string.
gavl_video_format_copy
GAVL_PUBLIC void gavl_video_format_copy(gavl_video_format_t *dst, const gavl_video_format_t *src)
Copy one video format to another.
gavl_pixelformat_get_best
GAVL_PUBLIC gavl_pixelformat_t gavl_pixelformat_get_best(gavl_pixelformat_t src, const gavl_pixelformat_t *dst_supported, int *penalty)
Get the best destination format for a given source format.
gavl_video_format_dumpi
GAVL_PUBLIC void gavl_video_format_dumpi(const gavl_video_format_t *format, int indent)
Dump a video format to stderr.
gavl_pixelformat_bytes_per_component
GAVL_PUBLIC int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat)
Get bytes per component for planar formats.
gavl_short_string_to_interlace_mode
GAVL_PUBLIC gavl_interlace_mode_t gavl_short_string_to_interlace_mode(const char *mode)
Translate a short string to an interlace mode.
gavl_pixelformat_num_channels
GAVL_PUBLIC int gavl_pixelformat_num_channels(gavl_pixelformat_t pixelformat)
Get the number of channels.
gavl_interlace_mode_is_mixed
GAVL_PUBLIC int gavl_interlace_mode_is_mixed(gavl_interlace_mode_t mode)
Check if an interlace mode is mixed.
gavl_framerate_mode_to_short_string
GAVL_PUBLIC const char * gavl_framerate_mode_to_short_string(gavl_framerate_mode_t mode)
Translate a framerate mode into a short string.
gavl_get_field_format
GAVL_PUBLIC void gavl_get_field_format(const gavl_video_format_t *frame_format, gavl_video_format_t *field_format, int field)
Get the video format of one field.
gavl_short_string_to_chroma_placement
GAVL_PUBLIC gavl_chroma_placement_t gavl_short_string_to_chroma_placement(const char *mode)
Translate a short string into a chroma placement.
gavl_pixelformat_chroma_sub
GAVL_PUBLIC void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int *sub_h, int *sub_v)
Get the horizontal and vertical subsampling factors.
GAVL_CHROMA_PLACEMENT_DVPAL
@ GAVL_CHROMA_PLACEMENT_DVPAL
Definition gavl.h:2252
GAVL_CHROMA_PLACEMENT_MPEG2
@ GAVL_CHROMA_PLACEMENT_MPEG2
Definition gavl.h:2251
GAVL_CHROMA_PLACEMENT_DEFAULT
@ GAVL_CHROMA_PLACEMENT_DEFAULT
Definition gavl.h:2250
GAVL_FRAMERATE_UNKNOWN
@ GAVL_FRAMERATE_UNKNOWN
Definition gavl.h:2291
GAVL_FRAMERATE_CONSTANT
@ GAVL_FRAMERATE_CONSTANT
Definition gavl.h:2292
GAVL_FRAMERATE_STILL
@ GAVL_FRAMERATE_STILL
Definition gavl.h:2294
GAVL_FRAMERATE_VARIABLE
@ GAVL_FRAMERATE_VARIABLE
Definition gavl.h:2293
GAVL_YUVJ_420_P
@ GAVL_YUVJ_420_P
Definition gavl.h:1930
GAVL_YUV_422_P
@ GAVL_YUV_422_P
Definition gavl.h:1917
GAVL_BGR_24
@ GAVL_BGR_24
Definition gavl.h:1866
GAVL_YUV_410_P
@ GAVL_YUV_410_P
Definition gavl.h:1926
GAVL_RGB_48
@ GAVL_RGB_48
Definition gavl.h:1879
GAVL_RGB_32
@ GAVL_RGB_32
Definition gavl.h:1869
GAVL_YUV_420_P
@ GAVL_YUV_420_P
Definition gavl.h:1914
GAVL_GRAYA_32
@ GAVL_GRAYA_32
Definition gavl.h:1839
GAVL_YUVA_32
@ GAVL_YUVA_32
Definition gavl.h:1899
GAVL_RGB_16
@ GAVL_RGB_16
Definition gavl.h:1856
GAVL_UYVY
@ GAVL_UYVY
Definition gavl.h:1896
GAVL_YUV_422_P_16
@ GAVL_YUV_422_P_16
Definition gavl.h:1943
GAVL_YUV_444_P
@ GAVL_YUV_444_P
Definition gavl.h:1920
GAVL_RGB_FLOAT
@ GAVL_RGB_FLOAT
Definition gavl.h:1886
GAVL_YUVJ_422_P
@ GAVL_YUVJ_422_P
Definition gavl.h:1933
GAVL_GRAY_8
@ GAVL_GRAY_8
Definition gavl.h:1823
GAVL_RGB_24
@ GAVL_RGB_24
Definition gavl.h:1863
GAVL_RGBA_64
@ GAVL_RGBA_64
Definition gavl.h:1882
GAVL_YUY2
@ GAVL_YUY2
Definition gavl.h:1893
GAVL_YUVA_FLOAT
@ GAVL_YUVA_FLOAT
Definition gavl.h:1909
GAVL_YUVJ_444_P
@ GAVL_YUVJ_444_P
Definition gavl.h:1936
GAVL_GRAYA_FLOAT
@ GAVL_GRAYA_FLOAT
Definition gavl.h:1843
GAVL_BGR_15
@ GAVL_BGR_15
Definition gavl.h:1852
GAVL_YUV_444_P_16
@ GAVL_YUV_444_P_16
Definition gavl.h:1940
GAVL_PIXELFORMAT_NONE
@ GAVL_PIXELFORMAT_NONE
Undefined.
Definition gavl.h:1819
GAVL_GRAYA_16
@ GAVL_GRAYA_16
Definition gavl.h:1835
GAVL_YUV_411_P
@ GAVL_YUV_411_P
Definition gavl.h:1923
GAVL_GRAY_FLOAT
@ GAVL_GRAY_FLOAT
Definition gavl.h:1831
GAVL_YUV_FLOAT
@ GAVL_YUV_FLOAT
Definition gavl.h:1905
GAVL_RGBA_32
@ GAVL_RGBA_32
Definition gavl.h:1875
GAVL_GRAY_16
@ GAVL_GRAY_16
Definition gavl.h:1827
GAVL_BGR_16
@ GAVL_BGR_16
Definition gavl.h:1860
GAVL_YUVA_64
@ GAVL_YUVA_64
Definition gavl.h:1902
GAVL_RGB_15
@ GAVL_RGB_15
Definition gavl.h:1848
GAVL_RGBA_FLOAT
@ GAVL_RGBA_FLOAT
Definition gavl.h:1889
GAVL_BGR_32
@ GAVL_BGR_32
Definition gavl.h:1872
GAVL_INTERLACE_MIXED_BOTTOM
@ GAVL_INTERLACE_MIXED_BOTTOM
Definition gavl.h:2338
GAVL_INTERLACE_MIXED_TOP
@ GAVL_INTERLACE_MIXED_TOP
Definition gavl.h:2337
GAVL_INTERLACE_NONE
@ GAVL_INTERLACE_NONE
Definition gavl.h:2333
GAVL_INTERLACE_BOTTOM_FIRST
@ GAVL_INTERLACE_BOTTOM_FIRST
Definition gavl.h:2335
GAVL_INTERLACE_UNKNOWN
@ GAVL_INTERLACE_UNKNOWN
Definition gavl.h:2332
GAVL_INTERLACE_MIXED
@ GAVL_INTERLACE_MIXED
Definition gavl.h:2336
GAVL_INTERLACE_TOP_FIRST
@ GAVL_INTERLACE_TOP_FIRST
Definition gavl.h:2334
GAVL_CCH_NONE
@ GAVL_CCH_NONE
None/undefined.
Definition gavl.h:2000
GAVL_CCH_Y
@ GAVL_CCH_Y
Luminance (also grayscale).
Definition gavl.h:2004
GAVL_CCH_RED
@ GAVL_CCH_RED
Red.
Definition gavl.h:2001
GAVL_CCH_CR
@ GAVL_CCH_CR
Chrominance red (aka V).
Definition gavl.h:2006
GAVL_CCH_GREEN
@ GAVL_CCH_GREEN
Green.
Definition gavl.h:2002
GAVL_CCH_ALPHA
@ GAVL_CCH_ALPHA
Transparency (or, to be more precise opacity).
Definition gavl.h:2007
GAVL_CCH_CB
@ GAVL_CCH_CB
Chrominance blue (aka U).
Definition gavl.h:2005
GAVL_CCH_BLUE
@ GAVL_CCH_BLUE
Blue.
Definition gavl.h:2003
gavl_video_frame_pool_create
GAVL_PUBLIC gavl_video_frame_pool_t * gavl_video_frame_pool_create(gavl_hw_context_t *hwctx)
Create a video frame pool.
gavl_video_frame_pool_get
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_pool_get(gavl_video_frame_pool_t *p)
Create a video frame pool.
gavl_video_frame_pool_t
struct gavl_video_frame_pool_s gavl_video_frame_pool_t
Video frame pool.
Definition gavl.h:4356
gavl_video_frame_pool_destroy
GAVL_PUBLIC void gavl_video_frame_pool_destroy(gavl_video_frame_pool_t *p)
Destroy a video frame pool.
gavl_video_frame_pool_reset
GAVL_PUBLIC void gavl_video_frame_pool_reset(gavl_video_frame_pool_t *p)
Reset a video frame pool.
gavl_video_frame_copy
GAVL_PUBLIC void gavl_video_frame_copy(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another.
gavl_video_frame_copy_plane
GAVL_PUBLIC void gavl_video_frame_copy_plane(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src, int plane)
Copy a single plane from one video frame to another.
gavl_video_frame_destroy
GAVL_PUBLIC void gavl_video_frame_destroy(gavl_video_frame_t *frame)
Destroy a video frame.
gavl_video_frame_copy_flip_x
GAVL_PUBLIC void gavl_video_frame_copy_flip_x(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with horizontal flipping.
gavl_video_frame_set_strides
GAVL_PUBLIC void gavl_video_frame_set_strides(gavl_video_frame_t *frame, const gavl_video_format_t *format)
Set the strides according to the format.
gavl_video_frame_insert_channel
GAVL_PUBLIC int gavl_video_frame_insert_channel(const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst)
Insert one channel from a grayscale image into a video frame.
gavl_video_frame_set_planes
GAVL_PUBLIC void gavl_video_frame_set_planes(gavl_video_frame_t *frame, const gavl_video_format_t *format, uint8_t *buffer)
Set the frames according to the format.
gavl_video_frame_copy_flip_xy
GAVL_PUBLIC void gavl_video_frame_copy_flip_xy(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with horizontal and vertical flipping.
gavl_video_frame_get_subframe
GAVL_PUBLIC void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, const gavl_rectangle_i_t *src_rect)
Get a subframe of another frame.
gavl_video_frame_copy_metadata
GAVL_PUBLIC void gavl_video_frame_copy_metadata(gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy metadata of one video frame to another.
gavl_video_frame_fill
GAVL_PUBLIC void gavl_video_frame_fill(gavl_video_frame_t *frame, const gavl_video_format_t *format, const float *color)
Fill the frame with a user specified color.
gavl_video_frame_dump
GAVL_PUBLIC void gavl_video_frame_dump(gavl_video_frame_t *frame, const gavl_video_format_t *format, const char *namebase)
Dump a video frame to files.
gavl_video_frame_copy_flip_y
GAVL_PUBLIC void gavl_video_frame_copy_flip_y(const gavl_video_format_t *format, gavl_video_frame_t *dst, const gavl_video_frame_t *src)
Copy one video frame to another with vertical flipping.
gavl_video_frame_get_field
GAVL_PUBLIC void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, int field)
Get a field from a frame.
gavl_video_frame_psnr
GAVL_PUBLIC void gavl_video_frame_psnr(double *psnr, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format)
Calculate the PSNR of 2 source frames.
gavl_video_frame_absdiff
GAVL_PUBLIC void gavl_video_frame_absdiff(gavl_video_frame_t *dst, const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, const gavl_video_format_t *format)
Fill the frame with the absolute difference of 2 source frames.
gavl_video_frame_ssim
GAVL_PUBLIC int gavl_video_frame_ssim(const gavl_video_frame_t *src1, const gavl_video_frame_t *src2, gavl_video_frame_t *dst, const gavl_video_format_t *format)
Calculate the SSIM of 2 source frames.
gavl_video_frame_extract_channel
GAVL_PUBLIC int gavl_video_frame_extract_channel(const gavl_video_format_t *format, gavl_color_channel_t ch, const gavl_video_frame_t *src, gavl_video_frame_t *dst)
Extract one channel of a video frame into a grayscale image.
gavl_video_frame_create
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t *format)
Create video frame.
gavl_video_frame_null
GAVL_PUBLIC void gavl_video_frame_null(gavl_video_frame_t *frame)
Zero all pointers in the video frame.
gavl_video_frame_clear
GAVL_PUBLIC void gavl_video_frame_clear(gavl_video_frame_t *frame, const gavl_video_format_t *format)
Fill the frame with black color.
gavl_video_frame_continuous
GAVL_PUBLIC int gavl_video_frame_continuous(const gavl_video_format_t *format, const gavl_video_frame_t *frame)
Check if a video frame uses a continuous memory block.
gavl_video_frames_equal
GAVL_PUBLIC int gavl_video_frames_equal(const gavl_video_format_t *format, const gavl_video_frame_t *f1, const gavl_video_frame_t *f2)
Check if 2 video frames are bit-identical.
gavl_video_frame_create_nopad
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t *format)
Create video frame without padding.
gavl_video_frame_dump_metadata
GAVL_PUBLIC void gavl_video_frame_dump_metadata(const gavl_video_format_t *format, const gavl_video_frame_t *frame)
Dump a metadata of a video frame.
gavl_video_options_set_quality
GAVL_PUBLIC void gavl_video_options_set_quality(gavl_video_options_t *opt, int quality)
Set the quality level for the converter.
gavl_video_options_set_alpha_mode
GAVL_PUBLIC void gavl_video_options_set_alpha_mode(gavl_video_options_t *opt, gavl_alpha_mode_t alpha_mode)
Set the alpha mode.
gavl_video_options_get_rectangles
GAVL_PUBLIC void gavl_video_options_get_rectangles(const gavl_video_options_t *opt, gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect)
Get source and destination rectangles.
gavl_video_options_get_background_color
GAVL_PUBLIC void gavl_video_options_get_background_color(const gavl_video_options_t *opt, double *color)
Get the background color for alpha blending.
gavl_video_options_get_alpha_mode
GAVL_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode(const gavl_video_options_t *opt)
Get the alpha mode.
gavl_video_options_set_rectangles
GAVL_PUBLIC void gavl_video_options_set_rectangles(gavl_video_options_t *opt, const gavl_rectangle_f_t *src_rect, const gavl_rectangle_i_t *dst_rect)
Set source and destination rectangles.
gavl_video_options_destroy
GAVL_PUBLIC void gavl_video_options_destroy(gavl_video_options_t *opt)
Destroy video options.
gavl_video_options_get_quality
GAVL_PUBLIC int gavl_video_options_get_quality(const gavl_video_options_t *opt)
Get the quality level for the converter.
gavl_video_options_set_scale_mode
GAVL_PUBLIC void gavl_video_options_set_scale_mode(gavl_video_options_t *opt, gavl_scale_mode_t scale_mode)
Set the scale mode.
gavl_deinterlace_mode_t
gavl_deinterlace_mode_t
Definition gavl.h:3171
gavl_video_options_get_deinterlace_drop_mode
GAVL_PUBLIC gavl_deinterlace_drop_mode_t gavl_video_options_get_deinterlace_drop_mode(const gavl_video_options_t *opt)
Get the deinterlace drop mode.
gavl_video_options_copy
GAVL_PUBLIC void gavl_video_options_copy(gavl_video_options_t *dst, const gavl_video_options_t *src)
Copy video options.
gavl_deinterlace_drop_mode_t
gavl_deinterlace_drop_mode_t
Specifies which field to drop when deinterlacing.
Definition gavl.h:3185
gavl_video_options_t
struct gavl_video_options_s gavl_video_options_t
Definition gavl.h:3230
gavl_video_options_get_scale_order
GAVL_PUBLIC int gavl_video_options_get_scale_order(const gavl_video_options_t *opt)
Get the scale order for GAVL_SCALE_SINC_LANCZOS.
gavl_video_options_get_downscale_blur
GAVL_PUBLIC float gavl_video_options_get_downscale_blur(const gavl_video_options_t *opt)
Get blur factor for downscaling.
gavl_alpha_mode_t
gavl_alpha_mode_t
Definition gavl.h:3159
gavl_video_options_set_deinterlace_drop_mode
GAVL_PUBLIC void gavl_video_options_set_deinterlace_drop_mode(gavl_video_options_t *opt, gavl_deinterlace_drop_mode_t deinterlace_drop_mode)
Set the deinterlace drop mode.
gavl_video_options_get_downscale_filter
GAVL_PUBLIC gavl_downscale_filter_t gavl_video_options_get_downscale_filter(const gavl_video_options_t *opt)
Get the antialiasing filter for downscaling.
gavl_video_options_create
GAVL_PUBLIC gavl_video_options_t * gavl_video_options_create(void)
Create an options container.
gavl_video_options_set_defaults
GAVL_PUBLIC void gavl_video_options_set_defaults(gavl_video_options_t *opt)
Set all options to their defaults.
gavl_video_options_set_conversion_flags
GAVL_PUBLIC void gavl_video_options_set_conversion_flags(gavl_video_options_t *opt, int conversion_flags)
Set the conversion flags.
gavl_scale_mode_t
gavl_scale_mode_t
Definition gavl.h:3195
gavl_video_options_set_downscale_blur
GAVL_PUBLIC void gavl_video_options_set_downscale_blur(gavl_video_options_t *opt, float f)
Set blur factor for downscaling.
gavl_video_options_set_background_color
GAVL_PUBLIC void gavl_video_options_set_background_color(gavl_video_options_t *opt, const double *color)
Set the background color for alpha blending.
gavl_video_options_set_downscale_filter
GAVL_PUBLIC void gavl_video_options_set_downscale_filter(gavl_video_options_t *opt, gavl_downscale_filter_t f)
Set antialiasing filter for downscaling.
gavl_video_options_get_conversion_flags
GAVL_PUBLIC int gavl_video_options_get_conversion_flags(const gavl_video_options_t *opt)
Get the conversion flags.
gavl_video_options_set_scale_order
GAVL_PUBLIC void gavl_video_options_set_scale_order(gavl_video_options_t *opt, int order)
Set the scale order for GAVL_SCALE_SINC_LANCZOS.
gavl_downscale_filter_t
gavl_downscale_filter_t
Definition gavl.h:3217
gavl_video_options_get_scale_mode
GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode(const gavl_video_options_t *opt)
Get the scale mode.
GAVL_DEINTERLACE_NONE
@ GAVL_DEINTERLACE_NONE
Definition gavl.h:3172
GAVL_DEINTERLACE_SCALE
@ GAVL_DEINTERLACE_SCALE
Definition gavl.h:3174
GAVL_DEINTERLACE_BLEND
@ GAVL_DEINTERLACE_BLEND
Definition gavl.h:3175
GAVL_DEINTERLACE_COPY
@ GAVL_DEINTERLACE_COPY
Definition gavl.h:3173
GAVL_DEINTERLACE_DROP_TOP
@ GAVL_DEINTERLACE_DROP_TOP
Definition gavl.h:3186
GAVL_DEINTERLACE_DROP_BOTTOM
@ GAVL_DEINTERLACE_DROP_BOTTOM
Definition gavl.h:3187
GAVL_ALPHA_IGNORE
@ GAVL_ALPHA_IGNORE
Definition gavl.h:3160
GAVL_ALPHA_BLEND_COLOR
@ GAVL_ALPHA_BLEND_COLOR
Definition gavl.h:3161
GAVL_SCALE_NONE
@ GAVL_SCALE_NONE
Definition gavl.h:3204
GAVL_SCALE_NEAREST
@ GAVL_SCALE_NEAREST
Definition gavl.h:3197
GAVL_SCALE_CUBIC_MITCHELL
@ GAVL_SCALE_CUBIC_MITCHELL
Definition gavl.h:3201
GAVL_SCALE_AUTO
@ GAVL_SCALE_AUTO
Definition gavl.h:3196
GAVL_SCALE_SINC_LANCZOS
@ GAVL_SCALE_SINC_LANCZOS
Definition gavl.h:3203
GAVL_SCALE_CUBIC_CATMULL
@ GAVL_SCALE_CUBIC_CATMULL
Definition gavl.h:3202
GAVL_SCALE_CUBIC_BSPLINE
@ GAVL_SCALE_CUBIC_BSPLINE
Definition gavl.h:3200
GAVL_SCALE_QUADRATIC
@ GAVL_SCALE_QUADRATIC
Definition gavl.h:3199
GAVL_SCALE_BILINEAR
@ GAVL_SCALE_BILINEAR
Definition gavl.h:3198
GAVL_DOWNSCALE_FILTER_AUTO
@ GAVL_DOWNSCALE_FILTER_AUTO
Auto selection based on quality.
Definition gavl.h:3218
GAVL_DOWNSCALE_FILTER_NONE
@ GAVL_DOWNSCALE_FILTER_NONE
Fastest method, might produce heavy aliasing artifacts.
Definition gavl.h:3219
GAVL_DOWNSCALE_FILTER_WIDE
@ GAVL_DOWNSCALE_FILTER_WIDE
Widen the filter curve according to the scaling ratio.
Definition gavl.h:3220
GAVL_DOWNSCALE_FILTER_GAUSS
@ GAVL_DOWNSCALE_FILTER_GAUSS
Do a Gaussian preblur.
Definition gavl.h:3221
gavl_video_scaler_init
GAVL_PUBLIC int gavl_video_scaler_init(gavl_video_scaler_t *scaler, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
Initialize a video scaler.
gavl_video_scaler_destroy
GAVL_PUBLIC void gavl_video_scaler_destroy(gavl_video_scaler_t *scaler)
Destroy a video scaler.
gavl_video_scaler_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_video_scaler_get_options(gavl_video_scaler_t *scaler)
gets options of a scaler
gavl_video_scaler_create
GAVL_PUBLIC gavl_video_scaler_t * gavl_video_scaler_create(void)
Create a video scaler.
gavl_video_scaler_t
struct gavl_video_scaler_s gavl_video_scaler_t
Opaque scaler structure.
Definition gavl.h:3679
gavl_video_scaler_scale
GAVL_PUBLIC void gavl_video_scaler_scale(gavl_video_scaler_t *scaler, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
Scale video.
gavl_video_scaler_init_convolve
GAVL_PUBLIC int gavl_video_scaler_init_convolve(gavl_video_scaler_t *scaler, const gavl_video_format_t *format, int h_radius, const float *h_coeffs, int v_radius, const float *v_coeffs)
Initialize a video scaler as a generic convolver.
gavl_image_transform_destroy
GAVL_PUBLIC void gavl_image_transform_destroy(gavl_image_transform_t *t)
Destroy a transformation engine.
gavl_image_transform_create
GAVL_PUBLIC gavl_image_transform_t * gavl_image_transform_create(void)
Create a transformation engine.
gavl_image_transform_init
GAVL_PUBLIC int gavl_image_transform_init(gavl_image_transform_t *t, gavl_video_format_t *format, gavl_image_transform_func func, void *priv)
Initialize a transformation engine.
gavl_image_transform_get_options
GAVL_PUBLIC gavl_video_options_t * gavl_image_transform_get_options(gavl_image_transform_t *t)
Get transformation options.
gavl_image_transform_t
struct gavl_image_transform_s gavl_image_transform_t
Opaque image transformation engine.
Definition gavl.h:3978
gavl_image_transform_func
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition gavl.h:3993
gavl_image_transform_transform
GAVL_PUBLIC void gavl_image_transform_transform(gavl_image_transform_t *t, gavl_video_frame_t *in_frame, gavl_video_frame_t *out_frame)
Transform an image.
GAVL_MAX_PLANES
#define GAVL_MAX_PLANES
Definition gavl.h:1433
gavl_volume_control_set_volume
GAVL_PUBLIC void gavl_volume_control_set_volume(gavl_volume_control_t *ctrl, float volume)
Set volume for a volume control.
gavl_volume_control_apply
GAVL_PUBLIC void gavl_volume_control_apply(gavl_volume_control_t *ctrl, gavl_audio_frame_t *frame)
Apply a volume control for an audio frame.
gavl_volume_to_float
GAVL_PUBLIC float gavl_volume_to_float(int volume, float one, int steps)
Convert an integer audio volume to a float (in dB).
gavl_volume_control_destroy
GAVL_PUBLIC void gavl_volume_control_destroy(gavl_volume_control_t *ctrl)
Destroys a volume control and frees all associated memory.
gavl_volume_control_set_format
GAVL_PUBLIC void gavl_volume_control_set_format(gavl_volume_control_t *ctrl, const gavl_audio_format_t *format)
Set format for a volume control.
gavl_volume_control_t
struct gavl_volume_control_s gavl_volume_control_t
Opaque structure for a volume control.
Definition gavl.h:1351
gavl_volume_control_create
GAVL_PUBLIC gavl_volume_control_t * gavl_volume_control_create(void)
Create volume control.
gavl_volume_to_int
GAVL_PUBLIC int gavl_volume_to_int(float volume, float one, int steps)
Convert an audio volume (in dB) to an integer.
gavl_audio_format_t
Audio Format.
Definition gavl.h:273
gavl_audio_format_t::samples_per_frame
uint32_t samples_per_frame
Definition gavl.h:274
gavl_audio_format_t::samplerate
uint32_t samplerate
Definition gavl.h:275
gavl_audio_format_t::rear_level
float rear_level
Definition gavl.h:281
gavl_audio_format_t::interleave_mode
gavl_interleave_mode_t interleave_mode
Definition gavl.h:278
gavl_audio_format_t::sample_format
gavl_sample_format_t sample_format
Definition gavl.h:277
gavl_audio_format_t::num_channels
uint32_t num_channels
Definition gavl.h:276
gavl_audio_format_t::center_level
float center_level
Definition gavl.h:280
gavl_audio_format_t::channel_locations
gavl_channel_id_t channel_locations[GAVL_MAX_CHANNELS]
Definition gavl.h:283
gavl_audio_frame_t
Generic container for audio samples.
Definition gavl.h:624
gavl_audio_frame_t::channel_stride
int channel_stride
Definition gavl.h:629
gavl_audio_frame_t::samples
gavl_audio_samples_t samples
Definition gavl.h:625
gavl_audio_frame_t::valid_samples
int valid_samples
Definition gavl.h:627
gavl_audio_frame_t::timestamp
int64_t timestamp
Definition gavl.h:628
gavl_audio_frame_t::channels
gavl_audio_channels_t channels
Definition gavl.h:626
gavl_frame_table_t
frame table structure
Definition gavl.h:4088
gavl_frame_table_t::tc
gavl_timecode_t tc
Timecode associated with this timestamp.
Definition gavl.h:4106
gavl_frame_table_t::num_timecodes
int num_timecodes
Number of timecodes.
Definition gavl.h:4100
gavl_frame_table_t::num_frames
int64_t num_frames
Number of frames.
Definition gavl.h:4096
gavl_frame_table_t::duration
int64_t duration
Duration of each of these frames.
Definition gavl.h:4097
gavl_frame_table_t::offset
int64_t offset
Timestamp of the first frame.
Definition gavl.h:4089
gavl_frame_table_t::entries_alloc
int64_t entries_alloc
Number of allocated entries (never touch this).
Definition gavl.h:4092
gavl_frame_table_t::num_entries
int64_t num_entries
Number of entries.
Definition gavl.h:4091
gavl_frame_table_t::pts
int64_t pts
Timestamp of this frame.
Definition gavl.h:4105
gavl_frame_table_t::timecodes_alloc
int timecodes_alloc
Number of allocated timecodes (never touch this).
Definition gavl.h:4101
gavl_packet_s
Packet structure.
Definition compression.h:428
gavl_rectangle_f_t
Floating point rectangle.
Definition gavl.h:1458
gavl_rectangle_f_t::x
double x
Definition gavl.h:1459
gavl_rectangle_f_t::y
double y
Definition gavl.h:1460
gavl_rectangle_f_t::w
double w
Definition gavl.h:1461
gavl_rectangle_f_t::h
double h
Definition gavl.h:1462
gavl_rectangle_i_t
Integer rectangle.
Definition gavl.h:1446
gavl_rectangle_i_t::x
int32_t x
Definition gavl.h:1447
gavl_rectangle_i_t::h
int32_t h
Definition gavl.h:1450
gavl_rectangle_i_t::y
int32_t y
Definition gavl.h:1448
gavl_rectangle_i_t::w
int32_t w
Definition gavl.h:1449
gavl_timecode_format_t
Timecode format.
Definition timecode.h:61
gavl_video_format_s
Video format.
Definition gavl.h:2405
gavl_video_format_s::frame_height
uint32_t frame_height
Definition gavl.h:2407
gavl_video_format_s::chroma_placement
gavl_chroma_placement_t chroma_placement
Definition gavl.h:2424
gavl_video_format_s::hwctx
gavl_hw_context_t * hwctx
Handle for accessing the frames. If NULL, frames are in regular RAM.
Definition gavl.h:2430
gavl_video_format_s::image_height
uint32_t image_height
Definition gavl.h:2410
gavl_video_format_s::pixel_height
uint32_t pixel_height
Definition gavl.h:2415
gavl_video_format_s::frame_width
uint32_t frame_width
Definition gavl.h:2406
gavl_video_format_s::image_width
uint32_t image_width
Definition gavl.h:2409
gavl_video_format_s::timescale
uint32_t timescale
Definition gavl.h:2421
gavl_video_format_s::interlace_mode
gavl_interlace_mode_t interlace_mode
Definition gavl.h:2426
gavl_video_format_s::framerate_mode
gavl_framerate_mode_t framerate_mode
Definition gavl.h:2423
gavl_video_format_s::pixelformat
gavl_pixelformat_t pixelformat
Definition gavl.h:2417
gavl_video_format_s::pixel_width
uint32_t pixel_width
Definition gavl.h:2414
gavl_video_format_s::timecode_format
gavl_timecode_format_t timecode_format
Definition gavl.h:2428
gavl_video_format_s::frame_duration
uint32_t frame_duration
Definition gavl.h:2419
gavl_video_frame_s
Definition gavl.h:2629
gavl_video_frame_s::planes
uint8_t * planes[GAVL_MAX_PLANES]
Definition gavl.h:2630
gavl_video_frame_s::duration
int64_t duration
Definition gavl.h:2635
gavl_video_frame_s::strides
int strides[GAVL_MAX_PLANES]
Definition gavl.h:2631
gavl_video_frame_s::client_data
void * client_data
Definition gavl.h:2633
gavl_video_frame_s::dst_y
int32_t dst_y
y offset in the destination frame. (since 1.5.0) *‍/
Definition gavl.h:2643
gavl_video_frame_s::storage
void * storage
Definition gavl.h:2646
gavl_video_frame_s::timestamp
int64_t timestamp
Definition gavl.h:2634
gavl_video_frame_s::dst_x
int32_t dst_x
x offset in the destination frame. (since 1.5.0) *‍/
Definition gavl.h:2642
gavl_video_frame_s::src_rect
gavl_rectangle_i_t src_rect
Valid rectangle in this frame (since 1.5.0) *‍/.
Definition gavl.h:2641
gavl_video_frame_s::hwctx
gavl_hw_context_t * hwctx
Handle for accessing the frame.
Definition gavl.h:2645
gavl_video_frame_s::interlace_mode
gavl_interlace_mode_t interlace_mode
Definition gavl.h:2636
gavl_video_frame_s::timecode
gavl_timecode_t timecode
Definition gavl.h:2637
gavl_audio_channels_t
Container for noninterleaved audio samples.
Definition gavl.h:592
gavl_audio_channels_t::s_16
int16_t * s_16[GAVL_MAX_CHANNELS]
Definition gavl.h:597
gavl_audio_channels_t::s_32
int32_t * s_32[GAVL_MAX_CHANNELS]
Definition gavl.h:600
gavl_audio_channels_t::f
float * f[GAVL_MAX_CHANNELS]
Definition gavl.h:602
gavl_audio_channels_t::d
double * d[GAVL_MAX_CHANNELS]
Definition gavl.h:603
gavl_audio_channels_t::s_8
int8_t * s_8[GAVL_MAX_CHANNELS]
Definition gavl.h:594
gavl_audio_channels_t::u_8
uint8_t * u_8[GAVL_MAX_CHANNELS]
Definition gavl.h:593
gavl_audio_channels_t::u_32
uint32_t * u_32[GAVL_MAX_CHANNELS]
Definition gavl.h:599
gavl_audio_channels_t::u_16
uint16_t * u_16[GAVL_MAX_CHANNELS]
Definition gavl.h:596
gavl_audio_samples_t
Container for interleaved audio samples.
Definition gavl.h:572
gavl_audio_samples_t::u_32
uint32_t * u_32
Definition gavl.h:579
gavl_audio_samples_t::s_8
int8_t * s_8
Definition gavl.h:574
gavl_audio_samples_t::u_16
uint16_t * u_16
Definition gavl.h:576
gavl_audio_samples_t::s_16
int16_t * s_16
Definition gavl.h:577
gavl_audio_samples_t::u_8
uint8_t * u_8
Definition gavl.h:573
gavl_audio_samples_t::f
float * f
Definition gavl.h:582
gavl_audio_samples_t::d
double * d
Definition gavl.h:583
gavl_audio_samples_t::s_32
int32_t * s_32
Definition gavl.h:580