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 - 2012 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21
27#ifndef GAVL_H_INCLUDED
28#define GAVL_H_INCLUDED
29
30#include <inttypes.h>
31
32#include <gavl/gavldefs.h>
33#include <gavl/gavltime.h>
34#include <gavl/timecode.h>
35#include <gavl/threadpool.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* Forward declarations */
42
49typedef struct gavl_video_source_s gavl_video_source_t;
50
57typedef struct gavl_audio_source_s gavl_audio_source_t;
58
65typedef struct gavl_packet_source_s gavl_packet_source_t;
66
73typedef struct
74gavl_audio_sink_s gavl_audio_sink_t;
75
82typedef struct
83gavl_video_sink_s gavl_video_sink_t;
84
91typedef struct
92gavl_packet_sink_s gavl_packet_sink_t;
93
99
107
108
109
116/* Quality levels */
117
141#define GAVL_QUALITY_FASTEST 1
142
149#define GAVL_QUALITY_BEST 5
150
157#define GAVL_QUALITY_DEFAULT 2
158
170#define GAVL_ACCEL_MMX (1<<0)
171#define GAVL_ACCEL_MMXEXT (1<<1)
172#define GAVL_ACCEL_SSE (1<<2)
173#define GAVL_ACCEL_SSE2 (1<<3)
174#define GAVL_ACCEL_SSE3 (1<<4)
175#define GAVL_ACCEL_3DNOW (1<<5)
176#define GAVL_ACCEL_3DNOWEXT (1<<6)
177#define GAVL_ACCEL_SSSE3 (1<<7)
178
183GAVL_PUBLIC int gavl_accel_supported();
184
193/* Sample formats: all multibyte numbers are native endian */
194
207#define GAVL_MAX_CHANNELS 128
208
226
238
262
285
286
287/* Audio format -> string conversions */
288
296GAVL_PUBLIC
298
306GAVL_PUBLIC
308
317GAVL_PUBLIC
319
327GAVL_PUBLIC
329
330
336GAVL_PUBLIC
338
345GAVL_PUBLIC
347
355GAVL_PUBLIC
357
365GAVL_PUBLIC
367
375GAVL_PUBLIC
377
378
379
387GAVL_PUBLIC
389
397GAVL_PUBLIC
399
407GAVL_PUBLIC
409
416GAVL_PUBLIC
418
419GAVL_PUBLIC
420int gavl_audio_format_buffer_size(const gavl_audio_format_t * format);
421
422
435GAVL_PUBLIC
436void gavl_audio_format_dumpi(const gavl_audio_format_t * format, int indent);
437
446GAVL_PUBLIC
448
455GAVL_PUBLIC
457
464GAVL_PUBLIC
466
473GAVL_PUBLIC
475
482GAVL_PUBLIC
484
485
486
493GAVL_PUBLIC
495
503GAVL_PUBLIC
505 const gavl_audio_format_t * src);
506
515GAVL_PUBLIC
517 const gavl_audio_format_t * format_2);
518
530GAVL_PUBLIC
532
539GAVL_PUBLIC
541
552GAVL_PUBLIC
553int gavl_nearest_samplerate(int in_rate, const int * supported);
554
555
570typedef union
571 {
572 uint8_t * u_8;
573 int8_t * s_8;
575 uint16_t * u_16;
576 int16_t * s_16;
578 uint32_t * u_32;
579 int32_t * s_32;
581 float * f;
582 double * d;
584
590typedef union
591 {
592 uint8_t * u_8[GAVL_MAX_CHANNELS];
593 int8_t * s_8[GAVL_MAX_CHANNELS];
595 uint16_t * u_16[GAVL_MAX_CHANNELS];
596 int16_t * s_16[GAVL_MAX_CHANNELS];
598 uint32_t * u_32[GAVL_MAX_CHANNELS];
599 int32_t * s_32[GAVL_MAX_CHANNELS];
602 double * d[GAVL_MAX_CHANNELS];
605
632
644GAVL_PUBLIC
646
658GAVL_PUBLIC
660
670GAVL_PUBLIC
672
682GAVL_PUBLIC
684 const gavl_audio_format_t * format);
685
696GAVL_PUBLIC
698 const gavl_audio_format_t * format,
699 int num_samples);
700
701
702
713GAVL_PUBLIC
715 const gavl_audio_format_t * format,
716 int channel);
717
738GAVL_PUBLIC
740 gavl_audio_frame_t * dst,
741 const gavl_audio_frame_t * src,
742 int dst_pos,
743 int src_pos,
744 int dst_size,
745 int src_size);
746
759GAVL_PUBLIC
761 gavl_audio_frame_t * dst,
762 const gavl_audio_frame_t * src);
763
781GAVL_PUBLIC
783 gavl_audio_frame_t * src,
784 gavl_audio_frame_t * dst,
785 int start, int len);
786
799GAVL_PUBLIC
801 const gavl_audio_frame_t * f1,
802 const gavl_audio_frame_t * f2);
803
815GAVL_PUBLIC
817 const gavl_audio_frame_t * f);
818
819
830GAVL_PUBLIC
832 const gavl_audio_format_t * format,
833 uint8_t * data);
843GAVL_PUBLIC
845 const gavl_audio_format_t * format,
846 uint8_t * data, int len);
847
848
867GAVL_PUBLIC
869 gavl_audio_frame_t * f, int num_samples);
870
871
891GAVL_PUBLIC
893 const gavl_audio_frame_t * frame,
894 const char * name_base);
895
896
911#define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
916#define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
921#define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
926#define GAVL_AUDIO_FRONT_TO_REAR_MASK \
927(GAVL_AUDIO_FRONT_TO_REAR_COPY | \
928GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
929 GAVL_AUDIO_FRONT_TO_REAR_DIFF)
931/* Options for mixing stereo to mono */
932
935#define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
938#define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
941#define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
945#define GAVL_AUDIO_STEREO_TO_MONO_MASK \
946(GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
947GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
948GAVL_AUDIO_STEREO_TO_MONO_MIX)
953#define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
960typedef enum
961 {
962 GAVL_AUDIO_DITHER_NONE = 0,
963 GAVL_AUDIO_DITHER_AUTO = 1,
964 GAVL_AUDIO_DITHER_RECT = 2,
965 GAVL_AUDIO_DITHER_TRI = 3,
966 GAVL_AUDIO_DITHER_SHAPED = 4,
968
982
989typedef struct gavl_audio_options_s gavl_audio_options_t;
990
997GAVL_PUBLIC
999
1006GAVL_PUBLIC
1008
1015GAVL_PUBLIC
1017
1024GAVL_PUBLIC
1027
1028
1035GAVL_PUBLIC
1037
1044GAVL_PUBLIC
1047
1054GAVL_PUBLIC
1056 int flags);
1057
1064GAVL_PUBLIC
1066
1072GAVL_PUBLIC
1074
1091GAVL_PUBLIC
1093 const double ** matrix);
1094
1103GAVL_PUBLIC
1104const double **
1106
1116GAVL_PUBLIC
1118
1125GAVL_PUBLIC
1127 const gavl_audio_options_t * src);
1128
1134GAVL_PUBLIC
1136
1137
1138
1139/* Audio converter */
1140
1174typedef struct gavl_audio_converter_s gavl_audio_converter_t;
1175
1181GAVL_PUBLIC
1183
1189GAVL_PUBLIC
1191
1200GAVL_PUBLIC
1202
1203
1218GAVL_PUBLIC
1220 const gavl_audio_format_t * input_format,
1221 const gavl_audio_format_t * output_format);
1222
1237GAVL_PUBLIC
1239 const gavl_audio_format_t * format);
1240
1255GAVL_PUBLIC
1257
1258
1272GAVL_PUBLIC
1274 const gavl_audio_frame_t * input_frame,
1275 gavl_audio_frame_t * output_frame);
1276
1277
1296GAVL_PUBLIC
1298 double ratio ) ;
1299
1300
1316GAVL_PUBLIC
1318 gavl_audio_frame_t * input_frame,
1319 gavl_audio_frame_t * output_frame,
1320 double ratio);
1321
1322
1336typedef struct gavl_volume_control_s gavl_volume_control_t;
1337
1338/* Create / destroy */
1339
1345GAVL_PUBLIC
1347
1353GAVL_PUBLIC
1355
1363GAVL_PUBLIC
1365 const gavl_audio_format_t * format);
1366
1373GAVL_PUBLIC
1375 float volume);
1376
1383GAVL_PUBLIC
1385 gavl_audio_frame_t * frame);
1386
1395GAVL_PUBLIC
1396int gavl_volume_to_int(float volume, float one, int steps);
1397
1406GAVL_PUBLIC
1407float gavl_volume_to_float(int volume, float one, int steps);
1408
1418#define GAVL_MAX_PLANES 4
1430typedef struct
1431 {
1432 int32_t x;
1433 int32_t y;
1434 int32_t w;
1435 int32_t h;
1437
1442typedef struct
1443 {
1444 double x;
1445 double y;
1446 double w;
1447 double h;
1449
1450GAVL_PUBLIC
1451void gavl_rectangle_i_init(gavl_rectangle_i_t * r);
1452
1453GAVL_PUBLIC
1454void gavl_rectangle_f_init(gavl_rectangle_f_t * r);
1455
1456
1463GAVL_PUBLIC
1465 const gavl_video_format_t * format);
1466
1473GAVL_PUBLIC
1475 const gavl_video_format_t * format);
1476
1491GAVL_PUBLIC
1493 gavl_rectangle_i_t * dst_rect,
1494 const gavl_video_format_t * src_format,
1495 const gavl_video_format_t * dst_format);
1496
1508GAVL_PUBLIC
1510 gavl_rectangle_i_t * dst_rect,
1511 const gavl_video_format_t * src_format,
1512 const gavl_video_format_t * dst_format);
1513
1514
1515
1522GAVL_PUBLIC
1524
1531GAVL_PUBLIC
1533
1540GAVL_PUBLIC
1542
1549GAVL_PUBLIC
1551
1558GAVL_PUBLIC
1560
1567GAVL_PUBLIC
1569
1576GAVL_PUBLIC
1578
1585GAVL_PUBLIC
1587
1594GAVL_PUBLIC
1596
1603GAVL_PUBLIC
1605
1619GAVL_PUBLIC
1620void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1621
1631GAVL_PUBLIC
1633 const gavl_video_format_t * format);
1634
1635
1642GAVL_PUBLIC
1644
1651GAVL_PUBLIC
1653
1654
1655
1662GAVL_PUBLIC
1664
1671GAVL_PUBLIC
1673
1682GAVL_PUBLIC
1684
1693GAVL_PUBLIC
1695
1723GAVL_PUBLIC
1725 const gavl_video_format_t * src_format,
1726 const gavl_rectangle_f_t * src_rect,
1727 const gavl_video_format_t * dst_format,
1728 float zoom, float squeeze);
1729
1734GAVL_PUBLIC
1736
1741GAVL_PUBLIC
1743
1744
1754#define GAVL_PIXFMT_PLANAR (1<<8)
1755
1759#define GAVL_PIXFMT_RGB (1<<9)
1760
1764#define GAVL_PIXFMT_YUV (1<<10)
1765
1769#define GAVL_PIXFMT_YUVJ (1<<11)
1770
1774#define GAVL_PIXFMT_ALPHA (1<<12)
1775
1779#define GAVL_PIXFMT_GRAY (1<<13)
1780
1786 {
1790
1794
1798
1802
1806
1810
1814
1846
1853
1860
1876
1880
1897
1907
1914
1915 };
1916
1922
1925#define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1928#define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1931#define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1934#define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1935
1938#define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1941#define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1944#define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1947#define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1948
1951#define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1954#define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1957#define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1960#define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1961
1979
1980/*
1981 * Colormodel related functions
1982 */
1983
1990#define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
1991
1992
1999#define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
2000
2007#define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
2008
2015#define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
2016
2023#define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
2024
2031#define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
2032
2033
2040GAVL_PUBLIC
2042
2050GAVL_PUBLIC gavl_color_channel_t
2052
2053
2060GAVL_PUBLIC
2062
2072GAVL_PUBLIC
2073void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
2074
2081GAVL_PUBLIC
2083
2090GAVL_PUBLIC
2092
2099GAVL_PUBLIC
2101
2116GAVL_PUBLIC
2118 gavl_pixelformat_t dst);
2119
2133GAVL_PUBLIC gavl_pixelformat_t
2135 const gavl_pixelformat_t * dst_supported,
2136 int * penalty);
2137
2138
2139
2146GAVL_PUBLIC
2148
2158GAVL_PUBLIC
2160
2161
2168GAVL_PUBLIC
2170
2177GAVL_PUBLIC
2179
2186GAVL_PUBLIC
2188
2189
2190
2196GAVL_PUBLIC
2198
2205GAVL_PUBLIC
2207
2208/* */
2209
2224
2231GAVL_PUBLIC
2233
2240GAVL_PUBLIC
2242
2249GAVL_PUBLIC
2251
2252
2257/* Changing the values alters the gmerlin-avdecoder index format */
2258
2266
2273GAVL_PUBLIC
2275
2282GAVL_PUBLIC
2284
2291GAVL_PUBLIC
2293
2298/* Changing the values alters the gmerlin-avdecoder index format */
2299
2310
2317GAVL_PUBLIC
2319
2326GAVL_PUBLIC
2328
2335GAVL_PUBLIC
2337
2346GAVL_PUBLIC
2348
2349#include <gavl/hw.h> // Needs forward declarations
2350
2351/* Video format structure */
2352
2353#define GAVL_IMAGE_ORIENT_FLIP_H (1<<2)
2354
2355typedef enum
2356 {
2357
2358 GAVL_IMAGE_ORIENT_NORMAL = 0, // EXIF: 1
2359 GAVL_IMAGE_ORIENT_ROT90_CW = 1, // EXIF: 8
2360 GAVL_IMAGE_ORIENT_ROT180_CW = 2, // EXIF: 3
2361 GAVL_IMAGE_ORIENT_ROT270_CW = 3, // EXIF: 6
2362
2363 GAVL_IMAGE_ORIENT_FH = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_NORMAL), // EXIF: 2
2364 GAVL_IMAGE_ORIENT_FH_ROT90_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT90_CW), // EXIF: 7
2365 GAVL_IMAGE_ORIENT_FH_ROT180_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT180_CW), // EXIF: 4
2366 GAVL_IMAGE_ORIENT_FH_ROT270_CW = (GAVL_IMAGE_ORIENT_FLIP_H | GAVL_IMAGE_ORIENT_ROT270_CW), // EXIF: 5
2367
2368 } gavl_image_orientation_t;
2369
2404
2412GAVL_PUBLIC
2414 const gavl_video_format_t * src);
2415
2424GAVL_PUBLIC
2426 const gavl_video_format_t * format_2);
2427
2428
2439GAVL_PUBLIC
2440void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2441 float * off_x, float * off_y);
2442
2443
2444
2457GAVL_PUBLIC
2459 const gavl_video_format_t * src);
2460
2468GAVL_PUBLIC
2470
2487GAVL_PUBLIC
2489 int pad_h, int pad_v);
2490
2491
2507GAVL_PUBLIC
2509 gavl_video_format_t * channel_format,
2511
2512
2526GAVL_PUBLIC
2528 gavl_video_format_t * field_format,
2529 int field);
2530
2531
2538GAVL_PUBLIC
2540
2553GAVL_PUBLIC
2554void gavl_video_format_dumpi(const gavl_video_format_t * format, int indent);
2555
2556GAVL_PUBLIC
2557void gavl_video_format_normalize_orientation(gavl_video_format_t * in_format,
2558 gavl_video_format_t * out_format);
2559
2560GAVL_PUBLIC const char *
2561gavl_image_orientation_to_string(gavl_image_orientation_t orient);
2562
2563
2587 {
2592 int64_t timestamp;
2593 int64_t duration;
2598 // void (*destroy)(struct gavl_video_frame_s*, void*priv); /*!< Function for destroying this frame (since 1.5.0) */
2599 // void * destroy_priv; /*!< Private data to pass to destroy() (since 1.5.0) */
2600
2602 int32_t dst_x;
2603 int32_t dst_y;
2604
2605 gavl_hw_context_t * hwctx;
2606 void * storage;
2608 int buf_idx;
2609 };
2610
2611
2623GAVL_PUBLIC
2625
2636GAVL_PUBLIC
2638
2639
2640
2650GAVL_PUBLIC
2652
2664GAVL_PUBLIC
2666
2675GAVL_PUBLIC
2677 const gavl_video_format_t * format);
2678
2688GAVL_PUBLIC
2690 const gavl_video_format_t * format,
2691 const float * color);
2692
2705GAVL_PUBLIC
2707 const gavl_video_frame_t * src1,
2708 const gavl_video_frame_t * src2,
2709 const gavl_video_format_t * format);
2710
2723GAVL_PUBLIC
2724void gavl_video_frame_psnr(double * psnr,
2725 const gavl_video_frame_t * src1,
2726 const gavl_video_frame_t * src2,
2727 const gavl_video_format_t * format);
2728
2755GAVL_PUBLIC
2757 const gavl_video_frame_t * src2,
2758 gavl_video_frame_t * dst,
2759 const gavl_video_format_t * format);
2760
2774GAVL_PUBLIC
2776 gavl_video_frame_t * dst,
2777 const gavl_video_frame_t * src);
2778
2791GAVL_PUBLIC
2793 gavl_video_frame_t * dst,
2794 const gavl_video_frame_t * src, int plane);
2795
2807GAVL_PUBLIC
2809 gavl_video_frame_t * dst,
2810 const gavl_video_frame_t * src);
2811
2823GAVL_PUBLIC
2825 gavl_video_frame_t * dst,
2826 const gavl_video_frame_t * src);
2827
2839GAVL_PUBLIC
2841 gavl_video_frame_t * dst,
2842 const gavl_video_frame_t * src);
2843
2856GAVL_PUBLIC
2858 const gavl_video_frame_t * src);
2859
2860
2878GAVL_PUBLIC
2880 const gavl_video_frame_t * src,
2881 gavl_video_frame_t * dst,
2882 const gavl_rectangle_i_t * src_rect);
2883
2899GAVL_PUBLIC
2901 const gavl_video_frame_t * src,
2902 gavl_video_frame_t * dst,
2903 int field);
2904
2905
2906
2919GAVL_PUBLIC
2921 const gavl_video_format_t * format,
2922 const char * namebase);
2923
2934GAVL_PUBLIC
2936 const gavl_video_frame_t * frame);
2937
2948GAVL_PUBLIC
2950 const gavl_video_format_t * format);
2951
2964GAVL_PUBLIC
2966 const gavl_video_format_t * format,
2967 uint8_t * buffer);
2968
2980GAVL_PUBLIC
2982 const gavl_video_frame_t * frame);
2983
2984
2999GAVL_PUBLIC
3002 const gavl_video_frame_t * src,
3003 gavl_video_frame_t * dst);
3004
3020GAVL_PUBLIC
3023 const gavl_video_frame_t * src,
3024 gavl_video_frame_t * dst);
3025
3026
3038GAVL_PUBLIC
3040 const gavl_video_frame_t * f1,
3041 const gavl_video_frame_t * f2);
3042
3043GAVL_PUBLIC
3044void gavl_video_frame_normalize_orientation(const gavl_video_format_t * in_format,
3045 const gavl_video_format_t * out_format,
3046 const gavl_video_frame_t * in_frame,
3047 gavl_video_frame_t * out_frame);
3048
3049/*****************************
3050 Conversion options
3051******************************/
3052
3068#define GAVL_FORCE_DEINTERLACE (1<<0)
3069
3074#define GAVL_CONVOLVE_CHROMA (1<<1)
3075
3080#define GAVL_CONVOLVE_NORMALIZE (1<<2)
3081
3089#define GAVL_RESAMPLE_CHROMA (1<<3)
3090
3097#define GAVL_FORCE_SW (1<<4)
3098
3111
3125
3137
3154
3171
3178typedef struct gavl_video_options_s gavl_video_options_t;
3179
3180/* Default Options */
3181
3187GAVL_PUBLIC
3189
3199GAVL_PUBLIC
3201
3208GAVL_PUBLIC
3210 const gavl_video_options_t * src);
3211
3217GAVL_PUBLIC
3219
3220
3235GAVL_PUBLIC
3237 const gavl_rectangle_f_t * src_rect,
3238 const gavl_rectangle_i_t * dst_rect);
3239
3247GAVL_PUBLIC
3249 gavl_rectangle_f_t * src_rect,
3250 gavl_rectangle_i_t * dst_rect);
3251
3258GAVL_PUBLIC
3260
3267GAVL_PUBLIC
3269
3270
3277GAVL_PUBLIC
3279 int conversion_flags);
3280
3287GAVL_PUBLIC
3289
3296GAVL_PUBLIC
3298 gavl_alpha_mode_t alpha_mode);
3299
3306GAVL_PUBLIC gavl_alpha_mode_t
3308
3309
3316GAVL_PUBLIC
3318 gavl_scale_mode_t scale_mode);
3319
3326GAVL_PUBLIC gavl_scale_mode_t
3328
3329
3336GAVL_PUBLIC
3338 int order);
3339
3346GAVL_PUBLIC
3348
3349
3356GAVL_PUBLIC
3358 const double * color);
3359
3366GAVL_PUBLIC
3368 double * color);
3369
3376GAVL_PUBLIC
3378 gavl_deinterlace_mode_t deinterlace_mode);
3379
3386GAVL_PUBLIC gavl_deinterlace_mode_t
3388
3395GAVL_PUBLIC
3397 gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3398
3407
3416GAVL_PUBLIC
3419
3420
3429GAVL_PUBLIC gavl_downscale_filter_t
3431
3449GAVL_PUBLIC
3451 float f);
3452
3461GAVL_PUBLIC
3463
3464/* Set an externally created thread pool. If this is not called, a private thread pool will be created if needed.
3465 This function has the advantage that one thread pool can be shared among different elements of a video
3466 pipeline, which will reduce the overhead */
3467
3468GAVL_PUBLIC
3469void gavl_video_options_set_thread_pool(gavl_video_options_t * opt, gavl_thread_pool_t * tp);
3470
3471GAVL_PUBLIC
3472gavl_thread_pool_t * gavl_video_options_get_thread_pool(const gavl_video_options_t * opt);
3473
3474/***************************************************
3475 * Create and destroy video converters
3476 ***************************************************/
3477
3510typedef struct gavl_video_converter_s gavl_video_converter_t;
3511
3517GAVL_PUBLIC
3519
3525GAVL_PUBLIC
3527
3528/**************************************************
3529 * Get options. Change the options with the gavl_video_options_set_*
3530 * functions above
3531 **************************************************/
3532
3541GAVL_PUBLIC gavl_video_options_t *
3543
3544
3558GAVL_PUBLIC
3560 const gavl_video_format_t * input_format,
3561 const gavl_video_format_t * output_format);
3562
3575GAVL_PUBLIC
3577
3578
3579/***************************************************
3580 * Convert a frame
3581 ***************************************************/
3582
3590GAVL_PUBLIC
3592 const gavl_video_frame_t * input_frame,
3593 gavl_video_frame_t * output_frame);
3594
3595
3627typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3628
3634GAVL_PUBLIC
3636
3642GAVL_PUBLIC
3644
3653GAVL_PUBLIC gavl_video_options_t *
3655
3668GAVL_PUBLIC
3670 const gavl_video_format_t * src_format,
3671 const gavl_video_format_t * dst_format);
3672
3694GAVL_PUBLIC
3696 const gavl_video_format_t * format,
3697 int h_radius, const float * h_coeffs,
3698 int v_radius, const float * v_coeffs);
3699
3707GAVL_PUBLIC
3709 const gavl_video_frame_t * input_frame,
3710 gavl_video_frame_t * output_frame);
3711
3727typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3728
3734GAVL_PUBLIC
3736
3742GAVL_PUBLIC
3744
3753GAVL_PUBLIC gavl_video_options_t *
3755
3766GAVL_PUBLIC
3768 const gavl_video_format_t * src_format);
3769
3770
3778GAVL_PUBLIC
3780 const gavl_video_frame_t * input_frame,
3781 gavl_video_frame_t * output_frame);
3782
3783
3784
3785/**************************************************
3786 * Transparent overlays
3787 **************************************************/
3788
3789/* Overlay struct */
3790
3819
3826typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3827
3833GAVL_PUBLIC
3835
3841GAVL_PUBLIC
3843
3850GAVL_PUBLIC gavl_video_options_t *
3852
3868GAVL_PUBLIC
3870 const gavl_video_format_t * frame_format,
3871 gavl_video_format_t * overlay_format);
3872
3882GAVL_PUBLIC
3884 gavl_overlay_t * ovl);
3885
3892GAVL_PUBLIC
3894 gavl_video_frame_t * dst_frame);
3895
3902GAVL_PUBLIC gavl_video_sink_t *
3904
3926typedef struct gavl_image_transform_s gavl_image_transform_t;
3927
3941typedef void (*gavl_image_transform_func)(void * priv,
3942 double xdst,
3943 double ydst,
3944 double * xsrc,
3945 double * ysrc);
3946
3947
3954GAVL_PUBLIC
3956
3962GAVL_PUBLIC
3964
3983GAVL_PUBLIC
3985 gavl_video_format_t * format,
3986 gavl_image_transform_func func, void * priv);
3987
3995GAVL_PUBLIC
3997 gavl_video_frame_t * in_frame,
3998 gavl_video_frame_t * out_frame);
3999
4010GAVL_PUBLIC gavl_video_options_t *
4012
4035typedef struct
4036 {
4037 int64_t offset;
4038 /* Primary */
4039 int64_t num_entries;
4041
4042 struct
4043 {
4044 int64_t num_frames;
4045 int64_t duration;
4046 } * entries;
4047
4050
4051 struct
4052 {
4053 int64_t pts;
4055 } * timecodes;
4056
4057 /* Secondary */
4058
4060
4067
4078GAVL_PUBLIC gavl_frame_table_t *
4079gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
4080 gavl_timecode_format_t * fmt_ret);
4081
4092GAVL_PUBLIC gavl_frame_table_t *
4093gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
4094 int64_t num_frames,
4095 gavl_timecode_t start_timecode);
4096
4104GAVL_PUBLIC gavl_frame_table_t *
4106
4107
4108
4116
4124GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
4125
4134GAVL_PUBLIC void
4136 int64_t pts, gavl_timecode_t tc);
4137
4148GAVL_PUBLIC int64_t
4150 int64_t frame, int * duration);
4151
4162GAVL_PUBLIC int64_t
4164 int64_t time,
4165 int64_t * start_time);
4166
4177GAVL_PUBLIC gavl_timecode_t
4179 int64_t time,
4180 int64_t * start_time,
4181 const gavl_timecode_format_t * fmt);
4182
4192GAVL_PUBLIC int64_t
4194 gavl_timecode_t tc,
4195 const gavl_timecode_format_t * fmt);
4196
4197
4208GAVL_PUBLIC gavl_timecode_t
4210 int64_t frame,
4211 int64_t * start_time,
4212 const gavl_timecode_format_t * fmt);
4213
4214
4215
4223GAVL_PUBLIC int64_t
4225
4233GAVL_PUBLIC int64_t
4235
4243GAVL_PUBLIC int64_t
4245
4254GAVL_PUBLIC
4256 const char * filename);
4257
4265GAVL_PUBLIC
4267
4274GAVL_PUBLIC void
4276
4304typedef struct gavl_video_frame_pool_s gavl_video_frame_pool_t;
4305
4312GAVL_PUBLIC
4315 void * priv);
4316
4322GAVL_PUBLIC
4324
4332GAVL_PUBLIC
4334
4342GAVL_PUBLIC
4344
4345/* Debayer routines */
4346
4347#define GAVL_BAYER_GREEN_FIRST (1<<0)
4348#define GAVL_BAYER_BLUE_LINE (1<<1)
4349
4350// GB
4351// RG
4352#define GAVL_BAYER_GBRG (GAVL_BAYER_GREEN_FIRST|GAVL_BAYER_BLUE_LINE)
4353
4354// GR
4355// BG
4356#define GAVL_BAYER_GRBG (GAVL_BAYER_GREEN_FIRST)
4357
4358// BG
4359// GR
4360#define GAVL_BAYER_BGGR (GAVL_BAYER_BLUE_LINE)
4361
4362// RG
4363// GB
4364#define GAVL_BAYER_RGGB 0
4365
4366GAVL_PUBLIC
4367void gavl_video_frame_debayer(gavl_video_options_t * opt,
4369 int bayer_format, gavl_video_format_t * dst_format);
4370
4371
4377#ifdef __cplusplus
4378}
4379#endif
4380
4381#endif /* GAVL_H_INCLUDED */
GAVL_PUBLIC gavl_deinterlace_mode_t gavl_video_options_get_deinterlace_mode(const gavl_video_options_t *opt)
Get the 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_PUBLIC int gavl_accel_supported()
Get the supported acceleration flags.
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_converter_get_options(gavl_audio_converter_t *cnv)
gets options of an audio converter
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_PUBLIC void gavl_audio_converter_destroy(gavl_audio_converter_t *cnv)
Destroys an audio converter and frees all associated memory.
GAVL_PUBLIC gavl_audio_converter_t * gavl_audio_converter_create()
Creates an audio converter.
struct gavl_audio_converter_s gavl_audio_converter_t
Opaque audio converter structure.
Definition gavl.h:1174
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_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_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_PUBLIC int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t *cnv, double ratio)
Set samplerate converstion ratio.
GAVL_PUBLIC int gavl_audio_converter_reinit(gavl_audio_converter_t *cnv)
Reinitialize an audio converter.
gavl_channel_id_t
Audio channel setup.
Definition gavl.h:247
gavl_sample_format_t
Format of one audio sample.
Definition gavl.h:216
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_PUBLIC void gavl_audio_format_copy(gavl_audio_format_t *dst, const gavl_audio_format_t *src)
Copy one audio format to another.
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_PUBLIC int gavl_side_channels(const gavl_audio_format_t *format)
Get number of side channels for a given format.
GAVL_PUBLIC void gavl_set_channel_setup(gavl_audio_format_t *format)
Set the default channel setup and indices.
GAVL_PUBLIC int gavl_lfe_channels(const gavl_audio_format_t *format)
Get number of LFE channels for a given format.
GAVL_PUBLIC gavl_sample_format_t gavl_get_sample_format(int index)
Get the sample format from index.
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_PUBLIC void gavl_audio_format_dumpi(const gavl_audio_format_t *format, int indent)
Dump an audio format to stderr.
GAVL_PUBLIC int gavl_nearest_samplerate(int in_rate, const int *supported)
Get the nearest samplerate out of a list of supported rates.
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_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_PUBLIC int gavl_num_sample_formats()
Get total number of supported sample formats.
gavl_interleave_mode_t
Definition gavl.h:233
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format(const char *str)
Convert a string to a sample format.
GAVL_PUBLIC int gavl_front_channels(const gavl_audio_format_t *format)
Get number of front channels for a given format.
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_PUBLIC int gavl_bytes_per_sample(gavl_sample_format_t format)
Get the number of bytes per sample for a given sample format.
GAVL_PUBLIC void gavl_audio_format_dump(const gavl_audio_format_t *format)
Dump an audio format to stderr.
GAVL_PUBLIC int gavl_aux_channels(const gavl_audio_format_t *format)
Get number of aux channels for a given format.
GAVL_PUBLIC int gavl_rear_channels(const gavl_audio_format_t *format)
Get number of rear channels for a given format.
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_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_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_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_PUBLIC int gavl_audio_formats_equal(const gavl_audio_format_t *format_1, const gavl_audio_format_t *format_2)
Compare 2 audio formats.
#define GAVL_MAX_CHANNELS
Maximum number of audio channels.
Definition gavl.h:207
@ GAVL_CHID_SIDE_RIGHT
Definition gavl.h:258
@ GAVL_CHID_FRONT_RIGHT
Definition gavl.h:251
@ GAVL_CHID_FRONT_LEFT
Definition gavl.h:250
@ GAVL_CHID_REAR_LEFT
Definition gavl.h:254
@ GAVL_CHID_SIDE_LEFT
Definition gavl.h:257
@ GAVL_CHID_NONE
Definition gavl.h:248
@ GAVL_CHID_FRONT_CENTER_LEFT
Definition gavl.h:252
@ GAVL_CHID_REAR_CENTER
Definition gavl.h:256
@ GAVL_CHID_LFE
Definition gavl.h:259
@ GAVL_CHID_REAR_RIGHT
Definition gavl.h:255
@ GAVL_CHID_AUX
Definition gavl.h:260
@ GAVL_CHID_FRONT_CENTER_RIGHT
Definition gavl.h:253
@ GAVL_CHID_FRONT_CENTER
Definition gavl.h:249
@ GAVL_SAMPLE_FLOAT
Definition gavl.h:223
@ GAVL_SAMPLE_NONE
Definition gavl.h:217
@ GAVL_SAMPLE_U8
Definition gavl.h:218
@ GAVL_SAMPLE_S8
Definition gavl.h:219
@ GAVL_SAMPLE_U16
Definition gavl.h:220
@ GAVL_SAMPLE_S16
Definition gavl.h:221
@ GAVL_SAMPLE_DOUBLE
Definition gavl.h:224
@ GAVL_SAMPLE_S32
Definition gavl.h:222
@ GAVL_INTERLEAVE_2
Definition gavl.h:235
@ GAVL_INTERLEAVE_ALL
Definition gavl.h:236
@ GAVL_INTERLEAVE_NONE
Definition gavl.h:234
GAVL_PUBLIC void gavl_audio_frame_destroy(gavl_audio_frame_t *frame)
Destroy an audio frame.
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_PUBLIC void gavl_audio_frame_mute(gavl_audio_frame_t *frame, const gavl_audio_format_t *format)
Mute an audio frame.
GAVL_PUBLIC void gavl_audio_frame_null(gavl_audio_frame_t *frame)
Zero all pointers in the audio frame.
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_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_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_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_PUBLIC gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t *format)
Create audio frame.
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_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_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_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_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_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.
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition gavl.h:989
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_PUBLIC void gavl_audio_options_copy(gavl_audio_options_t *dst, const gavl_audio_options_t *src)
Copy audio options.
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_options_create()
Create an options container.
gavl_audio_dither_mode_t
Dither mode.
Definition gavl.h:961
GAVL_PUBLIC void gavl_audio_options_set_conversion_flags(gavl_audio_options_t *opt, int flags)
Set the conversion flags.
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_PUBLIC void gavl_audio_options_set_defaults(gavl_audio_options_t *opt)
Set all options to their defaults.
GAVL_PUBLIC void gavl_audio_options_set_mix_matrix(gavl_audio_options_t *opt, const double **matrix)
Set a user defined mix matrix.
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
Resample mode.
Definition gavl.h:974
GAVL_PUBLIC const double ** gavl_audio_options_get_mix_matrix(const gavl_audio_options_t *opt)
Get the mix matrix.
GAVL_PUBLIC int gavl_audio_options_get_quality(const gavl_audio_options_t *opt)
Get the quality level for a converter.
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_PUBLIC void gavl_audio_options_destroy(gavl_audio_options_t *opt)
Destroy audio options.
GAVL_PUBLIC int gavl_audio_options_get_conversion_flags(const gavl_audio_options_t *opt)
Get the conversion flags.
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
Definition gavl.h:980
@ GAVL_RESAMPLE_ZOH
Definition gavl.h:976
@ GAVL_RESAMPLE_LINEAR
Definition gavl.h:977
@ GAVL_RESAMPLE_AUTO
Definition gavl.h:975
@ GAVL_RESAMPLE_SINC_MEDIUM
Definition gavl.h:979
@ GAVL_RESAMPLE_SINC_FAST
Definition gavl.h:978
GAVL_PUBLIC int gavl_frame_table_save(const gavl_frame_table_t *t, const char *filename)
Save a frame table to a file.
GAVL_PUBLIC int64_t gavl_frame_table_end_time(const gavl_frame_table_t *t)
get the end time of the last frame
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_load(const char *filename)
Load a frame table from a file.
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_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_PUBLIC void gavl_frame_table_dump(const gavl_frame_table_t *t)
Dump a frame table to stderr for debugging.
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_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_PUBLIC int64_t gavl_frame_table_duration(const gavl_frame_table_t *t)
get the total duration of all frames
GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t *t)
Destroy a frame table and free all memory.
GAVL_PUBLIC int64_t gavl_frame_table_num_frames(const gavl_frame_table_t *t)
get the total number of frames
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_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t *t, int64_t duration)
Append an entry.
GAVL_PUBLIC void gavl_frame_table_append_timecode(gavl_frame_table_t *t, int64_t pts, gavl_timecode_t tc)
Append a timecodes.
GAVL_PUBLIC gavl_frame_table_t * gavl_frame_table_create()
Create a frame table.
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_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_PUBLIC gavl_frame_table_t * gavl_frame_table_copy(const gavl_frame_table_t *tab)
Copy a frame table to another.
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_PUBLIC int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t *r)
Check if a float rectangle is empty.
GAVL_PUBLIC int gavl_rectangle_i_is_empty(const gavl_rectangle_i_t *r)
Check if an integer rectangle is empty.
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_PUBLIC void gavl_rectangle_i_align(gavl_rectangle_i_t *r, int h_align, int v_align)
Align a rectangle.
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_PUBLIC void gavl_rectangle_i_copy(gavl_rectangle_i_t *dst, const gavl_rectangle_i_t *src)
Copy an integer rectangle.
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_PUBLIC void gavl_rectangle_i_dump(const gavl_rectangle_i_t *r)
Dump a rectangle to stderr.
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_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_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_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_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_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_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_PUBLIC void gavl_rectangle_f_copy(gavl_rectangle_f_t *dst, const gavl_rectangle_f_t *src)
Copy a float rectangle.
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_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_PUBLIC void gavl_rectangle_f_dump(const gavl_rectangle_f_t *r)
Dump a floating point rectangle to stderr.
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_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_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_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_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.
struct gavl_video_sink_s gavl_video_sink_t
Video sink.
Definition gavl.h:82
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition gavl.h:73
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition gavl.h:91
struct gavl_video_source_s gavl_video_source_t
Forward declaration of the video source.
Definition gavl.h:49
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition gavl.h:57
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition gavl.h:65
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition timecode.h:43
GAVL_PUBLIC void gavl_overlay_blend(gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
Blend overlay onto video frame.
GAVL_PUBLIC void gavl_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t *ctx, gavl_overlay_t *ovl)
Set a new overlay.
gavl_video_frame_t gavl_overlay_t
Overlay structure.
Definition gavl.h:3818
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_PUBLIC gavl_overlay_blend_context_t * gavl_overlay_blend_context_create()
Create a blend context.
struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t
Opaque blend context.
Definition gavl.h:3826
GAVL_PUBLIC void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t *ctx)
Destroy a blend context and free all associated memory.
GAVL_PUBLIC gavl_video_sink_t * gavl_overlay_blend_context_get_sink(gavl_overlay_blend_context_t *ctx)
Get the sink for overlays.
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_PUBLIC gavl_video_converter_t * gavl_video_converter_create()
Creates a video converter.
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.
struct gavl_video_converter_s gavl_video_converter_t
Opaque video converter structure.
Definition gavl.h:3510
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_PUBLIC int gavl_video_converter_reinit(gavl_video_converter_t *cnv)
Reinitialize a video converter.
GAVL_PUBLIC void gavl_video_converter_destroy(gavl_video_converter_t *cnv)
Destroys a video converter and frees all associated memory.
GAVL_PUBLIC gavl_video_options_t * gavl_video_converter_get_options(gavl_video_converter_t *cnv)
gets options of a video converter
GAVL_PUBLIC int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_format_t *src_format)
Initialize a video deinterlacer.
struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t
Opaque deinterlacer structure.
Definition gavl.h:3727
GAVL_PUBLIC void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t *deinterlacer)
Destroy a video deinterlacer.
GAVL_PUBLIC gavl_video_options_t * gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t *deinterlacer)
gets options of a deinterlacer
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_PUBLIC gavl_video_deinterlacer_t * gavl_video_deinterlacer_create()
Create a video deinterlacer.
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.
#define GAVL_PIXFMT_PLANAR
Definition gavl.h:1754
#define GAVL_PIXFMT_ALPHA
Definition gavl.h:1774
GAVL_PUBLIC int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src, gavl_pixelformat_t dst)
Get the conversion penalty for pixelformat conversions.
GAVL_PUBLIC int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat)
Get bytes per pixel for packed formats.
gavl_chroma_placement_t
Chroma placement.
Definition gavl.h:2219
#define GAVL_PIXFMT_GRAY
Definition gavl.h:1779
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
Framerate mode.
Definition gavl.h:2260
gavl_pixelformat_e
Pixelformat definition.
Definition gavl.h:1786
GAVL_PUBLIC gavl_framerate_mode_t gavl_short_string_to_framerate_mode(const char *mode)
Translate a short string into a framerate mode.
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_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_PUBLIC const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a human readable string.
GAVL_PUBLIC void gavl_video_format_dump(const gavl_video_format_t *format)
Dump a video format to stderr.
GAVL_PUBLIC int gavl_video_format_get_image_size(const gavl_video_format_t *format)
Get the unpadded image size.
GAVL_PUBLIC gavl_pixelformat_t gavl_get_pixelformat(int index)
Get the pixelformat from index.
GAVL_PUBLIC const char * gavl_interlace_mode_to_short_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a short string.
GAVL_PUBLIC gavl_color_channel_t gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index)
Get the color channel.
GAVL_PUBLIC const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a human readable string.
enum gavl_pixelformat_e gavl_pixelformat_t
Pixelformat.
Definition gavl.h:1921
GAVL_PUBLIC gavl_pixelformat_t gavl_short_string_to_pixelformat(const char *name)
Translate a short pixelformat name into a pixelformat.
GAVL_PUBLIC const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode)
Translate a chroma placement into a human readable string.
GAVL_PUBLIC const uint32_t * gavl_pixelformat_get_masks(gavl_pixelformat_t pixelformat)
Get the masks for the components.
GAVL_PUBLIC const char * gavl_chroma_placement_to_short_string(gavl_chroma_placement_t mode)
Translate a chroma placement into a short string.
GAVL_PUBLIC gavl_pixelformat_t gavl_string_to_pixelformat(const char *name)
Translate a pixelformat name into a pixelformat.
gavl_interlace_mode_t
Interlace mode.
Definition gavl.h:2301
#define GAVL_PIXFMT_RGB
Definition gavl.h:1759
GAVL_PUBLIC const char * gavl_framerate_mode_to_string(gavl_framerate_mode_t mode)
Translate a framerate mode into a human readable string.
GAVL_PUBLIC int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat)
Get the effective number of bits for one pixel.
#define GAVL_PIXFMT_YUV
Definition gavl.h:1764
GAVL_PUBLIC int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat)
Get the number of planes.
gavl_color_channel_t
Color channel definitions.
Definition gavl.h:1969
GAVL_PUBLIC int gavl_num_pixelformats()
Get total number of supported pixelformats.
#define GAVL_PIXFMT_YUVJ
Definition gavl.h:1769
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_PUBLIC const char * gavl_pixelformat_to_short_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a short string.
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_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_PUBLIC void gavl_video_format_dumpi(const gavl_video_format_t *format, int indent)
Dump a video format to stderr.
GAVL_PUBLIC int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat)
Get bytes per component for planar formats.
GAVL_PUBLIC gavl_interlace_mode_t gavl_short_string_to_interlace_mode(const char *mode)
Translate a short string to an interlace mode.
GAVL_PUBLIC int gavl_pixelformat_num_channels(gavl_pixelformat_t pixelformat)
Get the number of channels.
GAVL_PUBLIC int gavl_interlace_mode_is_mixed(gavl_interlace_mode_t mode)
Check if an interlace mode is mixed.
GAVL_PUBLIC const char * gavl_framerate_mode_to_short_string(gavl_framerate_mode_t mode)
Translate a framerate mode into a short string.
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_PUBLIC gavl_chroma_placement_t gavl_short_string_to_chroma_placement(const char *mode)
Translate a short string into a chroma placement.
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
Definition gavl.h:2222
@ GAVL_CHROMA_PLACEMENT_MPEG2
Definition gavl.h:2221
@ GAVL_CHROMA_PLACEMENT_DEFAULT
Definition gavl.h:2220
@ GAVL_FRAMERATE_UNKNOWN
Definition gavl.h:2261
@ GAVL_FRAMERATE_CONSTANT
Definition gavl.h:2262
@ GAVL_FRAMERATE_STILL
Definition gavl.h:2264
@ GAVL_FRAMERATE_VARIABLE
Definition gavl.h:2263
@ GAVL_YUVJ_420_P
Definition gavl.h:1900
@ GAVL_YUV_422_P
Definition gavl.h:1887
@ GAVL_BGR_24
Definition gavl.h:1836
@ GAVL_YUV_410_P
Definition gavl.h:1896
@ GAVL_RGB_48
Definition gavl.h:1849
@ GAVL_RGB_32
Definition gavl.h:1839
@ GAVL_YUV_420_P
Definition gavl.h:1884
@ GAVL_GRAYA_32
Definition gavl.h:1809
@ GAVL_YUVA_32
Definition gavl.h:1869
@ GAVL_RGB_16
Definition gavl.h:1826
@ GAVL_UYVY
Definition gavl.h:1866
@ GAVL_YUV_422_P_16
Definition gavl.h:1913
@ GAVL_YUV_444_P
Definition gavl.h:1890
@ GAVL_RGB_FLOAT
Definition gavl.h:1856
@ GAVL_YUVJ_422_P
Definition gavl.h:1903
@ GAVL_GRAY_8
Definition gavl.h:1793
@ GAVL_RGB_24
Definition gavl.h:1833
@ GAVL_RGBA_64
Definition gavl.h:1852
@ GAVL_YUY2
Definition gavl.h:1863
@ GAVL_YUVA_FLOAT
Definition gavl.h:1879
@ GAVL_YUVJ_444_P
Definition gavl.h:1906
@ GAVL_GRAYA_FLOAT
Definition gavl.h:1813
@ GAVL_BGR_15
Definition gavl.h:1822
@ GAVL_YUV_444_P_16
Definition gavl.h:1910
@ GAVL_PIXELFORMAT_NONE
Undefined.
Definition gavl.h:1789
@ GAVL_GRAYA_16
Definition gavl.h:1805
@ GAVL_YUV_411_P
Definition gavl.h:1893
@ GAVL_GRAY_FLOAT
Definition gavl.h:1801
@ GAVL_YUV_FLOAT
Definition gavl.h:1875
@ GAVL_RGBA_32
Definition gavl.h:1845
@ GAVL_GRAY_16
Definition gavl.h:1797
@ GAVL_BGR_16
Definition gavl.h:1830
@ GAVL_YUVA_64
Definition gavl.h:1872
@ GAVL_RGB_15
Definition gavl.h:1818
@ GAVL_RGBA_FLOAT
Definition gavl.h:1859
@ GAVL_BGR_32
Definition gavl.h:1842
@ GAVL_INTERLACE_MIXED_BOTTOM
Definition gavl.h:2308
@ GAVL_INTERLACE_MIXED_TOP
Definition gavl.h:2307
@ GAVL_INTERLACE_NONE
Definition gavl.h:2303
@ GAVL_INTERLACE_BOTTOM_FIRST
Definition gavl.h:2305
@ GAVL_INTERLACE_UNKNOWN
Definition gavl.h:2302
@ GAVL_INTERLACE_MIXED
Definition gavl.h:2306
@ GAVL_INTERLACE_TOP_FIRST
Definition gavl.h:2304
@ GAVL_CCH_NONE
None/undefined.
Definition gavl.h:1970
@ GAVL_CCH_Y
Luminance (also grayscale)
Definition gavl.h:1974
@ GAVL_CCH_RED
Red.
Definition gavl.h:1971
@ GAVL_CCH_CR
Chrominance red (aka V)
Definition gavl.h:1976
@ GAVL_CCH_GREEN
Green.
Definition gavl.h:1972
@ GAVL_CCH_ALPHA
Transparency (or, to be more precise opacity)
Definition gavl.h:1977
@ GAVL_CCH_CB
Chrominance blue (aka U)
Definition gavl.h:1975
@ GAVL_CCH_BLUE
Blue.
Definition gavl.h:1973
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_pool_get(gavl_video_frame_pool_t *p)
Create a video frame pool.
GAVL_PUBLIC gavl_video_frame_pool_t * gavl_video_frame_pool_create(gavl_video_frame_t *(*create_frame)(void *priv), void *priv)
Create a video frame pool.
struct gavl_video_frame_pool_s gavl_video_frame_pool_t
Video frame pool.
Definition gavl.h:4304
GAVL_PUBLIC void gavl_video_frame_pool_destroy(gavl_video_frame_pool_t *p)
Destroy a video frame pool.
GAVL_PUBLIC void gavl_video_frame_pool_reset(gavl_video_frame_pool_t *p)
Reset a video frame pool.
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_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_PUBLIC void gavl_video_frame_destroy(gavl_video_frame_t *frame)
Destroy a video frame.
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_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_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_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_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_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_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_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 spefified color.
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_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_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_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_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 differene of 2 source frames.
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_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_PUBLIC gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t *format)
Create video frame.
GAVL_PUBLIC void gavl_video_frame_null(gavl_video_frame_t *frame)
Zero all pointers in the video frame.
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_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_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_PUBLIC gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t *format)
Create video frame without padding.
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_PUBLIC void gavl_video_options_set_quality(gavl_video_options_t *opt, int quality)
Set the quality level for the converter.
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_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_PUBLIC void gavl_video_options_get_background_color(const gavl_video_options_t *opt, double *color)
Get the background color for alpha blending.
GAVL_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode(const gavl_video_options_t *opt)
Get the alpha mode.
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_PUBLIC void gavl_video_options_destroy(gavl_video_options_t *opt)
Destroy video options.
GAVL_PUBLIC int gavl_video_options_get_quality(const gavl_video_options_t *opt)
Get the quality level for the converter.
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
Definition gavl.h:3119
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_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
Specifies which field to drop when deinterlacing.
Definition gavl.h:3133
GAVL_PUBLIC gavl_video_options_t * gavl_video_options_create()
Create an options container.
struct gavl_video_options_s gavl_video_options_t
Definition gavl.h:3178
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_PUBLIC float gavl_video_options_get_downscale_blur(const gavl_video_options_t *opt)
Get blur factor for downscaling.
gavl_alpha_mode_t
Definition gavl.h:3107
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_PUBLIC gavl_downscale_filter_t gavl_video_options_get_downscale_filter(const gavl_video_options_t *opt)
Get the antialiasing filter for downscaling.
GAVL_PUBLIC void gavl_video_options_set_defaults(gavl_video_options_t *opt)
Set all options to their defaults.
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
Definition gavl.h:3143
GAVL_PUBLIC void gavl_video_options_set_downscale_blur(gavl_video_options_t *opt, float f)
Set blur factor for downscaling.
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_PUBLIC void gavl_video_options_set_downscale_filter(gavl_video_options_t *opt, gavl_downscale_filter_t f)
Set antialiasing filter for downscaling.
GAVL_PUBLIC int gavl_video_options_get_conversion_flags(const gavl_video_options_t *opt)
Get the conversion flags.
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
Definition gavl.h:3165
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
Definition gavl.h:3120
@ GAVL_DEINTERLACE_SCALE
Definition gavl.h:3122
@ GAVL_DEINTERLACE_BLEND
Definition gavl.h:3123
@ GAVL_DEINTERLACE_COPY
Definition gavl.h:3121
@ GAVL_DEINTERLACE_DROP_TOP
Definition gavl.h:3134
@ GAVL_DEINTERLACE_DROP_BOTTOM
Definition gavl.h:3135
@ GAVL_ALPHA_IGNORE
Definition gavl.h:3108
@ GAVL_ALPHA_BLEND_COLOR
Definition gavl.h:3109
@ GAVL_SCALE_NONE
Definition gavl.h:3152
@ GAVL_SCALE_NEAREST
Definition gavl.h:3145
@ GAVL_SCALE_CUBIC_MITCHELL
Definition gavl.h:3149
@ GAVL_SCALE_AUTO
Definition gavl.h:3144
@ GAVL_SCALE_SINC_LANCZOS
Definition gavl.h:3151
@ GAVL_SCALE_CUBIC_CATMULL
Definition gavl.h:3150
@ GAVL_SCALE_CUBIC_BSPLINE
Definition gavl.h:3148
@ GAVL_SCALE_QUADRATIC
Definition gavl.h:3147
@ GAVL_SCALE_BILINEAR
Definition gavl.h:3146
@ GAVL_DOWNSCALE_FILTER_AUTO
Auto selection based on quality.
Definition gavl.h:3166
@ GAVL_DOWNSCALE_FILTER_NONE
Fastest method, might produce heavy aliasing artifacts.
Definition gavl.h:3167
@ GAVL_DOWNSCALE_FILTER_WIDE
Widen the filter curve according to the scaling ratio.
Definition gavl.h:3168
@ GAVL_DOWNSCALE_FILTER_GAUSS
Do a Gaussian preblur.
Definition gavl.h:3169
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_PUBLIC void gavl_video_scaler_destroy(gavl_video_scaler_t *scaler)
Destroy a video scaler.
GAVL_PUBLIC gavl_video_options_t * gavl_video_scaler_get_options(gavl_video_scaler_t *scaler)
gets options of a scaler
GAVL_PUBLIC gavl_video_scaler_t * gavl_video_scaler_create()
Create a video scaler.
struct gavl_video_scaler_s gavl_video_scaler_t
Opaque scaler structure.
Definition gavl.h:3627
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_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_PUBLIC void gavl_image_transform_destroy(gavl_image_transform_t *t)
Destroy a transformation engine.
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_PUBLIC gavl_video_options_t * gavl_image_transform_get_options(gavl_image_transform_t *t)
Get transformation options.
struct gavl_image_transform_s gavl_image_transform_t
Opaque image transformation engine.
Definition gavl.h:3926
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition gavl.h:3941
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_PUBLIC gavl_image_transform_t * gavl_image_transform_create()
Create a transformation engine.
#define GAVL_MAX_PLANES
Definition gavl.h:1418
GAVL_PUBLIC void gavl_volume_control_set_volume(gavl_volume_control_t *ctrl, float volume)
Set volume for a volume control.
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_PUBLIC gavl_volume_control_t * gavl_volume_control_create()
Create volume control.
GAVL_PUBLIC float gavl_volume_to_float(int volume, float one, int steps)
Convert an integer audio volume to a float (in dB)
GAVL_PUBLIC void gavl_volume_control_destroy(gavl_volume_control_t *ctrl)
Destroys a volume control and frees all associated memory.
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.
struct gavl_volume_control_s gavl_volume_control_t
Opaque structure for a volume control.
Definition gavl.h:1336
GAVL_PUBLIC int gavl_volume_to_int(float volume, float one, int steps)
Convert an audio volume (in dB) to an integer.
Audio Format.
Definition gavl.h:272
uint32_t samples_per_frame
Definition gavl.h:273
uint32_t samplerate
Definition gavl.h:274
float rear_level
Definition gavl.h:280
gavl_interleave_mode_t interleave_mode
Definition gavl.h:277
gavl_sample_format_t sample_format
Definition gavl.h:276
uint32_t num_channels
Definition gavl.h:275
float center_level
Definition gavl.h:279
Generic container for audio samples.
Definition gavl.h:623
int channel_stride
Definition gavl.h:628
gavl_audio_samples_t samples
Definition gavl.h:624
int valid_samples
Definition gavl.h:626
int64_t timestamp
Definition gavl.h:627
gavl_audio_channels_t channels
Definition gavl.h:625
frame table structure
Definition gavl.h:4036
gavl_timecode_t tc
Timecode associated with this timestamp.
Definition gavl.h:4054
int num_timecodes
Number of timecodes.
Definition gavl.h:4048
int64_t num_frames
Number of frames.
Definition gavl.h:4044
int64_t duration
Duration of each of these frames.
Definition gavl.h:4045
int64_t offset
Timestamp of the first frame.
Definition gavl.h:4037
int64_t entries_alloc
Number of allocated entries (never touch this)
Definition gavl.h:4040
int64_t num_entries
Number of entries.
Definition gavl.h:4039
int64_t pts
Timestamp of this frame.
Definition gavl.h:4053
int timecodes_alloc
Number of allocated timecodes (never touch this)
Definition gavl.h:4049
Floating point rectangle.
Definition gavl.h:1443
double x
Definition gavl.h:1444
double y
Definition gavl.h:1445
double w
Definition gavl.h:1446
double h
Definition gavl.h:1447
Integer rectangle.
Definition gavl.h:1431
int32_t x
Definition gavl.h:1432
int32_t h
Definition gavl.h:1435
int32_t y
Definition gavl.h:1433
int32_t w
Definition gavl.h:1434
Timecode format.
Definition timecode.h:60
Video format.
Definition gavl.h:2375
uint32_t frame_height
Definition gavl.h:2377
gavl_chroma_placement_t chroma_placement
Definition gavl.h:2394
gavl_hw_context_t * hwctx
Handle for accessing the frames. If NULL, frames are in regular RAM.
Definition gavl.h:2400
uint32_t image_height
Definition gavl.h:2380
uint32_t pixel_height
Definition gavl.h:2385
uint32_t frame_width
Definition gavl.h:2376
uint32_t image_width
Definition gavl.h:2379
uint32_t timescale
Definition gavl.h:2391
gavl_interlace_mode_t interlace_mode
Definition gavl.h:2396
gavl_framerate_mode_t framerate_mode
Definition gavl.h:2393
gavl_pixelformat_t pixelformat
Definition gavl.h:2387
uint32_t pixel_width
Definition gavl.h:2384
gavl_timecode_format_t timecode_format
Definition gavl.h:2398
uint32_t frame_duration
Definition gavl.h:2389
Definition gavl.h:2587
uint8_t * planes[GAVL_MAX_PLANES]
Definition gavl.h:2588
int64_t duration
Definition gavl.h:2593
int strides[GAVL_MAX_PLANES]
Definition gavl.h:2589
void * client_data
Definition gavl.h:2591
int32_t dst_y
y offset in the destination frame. (since 1.5.0) *‍/
Definition gavl.h:2603
void * storage
Definition gavl.h:2606
int64_t timestamp
Definition gavl.h:2592
int32_t dst_x
x offset in the destination frame. (since 1.5.0) *‍/
Definition gavl.h:2602
gavl_rectangle_i_t src_rect
Valid rectangle in this frame (since 1.5.0) *‍/.
Definition gavl.h:2601
int refcount
Definition gavl.h:2597
gavl_hw_context_t * hwctx
Handle for accessing the frame.
Definition gavl.h:2605
gavl_interlace_mode_t interlace_mode
Definition gavl.h:2594
gavl_timecode_t timecode
Definition gavl.h:2595
Container for noninterleaved audio samples.
Definition gavl.h:591
Container for interleaved audio samples.
Definition gavl.h:571
uint32_t * u_32
Definition gavl.h:578
int8_t * s_8
Definition gavl.h:573
uint16_t * u_16
Definition gavl.h:575
int16_t * s_16
Definition gavl.h:576
uint8_t * u_8
Definition gavl.h:572
float * f
Definition gavl.h:581
double * d
Definition gavl.h:582
int32_t * s_32
Definition gavl.h:579