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
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/* Forward declarations */
41
48typedef struct gavl_video_source_s gavl_video_source_t;
49
56typedef struct gavl_audio_source_s gavl_audio_source_t;
57
64typedef struct gavl_packet_source_s gavl_packet_source_t;
65
72typedef struct
73gavl_audio_sink_s gavl_audio_sink_t;
74
81typedef struct
82gavl_video_sink_s gavl_video_sink_t;
83
90typedef struct
91gavl_packet_sink_s gavl_packet_sink_t;
92
98
106
129typedef void (*gavl_video_process_func)(void * data, int start, int end);
130
145 void * gavl_data,
146 int start, int end,
147 void * client_data, int thread);
148
157typedef void (*gavl_video_stop_func)(void * client_data, int thread);
158
165/* Quality levels */
166
190#define GAVL_QUALITY_FASTEST 1
191
198#define GAVL_QUALITY_BEST 5
199
206#define GAVL_QUALITY_DEFAULT 2
207
219#define GAVL_ACCEL_MMX (1<<0)
220#define GAVL_ACCEL_MMXEXT (1<<1)
221#define GAVL_ACCEL_SSE (1<<2)
222#define GAVL_ACCEL_SSE2 (1<<3)
223#define GAVL_ACCEL_SSE3 (1<<4)
224#define GAVL_ACCEL_3DNOW (1<<5)
225#define GAVL_ACCEL_3DNOWEXT (1<<6)
226#define GAVL_ACCEL_SSSE3 (1<<7)
227
232GAVL_PUBLIC int gavl_accel_supported();
233
242/* Sample formats: all multibyte numbers are native endian */
243
256#define GAVL_MAX_CHANNELS 128
257
264typedef enum
265 {
275
281typedef enum
282 {
287
295typedef enum
296 {
311
320typedef struct
321 {
323 uint32_t samplerate;
324 uint32_t num_channels;
334
335
336/* Audio format -> string conversions */
337
345GAVL_PUBLIC
347
355GAVL_PUBLIC
357
366GAVL_PUBLIC
368
376GAVL_PUBLIC
378
379
385GAVL_PUBLIC
387
394GAVL_PUBLIC
396
404GAVL_PUBLIC
406
414GAVL_PUBLIC
416
424GAVL_PUBLIC
426
427
428
436GAVL_PUBLIC
438
446GAVL_PUBLIC
448
456GAVL_PUBLIC
458
465GAVL_PUBLIC
467
480GAVL_PUBLIC
481void gavl_audio_format_dumpi(const gavl_audio_format_t * format, int indent);
482
491GAVL_PUBLIC
493
500GAVL_PUBLIC
502
509GAVL_PUBLIC
511
518GAVL_PUBLIC
520
527GAVL_PUBLIC
529
530
531
538GAVL_PUBLIC
540
548GAVL_PUBLIC
550 const gavl_audio_format_t * src);
551
560GAVL_PUBLIC
562 const gavl_audio_format_t * format_2);
563
575GAVL_PUBLIC
577
584GAVL_PUBLIC
586
597GAVL_PUBLIC
598int gavl_nearest_samplerate(int in_rate, const int * supported);
599
600
615typedef union
616 {
617 uint8_t * u_8;
618 int8_t * s_8;
620 uint16_t * u_16;
621 int16_t * s_16;
623 uint32_t * u_32;
624 int32_t * s_32;
626 float * f;
627 double * d;
629
635typedef union
636 {
637 uint8_t * u_8[GAVL_MAX_CHANNELS];
638 int8_t * s_8[GAVL_MAX_CHANNELS];
640 uint16_t * u_16[GAVL_MAX_CHANNELS];
641 int16_t * s_16[GAVL_MAX_CHANNELS];
643 uint32_t * u_32[GAVL_MAX_CHANNELS];
644 int32_t * s_32[GAVL_MAX_CHANNELS];
647 double * d[GAVL_MAX_CHANNELS];
650
667typedef struct
668 {
672 int64_t timestamp;
675
687GAVL_PUBLIC
689
701GAVL_PUBLIC
703
713GAVL_PUBLIC
715
725GAVL_PUBLIC
727 const gavl_audio_format_t * format);
728
739GAVL_PUBLIC
741 const gavl_audio_format_t * format,
742 int num_samples);
743
744
745
756GAVL_PUBLIC
758 const gavl_audio_format_t * format,
759 int channel);
760
781GAVL_PUBLIC
783 gavl_audio_frame_t * dst,
784 const gavl_audio_frame_t * src,
785 int dst_pos,
786 int src_pos,
787 int dst_size,
788 int src_size);
789
802GAVL_PUBLIC
804 gavl_audio_frame_t * dst,
805 const gavl_audio_frame_t * src);
806
824GAVL_PUBLIC
826 gavl_audio_frame_t * src,
827 gavl_audio_frame_t * dst,
828 int start, int len);
829
842GAVL_PUBLIC
844 const gavl_audio_frame_t * f1,
845 const gavl_audio_frame_t * f2);
846
858GAVL_PUBLIC
860 const gavl_audio_frame_t * f);
861
862
873GAVL_PUBLIC
875 const gavl_audio_format_t * format,
876 uint8_t * data);
877
896GAVL_PUBLIC
898 gavl_audio_frame_t * f, int num_samples);
899
900
920GAVL_PUBLIC
922 const gavl_audio_frame_t * frame,
923 const char * name_base);
924
925
940#define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
945#define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
950#define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
955#define GAVL_AUDIO_FRONT_TO_REAR_MASK \
956(GAVL_AUDIO_FRONT_TO_REAR_COPY | \
957GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
958 GAVL_AUDIO_FRONT_TO_REAR_DIFF)
960/* Options for mixing stereo to mono */
961
964#define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
967#define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
970#define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
974#define GAVL_AUDIO_STEREO_TO_MONO_MASK \
975(GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
976GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
977GAVL_AUDIO_STEREO_TO_MONO_MIX)
982#define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
989typedef enum
990 {
991 GAVL_AUDIO_DITHER_NONE = 0,
992 GAVL_AUDIO_DITHER_AUTO = 1,
993 GAVL_AUDIO_DITHER_RECT = 2,
994 GAVL_AUDIO_DITHER_TRI = 3,
995 GAVL_AUDIO_DITHER_SHAPED = 4,
997
1002typedef enum
1003 {
1011
1018typedef struct gavl_audio_options_s gavl_audio_options_t;
1019
1026GAVL_PUBLIC
1028
1035GAVL_PUBLIC
1037
1044GAVL_PUBLIC
1046
1053GAVL_PUBLIC
1056
1057
1064GAVL_PUBLIC
1066
1073GAVL_PUBLIC
1076
1083GAVL_PUBLIC
1085 int flags);
1086
1093GAVL_PUBLIC
1095
1101GAVL_PUBLIC
1103
1120GAVL_PUBLIC
1122 const double ** matrix);
1123
1132GAVL_PUBLIC
1133const double **
1135
1145GAVL_PUBLIC
1147
1154GAVL_PUBLIC
1156 const gavl_audio_options_t * src);
1157
1163GAVL_PUBLIC
1165
1166
1167
1168/* Audio converter */
1169
1203typedef struct gavl_audio_converter_s gavl_audio_converter_t;
1204
1210GAVL_PUBLIC
1212
1218GAVL_PUBLIC
1220
1229GAVL_PUBLIC
1231
1232
1247GAVL_PUBLIC
1249 const gavl_audio_format_t * input_format,
1250 const gavl_audio_format_t * output_format);
1251
1266GAVL_PUBLIC
1268 const gavl_audio_format_t * format);
1269
1284GAVL_PUBLIC
1286
1287
1301GAVL_PUBLIC
1303 const gavl_audio_frame_t * input_frame,
1304 gavl_audio_frame_t * output_frame);
1305
1306
1325GAVL_PUBLIC
1327 double ratio ) ;
1328
1329
1345GAVL_PUBLIC
1347 gavl_audio_frame_t * input_frame,
1348 gavl_audio_frame_t * output_frame,
1349 double ratio);
1350
1351
1365typedef struct gavl_volume_control_s gavl_volume_control_t;
1366
1367/* Create / destroy */
1368
1374GAVL_PUBLIC
1376
1382GAVL_PUBLIC
1384
1392GAVL_PUBLIC
1394 const gavl_audio_format_t * format);
1395
1402GAVL_PUBLIC
1404 float volume);
1405
1412GAVL_PUBLIC
1414 gavl_audio_frame_t * frame);
1415
1424GAVL_PUBLIC
1425int gavl_volume_to_int(float volume, float one, int steps);
1426
1435GAVL_PUBLIC
1436float gavl_volume_to_float(int volume, float one, int steps);
1437
1447#define GAVL_MAX_PLANES 4
1459typedef struct
1460 {
1461 int32_t x;
1462 int32_t y;
1463 int32_t w;
1464 int32_t h;
1466
1471typedef struct
1472 {
1473 double x;
1474 double y;
1475 double w;
1476 double h;
1478
1485GAVL_PUBLIC
1487 const gavl_video_format_t * format);
1488
1495GAVL_PUBLIC
1497 const gavl_video_format_t * format);
1498
1513GAVL_PUBLIC
1515 gavl_rectangle_i_t * dst_rect,
1516 const gavl_video_format_t * src_format,
1517 const gavl_video_format_t * dst_format);
1518
1530GAVL_PUBLIC
1532 gavl_rectangle_i_t * dst_rect,
1533 const gavl_video_format_t * src_format,
1534 const gavl_video_format_t * dst_format);
1535
1536
1537
1544GAVL_PUBLIC
1546
1553GAVL_PUBLIC
1555
1562GAVL_PUBLIC
1564
1571GAVL_PUBLIC
1573
1580GAVL_PUBLIC
1582
1589GAVL_PUBLIC
1591
1598GAVL_PUBLIC
1600
1607GAVL_PUBLIC
1609
1616GAVL_PUBLIC
1618
1625GAVL_PUBLIC
1627
1641GAVL_PUBLIC
1642void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1643
1653GAVL_PUBLIC
1655 const gavl_video_format_t * format);
1656
1657
1664GAVL_PUBLIC
1666
1673GAVL_PUBLIC
1675
1676
1677
1684GAVL_PUBLIC
1686
1693GAVL_PUBLIC
1695
1704GAVL_PUBLIC
1706
1715GAVL_PUBLIC
1717
1745GAVL_PUBLIC
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
1756GAVL_PUBLIC
1758
1763GAVL_PUBLIC
1765
1766
1776#define GAVL_PIXFMT_PLANAR (1<<8)
1777
1781#define GAVL_PIXFMT_RGB (1<<9)
1782
1786#define GAVL_PIXFMT_YUV (1<<10)
1787
1791#define GAVL_PIXFMT_YUVJ (1<<11)
1792
1796#define GAVL_PIXFMT_ALPHA (1<<12)
1797
1801#define GAVL_PIXFMT_GRAY (1<<13)
1802
1808 {
1812
1816
1820
1824
1828
1832
1836
1868
1875
1882
1898
1902
1919
1929
1936
1937 };
1938
1944
1947#define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1950#define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1953#define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1956#define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1957
1960#define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1963#define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1966#define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1969#define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1970
1973#define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1976#define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1979#define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1982#define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1983
1990typedef enum
1991 {
2001
2002/*
2003 * Colormodel related functions
2004 */
2005
2012#define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
2013
2014
2021#define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
2022
2029#define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
2030
2037#define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
2038
2045#define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
2046
2053#define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
2054
2055
2062GAVL_PUBLIC
2064
2072GAVL_PUBLIC gavl_color_channel_t
2074
2075
2082GAVL_PUBLIC
2084
2094GAVL_PUBLIC
2095void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
2096
2103GAVL_PUBLIC
2105
2112GAVL_PUBLIC
2114
2121GAVL_PUBLIC
2123
2138GAVL_PUBLIC
2140 gavl_pixelformat_t dst);
2141
2155GAVL_PUBLIC gavl_pixelformat_t
2157 const gavl_pixelformat_t * dst_supported,
2158 int * penalty);
2159
2160
2161
2168GAVL_PUBLIC
2170
2180GAVL_PUBLIC
2182
2183
2190GAVL_PUBLIC
2192
2199GAVL_PUBLIC
2201
2208GAVL_PUBLIC
2210
2211
2212
2218GAVL_PUBLIC
2220
2227GAVL_PUBLIC
2229
2230/* */
2231
2240typedef enum
2241 {
2246
2253GAVL_PUBLIC
2255
2262GAVL_PUBLIC
2264
2271GAVL_PUBLIC
2273
2274
2279/* Changing the values alters the gmerlin-avdecoder index format */
2280
2281typedef enum
2282 {
2288
2295GAVL_PUBLIC
2297
2304GAVL_PUBLIC
2306
2313GAVL_PUBLIC
2315
2320/* Changing the values alters the gmerlin-avdecoder index format */
2321
2322typedef enum
2323 {
2332
2339GAVL_PUBLIC
2341
2348GAVL_PUBLIC
2350
2357GAVL_PUBLIC
2359
2368GAVL_PUBLIC
2370
2371#include <gavl/hw.h> // Needs forward declarations
2372
2373/* Video format structure */
2374
2380 {
2381 uint32_t frame_width;
2384 uint32_t image_width;
2387 /* Support for nonsquare pixels */
2388
2389 uint32_t pixel_width;
2396 uint32_t timescale;
2405 gavl_hw_context_t * hwctx;
2406
2407 };
2408
2416GAVL_PUBLIC
2418 const gavl_video_format_t * src);
2419
2428GAVL_PUBLIC
2430 const gavl_video_format_t * format_2);
2431
2432
2443GAVL_PUBLIC
2444void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2445 float * off_x, float * off_y);
2446
2447
2448
2461GAVL_PUBLIC
2463 const gavl_video_format_t * src);
2464
2472GAVL_PUBLIC
2474
2491GAVL_PUBLIC
2493 int pad_h, int pad_v);
2494
2495
2511GAVL_PUBLIC
2513 gavl_video_format_t * channel_format,
2515
2516
2530GAVL_PUBLIC
2532 gavl_video_format_t * field_format,
2533 int field);
2534
2535
2542GAVL_PUBLIC
2544
2557GAVL_PUBLIC
2558void gavl_video_format_dumpi(const gavl_video_format_t * format, int indent);
2559
2560
2584 {
2588 void * user_data;
2589 int64_t timestamp;
2590 int64_t duration;
2595 // void (*destroy)(struct gavl_video_frame_s*, void*priv); /*!< Function for destroying this frame (since 1.5.0) */
2596 // void * destroy_priv; /*!< Private data to pass to destroy() (since 1.5.0) */
2597
2599 int32_t dst_x;
2600 int32_t dst_y;
2601
2602 gavl_hw_context_t * hwctx;
2603
2604 };
2605
2606
2618GAVL_PUBLIC
2620
2631GAVL_PUBLIC
2633
2634
2635
2645GAVL_PUBLIC
2647
2659GAVL_PUBLIC
2661
2670GAVL_PUBLIC
2672 const gavl_video_format_t * format);
2673
2683GAVL_PUBLIC
2685 const gavl_video_format_t * format,
2686 const float * color);
2687
2700GAVL_PUBLIC
2702 const gavl_video_frame_t * src1,
2703 const gavl_video_frame_t * src2,
2704 const gavl_video_format_t * format);
2705
2718GAVL_PUBLIC
2719void gavl_video_frame_psnr(double * psnr,
2720 const gavl_video_frame_t * src1,
2721 const gavl_video_frame_t * src2,
2722 const gavl_video_format_t * format);
2723
2750GAVL_PUBLIC
2752 const gavl_video_frame_t * src2,
2753 gavl_video_frame_t * dst,
2754 const gavl_video_format_t * format);
2755
2769GAVL_PUBLIC
2771 gavl_video_frame_t * dst,
2772 const gavl_video_frame_t * src);
2773
2786GAVL_PUBLIC
2788 gavl_video_frame_t * dst,
2789 const gavl_video_frame_t * src, int plane);
2790
2802GAVL_PUBLIC
2804 gavl_video_frame_t * dst,
2805 const gavl_video_frame_t * src);
2806
2818GAVL_PUBLIC
2820 gavl_video_frame_t * dst,
2821 const gavl_video_frame_t * src);
2822
2834GAVL_PUBLIC
2836 gavl_video_frame_t * dst,
2837 const gavl_video_frame_t * src);
2838
2851GAVL_PUBLIC
2853 const gavl_video_frame_t * src);
2854
2855
2873GAVL_PUBLIC
2875 const gavl_video_frame_t * src,
2876 gavl_video_frame_t * dst,
2877 const gavl_rectangle_i_t * src_rect);
2878
2894GAVL_PUBLIC
2896 const gavl_video_frame_t * src,
2897 gavl_video_frame_t * dst,
2898 int field);
2899
2900
2901
2914GAVL_PUBLIC
2916 const gavl_video_format_t * format,
2917 const char * namebase);
2918
2929GAVL_PUBLIC
2931 const gavl_video_frame_t * frame);
2932
2943GAVL_PUBLIC
2945 const gavl_video_format_t * format);
2946
2959GAVL_PUBLIC
2961 const gavl_video_format_t * format,
2962 uint8_t * buffer);
2963
2975GAVL_PUBLIC
2977 const gavl_video_frame_t * frame);
2978
2979
2994GAVL_PUBLIC
2997 const gavl_video_frame_t * src,
2998 gavl_video_frame_t * dst);
2999
3015GAVL_PUBLIC
3018 const gavl_video_frame_t * src,
3019 gavl_video_frame_t * dst);
3020
3021
3033GAVL_PUBLIC
3035 const gavl_video_frame_t * f1,
3036 const gavl_video_frame_t * f2);
3037
3038
3039/*****************************
3040 Conversion options
3041******************************/
3042
3058#define GAVL_FORCE_DEINTERLACE (1<<0)
3059
3064#define GAVL_CONVOLVE_CHROMA (1<<1)
3065
3070#define GAVL_CONVOLVE_NORMALIZE (1<<2)
3071
3079#define GAVL_RESAMPLE_CHROMA (1<<3)
3080
3088typedef enum
3089 {
3093
3100typedef enum
3101 {
3107
3114typedef enum
3115 {
3119
3124typedef enum
3125 {
3136
3146typedef enum
3147 {
3153
3160typedef struct gavl_video_options_s gavl_video_options_t;
3161
3162/* Default Options */
3163
3169GAVL_PUBLIC
3171
3181GAVL_PUBLIC
3183
3190GAVL_PUBLIC
3192 const gavl_video_options_t * src);
3193
3199GAVL_PUBLIC
3201
3202
3217GAVL_PUBLIC
3219 const gavl_rectangle_f_t * src_rect,
3220 const gavl_rectangle_i_t * dst_rect);
3221
3229GAVL_PUBLIC
3231 gavl_rectangle_f_t * src_rect,
3232 gavl_rectangle_i_t * dst_rect);
3233
3240GAVL_PUBLIC
3242
3249GAVL_PUBLIC
3251
3252
3259GAVL_PUBLIC
3261 int conversion_flags);
3262
3269GAVL_PUBLIC
3271
3278GAVL_PUBLIC
3280 gavl_alpha_mode_t alpha_mode);
3281
3288GAVL_PUBLIC gavl_alpha_mode_t
3290
3291
3298GAVL_PUBLIC
3300 gavl_scale_mode_t scale_mode);
3301
3308GAVL_PUBLIC gavl_scale_mode_t
3310
3311
3318GAVL_PUBLIC
3320 int order);
3321
3328GAVL_PUBLIC
3330
3331
3338GAVL_PUBLIC
3340 const double * color);
3341
3348GAVL_PUBLIC
3350 double * color);
3351
3358GAVL_PUBLIC
3360 gavl_deinterlace_mode_t deinterlace_mode);
3361
3368GAVL_PUBLIC gavl_deinterlace_mode_t
3370
3377GAVL_PUBLIC
3379 gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3380
3389
3398GAVL_PUBLIC
3401
3402
3411GAVL_PUBLIC gavl_downscale_filter_t
3413
3431GAVL_PUBLIC
3433 float f);
3434
3443GAVL_PUBLIC
3445
3454GAVL_PUBLIC
3456
3457
3466GAVL_PUBLIC
3468
3478GAVL_PUBLIC
3481 void * client_data);
3482
3492GAVL_PUBLIC
3495 void ** client_data);
3496
3506GAVL_PUBLIC
3509 void * client_data);
3510
3520GAVL_PUBLIC
3523 void ** client_data);
3524
3525
3526/***************************************************
3527 * Create and destroy video converters
3528 ***************************************************/
3529
3562typedef struct gavl_video_converter_s gavl_video_converter_t;
3563
3569GAVL_PUBLIC
3571
3577GAVL_PUBLIC
3579
3580/**************************************************
3581 * Get options. Change the options with the gavl_video_options_set_*
3582 * functions above
3583 **************************************************/
3584
3593GAVL_PUBLIC gavl_video_options_t *
3595
3596
3610GAVL_PUBLIC
3612 const gavl_video_format_t * input_format,
3613 const gavl_video_format_t * output_format);
3614
3627GAVL_PUBLIC
3629
3630
3631/***************************************************
3632 * Convert a frame
3633 ***************************************************/
3634
3642GAVL_PUBLIC
3644 const gavl_video_frame_t * input_frame,
3645 gavl_video_frame_t * output_frame);
3646
3678typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3679
3685GAVL_PUBLIC
3687
3693GAVL_PUBLIC
3695
3704GAVL_PUBLIC gavl_video_options_t *
3706
3719GAVL_PUBLIC
3721 const gavl_video_format_t * src_format,
3722 const gavl_video_format_t * dst_format);
3723
3745GAVL_PUBLIC
3747 const gavl_video_format_t * format,
3748 int h_radius, const float * h_coeffs,
3749 int v_radius, const float * v_coeffs);
3750
3758GAVL_PUBLIC
3760 const gavl_video_frame_t * input_frame,
3761 gavl_video_frame_t * output_frame);
3762
3778typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3779
3785GAVL_PUBLIC
3787
3793GAVL_PUBLIC
3795
3804GAVL_PUBLIC gavl_video_options_t *
3806
3817GAVL_PUBLIC
3819 const gavl_video_format_t * src_format);
3820
3821
3829GAVL_PUBLIC
3831 const gavl_video_frame_t * input_frame,
3832 gavl_video_frame_t * output_frame);
3833
3834
3835
3836/**************************************************
3837 * Transparent overlays
3838 **************************************************/
3839
3840/* Overlay struct */
3841
3870
3877typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3878
3884GAVL_PUBLIC
3886
3892GAVL_PUBLIC
3894
3901GAVL_PUBLIC gavl_video_options_t *
3903
3919GAVL_PUBLIC
3921 const gavl_video_format_t * frame_format,
3922 gavl_video_format_t * overlay_format);
3923
3933GAVL_PUBLIC
3935 gavl_overlay_t * ovl);
3936
3943GAVL_PUBLIC
3945 gavl_video_frame_t * dst_frame);
3946
3953GAVL_PUBLIC gavl_video_sink_t *
3955
3977typedef struct gavl_image_transform_s gavl_image_transform_t;
3978
3992typedef void (*gavl_image_transform_func)(void * priv,
3993 double xdst,
3994 double ydst,
3995 double * xsrc,
3996 double * ysrc);
3997
3998
4005GAVL_PUBLIC
4007
4013GAVL_PUBLIC
4015
4034GAVL_PUBLIC
4036 gavl_video_format_t * format,
4037 gavl_image_transform_func func, void * priv);
4038
4046GAVL_PUBLIC
4048 gavl_video_frame_t * in_frame,
4049 gavl_video_frame_t * out_frame);
4050
4061GAVL_PUBLIC gavl_video_options_t *
4063
4086typedef struct
4087 {
4088 int64_t offset;
4089 /* Primary */
4090 int64_t num_entries;
4092
4093 struct
4094 {
4095 int64_t num_frames;
4096 int64_t duration;
4097 } * entries;
4098
4101
4102 struct
4103 {
4104 int64_t pts;
4106 } * timecodes;
4107
4108 /* Secondary */
4109
4111
4118
4129GAVL_PUBLIC gavl_frame_table_t *
4130gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
4131 gavl_timecode_format_t * fmt_ret);
4132
4143GAVL_PUBLIC gavl_frame_table_t *
4144gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
4145 int64_t num_frames,
4146 gavl_timecode_t start_timecode);
4147
4155GAVL_PUBLIC gavl_frame_table_t *
4157
4158
4159
4167
4175GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
4176
4185GAVL_PUBLIC void
4187 int64_t pts, gavl_timecode_t tc);
4188
4199GAVL_PUBLIC int64_t
4201 int64_t frame, int * duration);
4202
4213GAVL_PUBLIC int64_t
4215 int64_t time,
4216 int64_t * start_time);
4217
4228GAVL_PUBLIC gavl_timecode_t
4230 int64_t time,
4231 int64_t * start_time,
4232 const gavl_timecode_format_t * fmt);
4233
4243GAVL_PUBLIC int64_t
4245 gavl_timecode_t tc,
4246 const gavl_timecode_format_t * fmt);
4247
4248
4259GAVL_PUBLIC gavl_timecode_t
4261 int64_t frame,
4262 int64_t * start_time,
4263 const gavl_timecode_format_t * fmt);
4264
4265
4266
4274GAVL_PUBLIC int64_t
4276
4284GAVL_PUBLIC int64_t
4286
4294GAVL_PUBLIC int64_t
4296
4305GAVL_PUBLIC
4307 const char * filename);
4308
4316GAVL_PUBLIC
4318
4325GAVL_PUBLIC void
4327
4355typedef struct gavl_video_frame_pool_s gavl_video_frame_pool_t;
4356
4363GAVL_PUBLIC
4366 void * priv);
4367
4373GAVL_PUBLIC
4375
4383GAVL_PUBLIC
4385
4393GAVL_PUBLIC
4395
4401#ifdef __cplusplus
4402}
4403#endif
4404
4405#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:1203
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:296
gavl_sample_format_t
Format of one audio sample.
Definition: gavl.h:265
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:282
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:256
@ GAVL_CHID_SIDE_RIGHT
Definition: gavl.h:307
@ GAVL_CHID_FRONT_RIGHT
Definition: gavl.h:300
@ GAVL_CHID_FRONT_LEFT
Definition: gavl.h:299
@ GAVL_CHID_REAR_LEFT
Definition: gavl.h:303
@ GAVL_CHID_SIDE_LEFT
Definition: gavl.h:306
@ GAVL_CHID_NONE
Definition: gavl.h:297
@ GAVL_CHID_FRONT_CENTER_LEFT
Definition: gavl.h:301
@ GAVL_CHID_REAR_CENTER
Definition: gavl.h:305
@ GAVL_CHID_LFE
Definition: gavl.h:308
@ GAVL_CHID_REAR_RIGHT
Definition: gavl.h:304
@ GAVL_CHID_AUX
Definition: gavl.h:309
@ GAVL_CHID_FRONT_CENTER_RIGHT
Definition: gavl.h:302
@ GAVL_CHID_FRONT_CENTER
Definition: gavl.h:298
@ GAVL_SAMPLE_FLOAT
Definition: gavl.h:272
@ GAVL_SAMPLE_NONE
Definition: gavl.h:266
@ GAVL_SAMPLE_U8
Definition: gavl.h:267
@ GAVL_SAMPLE_S8
Definition: gavl.h:268
@ GAVL_SAMPLE_U16
Definition: gavl.h:269
@ GAVL_SAMPLE_S16
Definition: gavl.h:270
@ GAVL_SAMPLE_DOUBLE
Definition: gavl.h:273
@ GAVL_SAMPLE_S32
Definition: gavl.h:271
@ GAVL_INTERLEAVE_2
Definition: gavl.h:284
@ GAVL_INTERLEAVE_ALL
Definition: gavl.h:285
@ GAVL_INTERLEAVE_NONE
Definition: gavl.h:283
GAVL_PUBLIC void gavl_audio_frame_destroy(gavl_audio_frame_t *frame)
Destroy 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:1018
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:990
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:1003
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:1009
@ GAVL_RESAMPLE_ZOH
Definition: gavl.h:1005
@ GAVL_RESAMPLE_LINEAR
Definition: gavl.h:1006
@ GAVL_RESAMPLE_AUTO
Definition: gavl.h:1004
@ GAVL_RESAMPLE_SINC_MEDIUM
Definition: gavl.h:1008
@ GAVL_RESAMPLE_SINC_FAST
Definition: gavl.h:1007
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.
void(* gavl_video_stop_func)(void *client_data, int thread)
Wait until a piece of a calculation finished.
Definition: gavl.h:157
void(* gavl_video_process_func)(void *data, int start, int end)
Prototype of a process function.
Definition: gavl.h:129
void(* gavl_video_run_func)(gavl_video_process_func func, void *gavl_data, int start, int end, void *client_data, int thread)
Run a piece of a calculation.
Definition: gavl.h:144
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:81
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition: gavl.h:72
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition: gavl.h:90
struct gavl_video_source_s gavl_video_source_t
Forward declaration of the video source.
Definition: gavl.h:48
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition: gavl.h:56
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition: gavl.h:64
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:3869
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:3877
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:3562
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:3778
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:1776
#define GAVL_PIXFMT_ALPHA
Definition: gavl.h:1796
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:2241
#define GAVL_PIXFMT_GRAY
Definition: gavl.h:1801
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:2282
gavl_pixelformat_e
Pixelformat definition.
Definition: gavl.h:1808
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:1943
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:2323
#define GAVL_PIXFMT_RGB
Definition: gavl.h:1781
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:1786
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:1991
GAVL_PUBLIC int gavl_num_pixelformats()
Get total number of supported pixelformats.
#define GAVL_PIXFMT_YUVJ
Definition: gavl.h:1791
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:2244
@ GAVL_CHROMA_PLACEMENT_MPEG2
Definition: gavl.h:2243
@ GAVL_CHROMA_PLACEMENT_DEFAULT
Definition: gavl.h:2242
@ GAVL_FRAMERATE_UNKNOWN
Definition: gavl.h:2283
@ GAVL_FRAMERATE_CONSTANT
Definition: gavl.h:2284
@ GAVL_FRAMERATE_STILL
Definition: gavl.h:2286
@ GAVL_FRAMERATE_VARIABLE
Definition: gavl.h:2285
@ GAVL_YUVJ_420_P
Definition: gavl.h:1922
@ GAVL_YUV_422_P
Definition: gavl.h:1909
@ GAVL_BGR_24
Definition: gavl.h:1858
@ GAVL_YUV_410_P
Definition: gavl.h:1918
@ GAVL_RGB_48
Definition: gavl.h:1871
@ GAVL_RGB_32
Definition: gavl.h:1861
@ GAVL_YUV_420_P
Definition: gavl.h:1906
@ GAVL_GRAYA_32
Definition: gavl.h:1831
@ GAVL_YUVA_32
Definition: gavl.h:1891
@ GAVL_RGB_16
Definition: gavl.h:1848
@ GAVL_UYVY
Definition: gavl.h:1888
@ GAVL_YUV_422_P_16
Definition: gavl.h:1935
@ GAVL_YUV_444_P
Definition: gavl.h:1912
@ GAVL_RGB_FLOAT
Definition: gavl.h:1878
@ GAVL_YUVJ_422_P
Definition: gavl.h:1925
@ GAVL_GRAY_8
Definition: gavl.h:1815
@ GAVL_RGB_24
Definition: gavl.h:1855
@ GAVL_RGBA_64
Definition: gavl.h:1874
@ GAVL_YUY2
Definition: gavl.h:1885
@ GAVL_YUVA_FLOAT
Definition: gavl.h:1901
@ GAVL_YUVJ_444_P
Definition: gavl.h:1928
@ GAVL_GRAYA_FLOAT
Definition: gavl.h:1835
@ GAVL_BGR_15
Definition: gavl.h:1844
@ GAVL_YUV_444_P_16
Definition: gavl.h:1932
@ GAVL_PIXELFORMAT_NONE
Undefined.
Definition: gavl.h:1811
@ GAVL_GRAYA_16
Definition: gavl.h:1827
@ GAVL_YUV_411_P
Definition: gavl.h:1915
@ GAVL_GRAY_FLOAT
Definition: gavl.h:1823
@ GAVL_YUV_FLOAT
Definition: gavl.h:1897
@ GAVL_RGBA_32
Definition: gavl.h:1867
@ GAVL_GRAY_16
Definition: gavl.h:1819
@ GAVL_BGR_16
Definition: gavl.h:1852
@ GAVL_YUVA_64
Definition: gavl.h:1894
@ GAVL_RGB_15
Definition: gavl.h:1840
@ GAVL_RGBA_FLOAT
Definition: gavl.h:1881
@ GAVL_BGR_32
Definition: gavl.h:1864
@ GAVL_INTERLACE_MIXED_BOTTOM
Definition: gavl.h:2330
@ GAVL_INTERLACE_MIXED_TOP
Definition: gavl.h:2329
@ GAVL_INTERLACE_NONE
Definition: gavl.h:2325
@ GAVL_INTERLACE_BOTTOM_FIRST
Definition: gavl.h:2327
@ GAVL_INTERLACE_UNKNOWN
Definition: gavl.h:2324
@ GAVL_INTERLACE_MIXED
Definition: gavl.h:2328
@ GAVL_INTERLACE_TOP_FIRST
Definition: gavl.h:2326
@ GAVL_CCH_NONE
None/undefined.
Definition: gavl.h:1992
@ GAVL_CCH_Y
Luminance (also grayscale)
Definition: gavl.h:1996
@ GAVL_CCH_RED
Red.
Definition: gavl.h:1993
@ GAVL_CCH_CR
Chrominance red (aka V)
Definition: gavl.h:1998
@ GAVL_CCH_GREEN
Green.
Definition: gavl.h:1994
@ GAVL_CCH_ALPHA
Transparency (or, to be more precise opacity)
Definition: gavl.h:1999
@ GAVL_CCH_CB
Chrominance blue (aka U)
Definition: gavl.h:1997
@ GAVL_CCH_BLUE
Blue.
Definition: gavl.h:1995
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:4355
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_run_func(gavl_video_options_t *opt, gavl_video_run_func func, void *client_data)
Set function to be passed to each thread.
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_num_threads(const gavl_video_options_t *opt)
Set number of threads.
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_num_threads(gavl_video_options_t *opt, int n)
Set number of threads.
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:3101
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:3115
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:3160
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 gavl_video_stop_func gavl_video_options_get_stop_func(const gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
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:3089
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 void gavl_video_options_set_stop_func(gavl_video_options_t *opt, gavl_video_stop_func func, void *client_data)
Set function to be passed to each thread.
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:3125
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:3147
GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode(const gavl_video_options_t *opt)
Get the scale mode.
GAVL_PUBLIC gavl_video_run_func gavl_video_options_get_run_func(const gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
@ GAVL_DEINTERLACE_NONE
Definition: gavl.h:3102
@ GAVL_DEINTERLACE_SCALE
Definition: gavl.h:3104
@ GAVL_DEINTERLACE_BLEND
Definition: gavl.h:3105
@ GAVL_DEINTERLACE_COPY
Definition: gavl.h:3103
@ GAVL_DEINTERLACE_DROP_TOP
Definition: gavl.h:3116
@ GAVL_DEINTERLACE_DROP_BOTTOM
Definition: gavl.h:3117
@ GAVL_ALPHA_IGNORE
Definition: gavl.h:3090
@ GAVL_ALPHA_BLEND_COLOR
Definition: gavl.h:3091
@ GAVL_SCALE_NONE
Definition: gavl.h:3134
@ GAVL_SCALE_NEAREST
Definition: gavl.h:3127
@ GAVL_SCALE_CUBIC_MITCHELL
Definition: gavl.h:3131
@ GAVL_SCALE_AUTO
Definition: gavl.h:3126
@ GAVL_SCALE_SINC_LANCZOS
Definition: gavl.h:3133
@ GAVL_SCALE_CUBIC_CATMULL
Definition: gavl.h:3132
@ GAVL_SCALE_CUBIC_BSPLINE
Definition: gavl.h:3130
@ GAVL_SCALE_QUADRATIC
Definition: gavl.h:3129
@ GAVL_SCALE_BILINEAR
Definition: gavl.h:3128
@ GAVL_DOWNSCALE_FILTER_AUTO
Auto selection based on quality.
Definition: gavl.h:3148
@ GAVL_DOWNSCALE_FILTER_NONE
Fastest method, might produce heavy aliasing artifacts.
Definition: gavl.h:3149
@ GAVL_DOWNSCALE_FILTER_WIDE
Widen the filter curve according to the scaling ratio.
Definition: gavl.h:3150
@ GAVL_DOWNSCALE_FILTER_GAUSS
Do a Gaussian preblur.
Definition: gavl.h:3151
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:3678
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:3977
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition: gavl.h:3992
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:1447
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:1365
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:321
uint32_t samples_per_frame
Definition: gavl.h:322
uint32_t samplerate
Definition: gavl.h:323
float rear_level
Definition: gavl.h:329
gavl_interleave_mode_t interleave_mode
Definition: gavl.h:326
gavl_sample_format_t sample_format
Definition: gavl.h:325
uint32_t num_channels
Definition: gavl.h:324
float center_level
Definition: gavl.h:328
Generic container for audio samples.
Definition: gavl.h:668
int channel_stride
Definition: gavl.h:673
gavl_audio_samples_t samples
Definition: gavl.h:669
int valid_samples
Definition: gavl.h:671
int64_t timestamp
Definition: gavl.h:672
gavl_audio_channels_t channels
Definition: gavl.h:670
frame table structure
Definition: gavl.h:4087
gavl_timecode_t tc
Timecode associated with this timestamp.
Definition: gavl.h:4105
int num_timecodes
Number of timecodes.
Definition: gavl.h:4099
int64_t num_frames
Number of frames.
Definition: gavl.h:4095
int64_t duration
Duration of each of these frames.
Definition: gavl.h:4096
int64_t offset
Timestamp of the first frame.
Definition: gavl.h:4088
int64_t entries_alloc
Number of allocated entries (never touch this)
Definition: gavl.h:4091
int64_t num_entries
Number of entries.
Definition: gavl.h:4090
int64_t pts
Timestamp of this frame.
Definition: gavl.h:4104
int timecodes_alloc
Number of allocated timecodes (never touch this)
Definition: gavl.h:4100
Floating point rectangle.
Definition: gavl.h:1472
double x
Definition: gavl.h:1473
double y
Definition: gavl.h:1474
double w
Definition: gavl.h:1475
double h
Definition: gavl.h:1476
Integer rectangle.
Definition: gavl.h:1460
int32_t x
Definition: gavl.h:1461
int32_t h
Definition: gavl.h:1464
int32_t y
Definition: gavl.h:1462
int32_t w
Definition: gavl.h:1463
Timecode format.
Definition: timecode.h:60
Video format.
Definition: gavl.h:2380
uint32_t frame_height
Definition: gavl.h:2382
gavl_chroma_placement_t chroma_placement
Definition: gavl.h:2399
gavl_hw_context_t * hwctx
Handle for accessing the frames. If NULL, frames are in regular RAM.
Definition: gavl.h:2405
uint32_t image_height
Definition: gavl.h:2385
uint32_t pixel_height
Definition: gavl.h:2390
uint32_t frame_width
Definition: gavl.h:2381
uint32_t image_width
Definition: gavl.h:2384
uint32_t timescale
Definition: gavl.h:2396
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2401
gavl_framerate_mode_t framerate_mode
Definition: gavl.h:2398
gavl_pixelformat_t pixelformat
Definition: gavl.h:2392
uint32_t pixel_width
Definition: gavl.h:2389
gavl_timecode_format_t timecode_format
Definition: gavl.h:2403
uint32_t frame_duration
Definition: gavl.h:2394
Definition: gavl.h:2584
uint8_t * planes[GAVL_MAX_PLANES]
Definition: gavl.h:2585
int64_t duration
Definition: gavl.h:2590
int strides[GAVL_MAX_PLANES]
Definition: gavl.h:2586
int32_t dst_y
y offset in the destination frame. (since 1.5.0) *‍/
Definition: gavl.h:2600
void * user_data
Definition: gavl.h:2588
int64_t timestamp
Definition: gavl.h:2589
int32_t dst_x
x offset in the destination frame. (since 1.5.0) *‍/
Definition: gavl.h:2599
gavl_rectangle_i_t src_rect
Valid rectangle in this frame (since 1.5.0) *‍/.
Definition: gavl.h:2598
int refcount
Definition: gavl.h:2594
gavl_hw_context_t * hwctx
Handle for accessing the frame.
Definition: gavl.h:2602
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2591
gavl_timecode_t timecode
Definition: gavl.h:2592
Container for noninterleaved audio samples.
Definition: gavl.h:636
Container for interleaved audio samples.
Definition: gavl.h:616
uint32_t * u_32
Definition: gavl.h:623
int8_t * s_8
Definition: gavl.h:618
uint16_t * u_16
Definition: gavl.h:620
int16_t * s_16
Definition: gavl.h:621
uint8_t * u_8
Definition: gavl.h:617
float * f
Definition: gavl.h:626
double * d
Definition: gavl.h:627
int32_t * s_32
Definition: gavl.h:624