1 /* 2 * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __BLEND_H__ 21 #define __BLEND_H__ 22 23 #include <gst/gst.h> 24 #include <gst/video/video.h> 25 26 /** 27 * GstCompositorBlendMode: 28 * @COMPOSITOR_BLEND_MODE_SOURCE: Copy source 29 * @COMPOSITOR_BLEND_MODE_OVER: Normal blending 30 * @COMPOSITOR_BLEND_MODE_ADD: Alphas are simply added, 31 * 32 * The different modes compositor can use for blending. 33 */ 34 typedef enum 35 { 36 COMPOSITOR_BLEND_MODE_SOURCE, 37 COMPOSITOR_BLEND_MODE_OVER, 38 COMPOSITOR_BLEND_MODE_ADD, 39 } GstCompositorBlendMode; 40 41 /* 42 * @srcframe: source #GstVideoFrame 43 * @xpos: horizontal start position of @srcframe, leftmost pixel line. 44 * @ypos: vertical start position of @srcframe, topmost pixel line. 45 * @gdouble: src_alpha, alpha factor applied to @srcframe 46 * @destframe: destination #GstVideoFrame 47 * @dst_y_start: start position of where to write into @destframe. Used for splitting work across multiple sequences. 48 * @dst_y_end: end position of where to write into @destframe. Used for splitting work across multiple sequences. 49 */ 50 typedef void (*BlendFunction) (GstVideoFrame *srcframe, gint xpos, gint ypos, gdouble src_alpha, GstVideoFrame * destframe, 51 gint dst_y_start, gint dst_y_end, GstCompositorBlendMode mode); 52 typedef void (*FillCheckerFunction) (GstVideoFrame * frame, guint y_start, guint y_end); 53 typedef void (*FillColorFunction) (GstVideoFrame * frame, guint y_start, guint y_end, gint c1, gint c2, gint c3); 54 55 extern BlendFunction gst_compositor_blend_argb; 56 extern BlendFunction gst_compositor_blend_bgra; 57 #define gst_compositor_blend_ayuv gst_compositor_blend_argb 58 #define gst_compositor_blend_vuya gst_compositor_blend_bgra 59 #define gst_compositor_blend_abgr gst_compositor_blend_argb 60 #define gst_compositor_blend_rgba gst_compositor_blend_bgra 61 62 extern BlendFunction gst_compositor_overlay_argb; 63 extern BlendFunction gst_compositor_overlay_bgra; 64 #define gst_compositor_overlay_ayuv gst_compositor_overlay_argb 65 #define gst_compositor_overlay_vuya gst_compositor_overlay_bgra 66 #define gst_compositor_overlay_abgr gst_compositor_overlay_argb 67 #define gst_compositor_overlay_rgba gst_compositor_overlay_bgra 68 extern BlendFunction gst_compositor_blend_i420; 69 #define gst_compositor_blend_yv12 gst_compositor_blend_i420 70 extern BlendFunction gst_compositor_blend_nv12; 71 extern BlendFunction gst_compositor_blend_nv21; 72 extern BlendFunction gst_compositor_blend_y41b; 73 extern BlendFunction gst_compositor_blend_y42b; 74 extern BlendFunction gst_compositor_blend_y444; 75 extern BlendFunction gst_compositor_blend_rgb; 76 #define gst_compositor_blend_bgr gst_compositor_blend_rgb 77 extern BlendFunction gst_compositor_blend_rgbx; 78 #define gst_compositor_blend_bgrx gst_compositor_blend_rgbx 79 #define gst_compositor_blend_xrgb gst_compositor_blend_rgbx 80 #define gst_compositor_blend_xbgr gst_compositor_blend_rgbx 81 extern BlendFunction gst_compositor_blend_yuy2; 82 #define gst_compositor_blend_uyvy gst_compositor_blend_yuy2; 83 #define gst_compositor_blend_yvyu gst_compositor_blend_yuy2; 84 85 extern FillCheckerFunction gst_compositor_fill_checker_argb; 86 #define gst_compositor_fill_checker_abgr gst_compositor_fill_checker_argb 87 extern FillCheckerFunction gst_compositor_fill_checker_bgra; 88 #define gst_compositor_fill_checker_rgba gst_compositor_fill_checker_bgra 89 extern FillCheckerFunction gst_compositor_fill_checker_ayuv; 90 extern FillCheckerFunction gst_compositor_fill_checker_vuya; 91 extern FillCheckerFunction gst_compositor_fill_checker_i420; 92 #define gst_compositor_fill_checker_yv12 gst_compositor_fill_checker_i420 93 extern FillCheckerFunction gst_compositor_fill_checker_nv12; 94 extern FillCheckerFunction gst_compositor_fill_checker_nv21; 95 extern FillCheckerFunction gst_compositor_fill_checker_y41b; 96 extern FillCheckerFunction gst_compositor_fill_checker_y42b; 97 extern FillCheckerFunction gst_compositor_fill_checker_y444; 98 extern FillCheckerFunction gst_compositor_fill_checker_rgb; 99 #define gst_compositor_fill_checker_bgr gst_compositor_fill_checker_rgb 100 extern FillCheckerFunction gst_compositor_fill_checker_rgbx; 101 #define gst_compositor_fill_checker_bgrx gst_compositor_fill_checker_rgbx 102 extern FillCheckerFunction gst_compositor_fill_checker_xrgb; 103 #define gst_compositor_fill_checker_xbgr gst_compositor_fill_checker_xrgb 104 extern FillCheckerFunction gst_compositor_fill_checker_yuy2; 105 #define gst_compositor_fill_checker_yvyu gst_compositor_fill_checker_yuy2; 106 extern FillCheckerFunction gst_compositor_fill_checker_uyvy; 107 108 extern FillColorFunction gst_compositor_fill_color_argb; 109 extern FillColorFunction gst_compositor_fill_color_abgr; 110 extern FillColorFunction gst_compositor_fill_color_bgra; 111 extern FillColorFunction gst_compositor_fill_color_rgba; 112 extern FillColorFunction gst_compositor_fill_color_ayuv; 113 extern FillColorFunction gst_compositor_fill_color_vuya; 114 extern FillColorFunction gst_compositor_fill_color_i420; 115 extern FillColorFunction gst_compositor_fill_color_yv12; 116 extern FillColorFunction gst_compositor_fill_color_nv12; 117 #define gst_compositor_fill_color_nv21 gst_compositor_fill_color_nv12; 118 extern FillColorFunction gst_compositor_fill_color_y41b; 119 extern FillColorFunction gst_compositor_fill_color_y42b; 120 extern FillColorFunction gst_compositor_fill_color_y444; 121 extern FillColorFunction gst_compositor_fill_color_rgb; 122 extern FillColorFunction gst_compositor_fill_color_bgr; 123 extern FillColorFunction gst_compositor_fill_color_xrgb; 124 extern FillColorFunction gst_compositor_fill_color_xbgr; 125 extern FillColorFunction gst_compositor_fill_color_rgbx; 126 extern FillColorFunction gst_compositor_fill_color_bgrx; 127 extern FillColorFunction gst_compositor_fill_color_yuy2; 128 extern FillColorFunction gst_compositor_fill_color_yvyu; 129 extern FillColorFunction gst_compositor_fill_color_uyvy; 130 131 void gst_compositor_init_blend (void); 132 133 #endif /* __BLEND_H__ */ 134