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
37 extern "C" {
38 #endif
39 
40  /* Forward declarations */
41 
48 typedef struct gavl_video_source_s gavl_video_source_t;
49 
56 typedef struct gavl_audio_source_s gavl_audio_source_t;
57 
64 typedef struct gavl_packet_source_s gavl_packet_source_t;
65 
72 typedef struct
73 gavl_audio_sink_s gavl_audio_sink_t;
74 
81 typedef struct
82 gavl_video_sink_s gavl_video_sink_t;
83 
90 typedef struct
91 gavl_packet_sink_s gavl_packet_sink_t;
92 
115 typedef void (*gavl_video_process_func)(void * data, int start, int end);
116 
131  void * gavl_data,
132  int start, int end,
133  void * client_data, int thread);
134 
143 typedef void (*gavl_video_stop_func)(void * client_data, int thread);
144 
154 
155 
156 /* Quality levels */
157 
181 #define GAVL_QUALITY_FASTEST 1
182 
189 #define GAVL_QUALITY_BEST 5
190 
197 #define GAVL_QUALITY_DEFAULT 2
198 
210 #define GAVL_ACCEL_MMX (1<<0)
211 #define GAVL_ACCEL_MMXEXT (1<<1)
212 #define GAVL_ACCEL_SSE (1<<2)
213 #define GAVL_ACCEL_SSE2 (1<<3)
214 #define GAVL_ACCEL_SSE3 (1<<4)
215 #define GAVL_ACCEL_3DNOW (1<<5)
216 #define GAVL_ACCEL_3DNOWEXT (1<<6)
217 #define GAVL_ACCEL_SSSE3 (1<<7)
218 
219 
223 GAVL_PUBLIC int gavl_accel_supported();
224 
233 /* Sample formats: all multibyte numbers are native endian */
234 
247 #define GAVL_MAX_CHANNELS 128
248 
255 typedef enum
256  {
266 
272 typedef enum
273  {
278 
286 typedef enum
287  {
302 
311 typedef struct
312  {
313  uint32_t samples_per_frame;
314  uint32_t samplerate;
315  uint32_t num_channels;
319  float center_level;
320  float rear_level;
322  gavl_channel_id_t channel_locations[GAVL_MAX_CHANNELS];
325 
326 
327 /* Audio format -> string conversions */
328 
336 GAVL_PUBLIC
338 
347 GAVL_PUBLIC
349 
355 GAVL_PUBLIC
357 
364 GAVL_PUBLIC
366 
373 GAVL_PUBLIC
374 const char * gavl_channel_id_to_string(gavl_channel_id_t id);
375 
376 
383 GAVL_PUBLIC
385 
392 GAVL_PUBLIC
393 void gavl_audio_format_dump(const gavl_audio_format_t * format);
394 
407 GAVL_PUBLIC
408 void gavl_audio_format_dumpi(const gavl_audio_format_t * format, int indent);
409 
418 GAVL_PUBLIC
419 int gavl_channel_index(const gavl_audio_format_t * format, gavl_channel_id_t id);
420 
427 GAVL_PUBLIC
428 int gavl_front_channels(const gavl_audio_format_t * format);
429 
436 GAVL_PUBLIC
437 int gavl_rear_channels(const gavl_audio_format_t * format);
438 
445 GAVL_PUBLIC
446 int gavl_side_channels(const gavl_audio_format_t * format);
447 
454 GAVL_PUBLIC
455 int gavl_aux_channels(const gavl_audio_format_t * format);
456 
457 
458 
465 GAVL_PUBLIC
466 int gavl_lfe_channels(const gavl_audio_format_t * format);
467 
475 GAVL_PUBLIC
477  const gavl_audio_format_t * src);
478 
487 GAVL_PUBLIC
488 int gavl_audio_formats_equal(const gavl_audio_format_t * format_1,
489  const gavl_audio_format_t * format_2);
490 
502 GAVL_PUBLIC
504 
511 GAVL_PUBLIC
513 
524 GAVL_PUBLIC
525 int gavl_nearest_samplerate(int in_rate, const int * supported);
526 
527 
542 typedef union
543  {
544  uint8_t * u_8;
545  int8_t * s_8;
547  uint16_t * u_16;
548  int16_t * s_16;
550  uint32_t * u_32;
551  int32_t * s_32;
553  float * f;
554  double * d;
556 
562 typedef union
563  {
564  uint8_t * u_8[GAVL_MAX_CHANNELS];
565  int8_t * s_8[GAVL_MAX_CHANNELS];
567  uint16_t * u_16[GAVL_MAX_CHANNELS];
568  int16_t * s_16[GAVL_MAX_CHANNELS];
570  uint32_t * u_32[GAVL_MAX_CHANNELS];
571  int32_t * s_32[GAVL_MAX_CHANNELS];
573  float * f[GAVL_MAX_CHANNELS];
574  double * d[GAVL_MAX_CHANNELS];
577 
594 typedef struct
595  {
599  int64_t timestamp;
602 
614 GAVL_PUBLIC
616 
628 GAVL_PUBLIC
630 
640 GAVL_PUBLIC
642 
652 GAVL_PUBLIC
654  const gavl_audio_format_t * format);
655 
666 GAVL_PUBLIC
668  const gavl_audio_format_t * format,
669  int num_samples);
670 
671 
672 
683 GAVL_PUBLIC
685  const gavl_audio_format_t * format,
686  int channel);
687 
708 GAVL_PUBLIC
709 int gavl_audio_frame_copy(const gavl_audio_format_t * format,
710  gavl_audio_frame_t * dst,
711  const gavl_audio_frame_t * src,
712  int dst_pos,
713  int src_pos,
714  int dst_size,
715  int src_size);
716 
729 GAVL_PUBLIC
731  gavl_audio_frame_t * dst,
732  const gavl_audio_frame_t * src);
733 
751 GAVL_PUBLIC
753  gavl_audio_frame_t * src,
754  gavl_audio_frame_t * dst,
755  int start, int len);
756 
769 GAVL_PUBLIC
771  const gavl_audio_frame_t * f1,
772  const gavl_audio_frame_t * f2);
773 
785 GAVL_PUBLIC
787  const gavl_audio_frame_t * f);
788 
789 
800 GAVL_PUBLIC
802  const gavl_audio_format_t * format,
803  uint8_t * data);
804 
823 GAVL_PUBLIC
824 int gavl_audio_frame_skip(const gavl_audio_format_t * format,
825  gavl_audio_frame_t * f, int num_samples);
826 
827 
847 GAVL_PUBLIC
848 int gavl_audio_frame_plot(const gavl_audio_format_t * format,
849  const gavl_audio_frame_t * frame,
850  const char * name_base);
851 
852 
867 #define GAVL_AUDIO_FRONT_TO_REAR_COPY (1<<0)
872 #define GAVL_AUDIO_FRONT_TO_REAR_MUTE (1<<1)
877 #define GAVL_AUDIO_FRONT_TO_REAR_DIFF (1<<2)
882 #define GAVL_AUDIO_FRONT_TO_REAR_MASK \
883 (GAVL_AUDIO_FRONT_TO_REAR_COPY | \
884 GAVL_AUDIO_FRONT_TO_REAR_MUTE | \
885  GAVL_AUDIO_FRONT_TO_REAR_DIFF)
887 /* Options for mixing stereo to mono */
888 
891 #define GAVL_AUDIO_STEREO_TO_MONO_LEFT (1<<3)
894 #define GAVL_AUDIO_STEREO_TO_MONO_RIGHT (1<<4)
897 #define GAVL_AUDIO_STEREO_TO_MONO_MIX (1<<5)
901 #define GAVL_AUDIO_STEREO_TO_MONO_MASK \
902 (GAVL_AUDIO_STEREO_TO_MONO_LEFT | \
903 GAVL_AUDIO_STEREO_TO_MONO_RIGHT | \
904 GAVL_AUDIO_STEREO_TO_MONO_MIX)
909 #define GAVL_AUDIO_NORMALIZE_MIX_MATRIX (1<<6)
916 typedef enum
917  {
918  GAVL_AUDIO_DITHER_NONE = 0,
919  GAVL_AUDIO_DITHER_AUTO = 1,
920  GAVL_AUDIO_DITHER_RECT = 2,
921  GAVL_AUDIO_DITHER_TRI = 3,
922  GAVL_AUDIO_DITHER_SHAPED = 4,
924 
929 typedef enum
930  {
938 
945 typedef struct gavl_audio_options_s gavl_audio_options_t;
946 
953 GAVL_PUBLIC
955 
962 GAVL_PUBLIC
964 
971 GAVL_PUBLIC
973 
980 GAVL_PUBLIC
983 
984 
991 GAVL_PUBLIC
993 
1000 GAVL_PUBLIC
1003 
1010 GAVL_PUBLIC
1012  int flags);
1013 
1020 GAVL_PUBLIC
1022 
1028 GAVL_PUBLIC
1030 
1047 GAVL_PUBLIC
1049  const double ** matrix);
1050 
1059 GAVL_PUBLIC
1060 const double **
1062 
1072 GAVL_PUBLIC
1074 
1081 GAVL_PUBLIC
1083  const gavl_audio_options_t * src);
1084 
1090 GAVL_PUBLIC
1092 
1093 
1094 
1095 /* Audio converter */
1096 
1130 typedef struct gavl_audio_converter_s gavl_audio_converter_t;
1131 
1137 GAVL_PUBLIC
1139 
1145 GAVL_PUBLIC
1147 
1156 GAVL_PUBLIC
1158 
1159 
1174 GAVL_PUBLIC
1176  const gavl_audio_format_t * input_format,
1177  const gavl_audio_format_t * output_format);
1178 
1193 GAVL_PUBLIC
1195  const gavl_audio_format_t * format);
1196 
1211 GAVL_PUBLIC
1213 
1214 
1228 GAVL_PUBLIC
1230  const gavl_audio_frame_t * input_frame,
1231  gavl_audio_frame_t * output_frame);
1232 
1233 
1252 GAVL_PUBLIC
1254  double ratio ) ;
1255 
1256 
1272 GAVL_PUBLIC
1274  gavl_audio_frame_t * input_frame,
1275  gavl_audio_frame_t * output_frame,
1276  double ratio);
1277 
1278 
1292 typedef struct gavl_volume_control_s gavl_volume_control_t;
1293 
1294 /* Create / destroy */
1295 
1301 GAVL_PUBLIC
1303 
1309 GAVL_PUBLIC
1311 
1319 GAVL_PUBLIC
1321  const gavl_audio_format_t * format);
1322 
1329 GAVL_PUBLIC
1331  float volume);
1332 
1339 GAVL_PUBLIC
1341  gavl_audio_frame_t * frame);
1342 
1343 
1353 #define GAVL_MAX_PLANES 4
1365 typedef struct
1366  {
1367  int32_t x;
1368  int32_t y;
1369  int32_t w;
1370  int32_t h;
1372 
1377 typedef struct
1378  {
1379  double x;
1380  double y;
1381  double w;
1382  double h;
1384 
1391 GAVL_PUBLIC
1393  const gavl_video_format_t * format);
1394 
1401 GAVL_PUBLIC
1403  const gavl_video_format_t * format);
1404 
1419 GAVL_PUBLIC
1421  gavl_rectangle_i_t * dst_rect,
1422  const gavl_video_format_t * src_format,
1423  const gavl_video_format_t * dst_format);
1424 
1436 GAVL_PUBLIC
1438  gavl_rectangle_i_t * dst_rect,
1439  const gavl_video_format_t * src_format,
1440  const gavl_video_format_t * dst_format);
1441 
1442 
1443 
1450 GAVL_PUBLIC
1452 
1459 GAVL_PUBLIC
1461 
1468 GAVL_PUBLIC
1469 void gavl_rectangle_i_crop_left(gavl_rectangle_i_t * r, int num_pixels);
1470 
1477 GAVL_PUBLIC
1478 void gavl_rectangle_i_crop_right(gavl_rectangle_i_t * r, int num_pixels);
1479 
1486 GAVL_PUBLIC
1487 void gavl_rectangle_i_crop_top(gavl_rectangle_i_t * r, int num_pixels);
1488 
1495 GAVL_PUBLIC
1496 void gavl_rectangle_i_crop_bottom(gavl_rectangle_i_t * r, int num_pixels);
1497 
1504 GAVL_PUBLIC
1505 void gavl_rectangle_f_crop_left(gavl_rectangle_f_t * r, double num_pixels);
1506 
1513 GAVL_PUBLIC
1514 void gavl_rectangle_f_crop_right(gavl_rectangle_f_t * r, double num_pixels);
1515 
1522 GAVL_PUBLIC
1523 void gavl_rectangle_f_crop_top(gavl_rectangle_f_t * r, double num_pixels);
1524 
1531 GAVL_PUBLIC
1532 void gavl_rectangle_f_crop_bottom(gavl_rectangle_f_t * r, double num_pixels);
1533 
1547 GAVL_PUBLIC
1548 void gavl_rectangle_i_align(gavl_rectangle_i_t * r, int h_align, int v_align);
1549 
1559 GAVL_PUBLIC
1561  const gavl_video_format_t * format);
1562 
1563 
1570 GAVL_PUBLIC
1572 
1579 GAVL_PUBLIC
1581 
1582 
1583 
1590 GAVL_PUBLIC
1592 
1599 GAVL_PUBLIC
1601 
1610 GAVL_PUBLIC
1612 
1621 GAVL_PUBLIC
1623 
1651 GAVL_PUBLIC
1653  const gavl_video_format_t * src_format,
1654  const gavl_rectangle_f_t * src_rect,
1655  const gavl_video_format_t * dst_format,
1656  float zoom, float squeeze);
1657 
1662 GAVL_PUBLIC
1664 
1669 GAVL_PUBLIC
1671 
1672 
1682 #define GAVL_PIXFMT_PLANAR (1<<8)
1683 
1687 #define GAVL_PIXFMT_RGB (1<<9)
1688 
1692 #define GAVL_PIXFMT_YUV (1<<10)
1693 
1697 #define GAVL_PIXFMT_YUVJ (1<<11)
1698 
1702 #define GAVL_PIXFMT_ALPHA (1<<12)
1703 
1707 #define GAVL_PIXFMT_GRAY (1<<13)
1708 
1713 typedef enum
1714  {
1718 
1722 
1726 
1730 
1734 
1738 
1742 
1774 
1781 
1788 
1804 
1808 
1825 
1835 
1842 
1844 
1847 #define GAVL_PIXELFORMAT_1D_8 GAVL_GRAY_8
1848 
1850 #define GAVL_PIXELFORMAT_2D_8 GAVL_GRAYA_16
1851 
1853 #define GAVL_PIXELFORMAT_3D_8 GAVL_RGB_24
1854 
1856 #define GAVL_PIXELFORMAT_4D_8 GAVL_RGBA_32
1857 
1860 #define GAVL_PIXELFORMAT_1D_16 GAVL_GRAY_16
1861 
1863 #define GAVL_PIXELFORMAT_2D_16 GAVL_GRAYA_32
1864 
1866 #define GAVL_PIXELFORMAT_3D_16 GAVL_RGB_48
1867 
1869 #define GAVL_PIXELFORMAT_4D_16 GAVL_RGBA_64
1870 
1873 #define GAVL_PIXELFORMAT_1D_FLOAT GAVL_GRAY_FLOAT
1874 
1876 #define GAVL_PIXELFORMAT_2D_FLOAT GAVL_GRAYA_FLOAT
1877 
1879 #define GAVL_PIXELFORMAT_3D_FLOAT GAVL_RGB_FLOAT
1880 
1882 #define GAVL_PIXELFORMAT_4D_FLOAT GAVL_RGBA_FLOAT
1883 
1890 typedef enum
1891  {
1901 
1902 /*
1903  * Colormodel related functions
1904  */
1905 
1912 #define gavl_pixelformat_is_gray(fmt) ((fmt) & GAVL_PIXFMT_GRAY)
1913 
1914 
1921 #define gavl_pixelformat_is_rgb(fmt) ((fmt) & GAVL_PIXFMT_RGB)
1922 
1929 #define gavl_pixelformat_is_yuv(fmt) ((fmt) & GAVL_PIXFMT_YUV)
1930 
1937 #define gavl_pixelformat_is_jpeg_scaled(fmt) ((fmt) & GAVL_PIXFMT_YUVJ)
1938 
1945 #define gavl_pixelformat_has_alpha(fmt) ((fmt) & GAVL_PIXFMT_ALPHA)
1946 
1953 #define gavl_pixelformat_is_planar(fmt) ((fmt) & GAVL_PIXFMT_PLANAR)
1954 
1955 
1962 GAVL_PUBLIC
1963 int gavl_pixelformat_num_channels(gavl_pixelformat_t pixelformat);
1964 
1972 GAVL_PUBLIC gavl_color_channel_t
1973 gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index);
1974 
1975 
1982 GAVL_PUBLIC
1983 int gavl_pixelformat_num_planes(gavl_pixelformat_t pixelformat);
1984 
1994 GAVL_PUBLIC
1995 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
1996 
2003 GAVL_PUBLIC
2004 int gavl_pixelformat_bytes_per_component(gavl_pixelformat_t pixelformat);
2005 
2012 GAVL_PUBLIC
2013 int gavl_pixelformat_bytes_per_pixel(gavl_pixelformat_t pixelformat);
2014 
2021 GAVL_PUBLIC
2022 int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat);
2023 
2038 GAVL_PUBLIC
2039 int gavl_pixelformat_conversion_penalty(gavl_pixelformat_t src,
2040  gavl_pixelformat_t dst);
2041 
2055 GAVL_PUBLIC gavl_pixelformat_t
2056 gavl_pixelformat_get_best(gavl_pixelformat_t src,
2057  const gavl_pixelformat_t * dst_supported,
2058  int * penalty);
2059 
2060 
2061 
2068 GAVL_PUBLIC
2069 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat);
2070 
2080 GAVL_PUBLIC
2081 const char * gavl_pixelformat_to_short_string(gavl_pixelformat_t pixelformat);
2082 
2083 
2090 GAVL_PUBLIC
2091 gavl_pixelformat_t gavl_string_to_pixelformat(const char * name);
2092 
2099 GAVL_PUBLIC
2100 gavl_pixelformat_t gavl_short_string_to_pixelformat(const char * name);
2101 
2102 
2108 GAVL_PUBLIC
2109 int gavl_num_pixelformats();
2110 
2117 GAVL_PUBLIC
2118 gavl_pixelformat_t gavl_get_pixelformat(int index);
2119 
2120 /* */
2121 
2130 typedef enum
2131  {
2136 
2143 GAVL_PUBLIC
2144 const char * gavl_chroma_placement_to_string(gavl_chroma_placement_t mode);
2145 
2150 /* Changing the values alters the gmerlin-avdecoder index format */
2151 
2152 typedef enum
2153  {
2159 
2166 GAVL_PUBLIC
2168 
2173 /* Changing the values alters the gmerlin-avdecoder index format */
2174 
2175 typedef enum
2176  {
2181  GAVL_INTERLACE_MIXED = (0x10 | 1),
2185 
2192 GAVL_PUBLIC
2194 
2203 GAVL_PUBLIC
2205 
2206 /* Video format structure */
2207 
2213  {
2214  uint32_t frame_width;
2215  uint32_t frame_height;
2217  uint32_t image_width;
2218  uint32_t image_height;
2220  /* Support for nonsquare pixels */
2221 
2222  uint32_t pixel_width;
2223  uint32_t pixel_height;
2225  gavl_pixelformat_t pixelformat;
2227  uint32_t frame_duration;
2229  uint32_t timescale;
2232  gavl_chroma_placement_t chroma_placement;
2237  };
2238 
2246 GAVL_PUBLIC
2248  const gavl_video_format_t * src);
2249 
2258 GAVL_PUBLIC
2259 int gavl_video_formats_equal(const gavl_video_format_t * format_1,
2260  const gavl_video_format_t * format_2);
2261 
2262 
2273 GAVL_PUBLIC
2274 void gavl_video_format_get_chroma_offset(const gavl_video_format_t * format, int field, int plane,
2275  float * off_x, float * off_y);
2276 
2277 
2278 
2291 GAVL_PUBLIC
2293  const gavl_video_format_t * src);
2294 
2302 GAVL_PUBLIC
2304 
2321 GAVL_PUBLIC
2323  int pad_h, int pad_v);
2324 
2325 
2341 GAVL_PUBLIC
2342 int gavl_get_color_channel_format(const gavl_video_format_t * frame_format,
2343  gavl_video_format_t * channel_format,
2344  gavl_color_channel_t ch);
2345 
2346 
2360 GAVL_PUBLIC
2361 void gavl_get_field_format(const gavl_video_format_t * frame_format,
2362  gavl_video_format_t * field_format,
2363  int field);
2364 
2365 
2372 GAVL_PUBLIC
2373 void gavl_video_format_dump(const gavl_video_format_t * format);
2374 
2387 GAVL_PUBLIC
2388 void gavl_video_format_dumpi(const gavl_video_format_t * format, int indent);
2389 
2390 
2413 typedef struct gavl_video_frame_s
2414  {
2415  uint8_t * planes[GAVL_MAX_PLANES];
2416  int strides[GAVL_MAX_PLANES];
2418  void * user_data;
2419  int64_t timestamp;
2420  int64_t duration;
2424  int refcount;
2425  void (*destroy)(struct gavl_video_frame_s*, void*priv);
2426  void * destroy_priv;
2429  int32_t dst_x;
2430  int32_t dst_y;
2431 
2433 
2434 
2446 GAVL_PUBLIC
2448 
2459 GAVL_PUBLIC
2461 
2462 
2463 
2473 GAVL_PUBLIC
2475 
2487 GAVL_PUBLIC
2489 
2498 GAVL_PUBLIC
2500  const gavl_video_format_t * format);
2501 
2511 GAVL_PUBLIC
2513  const gavl_video_format_t * format,
2514  const float * color);
2515 
2528 GAVL_PUBLIC
2530  const gavl_video_frame_t * src1,
2531  const gavl_video_frame_t * src2,
2532  const gavl_video_format_t * format);
2533 
2546 GAVL_PUBLIC
2547 void gavl_video_frame_psnr(double * psnr,
2548  const gavl_video_frame_t * src1,
2549  const gavl_video_frame_t * src2,
2550  const gavl_video_format_t * format);
2551 
2578 GAVL_PUBLIC
2579 int gavl_video_frame_ssim(const gavl_video_frame_t * src1,
2580  const gavl_video_frame_t * src2,
2581  gavl_video_frame_t * dst,
2582  const gavl_video_format_t * format);
2583 
2597 GAVL_PUBLIC
2598 void gavl_video_frame_copy(const gavl_video_format_t * format,
2599  gavl_video_frame_t * dst,
2600  const gavl_video_frame_t * src);
2601 
2614 GAVL_PUBLIC
2616  gavl_video_frame_t * dst,
2617  const gavl_video_frame_t * src, int plane);
2618 
2630 GAVL_PUBLIC
2632  gavl_video_frame_t * dst,
2633  const gavl_video_frame_t * src);
2634 
2646 GAVL_PUBLIC
2648  gavl_video_frame_t * dst,
2649  const gavl_video_frame_t * src);
2650 
2662 GAVL_PUBLIC
2664  gavl_video_frame_t * dst,
2665  const gavl_video_frame_t * src);
2666 
2679 GAVL_PUBLIC
2681  const gavl_video_frame_t * src);
2682 
2683 
2701 GAVL_PUBLIC
2702 void gavl_video_frame_get_subframe(gavl_pixelformat_t pixelformat,
2703  const gavl_video_frame_t * src,
2704  gavl_video_frame_t * dst,
2705  const gavl_rectangle_i_t * src_rect);
2706 
2722 GAVL_PUBLIC
2723 void gavl_video_frame_get_field(gavl_pixelformat_t pixelformat,
2724  const gavl_video_frame_t * src,
2725  gavl_video_frame_t * dst,
2726  int field);
2727 
2728 
2729 
2742 GAVL_PUBLIC
2744  const gavl_video_format_t * format,
2745  const char * namebase);
2746 
2757 GAVL_PUBLIC
2759  const gavl_video_frame_t * frame);
2760 
2771 GAVL_PUBLIC
2773  const gavl_video_format_t * format);
2774 
2787 GAVL_PUBLIC
2789  const gavl_video_format_t * format,
2790  uint8_t * buffer);
2791 
2803 GAVL_PUBLIC
2805  const gavl_video_frame_t * frame);
2806 
2807 
2822 GAVL_PUBLIC
2824  gavl_color_channel_t ch,
2825  const gavl_video_frame_t * src,
2826  gavl_video_frame_t * dst);
2827 
2843 GAVL_PUBLIC
2845  gavl_color_channel_t ch,
2846  const gavl_video_frame_t * src,
2847  gavl_video_frame_t * dst);
2848 
2849 
2861 GAVL_PUBLIC
2862 int gavl_video_frames_equal(const gavl_video_format_t * format,
2863  const gavl_video_frame_t * f1,
2864  const gavl_video_frame_t * f2);
2865 
2866 
2867 /*****************************
2868  Conversion options
2869 ******************************/
2870 
2886 #define GAVL_FORCE_DEINTERLACE (1<<0)
2887 
2892 #define GAVL_CONVOLVE_CHROMA (1<<1)
2893 
2898 #define GAVL_CONVOLVE_NORMALIZE (1<<2)
2899 
2907 #define GAVL_RESAMPLE_CHROMA (1<<3)
2908 
2916 typedef enum
2917  {
2921 
2928 typedef enum
2929  {
2935 
2942 typedef enum
2943  {
2947 
2952 typedef enum
2953  {
2964 
2974 typedef enum
2975  {
2981 
2988 typedef struct gavl_video_options_s gavl_video_options_t;
2989 
2990 /* Default Options */
2991 
2997 GAVL_PUBLIC
2999 
3009 GAVL_PUBLIC
3011 
3018 GAVL_PUBLIC
3020  const gavl_video_options_t * src);
3021 
3027 GAVL_PUBLIC
3029 
3030 
3045 GAVL_PUBLIC
3047  const gavl_rectangle_f_t * src_rect,
3048  const gavl_rectangle_i_t * dst_rect);
3049 
3057 GAVL_PUBLIC
3059  gavl_rectangle_f_t * src_rect,
3060  gavl_rectangle_i_t * dst_rect);
3061 
3068 GAVL_PUBLIC
3069 void gavl_video_options_set_quality(gavl_video_options_t * opt, int quality);
3070 
3077 GAVL_PUBLIC
3079 
3080 
3087 GAVL_PUBLIC
3089  int conversion_flags);
3090 
3097 GAVL_PUBLIC
3099 
3106 GAVL_PUBLIC
3108  gavl_alpha_mode_t alpha_mode);
3109 
3116 GAVL_PUBLIC gavl_alpha_mode_t
3118 
3119 
3126 GAVL_PUBLIC
3128  gavl_scale_mode_t scale_mode);
3129 
3136 GAVL_PUBLIC gavl_scale_mode_t
3138 
3139 
3146 GAVL_PUBLIC
3148  int order);
3149 
3156 GAVL_PUBLIC
3158 
3159 
3166 GAVL_PUBLIC
3168  const float * color);
3169 
3176 GAVL_PUBLIC
3178  float * color);
3179 
3186 GAVL_PUBLIC
3188  gavl_deinterlace_mode_t deinterlace_mode);
3189 
3196 GAVL_PUBLIC gavl_deinterlace_mode_t
3198 
3205 GAVL_PUBLIC
3207  gavl_deinterlace_drop_mode_t deinterlace_drop_mode);
3208 
3215 GAVL_PUBLIC gavl_deinterlace_drop_mode_t
3217 
3226 GAVL_PUBLIC
3228  gavl_downscale_filter_t f);
3229 
3230 
3239 GAVL_PUBLIC gavl_downscale_filter_t
3241 
3259 GAVL_PUBLIC
3261  float f);
3262 
3271 GAVL_PUBLIC
3273 
3282 GAVL_PUBLIC
3284 
3285 
3294 GAVL_PUBLIC
3296 
3306 GAVL_PUBLIC
3308  gavl_video_run_func func,
3309  void * client_data);
3310 
3320 GAVL_PUBLIC
3323  void ** client_data);
3324 
3334 GAVL_PUBLIC
3336  gavl_video_stop_func func,
3337  void * client_data);
3338 
3348 GAVL_PUBLIC
3351  void ** client_data);
3352 
3353 
3354 /***************************************************
3355  * Create and destroy video converters
3356  ***************************************************/
3357 
3390 typedef struct gavl_video_converter_s gavl_video_converter_t;
3391 
3397 GAVL_PUBLIC
3399 
3405 GAVL_PUBLIC
3407 
3408 /**************************************************
3409  * Get options. Change the options with the gavl_video_options_set_*
3410  * functions above
3411  **************************************************/
3412 
3421 GAVL_PUBLIC gavl_video_options_t *
3423 
3424 
3438 GAVL_PUBLIC
3440  const gavl_video_format_t * input_format,
3441  const gavl_video_format_t * output_format);
3442 
3455 GAVL_PUBLIC
3457 
3458 
3459 /***************************************************
3460  * Convert a frame
3461  ***************************************************/
3462 
3470 GAVL_PUBLIC
3472  const gavl_video_frame_t * input_frame,
3473  gavl_video_frame_t * output_frame);
3474 
3506 typedef struct gavl_video_scaler_s gavl_video_scaler_t;
3507 
3513 GAVL_PUBLIC
3515 
3521 GAVL_PUBLIC
3523 
3532 GAVL_PUBLIC gavl_video_options_t *
3534 
3547 GAVL_PUBLIC
3549  const gavl_video_format_t * src_format,
3550  const gavl_video_format_t * dst_format);
3551 
3573 GAVL_PUBLIC
3575  const gavl_video_format_t * format,
3576  int h_radius, const float * h_coeffs,
3577  int v_radius, const float * v_coeffs);
3578 
3586 GAVL_PUBLIC
3588  const gavl_video_frame_t * input_frame,
3589  gavl_video_frame_t * output_frame);
3590 
3606 typedef struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t;
3607 
3613 GAVL_PUBLIC
3615 
3621 GAVL_PUBLIC
3623 
3632 GAVL_PUBLIC gavl_video_options_t *
3634 
3645 GAVL_PUBLIC
3647  const gavl_video_format_t * src_format);
3648 
3649 
3657 GAVL_PUBLIC
3659  const gavl_video_frame_t * input_frame,
3660  gavl_video_frame_t * output_frame);
3661 
3662 
3663 
3664 /**************************************************
3665  * Transparent overlays
3666  **************************************************/
3667 
3668 /* Overlay struct */
3669 
3698 
3705 typedef struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t;
3706 
3712 GAVL_PUBLIC
3714 
3720 GAVL_PUBLIC
3722 
3729 GAVL_PUBLIC gavl_video_options_t *
3731 
3747 GAVL_PUBLIC
3749  const gavl_video_format_t * frame_format,
3750  gavl_video_format_t * overlay_format);
3751 
3761 GAVL_PUBLIC
3763  gavl_overlay_t * ovl);
3764 
3771 GAVL_PUBLIC
3773  gavl_video_frame_t * dst_frame);
3774 
3781 GAVL_PUBLIC gavl_video_sink_t *
3783 
3805 typedef struct gavl_image_transform_s gavl_image_transform_t;
3806 
3820 typedef void (*gavl_image_transform_func)(void * priv,
3821  double xdst,
3822  double ydst,
3823  double * xsrc,
3824  double * ysrc);
3825 
3826 
3833 GAVL_PUBLIC
3835 
3841 GAVL_PUBLIC
3843 
3862 GAVL_PUBLIC
3864  gavl_video_format_t * format,
3865  gavl_image_transform_func func, void * priv);
3866 
3874 GAVL_PUBLIC
3876  gavl_video_frame_t * in_frame,
3877  gavl_video_frame_t * out_frame);
3878 
3889 GAVL_PUBLIC gavl_video_options_t *
3891 
3914 typedef struct
3915  {
3916  int64_t offset;
3917  /* Primary */
3918  int64_t num_entries;
3919  int64_t entries_alloc;
3920 
3921  struct
3922  {
3923  int64_t num_frames;
3924  int64_t duration;
3925  } * entries;
3926 
3929 
3930  struct
3931  {
3932  int64_t pts;
3934  } * timecodes;
3935 
3936  /* Secondary */
3937 
3939 
3946 
3957 GAVL_PUBLIC gavl_frame_table_t *
3958 gavl_frame_table_create_audio(int samplerate, int64_t offset, int64_t duration,
3959  gavl_timecode_format_t * fmt_ret);
3960 
3971 GAVL_PUBLIC gavl_frame_table_t *
3972 gavl_frame_table_create_cfr(int64_t offset, int64_t frame_duration,
3973  int64_t num_frames,
3974  gavl_timecode_t start_timecode);
3975 
3983 GAVL_PUBLIC gavl_frame_table_t *
3985 
3986 
3987 
3994 GAVL_PUBLIC void gavl_frame_table_destroy(gavl_frame_table_t * t);
3995 
4003 GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t * t, int64_t duration);
4004 
4013 GAVL_PUBLIC void
4015  int64_t pts, gavl_timecode_t tc);
4016 
4027 GAVL_PUBLIC int64_t
4029  int64_t frame, int * duration);
4030 
4041 GAVL_PUBLIC int64_t
4043  int64_t time,
4044  int64_t * start_time);
4045 
4056 GAVL_PUBLIC gavl_timecode_t
4058  int64_t time,
4059  int64_t * start_time,
4060  const gavl_timecode_format_t * fmt);
4061 
4071 GAVL_PUBLIC int64_t
4073  gavl_timecode_t tc,
4074  const gavl_timecode_format_t * fmt);
4075 
4076 
4087 GAVL_PUBLIC gavl_timecode_t
4089  int64_t frame,
4090  int64_t * start_time,
4091  const gavl_timecode_format_t * fmt);
4092 
4093 
4094 
4102 GAVL_PUBLIC int64_t
4104 
4112 GAVL_PUBLIC int64_t
4114 
4122 GAVL_PUBLIC int64_t
4124 
4133 GAVL_PUBLIC
4135  const char * filename);
4136 
4144 GAVL_PUBLIC
4145 gavl_frame_table_t * gavl_frame_table_load(const char * filename);
4146 
4153 GAVL_PUBLIC void
4155 
4183 typedef struct gavl_video_frame_pool_s gavl_video_frame_pool_t;
4184 
4191 GAVL_PUBLIC
4193 gavl_video_frame_pool_create(gavl_video_frame_t * (*create_frame)(void * priv),
4194  void * priv);
4195 
4201 GAVL_PUBLIC
4203 
4211 GAVL_PUBLIC
4213 
4221 GAVL_PUBLIC
4223 
4229 #ifdef __cplusplus
4230 }
4231 #endif
4232 
4233 #endif /* GAVL_H_INCLUDED */
uint16_t * u_16
Definition: gavl.h:547
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:1292
Definition: gavl.h:276
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:594
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:3933
Timecode format.
Definition: timecode.h:59
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 int gavl_frame_table_save(const gavl_frame_table_t *t, const char *filename)
Save a frame table to a file.
struct gavl_audio_options_s gavl_audio_options_t
Opaque container for audio conversion options.
Definition: gavl.h:945
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.
Definition: gavl.h:1721
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:2916
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.
GAVL_PUBLIC gavl_sample_format_t gavl_string_to_sample_format(const char *str)
Convert a string to a sample format.
int32_t * s_32
Definition: gavl.h:551
GAVL_PUBLIC int gavl_audio_options_get_conversion_flags(const gavl_audio_options_t *opt)
Get the conversion flags.
GAVL_PUBLIC void gavl_volume_control_set_volume(gavl_volume_control_t *ctrl, float volume)
Set volume for a volume control.
struct gavl_video_frame_pool_s gavl_video_frame_pool_t
Video frame pool.
Definition: gavl.h:4183
double h
Definition: gavl.h:1382
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:1746
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:1821
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 double ** gavl_audio_options_get_mix_matrix(const gavl_audio_options_t *opt)
Get the mix matrix.
struct gavl_video_frame_s gavl_video_frame_t
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:596
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:1713
gavl_downscale_filter_t
Definition: gavl.h:2974
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:2952
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:295
gavl_channel_id_t
Audio channel setup.
Definition: gavl.h:286
Definition: gavl.h:263
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:2958
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.
gavl_timecode_t timecode
Definition: gavl.h:2422
Green.
Definition: gavl.h:1894
GAVL_PUBLIC gavl_video_options_t * gavl_overlay_blend_context_get_options(gavl_overlay_blend_context_t *ctx)
Get options from a blend context.
Definition: gavl.h:935
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:1682
Definition: gavl.h:1841
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 int gavl_pixelformat_num_channels(gavl_pixelformat_t pixelformat)
Get the number of channels.
int32_t x
Definition: gavl.h:1367
Definition: gavl.h:297
Definition: gavl.h:2178
None/undefined.
Definition: gavl.h:1892
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 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.
uint32_t image_width
Definition: gavl.h:2217
struct gavl_video_source_s gavl_video_source_t
Forward declaration of the video source.
Definition: gavl.h:48
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:599
int64_t entries_alloc
Number of allocated entries (never touch this)
Definition: gavl.h:3919
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:3924
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:1767
int64_t num_frames
Number of frames.
Definition: gavl.h:3923
#define GAVL_PIXFMT_ALPHA
Definition: gavl.h:1702
struct gavl_audio_source_s gavl_audio_source_t
Forward declaration of the audio source.
Definition: gavl.h:56
struct gavl_video_options_s gavl_video_options_t
Definition: gavl.h:2988
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_audio_format_dumpi(const gavl_audio_format_t *format, int indent)
Dump an audio format to stderr.
gavl_interlace_mode_t
Interlace mode.
Definition: gavl.h:2175
Definition: gavl.h:2962
Definition: gavl.h:2960
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_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.
Definition: gavl.h:2919
#define GAVL_PIXFMT_GRAY
Definition: gavl.h:1707
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:1761
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:2132
int64_t timestamp
Definition: gavl.h:2419
int16_t * s_16
Definition: gavl.h:548
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:3916
Definition: gavl.h:1770
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:2954
GAVL_PUBLIC int gavl_lfe_channels(const gavl_audio_format_t *format)
Get number of LFE channels for a given format.
int valid_samples
Definition: gavl.h:598
double y
Definition: gavl.h:1380
GAVL_PUBLIC int gavl_pixelformat_bits_per_pixel(gavl_pixelformat_t pixelformat)
Get the effective number of bits for one pixel.
gavl_framerate_mode_t framerate_mode
Definition: gavl.h:2231
gavl_audio_channels_t channels
Definition: gavl.h:597
GAVL_PUBLIC gavl_downscale_filter_t gavl_video_options_get_downscale_filter(const gavl_video_options_t *opt)
Get the antialiasing filter for downscaling.
float center_level
Definition: gavl.h:319
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:1838
GAVL_PUBLIC gavl_color_channel_t gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index)
Get the color channel.
Definition: gavl.h:292
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:1800
struct gavl_packet_source_s gavl_packet_source_t
Forward declaration of the packet source.
Definition: gavl.h:64
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:1898
uint8_t * u_8
Definition: gavl.h:544
struct gavl_image_transform_s gavl_image_transform_t
Opaque image transformation engine.
Definition: gavl.h:3805
GAVL_PUBLIC void gavl_frame_table_append_entry(gavl_frame_table_t *t, int64_t duration)
Append an entry.
Definition: gavl.h:2918
int32_t w
Definition: gavl.h:1369
Definition: gavl.h:275
Container for noninterleaved audio samples.
Definition: gavl.h:562
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.
struct gavl_audio_sink_s gavl_audio_sink_t
Audio sink.
Definition: gavl.h:72
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:300
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_PUBLIC void gavl_video_options_set_deinterlace_mode(gavl_video_options_t *opt, gavl_deinterlace_mode_t deinterlace_mode)
Set the deinterlace mode.
int64_t duration
Definition: gavl.h:2420
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 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:1692
#define GAVL_MAX_CHANNELS
Maximum number of audio channels.
Definition: gavl.h:247
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.
Definition: gavl.h:1797
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_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.
gavl_interlace_mode_t interlace_mode
Definition: gavl.h:2421
Definition: gavl.h:1758
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 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.
void * destroy_priv
Definition: gavl.h:2426
Definition: gavl.h:1764
void(* gavl_image_transform_func)(void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
Function describing the method.
Definition: gavl.h:3820
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:3390
Definition: gavl.h:1750
GAVL_PUBLIC void gavl_video_frame_pool_destroy(gavl_video_frame_pool_t *p)
Destroy a video frame pool.
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition: timecode.h:43
uint32_t num_channels
Definition: gavl.h:315
GAVL_PUBLIC gavl_video_frame_t * gavl_video_frame_pool_get(gavl_video_frame_pool_t *p)
Create a video frame pool.
int64_t pts
Timestamp of this frame.
Definition: gavl.h:3932
Definition: gavl.h:934
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_volume_control_apply(gavl_volume_control_t *ctrl, gavl_audio_frame_t *frame)
Apply a volume control for an audio frame.
Definition: gavl.h:2179
Definition: gavl.h:1834
Definition: gavl.h:1733
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:293
GAVL_PUBLIC int gavl_front_channels(const gavl_audio_format_t *format)
Get number of front channels for a given format.
Definition: gavl.h:2961
Red.
Definition: gavl.h:1893
Definition: gavl.h:2931
double x
Definition: gavl.h:1379
uint32_t frame_width
Definition: gavl.h:2214
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:290
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.
struct gavl_video_sink_s gavl_video_sink_t
Video sink.
Definition: gavl.h:81
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:258
Definition: gavl.h:2959
Definition: gavl.h:1831
Definition: gavl.h:1729
GAVL_PUBLIC void gavl_video_converter_destroy(gavl_video_converter_t *cnv)
Destroys a video converter and frees all associated memory.
Definition: gavl.h:296
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:2978
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_interleave_mode_t interleave_mode
Definition: gavl.h:317
float * f
Definition: gavl.h:553
Integer rectangle.
Definition: gavl.h:1365
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_PUBLIC int gavl_audio_options_get_quality(const gavl_audio_options_t *opt)
Get the quality level for a converter.
gavl_video_frame_t gavl_overlay_t
Overlay structure.
Definition: gavl.h:3697
gavl_sample_format_t
Format of one audio sample.
Definition: gavl.h:255
GAVL_PUBLIC void gavl_rectangle_i_copy(gavl_rectangle_i_t *dst, const gavl_rectangle_i_t *src)
Copy an integer rectangle.
GAVL_PUBLIC int gavl_video_options_get_num_threads(const gavl_video_options_t *opt)
Set number of threads.
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_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:2130
gavl_chroma_placement_t chroma_placement
Definition: gavl.h:2232
GAVL_PUBLIC void gavl_video_scaler_destroy(gavl_video_scaler_t *scaler)
Destroy a video scaler.
Definition: gavl.h:1784
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:2933
GAVL_PUBLIC int gavl_video_format_get_image_size(const gavl_video_format_t *format)
Get the unpadded image size.
int32_t dst_y
y offset in the destination frame. (since 1.5.0) */
Definition: gavl.h:2430
gavl_audio_dither_mode_t
Dither mode.
Definition: gavl.h:916
#define GAVL_PIXFMT_RGB
Definition: gavl.h:1687
float rear_level
Definition: gavl.h:320
Definition: gavl.h:1787
uint32_t image_height
Definition: gavl.h:2218
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:554
Undefined.
Definition: gavl.h:1717
Definition: gavl.h:298
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:1812
Do a Gaussian preblur.
Definition: gavl.h:2979
uint32_t timescale
Definition: gavl.h:2229
GAVL_PUBLIC void gavl_video_format_dumpi(const gavl_video_format_t *format, int indent)
Dump a video format to stderr.
Definition: gavl.h:2956
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:1777
Definition: gavl.h:294
int32_t h
Definition: gavl.h:1370
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.
GAVL_PUBLIC gavl_pixelformat_t gavl_get_pixelformat(int index)
Get the pixelformat from index.
GAVL_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode(const gavl_video_options_t *opt)
Get the alpha mode.
gavl_deinterlace_mode_t
Definition: gavl.h:2928
GAVL_PUBLIC void gavl_audio_options_set_quality(gavl_audio_options_t *opt, int quality)
Set the quality level for the converter.
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.
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:2932
Definition: gavl.h:2944
Definition: gavl.h:2413
Definition: gavl.h:1725
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_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.
Definition: gavl.h:1791
GAVL_PUBLIC int gavl_side_channels(const gavl_audio_format_t *format)
Get number of side channels for a given format.
Definition: gavl.h:260
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:931
GAVL_PUBLIC void gavl_video_format_set_frame_size(gavl_video_format_t *format, int pad_h, int pad_v)
Set the frame size from the image size.
GAVL_PUBLIC gavl_image_transform_t * gavl_image_transform_create()
Create a transformation engine.
GAVL_PUBLIC void gavl_overlay_blend(gavl_overlay_blend_context_t *ctx, gavl_video_frame_t *dst_frame)
Blend overlay onto video frame.
int32_t dst_x
x offset in the destination frame. (since 1.5.0) */
Definition: gavl.h:2429
Definition: gavl.h:2133
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:2155
GAVL_PUBLIC int gavl_video_converter_init(gavl_video_converter_t *cnv, const gavl_video_format_t *input_format, const gavl_video_format_t *output_format)
Initialize a video converter.
GAVL_PUBLIC int gavl_video_options_get_conversion_flags(const gavl_video_options_t *opt)
Get the conversion flags.
struct gavl_video_deinterlacer_s gavl_video_deinterlacer_t
Opaque deinterlacer structure.
Definition: gavl.h:3606
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:1895
Floating point rectangle.
Definition: gavl.h:1377
struct gavl_overlay_blend_context_s gavl_overlay_blend_context_t
Opaque blend context.
Definition: gavl.h:3705
void(* gavl_video_process_func)(void *data, int start, int end)
Prototype of a process function.
Definition: gavl.h:115
Definition: gavl.h:2134
Definition: gavl.h:264
Container for interleaved audio samples.
Definition: gavl.h:542
Definition: gavl.h:1741
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_pixelformat_t gavl_short_string_to_pixelformat(const char *name)
Translate a short pixelformat name into a pixelformat.
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:2152
Definition: gavl.h:1815
Definition: gavl.h:259
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:1697
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:130
Definition: gavl.h:2945
uint32_t * u_32
Definition: gavl.h:550
#define GAVL_MAX_PLANES
Definition: gavl.h:1353
gavl_resample_mode_t
Resample mode.
Definition: gavl.h:929
gavl_interleave_mode_t
Definition: gavl.h:272
Definition: gavl.h:1780
Definition: gavl.h:262
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.
uint32_t samplerate
Definition: gavl.h:314
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.
void(* gavl_video_stop_func)(void *client_data, int thread)
Wait until a piece of a calculation finished.
Definition: gavl.h:143
Definition: gavl.h:2156
Definition: gavl.h:261
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:1824
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_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_video_options_get_background_color(const gavl_video_options_t *opt, float *color)
Get the background color for alpha blending.
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:289
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:288
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_interlace_mode_t interlace_mode
Definition: gavl.h:2234
gavl_rectangle_i_t src_rect
Valid rectangle in this frame (since 1.5.0) */.
Definition: gavl.h:2428
struct gavl_audio_converter_s gavl_audio_converter_t
Opaque audio converter structure.
Definition: gavl.h:1130
gavl_timecode_format_t timecode_format
Definition: gavl.h:2236
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 const char * gavl_pixelformat_to_string(gavl_pixelformat_t pixelformat)
Translate a pixelformat into a human readable string.
Definition: gavl.h:1737
GAVL_PUBLIC int gavl_interlace_mode_is_mixed(gavl_interlace_mode_t mode)
Check if an interlace mode is mixed.
uint32_t frame_height
Definition: gavl.h:2215
Chrominance blue (aka U)
Definition: gavl.h:1897
int32_t y
Definition: gavl.h:1368
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:316
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.
void * user_data
Definition: gavl.h:2418
int channel_stride
Definition: gavl.h:600
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_deinterlace_mode_t gavl_video_options_get_deinterlace_mode(const gavl_video_options_t *opt)
Get the deinterlace mode.
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:2177
GAVL_PUBLIC gavl_audio_converter_t * gavl_audio_converter_create()
Creates an audio converter.
Definition: gavl.h:2930
GAVL_PUBLIC gavl_video_options_t * gavl_video_deinterlacer_get_options(gavl_video_deinterlacer_t *deinterlacer)
gets options of a deinterlacer
Definition: gavl.h:2957
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.
struct gavl_packet_sink_s gavl_packet_sink_t
Packet sink.
Definition: gavl.h:90
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.
Audio Format.
Definition: gavl.h:311
frame table structure
Definition: gavl.h:3914
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:1807
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:2955
int64_t num_entries
Number of entries.
Definition: gavl.h:3918
GAVL_PUBLIC void gavl_video_frame_pool_reset(gavl_video_frame_pool_t *p)
Reset a video frame pool.
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:2180
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:936
uint32_t frame_duration
Definition: gavl.h:2227
GAVL_PUBLIC int gavl_accel_supported()
Get the supported acceleration flags.
Definition: gavl.h:1754
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:2225
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:3928
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:2977
int refcount
Definition: gavl.h:2424
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:1818
Definition: gavl.h:2154
struct gavl_video_scaler_s gavl_video_scaler_t
Opaque scaler structure.
Definition: gavl.h:3506
gavl_deinterlace_drop_mode_t
Specifies which field to drop when deinterlacing.
Definition: gavl.h:2942
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:1803
Definition: gavl.h:932
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.
uint32_t samples_per_frame
Definition: gavl.h:313
Definition: gavl.h:299
uint32_t pixel_height
Definition: gavl.h:2223
Transparency (or, to be more precise opacity)
Definition: gavl.h:1899
Definition: gavl.h:2183
Auto selection based on quality.
Definition: gavl.h:2976
GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode(const gavl_video_options_t *opt)
Get the scale mode.
GAVL_PUBLIC void gavl_video_format_dump(const gavl_video_format_t *format)
Dump a video 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 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:1773
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.
Video format.
Definition: gavl.h:2212
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:933
int8_t * s_8
Definition: gavl.h:545
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:1890
uint32_t pixel_width
Definition: gavl.h:2222
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 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 float gavl_video_options_get_downscale_blur(const gavl_video_options_t *opt)
Get blur factor for downscaling.
Definition: gavl.h:291
Luminance (also grayscale)
Definition: gavl.h:1896
Definition: gavl.h:1794
int num_timecodes
Number of timecodes.
Definition: gavl.h:3927
Definition: gavl.h:2157
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 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_set_scale_order(gavl_video_options_t *opt, int order)
Set the scale order for GAVL_SCALE_SINC_LANCZOS.
Definition: gavl.h:2181
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:2182
GAVL_PUBLIC int gavl_video_options_get_quality(const gavl_video_options_t *opt)
Get the quality level for the converter.
Definition: gavl.h:1828
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.
Definition: gavl.h:257
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:274
double w
Definition: gavl.h:1381
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_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.