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 - 2011 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 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include <gavl/timecode.h>
40 
41 
64 typedef void (*gavl_video_process_func)(void * data, int start, int end);
65 
80  void * gavl_data,
81  int start, int end,
82  void * client_data, int thread);
83 
92 typedef void (*gavl_video_stop_func)(void * client_data, int thread);
93 
103 
104 
105 /* Quality levels */
106 
130 #define GAVL_QUALITY_FASTEST 1
131 
138 #define GAVL_QUALITY_BEST 5
139 
146 #define GAVL_QUALITY_DEFAULT 2
147 
159 #define GAVL_ACCEL_MMX (1<<0)
160 #define GAVL_ACCEL_MMXEXT (1<<1)
161 #define GAVL_ACCEL_SSE (1<<2)
162 #define GAVL_ACCEL_SSE2 (1<<3)
163 #define GAVL_ACCEL_SSE3 (1<<4)
164 #define GAVL_ACCEL_3DNOW (1<<5)
165 #define GAVL_ACCEL_3DNOWEXT (1<<6)
166 #define GAVL_ACCEL_SSSE3 (1<<7)
167 
168 
172 GAVL_PUBLIC int gavl_accel_supported();
173 
182 /* Sample formats: all multibyte numbers are native endian */
183 
196 #define GAVL_MAX_CHANNELS 128
197 
204 typedef enum
205  {
215 
221 typedef enum
222  {
227 
235 typedef enum
236  {
251 
260 typedef struct
261  {
268  float center_level;
269  float rear_level;
274 
275 
276 /* Audio format -> string conversions */
277 
285 GAVL_PUBLIC
287 
296 GAVL_PUBLIC
298 
304 GAVL_PUBLIC
306 
313 GAVL_PUBLIC
315 
322 GAVL_PUBLIC
324 
325 
332 GAVL_PUBLIC
334 
341 GAVL_PUBLIC
342 void gavl_audio_format_dump(const gavl_audio_format_t * format);
343 
352 GAVL_PUBLIC
354 
361 GAVL_PUBLIC
362 int gavl_front_channels(const gavl_audio_format_t * format);
363 
370 GAVL_PUBLIC
371 int gavl_rear_channels(const gavl_audio_format_t * format);
372 
379 GAVL_PUBLIC
380 int gavl_side_channels(const gavl_audio_format_t * format);
381 
388 GAVL_PUBLIC
389 int gavl_aux_channels(const gavl_audio_format_t * format);
390 
391 
392 
399 GAVL_PUBLIC
400 int gavl_lfe_channels(const gavl_audio_format_t * format);
401 
409 GAVL_PUBLIC
411  const gavl_audio_format_t * src);
412 
421 GAVL_PUBLIC
422 int gavl_audio_formats_equal(const gavl_audio_format_t * format_1,
423  const gavl_audio_format_t * format_2);
424 
436 GAVL_PUBLIC
438 
445 GAVL_PUBLIC
447 
462 typedef union
463  {
464  uint8_t * u_8;
465  int8_t * s_8;
467  uint16_t * u_16;
468  int16_t * s_16;
470  uint32_t * u_32;
471  int32_t * s_32;
473  float * f;
474  double * d;
476 
482 typedef union
483  {
484  uint8_t * u_8[GAVL_MAX_CHANNELS];
485  int8_t * s_8[GAVL_MAX_CHANNELS];
487  uint16_t * u_16[GAVL_MAX_CHANNELS];
488  int16_t * s_16[GAVL_MAX_CHANNELS];
490  uint32_t * u_32[GAVL_MAX_CHANNELS];
491  int32_t * s_32[GAVL_MAX_CHANNELS];
493  float * f[GAVL_MAX_CHANNELS];
494  double * d[GAVL_MAX_CHANNELS];
497 
514 typedef struct
515  {
519  int64_t timestamp;
522 
534 GAVL_PUBLIC
536 
548 GAVL_PUBLIC
550 
560 GAVL_PUBLIC
562 
572 GAVL_PUBLIC
574  const gavl_audio_format_t * format);
575 
586 GAVL_PUBLIC
588  const gavl_audio_format_t * format,
589  int num_samples);
590 
591 
592 
603 GAVL_PUBLIC
605  const gavl_audio_format_t * format,
606  int channel);
607 
628 GAVL_PUBLIC
629 int gavl_audio_frame_copy(const gavl_audio_format_t * format,
630  gavl_audio_frame_t * dst,
631  const gavl_audio_frame_t * src,
632  int dst_pos,
633  int src_pos,
634  int dst_size,
635  int src_size);
636 
649 GAVL_PUBLIC
651  gavl_audio_frame_t * dst,
652  const gavl_audio_frame_t * src);
653 
671 GAVL_PUBLIC
673  gavl_audio_frame_t * src,
674  gavl_audio_frame_t * dst,
675  int start, int len);
676 
689 GAVL_PUBLIC
691  const gavl_audio_frame_t * f1,
692  const gavl_audio_frame_t * f2);
693 
713 GAVL_PUBLIC
714 int gavl_audio_frame_plot(const gavl_audio_format_t * format,
715  const gavl_audio_frame_t * frame,
716  const char * name_base);
717 
718 
733 #define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
738 #define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
743 #define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
748 #define GAVL_AUDIO_FRONT_TO_REAR_MASK \
749 (GAVL_AUDIO_FRONT_TO_REAR_COPY | \
750 GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
751  GAVL_AUDIO_FRONT_TO_REAR_DIFF)
753 /* Options for mixing stereo to mono */
754 
757 #define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
760 #define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
763 #define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
767 #define GAVL_AUDIO_STEREO_TO_MONO_MASK \
768 (GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
769 GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
770 GAVL_AUDIO_STEREO_TO_MONO_MIX)
775 #define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
782 typedef enum
783  {
784  GAVL_AUDIO_DITHER_NONE = 0,
785  GAVL_AUDIO_DITHER_AUTO = 1,
786  GAVL_AUDIO_DITHER_RECT = 2,
787  GAVL_AUDIO_DITHER_TRI = 3,
788  GAVL_AUDIO_DITHER_SHAPED = 4,
790 
795 typedef enum
796  {
804 
811 typedef struct gavl_audio_options_s gavl_audio_options_t;
812 
819 GAVL_PUBLIC
821 
828 GAVL_PUBLIC
830 
837 GAVL_PUBLIC
839 
846 GAVL_PUBLIC
848 
849 
856 GAVL_PUBLIC
858 
865 GAVL_PUBLIC
867 
874 GAVL_PUBLIC
876  int flags);
877 
884 GAVL_PUBLIC
886 
892 GAVL_PUBLIC
894 
911 GAVL_PUBLIC
913  const double ** matrix);
914 
923 GAVL_PUBLIC
925 
935 GAVL_PUBLIC
937 
944 GAVL_PUBLIC
946  const gavl_audio_options_t * src);
947 
953 GAVL_PUBLIC
955 
956 
957 
958 /* Audio converter */
959 
993 typedef struct gavl_audio_converter_s gavl_audio_converter_t;
994 
1000 GAVL_PUBLIC
1002 
1008 GAVL_PUBLIC
1010 
1019 GAVL_PUBLIC
1021 
1022 
1037 GAVL_PUBLIC
1039  const gavl_audio_format_t * input_format,
1040  const gavl_audio_format_t * output_format);
1041 
1056 GAVL_PUBLIC
1058  const gavl_audio_format_t * format);
1059 
1074 GAVL_PUBLIC
1076 
1077 
1091 GAVL_PUBLIC
1093  const gavl_audio_frame_t * input_frame,
1094  gavl_audio_frame_t * output_frame);
1095 
1096 
1115 GAVL_PUBLIC
1117  double ratio ) ;
1118 
1119 
1135 GAVL_PUBLIC
1137  gavl_audio_frame_t * input_frame,
1138  gavl_audio_frame_t * output_frame,
1139  double ratio);
1140 
1141 
1155 typedef struct gavl_volume_control_s gavl_volume_control_t;
1156 
1157 /* Create / destroy */
1158 
1164 GAVL_PUBLIC
1166 
1172 GAVL_PUBLIC
1174 
1182 GAVL_PUBLIC
1184  const gavl_audio_format_t * format);
1185 
1192 GAVL_PUBLIC
1194  float volume);
1195 
1202 GAVL_PUBLIC
1204  gavl_audio_frame_t * frame);
1205 
1221 typedef struct gavl_peak_detector_s gavl_peak_detector_t;
1222 
1223 /* Create / destroy */
1224 
1230 GAVL_PUBLIC
1232 
1238 GAVL_PUBLIC
1240 
1250 GAVL_PUBLIC
1252  const gavl_audio_format_t * format);
1253 
1260 GAVL_PUBLIC
1262  gavl_audio_frame_t * frame);
1263 
1276 GAVL_PUBLIC
1278  double * min, double * max,
1279  double * abs);
1280 
1293 GAVL_PUBLIC
1295  double * min, double * max,
1296  double * abs);
1297 
1303 GAVL_PUBLIC
1305 
1315 #define GAVL_MAX_PLANES 4
1327 typedef struct
1328  {
1329  int x;
1330  int y;
1331  int w;
1332  int h;
1334 
1339 typedef struct
1340  {
1341  double x;
1342  double y;
1343  double w;
1344  double h;
1346 
1353 GAVL_PUBLIC
1355  const gavl_video_format_t * format);
1356 
1363 GAVL_PUBLIC
1365  const gavl_video_format_t * format);
1366 
1381 GAVL_PUBLIC
1383  gavl_rectangle_i_t * dst_rect,
1384  const gavl_video_format_t * src_format,
1385  const gavl_video_format_t * dst_format);
1386 
1398 GAVL_PUBLIC
1400  gavl_rectangle_i_t * dst_rect,
1401  const gavl_video_format_t * src_format,
1402  const gavl_video_format_t * dst_format);
1403 
1404 
1405 
1412 GAVL_PUBLIC
1414 
1421 GAVL_PUBLIC
1423 
1430 GAVL_PUBLIC
1431 void gavl_rectangle_i_crop_left(gavl_rectangle_i_t * r, int num_pixels);
1432 
1439 GAVL_PUBLIC
1440 void gavl_rectangle_i_crop_right(gavl_rectangle_i_t * r, int num_pixels);
1441 
1448 GAVL_PUBLIC
1449 void gavl_rectangle_i_crop_top(gavl_rectangle_i_t * r, int num_pixels);
1450 
1457 GAVL_PUBLIC
1458 void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t * r, int num_pixels);
1459 
1466 GAVL_PUBLIC
1467 void gavl_rectangle_f_crop_left(gavl_rectangle_f_t * r, double num_pixels);
1468 
1475 GAVL_PUBLIC
1476 void gavl_rectangle_f_crop_right(gavl_rectangle_f_t * r, double num_pixels);
1477 
1484 GAVL_PUBLIC
1485 void gavl_rectangle_f_crop_top(gavl_rectangle_f_t * r, double num_pixels);
1486 
1493 GAVL_PUBLIC
1494 void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t * r, double num_pixels);
1495 
1509 GAVL_PUBLIC
1510 void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1511 
1521 GAVL_PUBLIC
1523  const gavl_video_format_t * format);
1524 
1525 
1532 GAVL_PUBLIC
1534 
1541 GAVL_PUBLIC
1543 
1544 
1545 
1552 GAVL_PUBLIC
1554 
1561 GAVL_PUBLIC
1563 
1572 GAVL_PUBLIC
1574 
1583 GAVL_PUBLIC
1585 
1613 GAVL_PUBLIC
1615  const gavl_video_format_t * src_format,
1616  const gavl_rectangle_f_t * src_rect,
1617  const gavl_video_format_t * dst_format,
1618  float zoom, float squeeze);
1619 
1624 GAVL_PUBLIC
1626 
1631 GAVL_PUBLIC
1633 
1634 
1644 #define GAVL_PIXFMT_PLANAR (1<<8)
1645 
1649 #define GAVL_PIXFMT_RGB (1<<9)
1650 
1654 #define GAVL_PIXFMT_YUV (1<<10)
1655 
1659 #define GAVL_PIXFMT_YUVJ (1<<11)
1660 
1664 #define GAVL_PIXFMT_ALPHA (1<<12)
1665 
1669 #define GAVL_PIXFMT_GRAY (1<<13)
1670 
1675 typedef enum
1676  {
1680 
1684 
1688 
1692 
1696 
1700 
1704 
1736 
1743 
1750 
1766 
1770 
1787 
1797 
1804 
1806 
1809 #define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1810 
1812 #define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1813 
1815 #define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1816 
1818 #define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1819 
1822 #define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1823 
1825 #define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1826 
1828 #define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1829 
1831 #define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1832 
1835 #define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1836 
1838 #define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1839 
1841 #define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1842 
1844 #define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1845 
1852 typedef enum
1853  {
1862 
1863 /*
1864  * Colormodel related functions
1865  */
1866 
1873 #define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
1874 
1875 
1882 #define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
1883 
1890 #define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
1891 
1898 #define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
1899 
1906 #define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
1907 
1914 #define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
1915 
1922 GAVL_PUBLIC
1924 
1934 GAVL_PUBLIC
1935 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
1936 
1943 GAVL_PUBLIC
1945 
1952 GAVL_PUBLIC
1954 
1961 GAVL_PUBLIC
1963 
1978 GAVL_PUBLIC
1980  gavl_pixelformat_t dst);
1981 
1995 GAVL_PUBLIC gavl_pixelformat_t
1997  const gavl_pixelformat_t * dst_supported,
1998  int * penalty);
1999 
2000 
2001 
2008 GAVL_PUBLIC
2009 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat);
2010 
2017 GAVL_PUBLIC
2019 
2025 GAVL_PUBLIC
2026 int gavl_num_pixelformats();
2027 
2034 GAVL_PUBLIC
2036 
2037 /* */
2038 
2047 typedef enum
2048  {
2053 
2060 GAVL_PUBLIC
2062 
2067 /* Changing the values alters the gmerlin-avdecoder index format */
2068 
2069 typedef enum
2070  {
2076 
2083 GAVL_PUBLIC
2085 
2090 /* Changing the values alters the gmerlin-avdecoder index format */
2091 
2092 typedef enum
2093  {
2102 
2109 GAVL_PUBLIC
2111 
2112 
2113 /* Video format structure */
2114 
2120  {
2127  /* Support for nonsquare pixels */
2128 
2144  };
2145 
2153 GAVL_PUBLIC
2155  const gavl_video_format_t * src);
2156 
2165 GAVL_PUBLIC
2166 int gavl_video_formats_equal(const gavl_video_format_t * format_1,
2167  const gavl_video_format_t * format_2);
2168 
2169 
2180 GAVL_PUBLIC
2181 void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2182  float * off_x, float * off_y);
2183 
2184 
2185 
2198 GAVL_PUBLIC
2200  const gavl_video_format_t * src);
2201 
2209 GAVL_PUBLIC
2211 
2227 GAVL_PUBLIC
2228 int gavl_get_color_channel_format(const gavl_video_format_t * frame_format,
2229  gavl_video_format_t * channel_format,
2231 
2232 
2239 GAVL_PUBLIC
2240 void gavl_video_format_dump(const gavl_video_format_t * format);
2241 
2242 
2265 typedef struct
2266  {
2267  uint8_t * planes[GAVL_MAX_PLANES];
2268  int strides[GAVL_MAX_PLANES];
2270  void * user_data;
2271  int64_t timestamp;
2272  int64_t duration;
2276 
2277 
2289 GAVL_PUBLIC
2291 
2302 GAVL_PUBLIC
2304 
2305 
2306 
2316 GAVL_PUBLIC
2318 
2330 GAVL_PUBLIC
2332 
2341 GAVL_PUBLIC
2343  const gavl_video_format_t * format);
2344 
2354 GAVL_PUBLIC
2356  const gavl_video_format_t * format,
2357  const float * color);
2358 
2371 GAVL_PUBLIC
2373  const gavl_video_frame_t * src1,
2374  const gavl_video_frame_t * src2,
2375  const gavl_video_format_t * format);
2376 
2389 GAVL_PUBLIC
2390 void gavl_video_frame_psnr(double * psnr,
2391  const gavl_video_frame_t * src1,
2392  const gavl_video_frame_t * src2,
2393  const gavl_video_format_t * format);
2394 
2421 GAVL_PUBLIC
2422 int gavl_video_frame_ssim(const gavl_video_frame_t * src1,
2423  const gavl_video_frame_t * src2,
2424  gavl_video_frame_t * dst,
2425  const gavl_video_format_t * format);
2426 
2440 GAVL_PUBLIC
2441 void gavl_video_frame_copy(const gavl_video_format_t * format,
2442  gavl_video_frame_t * dst,
2443  const gavl_video_frame_t * src);
2444 
2457 GAVL_PUBLIC
2459  gavl_video_frame_t * dst,
2460  const gavl_video_frame_t * src, int plane);
2461 
2473 GAVL_PUBLIC
2475  gavl_video_frame_t * dst,
2476  const gavl_video_frame_t * src);
2477 
2489 GAVL_PUBLIC
2491  gavl_video_frame_t * dst,
2492  const gavl_video_frame_t * src);
2493 
2505 GAVL_PUBLIC
2507  gavl_video_frame_t * dst,
2508  const gavl_video_frame_t * src);
2509 
2522 GAVL_PUBLIC
2524  const gavl_video_frame_t * src);
2525 
2526 
2544 GAVL_PUBLIC
2546  const gavl_video_frame_t * src,
2547  gavl_video_frame_t * dst,
2548  gavl_rectangle_i_t * src_rect);
2549 
2565 GAVL_PUBLIC
2567  const gavl_video_frame_t * src,
2568  gavl_video_frame_t * dst,
2569  int field);
2570 
2571 
2572 
2585 GAVL_PUBLIC
2587  const gavl_video_format_t * format,
2588  const char * namebase);
2589 
2600 GAVL_PUBLIC
2602  const gavl_video_format_t * format);
2603 
2616 GAVL_PUBLIC
2618  const gavl_video_format_t * format,
2619  uint8_t * buffer);
2620 
2635 GAVL_PUBLIC
2638  const gavl_video_frame_t * src,
2639  gavl_video_frame_t * dst);
2640 
2656 GAVL_PUBLIC
2659  const gavl_video_frame_t * src,
2660  gavl_video_frame_t * dst);
2661 
2662 
2674 GAVL_PUBLIC
2675 int gavl_video_frames_equal(const gavl_video_format_t * format,
2676  const gavl_video_frame_t * f1,
2677  const gavl_video_frame_t * f2);
2678 
2679 
2680 /*****************************
2681  Conversion options
2682 ******************************/
2683 
2699 #define GAVL_FORCE_DEINTERLACE (1<<0)
2700 
2705 #define GAVL_CONVOLVE_CHROMA (1<<1)
2706 
2711 #define GAVL_CONVOLVE_NORMALIZE (1<<2)
2712 
2720 #define GAVL_RESAMPLE_CHROMA (1<<3)
2721 
2729 typedef enum
2730  {
2734 
2741 typedef enum
2742  {
2748 
2755 typedef enum
2756  {
2760 
2765 typedef enum
2766  {
2777 
2787 typedef enum
2788  {
2794 
2801 typedef struct gavl_video_options_s gavl_video_options_t;
2802 
2803 /* Default Options */
2804 
2810 GAVL_PUBLIC
2812 
2822 GAVL_PUBLIC
2824 
2831 GAVL_PUBLIC
2833  const gavl_video_options_t * src);
2834 
2840 GAVL_PUBLIC
2842 
2843 
2858 GAVL_PUBLIC
2860  const gavl_rectangle_f_t * src_rect,
2861  const gavl_rectangle_i_t * dst_rect);
2862 
2870 GAVL_PUBLIC
2872  gavl_rectangle_f_t * src_rect,
2873  gavl_rectangle_i_t * dst_rect);
2874 
2881 GAVL_PUBLIC
2882 void gavl_video_options_set_quality(gavl_video_options_t * opt, int quality);
2883 
2890 GAVL_PUBLIC
2892 
2893 
2900 GAVL_PUBLIC
2902  int conversion_flags);
2903 
2910 GAVL_PUBLIC
2912 
2919 GAVL_PUBLIC
2921  gavl_alpha_mode_t alpha_mode);
2922 
2929 GAVL_PUBLIC gavl_alpha_mode_t
2931 
2932 
2939 GAVL_PUBLIC
2941  gavl_scale_mode_t scale_mode);
2942 
2949 GAVL_PUBLIC gavl_scale_mode_t
2951 
2952 
2959 GAVL_PUBLIC
2961  int order);
2962 
2969 GAVL_PUBLIC
2971 
2972 
2979 GAVL_PUBLIC
2981  const float * color);
2982 
2989 GAVL_PUBLIC
2991  float * color);
2992 
2999 GAVL_PUBLIC
3001  gavl_deinterlace_mode_t deinterlace_mode);
3002 
3009 GAVL_PUBLIC gavl_deinterlace_mode_t
3011 
3018 GAVL_PUBLIC
3020  gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3021 
3028 GAVL_PUBLIC gavl_deinterlace_drop_mode_t
3030 
3039 GAVL_PUBLIC
3042 
3043 
3052 GAVL_PUBLIC gavl_downscale_filter_t
3054 
3072 GAVL_PUBLIC
3074  float f);
3075 
3084 GAVL_PUBLIC
3086 
3095 GAVL_PUBLIC
3097 
3098 
3107 GAVL_PUBLIC
3109 
3119 GAVL_PUBLIC
3121  gavl_video_run_func func,
3122  void * client_data);
3123 
3133 GAVL_PUBLIC
3135  void ** client_data);
3136 
3146 GAVL_PUBLIC
3148  gavl_video_stop_func func,
3149  void * client_data);
3150 
3160 GAVL_PUBLIC
3162  void ** client_data);
3163 
3164 
3165 /***************************************************
3166  * Create and destroy video converters
3167  ***************************************************/
3168 
3201 typedef struct gavl_video_converter_s gavl_video_converter_t;
3202 
3208 GAVL_PUBLIC
3210 
3216 GAVL_PUBLIC
3218 
3219 /**************************************************
3220  * Get options. Change the options with the gavl_video_options_set_*
3221  * functions above
3222  **************************************************/
3223 
3232 GAVL_PUBLIC gavl_video_options_t *
3234 
3235 
3249 GAVL_PUBLIC
3251  const gavl_video_format_t * input_format,
3252  const gavl_video_format_t * output_format);
3253 
3266 GAVL_PUBLIC
3268 
3269 
3270 /***************************************************
3271  * Convert a frame
3272  ***************************************************/
3273 
3281 GAVL_PUBLIC
3283  const gavl_video_frame_t * input_frame,
3284  gavl_video_frame_t * output_frame);
3285 
3317 typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3318 
3324 GAVL_PUBLIC
3326 
3332 GAVL_PUBLIC
3334 
3343 GAVL_PUBLIC gavl_video_options_t *
3345 
3358 GAVL_PUBLIC
3360  const gavl_video_format_t * src_format,
3361  const gavl_video_format_t * dst_format);
3362 
3384 GAVL_PUBLIC
3386  const gavl_video_format_t * format,
3387  int h_radius, const float * h_coeffs,
3388  int v_radius, const float * v_coeffs);
3389 
3397 GAVL_PUBLIC
3399  const gavl_video_frame_t * input_frame,
3400  gavl_video_frame_t * output_frame);
3401 
3417 typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3418 
3424 GAVL_PUBLIC
3426 
3432 GAVL_PUBLIC
3434 
3443 GAVL_PUBLIC gavl_video_options_t *
3445 
3456 GAVL_PUBLIC
3458  const gavl_video_format_t * src_format);
3459 
3460 
3468 GAVL_PUBLIC
3470  const gavl_video_frame_t * input_frame,
3471  gavl_video_frame_t * output_frame);
3472 
3473 
3474 
3475 /**************************************************
3476  * Transparent overlays
3477  **************************************************/
3478 
3479 /* Overlay struct */
3480 
3508 typedef struct
3509  {
3512  int dst_x;
3513  int dst_y;
3514  } gavl_overlay_t;
3515 
3522 typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3523 
3529 GAVL_PUBLIC
3531 
3537 GAVL_PUBLIC
3539 
3546 GAVL_PUBLIC gavl_video_options_t *
3548 
3564 GAVL_PUBLIC
3566  const gavl_video_format_t * frame_format,
3567  gavl_video_format_t * overlay_format);
3568 
3578 GAVL_PUBLIC
3580  gavl_overlay_t * ovl);
3581 
3588 GAVL_PUBLIC
3590  gavl_video_frame_t * dst_frame);
3591 
3613 typedef struct gavl_image_transform_s gavl_image_transform_t;
3614 
3628 typedef void (*gavl_image_transform_func)(void * priv,
3629  double xdst,
3630  double ydst,
3631  double * xsrc,
3632  double * ysrc);
3633 
3634 
3641 GAVL_PUBLIC
3643 
3649 GAVL_PUBLIC
3651 
3670 GAVL_PUBLIC
3672  gavl_video_format_t * format,
3673  gavl_image_transform_func func, void * priv);
3674 
3682 GAVL_PUBLIC
3684  gavl_video_frame_t * in_frame,
3685  gavl_video_frame_t * out_frame);
3686 
3697 GAVL_PUBLIC gavl_video_options_t *
3699 
3722 typedef struct
3723  {
3724  int64_t offset;
3725  /* Primary */
3726  int64_t num_entries;
3727  int64_t entries_alloc;
3728 
3729  struct
3730  {
3731  int64_t num_frames;
3732  int64_t duration;
3733  } * entries;
3734 
3737 
3738  struct
3739  {
3740  int64_t pts;
3742  } * timecodes;
3743 
3744  /* Secondary */
3745 
3747 
3754 
3765 GAVL_PUBLIC gavl_frame_table_t *
3766 gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
3767  gavl_timecode_format_t * fmt_ret);
3768 
3780 GAVL_PUBLIC gavl_frame_table_t *
3781 gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
3782  int64_t num_frames,
3783  gavl_timecode_t start_timecode);
3784 
3792 GAVL_PUBLIC gavl_frame_table_t *
3794 
3795 
3796 
3803 GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t * t);
3804 
3812 GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
3813 
3822 GAVL_PUBLIC void
3824  int64_t pts, gavl_timecode_t tc);
3825 
3836 GAVL_PUBLIC int64_t
3838  int64_t frame, int * duration);
3839 
3850 GAVL_PUBLIC int64_t
3852  int64_t time,
3853  int64_t * start_time);
3854 
3865 GAVL_PUBLIC gavl_timecode_t
3867  int64_t time,
3868  int64_t * start_time,
3869  const gavl_timecode_format_t * fmt);
3870 
3880 GAVL_PUBLIC int64_t
3882  gavl_timecode_t tc,
3883  const gavl_timecode_format_t * fmt);
3884 
3885 
3896 GAVL_PUBLIC gavl_timecode_t
3898  int64_t frame,
3899  int64_t * start_time,
3900  const gavl_timecode_format_t * fmt);
3901 
3902 
3903 
3911 GAVL_PUBLIC int64_t
3913 
3921 GAVL_PUBLIC int64_t
3923 
3931 GAVL_PUBLIC int64_t
3933 
3942 GAVL_PUBLIC
3944  const char * filename);
3945 
3953 GAVL_PUBLIC
3954 gavl_frame_table_t * gavl_frame_table_load(const char * filename);
3955 
3962 GAVL_PUBLIC void
3964 
3965 
3966 
3967 
3968 
3969 
3975 #ifdef __cplusplus
3976 }
3977 #endif
3978 
3979 #endif /* GAVL_H_INCLUDED */
uint16_t * u_16
Definition: gavl.h:467
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.
struct gavl_volume_control_s gavl_volume_control_t
Opaque structure for a volume control.
Definition: gavl.h:1155
Definition: gavl.h:225
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.
Generic container for audio samples.
Definition: gavl.h:514
GAVL_PUBLIC void gavl_video_deinterlacer_destroy(gavl_video_deinterlacer_t *deinterlacer)
Destroy a video deinterlacer.
gavl_timecode_t tc
Timecode associated with this timestamp.
Definition: gavl.h:3741
Timecode format.
Definition: timecode.h:59
GAVL_PUBLIC void gavl_peak_detector_get_peaks(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume for all channels separate.
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition: gavl.h:811
Definition: gavl.h:1683
GAVL_PUBLIC int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat)
Get bytes per component for planar formats.
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_alpha_mode_t
Definition: gavl.h:2729
GAVL_PUBLIC void gavl_audio_frame_null(gavl_audio_frame_t *frame)
Zero all pointers in the audio frame.
GAVL_PUBLIC void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int *sub_h, int *sub_v)
Get the horizontal and vertical subsampling factors.
void * user_data
Definition: gavl.h:2270
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format(const char *str)
Convert a string to a sample format.
int dst_y
y offset in the destination frame. */
Definition: gavl.h:3513
int32_t * s_32
Definition: gavl.h:471
GAVL_PUBLIC void gavl_volume_control_set_volume(gavl_volume_control_t *ctrl, float volume)
Set volume for a volume control.
GAVL_PUBLIC int gavl_video_options_get_scale_order(gavl_video_options_t *opt)
Get the scale order for GAVL_SCALE_SINC_LANCZOS.
double h
Definition: gavl.h:1344
GAVL_PUBLIC gavl_audio_options_t * gavl_audio_options_create()
Create an options container.
GAVL_PUBLIC gavl_sample_format_t gavl_get_sample_format(int index)
Get the sample format from index.
Definition: gavl.h:1708
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_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 gavl_video_options_t * gavl_video_scaler_get_options(gavl_video_scaler_t *scaler)
gets options of a scaler
GAVL_PUBLIC int gavl_num_sample_formats()
Get total number of supported sample formats.
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 gavl_audio_frame_t * gavl_audio_frame_create(const gavl_audio_format_t *format)
Create audio frame.
Definition: gavl.h:1783
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 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_set_channel_setup(gavl_audio_format_t *format)
Set the default channel setup and indices.
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 int gavl_rear_channels(const gavl_audio_format_t *format)
Get number of rear channels for a given format.
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_audio_samples_t samples
Definition: gavl.h:516
GAVL_PUBLIC gavl_pixelformat_t gavl_string_to_pixelformat(const char *name)
Translate a pixelformat name into a pixelformat.
gavl_pixelformat_t
Pixelformat definition.
Definition: gavl.h:1675
gavl_downscale_filter_t
Definition: gavl.h:2787
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_video_options_set_scale_mode(gavl_video_options_t *opt, gavl_scale_mode_t scale_mode)
Set the scale mode.
gavl_scale_mode_t
Definition: gavl.h:2765
GAVL_PUBLIC void gavl_video_options_get_background_color(gavl_video_options_t *opt, float *color)
Get the background color for alpha blending.
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.
Definition: gavl.h:244
gavl_channel_id_t
Audio channel setup.
Definition: gavl.h:235
Definition: gavl.h:212
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.
Definition: gavl.h:2771
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 gavl_frame_table_t * gavl_frame_table_load(const char *filename)
Load a frame table from a file.
Green.
Definition: gavl.h:1855
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 int gavl_audio_options_get_quality(gavl_audio_options_t *opt)
Get the quality level for a converter.
Definition: gavl.h:801
GAVL_PUBLIC int gavl_num_pixelformats()
Get total number of supported pixelformats.
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.
#define GAVL_PIXFMT_PLANAR
Definition: gavl.h:1644
Definition: gavl.h:1803
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.
int w
Definition: gavl.h:1331
Definition: gavl.h:246
Definition: gavl.h:2095
int samples_per_frame
Definition: gavl.h:262
GAVL_PUBLIC void gavl_audio_options_set_conversion_flags(gavl_audio_options_t *opt, int flags)
Set the conversion flags.
GAVL_PUBLIC gavl_video_converter_t * gavl_video_converter_create()
Creates a video converter.
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 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 gavl_video_run_func gavl_video_options_get_run_func(gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
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_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 int gavl_frame_table_save(const gavl_frame_table_t *tab, const char *filename)
Save a frame table to a file.
GAVL_PUBLIC void gavl_video_options_set_background_color(gavl_video_options_t *opt, const float *color)
Set the background color for alpha blending.
GAVL_PUBLIC void gavl_rectangle_i_align(gavl_rectangle_i_t *r, int h_align, int v_align)
Align a rectangle.
int64_t timestamp
Definition: gavl.h:519
int64_t entries_alloc
Number of allocated entries (never touch this)
Definition: gavl.h:3727
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 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.
int64_t duration
Duration of each of these frames.
Definition: gavl.h:3732
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.
Definition: gavl.h:1729
GAVL_PUBLIC int gavl_video_options_get_quality(gavl_video_options_t *opt)
Get the quality level for the converter.
int64_t num_frames
Number of frames.
Definition: gavl.h:3731
#define GAVL_PIXFMT_ALPHA
Definition: gavl.h:1664
struct gavl_video_options_s gavl_video_options_t
Definition: gavl.h:2801
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 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_volume_control_set_format(gavl_volume_control_t *ctrl, const gavl_audio_format_t *format)
Set format for a volume control.
GAVL_PUBLIC void gavl_peak_detector_update(gavl_peak_detector_t *pd, gavl_audio_frame_t *frame)
Feed the peak detector with a new frame.
gavl_interlace_mode_t
Interlace mode.
Definition: gavl.h:2092
Definition: gavl.h:2775
Definition: gavl.h:2773
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.
Definition: gavl.h:2732
#define GAVL_PIXFMT_GRAY
Definition: gavl.h:1669
GAVL_PUBLIC gavl_video_options_t * gavl_video_options_create()
Create an options container.
GAVL_PUBLIC gavl_video_options_t * gavl_video_converter_get_options(gavl_video_converter_t *cnv)
gets options of a video converter
Definition: gavl.h:1723
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.
Definition: gavl.h:2049
int16_t * s_16
Definition: gavl.h:468
GAVL_PUBLIC void gavl_rectangle_f_dump(const gavl_rectangle_f_t *r)
Dump a floating point rectangle to stderr.
int64_t offset
Timestamp of the first frame.
Definition: gavl.h:3724
Definition: gavl.h:1732
GAVL_PUBLIC void gavl_video_format_copy(gavl_video_format_t *dst, const gavl_video_format_t *src)
Copy one video format to another.
Definition: gavl.h:2767
GAVL_PUBLIC int gavl_lfe_channels(const gavl_audio_format_t *format)
Get number of LFE channels for a given format.
GAVL_PUBLIC gavl_peak_detector_t * gavl_peak_detector_create()
Create peak detector.
int valid_samples
Definition: gavl.h:518
double y
Definition: gavl.h:1342
GAVL_PUBLIC int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat)
Get the effective number of bits for one pixel.
GAVL_PUBLIC gavl_deinterlace_drop_mode_t gavl_video_options_get_deinterlace_drop_mode(gavl_video_options_t *opt)
Get the deinterlace drop mode.
gavl_framerate_mode_t framerate_mode
Definition: gavl.h:2138
gavl_audio_channels_t channels
Definition: gavl.h:517
float center_level
Definition: gavl.h:268
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.
Definition: gavl.h:1800
Definition: gavl.h:241
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.
Definition: gavl.h:1762
GAVL_PUBLIC float gavl_video_options_get_downscale_blur(gavl_video_options_t *opt)
Get blur factor for downscaling.
GAVL_PUBLIC gavl_deinterlace_mode_t gavl_video_options_get_deinterlace_mode(gavl_video_options_t *opt)
Get the deinterlace mode.
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.
Chrominance red (aka V)
Definition: gavl.h:1859
uint8_t * u_8
Definition: gavl.h:464
struct gavl_image_transform_s gavl_image_transform_t
Opaque image transformation engine.
Definition: gavl.h:3613
GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t *t, int64_t duration)
Append an entry.
Definition: gavl.h:2731
Definition: gavl.h:224
Container for noninterleaved audio samples.
Definition: gavl.h:482
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_overlay_blend_context_set_overlay(gavl_overlay_blend_context_t *ctx, gavl_overlay_t *ovl)
Set a new overlay.
Definition: gavl.h:249
GAVL_PUBLIC int gavl_audio_converter_reinit(gavl_audio_converter_t *cnv)
Reinitialize an audio converter.
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 void gavl_video_options_set_defaults(gavl_video_options_t *opt)
Set all options to their defaults.
GAVL_PUBLIC int64_t gavl_frame_table_num_frames(const gavl_frame_table_t *t)
get the total number of frames
GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t *t)
Destroy a frame table and free all memory.
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2273
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_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 const char * gavl_interleave_mode_to_string(gavl_interleave_mode_t mode)
Convert a gavl_interleave_mode_t to a human readable string.
#define GAVL_PIXFMT_YUV
Definition: gavl.h:1654
#define GAVL_MAX_CHANNELS
Maximum number of audio channels.
Definition: gavl.h:196
GAVL_PUBLIC void gavl_image_transform_destroy(gavl_image_transform_t *t)
Destroy a transformation engine.
GAVL_PUBLIC void gavl_frame_table_dump(const gavl_frame_table_t *t)
Dump a frame table to stderr for debugging.
int pixel_height
Definition: gavl.h:2130
int frame_duration
Definition: gavl.h:2134
Definition: gavl.h:1759
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 void gavl_audio_frame_destroy(gavl_audio_frame_t *frame)
Destroy an audio frame.
Definition: gavl.h:1720
Definition: gavl.h:1726
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition: gavl.h:3628
GAVL_PUBLIC void gavl_video_frame_null(gavl_video_frame_t *frame)
Zero all pointers in the video frame.
struct gavl_video_converter_s gavl_video_converter_t
Opaque video converter structure.
Definition: gavl.h:3201
Definition: gavl.h:1712
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition: timecode.h:43
int pixel_width
Definition: gavl.h:2129
int64_t pts
Timestamp of this frame.
Definition: gavl.h:3740
Definition: gavl.h:800
Definition: gavl.h:2265
GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode(gavl_video_options_t *opt)
Get the scale mode.
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.
Definition: gavl.h:2096
Definition: gavl.h:1796
Definition: gavl.h:1695
int frame_width
Definition: gavl.h:2121
GAVL_PUBLIC gavl_volume_control_t * gavl_volume_control_create()
Create volume control.
GAVL_PUBLIC void gavl_video_options_set_downscale_blur(gavl_video_options_t *opt, float f)
Set blur factor for downscaling.
Definition: gavl.h:242
GAVL_PUBLIC int gavl_front_channels(const gavl_audio_format_t *format)
Get number of front channels for a given format.
Definition: gavl.h:2774
Red.
Definition: gavl.h:1854
Definition: gavl.h:2744
double x
Definition: gavl.h:1341
GAVL_PUBLIC void gavl_audio_options_copy(gavl_audio_options_t *dst, const gavl_audio_options_t *src)
Copy audio options.
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.
Definition: gavl.h:239
GAVL_PUBLIC void gavl_rectangle_i_crop_right(gavl_rectangle_i_t *r, int num_pixels)
Crop an integer rectangle by some pixels from the right border.
GAVL_PUBLIC const char * gavl_interlace_mode_to_string(gavl_interlace_mode_t mode)
Translate an interlace mode into a human readable string.
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_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 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.
Definition: gavl.h:207
Definition: gavl.h:2772
Definition: gavl.h:1793
Definition: gavl.h:1691
int x
Definition: gavl.h:1329
GAVL_PUBLIC void gavl_video_converter_destroy(gavl_video_converter_t *cnv)
Destroys a video converter and frees all associated memory.
Definition: gavl.h:245
GAVL_PUBLIC gavl_video_options_t * gavl_image_transform_get_options(gavl_image_transform_t *t)
Get transformation options.
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.
Widen the filter curve according to the scaling ratio.
Definition: gavl.h:2791
int samplerate
Definition: gavl.h:263
gavl_interleave_mode_t interleave_mode
Definition: gavl.h:266
float * f
Definition: gavl.h:473
Definition: gavl.h:1327
GAVL_PUBLIC void gavl_audio_converter_destroy(gavl_audio_converter_t *cnv)
Destroys an audio converter and frees all associated memory.
GAVL_PUBLIC int gavl_rectangle_f_is_empty(const gavl_rectangle_f_t *r)
Check if a float rectangle is empty.
gavl_sample_format_t
Format of one audio sample.
Definition: gavl.h:204
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_top(gavl_rectangle_f_t *r, double num_pixels)
Crop a float rectangle by some pixels from the top border.
GAVL_PUBLIC void gavl_peak_detector_destroy(gavl_peak_detector_t *pd)
Destroys a peak detector and frees all associated memory.
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 gavl_overlay_blend_context_t * gavl_overlay_blend_context_create()
Create a blend context.
gavl_chroma_placement_t
Chroma placement.
Definition: gavl.h:2047
gavl_chroma_placement_t chroma_placement
Definition: gavl.h:2139
GAVL_PUBLIC void gavl_video_scaler_destroy(gavl_video_scaler_t *scaler)
Destroy a video scaler.
Definition: gavl.h:1746
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.
Definition: gavl.h:2746
GAVL_PUBLIC int gavl_video_format_get_image_size(const gavl_video_format_t *format)
Get the unpadded image size.
gavl_audio_dither_mode_t
Dither mode.
Definition: gavl.h:782
#define GAVL_PIXFMT_RGB
Definition: gavl.h:1649
float rear_level
Definition: gavl.h:269
Definition: gavl.h:1749
GAVL_PUBLIC int gavl_video_options_get_conversion_flags(gavl_video_options_t *opt)
Get the conversion flags.
GAVL_PUBLIC int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src, gavl_pixelformat_t dst)
Get the conversion penalty for pixelformat conversions.
double * d
Definition: gavl.h:474
Undefined.
Definition: gavl.h:1679
Definition: gavl.h:247
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_frame_table_t * gavl_frame_table_create()
Create a frame table.
Definition: gavl.h:1774
Do a Gaussian preblur.
Definition: gavl.h:2792
Definition: gavl.h:2769
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_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_frame_table_t * gavl_frame_table_copy(const gavl_frame_table_t *tab)
Copy a frame table to another.
Definition: gavl.h:1739
Definition: gavl.h:243
gavl_timecode_t timecode
Definition: gavl.h:2274
GAVL_PUBLIC int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat)
Get bytes per pixel for packed formats.
GAVL_PUBLIC int gavl_video_converter_reinit(gavl_video_converter_t *cnv)
Reinitialize a video converter.
GAVL_PUBLIC void gavl_rectangle_f_copy(gavl_rectangle_f_t *dst, const gavl_rectangle_f_t *src)
Copy a float rectangle.
Overlay structure.
Definition: gavl.h:3508
GAVL_PUBLIC gavl_pixelformat_t gavl_get_pixelformat(int index)
Get the pixelformat from index.
gavl_deinterlace_mode_t
Definition: gavl.h:2741
GAVL_PUBLIC void gavl_audio_options_set_quality(gavl_audio_options_t *opt, int quality)
Set the quality level for the converter.
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_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 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 const char * gavl_sample_format_to_string(gavl_sample_format_t format)
Convert a gavl_sample_format_t to a human readable string.
Definition: gavl.h:2745
Definition: gavl.h:2757
Definition: gavl.h:1687
Definition: gavl.h:1753
GAVL_PUBLIC int gavl_side_channels(const gavl_audio_format_t *format)
Get number of side channels for a given format.
Definition: gavl.h:209
GAVL_PUBLIC void gavl_video_frame_destroy(gavl_video_frame_t *frame)
Destroy a video frame.
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_options_destroy(gavl_audio_options_t *opt)
Destroy audio options.
Definition: gavl.h:797
GAVL_PUBLIC gavl_image_transform_t * gavl_image_transform_create()
Create a transformation engine.
gavl_video_frame_t * frame
Video frame in an alpha capable format */.
Definition: gavl.h:3510
GAVL_PUBLIC void gavl_overlay_blend(gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
Blend overlay onto video frame.
Definition: gavl.h:2050
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.
Definition: gavl.h:2072
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_deinterlacer_s gavl_video_deinterlacer_t
Opaque deinterlacer structure.
Definition: gavl.h:3417
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.
Blue.
Definition: gavl.h:1856
Definition: gavl.h:1339
struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t
Opaque blend context.
Definition: gavl.h:3522
void(* gavl_video_process_func)(void *data, int start, int end)
Prototype of a process function.
Definition: gavl.h:64
Definition: gavl.h:2051
Definition: gavl.h:213
GAVL_PUBLIC void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat, const gavl_video_frame_t *src, gavl_video_frame_t *dst, gavl_rectangle_i_t *src_rect)
Get a subframe of another frame.
Container for interleaved audio samples.
Definition: gavl.h:462
Definition: gavl.h:1703
GAVL_PUBLIC void gavl_overlay_blend_context_destroy(gavl_overlay_blend_context_t *ctx)
Destroy a blend context and free all associated memory.
int64_t duration
Definition: gavl.h:2272
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 gavl_video_frame_t * gavl_video_frame_create_nopad(const gavl_video_format_t *format)
Create video frame without padding.
gavl_framerate_mode_t
Framerate mode.
Definition: gavl.h:2069
int h
Definition: gavl.h:1332
Definition: gavl.h:1777
Definition: gavl.h:208
GAVL_PUBLIC gavl_video_scaler_t * gavl_video_scaler_create()
Create a video scaler.
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_audio_format_copy(gavl_audio_format_t *dst, const gavl_audio_format_t *src)
Copy one audio format to another.
GAVL_PUBLIC void gavl_video_options_set_alpha_mode(gavl_video_options_t *opt, gavl_alpha_mode_t alpha_mode)
Set the alpha mode.
#define GAVL_PIXFMT_YUVJ
Definition: gavl.h:1659
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:79
Definition: gavl.h:2758
uint32_t * u_32
Definition: gavl.h:470
#define GAVL_MAX_PLANES
Definition: gavl.h:1315
gavl_resample_mode_t
Resample mode.
Definition: gavl.h:795
gavl_interleave_mode_t
Definition: gavl.h:221
Definition: gavl.h:1742
Definition: gavl.h:211
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_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 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.
int y
Definition: gavl.h:1330
GAVL_PUBLIC gavl_video_deinterlacer_t * gavl_video_deinterlacer_create()
Create a video deinterlacer.
void(* gavl_video_stop_func)(void *client_data, int thread)
Wait until a piece of a calculation finished.
Definition: gavl.h:92
int image_height
Definition: gavl.h:2125
Definition: gavl.h:2073
Definition: gavl.h:210
GAVL_PUBLIC gavl_audio_dither_mode_t gavl_audio_options_get_dither_mode(gavl_audio_options_t *opt)
Get the dither mode for the converter.
GAVL_PUBLIC int gavl_audio_options_get_conversion_flags(gavl_audio_options_t *opt)
Get the conversion flags.
GAVL_PUBLIC void gavl_video_options_set_num_threads(gavl_video_options_t *opt, int n)
Set number of threads.
GAVL_PUBLIC int64_t gavl_frame_table_end_time(const gavl_frame_table_t *t)
get the end time of the last frame
Definition: gavl.h:1786
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 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.
Definition: gavl.h:238
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.
Definition: gavl.h:237
GAVL_PUBLIC void gavl_audio_options_set_defaults(gavl_audio_options_t *opt)
Set all options to their defaults.
GAVL_PUBLIC void gavl_audio_format_dump(const gavl_audio_format_t *format)
Dump an audio format to stderr.
GAVL_PUBLIC int gavl_video_options_get_num_threads(gavl_video_options_t *opt)
Set number of threads.
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2141
struct gavl_audio_converter_s gavl_audio_converter_t
Opaque audio converter structure.
Definition: gavl.h:993
gavl_timecode_format_t timecode_format
Definition: gavl.h:2143
GAVL_PUBLIC const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a human readable string.
Definition: gavl.h:1699
int image_width
Definition: gavl.h:2124
Chrominance blue (aka U)
Definition: gavl.h:1858
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_sample_format_t sample_format
Definition: gavl.h:265
int frame_height
Definition: gavl.h:2122
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.
int channel_stride
Definition: gavl.h:520
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_frame_table_append_timecode(gavl_frame_table_t *t, int64_t pts, gavl_timecode_t tc)
Append a timecodes.
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 gavl_downscale_filter_t gavl_video_options_get_downscale_filter(gavl_video_options_t *opt)
Get the antialiasing filter for downscaling.
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.
Definition: gavl.h:2094
GAVL_PUBLIC gavl_audio_converter_t * gavl_audio_converter_create()
Creates an audio converter.
Definition: gavl.h:2743
GAVL_PUBLIC gavl_video_options_t * gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t *deinterlacer)
gets options of a deinterlacer
Definition: gavl.h:2770
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_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 const double ** gavl_audio_options_get_mix_matrix(gavl_audio_options_t *opt)
Get the mix matrix.
GAVL_PUBLIC void gavl_video_options_get_rectangles(gavl_video_options_t *opt, gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect)
Get source and destination rectangles.
Audio Format.
Definition: gavl.h:260
frame table structure
Definition: gavl.h:3722
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_options_set_resample_mode(gavl_audio_options_t *opt, gavl_resample_mode_t mode)
Set the resample mode for the converter.
Definition: gavl.h:1769
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.
Definition: gavl.h:2768
int64_t num_entries
Number of entries.
Definition: gavl.h:3726
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_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.
Definition: gavl.h:2097
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 int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat)
Get the number of planes.
Definition: gavl.h:802
GAVL_PUBLIC int gavl_accel_supported()
Get the supported acceleration flags.
Definition: gavl.h:1716
GAVL_PUBLIC int gavl_video_deinterlacer_init(gavl_video_deinterlacer_t *deinterlacer, const gavl_video_format_t *src_format)
Initialize a video deinterlacer.
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_PUBLIC int64_t gavl_frame_table_duration(const gavl_frame_table_t *t)
get the total duration of all frames
gavl_pixelformat_t pixelformat
Definition: gavl.h:2132
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.
int timecodes_alloc
Number of allocated timecodes (never touch this)
Definition: gavl.h:3736
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.
Fastest method, might produce heavy aliasing artifacts.
Definition: gavl.h:2790
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.
Definition: gavl.h:1780
Definition: gavl.h:2071
struct gavl_video_scaler_s gavl_video_scaler_t
Opaque scaler structure.
Definition: gavl.h:3317
gavl_deinterlace_drop_mode_t
Specifies which field to drop when deinterlacing.
Definition: gavl.h:2755
GAVL_PUBLIC void gavl_rectangle_i_dump(const gavl_rectangle_i_t *r)
Dump a rectangle to stderr.
GAVL_PUBLIC void gavl_audio_options_set_mix_matrix(gavl_audio_options_t *opt, const double **matrix)
Set a user defined mix matrix.
Definition: gavl.h:1765
Definition: gavl.h:798
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.
Definition: gavl.h:248
Transparency (or, to be more precise opacity)
Definition: gavl.h:1860
gavl_rectangle_i_t ovl_rect
Rectangle in the source frame */.
Definition: gavl.h:3511
Definition: gavl.h:2100
int timescale
Definition: gavl.h:2136
Auto selection based on quality.
Definition: gavl.h:2789
GAVL_PUBLIC void gavl_video_format_dump(const gavl_video_format_t *format)
Dump a video format to stderr.
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.
Definition: gavl.h:1735
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 void gavl_video_options_copy(gavl_video_options_t *dst, const gavl_video_options_t *src)
Copy video options.
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.
struct gavl_peak_detector_s gavl_peak_detector_t
Opaque structure for peak detector.
Definition: gavl.h:1221
GAVL_PUBLIC void gavl_peak_detector_reset(gavl_peak_detector_t *pd)
Reset a peak detector.
Video format.
Definition: gavl.h:2119
GAVL_PUBLIC void gavl_video_options_set_quality(gavl_video_options_t *opt, int quality)
Set the quality level for the converter.
Definition: gavl.h:799
int8_t * s_8
Definition: gavl.h:465
GAVL_PUBLIC int gavl_audio_converter_set_resample_ratio(gavl_audio_converter_t *cnv, double ratio)
Set samplerate converstion ratio.
gavl_color_channel_t
Color channel definitions.
Definition: gavl.h:1852
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 gavl_resample_mode_t gavl_audio_options_get_resample_mode(gavl_audio_options_t *opt)
Get the resample mode for the converter.
int num_channels
Definition: gavl.h:264
Definition: gavl.h:240
Luminance (also grayscale)
Definition: gavl.h:1857
Definition: gavl.h:1756
int num_timecodes
Number of timecodes.
Definition: gavl.h:3735
Definition: gavl.h:2074
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.
int dst_x
x offset in the destination frame. */
Definition: gavl.h:3512
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_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode(gavl_video_options_t *opt)
Get the alpha mode.
GAVL_PUBLIC gavl_video_stop_func gavl_video_options_get_stop_func(gavl_video_options_t *opt, void **client_data)
Get function to be passed to each thread.
Definition: gavl.h:2098
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.
Definition: gavl.h:2099
Definition: gavl.h:1790
Definition: gavl.h:206
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.
Definition: gavl.h:223
GAVL_PUBLIC void gavl_peak_detector_get_peak(gavl_peak_detector_t *pd, double *min, double *max, double *abs)
Get the peak volume across all channels.
double w
Definition: gavl.h:1343
int64_t timestamp
Definition: gavl.h:2271
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_peak_detector_set_format(gavl_peak_detector_t *pd, const gavl_audio_format_t *format)
Set format for a peak detector.
GAVL_PUBLIC void gavl_video_options_destroy(gavl_video_options_t *opt)
Destroy video options.
GAVL_PUBLIC void gavl_video_options_set_conversion_flags(gavl_video_options_t *opt, int conversion_flags)
Set the conversion flags.