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;
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
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
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
1964 
1972 GAVL_PUBLIC gavl_color_channel_t
1973 gavl_pixelformat_get_channel(gavl_pixelformat_t pixelformat, int index);
1974 
1975 
1982 GAVL_PUBLIC
1984 
1994 GAVL_PUBLIC
1995 void gavl_pixelformat_chroma_sub(gavl_pixelformat_t pixelformat, int * sub_h, int * sub_v);
1996 
2003 GAVL_PUBLIC
2005 
2012 GAVL_PUBLIC
2014 
2021 GAVL_PUBLIC
2023 
2038 GAVL_PUBLIC
2040  gavl_pixelformat_t dst);
2041 
2055 GAVL_PUBLIC gavl_pixelformat_t
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
2092 
2099 GAVL_PUBLIC
2101 
2102 
2108 GAVL_PUBLIC
2109 int gavl_num_pixelformats();
2110 
2117 GAVL_PUBLIC
2119 
2120 /* */
2121 
2130 typedef enum
2131  {
2136 
2143 GAVL_PUBLIC
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;
2227  uint32_t frame_duration;
2229  uint32_t timescale;
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,
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  {
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
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
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
2825  const gavl_video_frame_t * src,
2826  gavl_video_frame_t * dst);
2827 
2843 GAVL_PUBLIC
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
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 */