2010-01-04 09:24:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2010-01-04 09:24:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __BLEND_H__
|
|
|
|
#define __BLEND_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2012-01-25 17:00:52 +00:00
|
|
|
#include <gst/video/video.h>
|
2010-01-04 09:24:45 +00:00
|
|
|
|
2012-01-26 17:15:51 +00:00
|
|
|
typedef void (*BlendFunction) (GstVideoFrame *srcframe, gint xpos, gint ypos, gdouble src_alpha, GstVideoFrame * destframe);
|
2012-01-25 17:00:52 +00:00
|
|
|
typedef void (*FillCheckerFunction) (GstVideoFrame * frame);
|
|
|
|
typedef void (*FillColorFunction) (GstVideoFrame * frame, gint c1, gint c2, gint c3);
|
2010-01-04 09:24:45 +00:00
|
|
|
|
|
|
|
extern BlendFunction gst_video_mixer_blend_argb;
|
|
|
|
extern BlendFunction gst_video_mixer_blend_bgra;
|
|
|
|
#define gst_video_mixer_blend_ayuv gst_video_mixer_blend_argb
|
2010-03-20 09:47:42 +00:00
|
|
|
#define gst_video_mixer_blend_abgr gst_video_mixer_blend_argb
|
|
|
|
#define gst_video_mixer_blend_rgba gst_video_mixer_blend_bgra
|
videomixer2: Add transparent background option for alpha channel formats
This option allows the videomixer2 element to output a valid alpha
channel when the inputs contain a valid alpha channel. This allows
mixing to occur in multiple stages serially.
The following pipeline shows an example of such a pipeline:
gst-launch videotestsrc background-color=0x000000 pattern=ball ! video/x-raw-yuv,format=\(fourcc\)AYUV ! videomixer2 background=transparent name=mix1 ! videomixer2 name=mix2 ! ffmpegcolorspace ! autovideosink videotestsrc ! video/x-raw-yuv,format=\(fourcc\)AYUV ! mix2.
The first videotestsrc in this pipeline creates a moving ball on a
transparent background. It is then passed to the first videomixer2.
Previously, this videomixer2 would have forced the alpha channel to
1.0 and given a background of checker, black, or white to the
stream. With this patch, however, you can now specify the background
as transparent, and the alpha channel of the input will be
preserved. This allows for further mixing downstream, as is shown in
the above pipeline where the a second videomixer2 is used to mix in a
background of an smpte videotestsrc. So the result is a ball hovering
over the smpte test source. This could, of course, have been
accomplished with a single mixer element, but staged mixing is useful
when it is not convenient to mix all video at once (e.g. a pipeline
where a foreground and background bin exist and are mixed at the final
output, but the foreground bin needs an internal mixer to create
transitions between clips).
Fixes bug #639994.
2011-01-19 19:07:17 +00:00
|
|
|
extern BlendFunction gst_video_mixer_overlay_argb;
|
|
|
|
extern BlendFunction gst_video_mixer_overlay_bgra;
|
|
|
|
#define gst_video_mixer_overlay_ayuv gst_video_mixer_overlay_argb
|
|
|
|
#define gst_video_mixer_overlay_abgr gst_video_mixer_overlay_argb
|
|
|
|
#define gst_video_mixer_overlay_rgba gst_video_mixer_overlay_bgra
|
2010-01-04 09:24:45 +00:00
|
|
|
extern BlendFunction gst_video_mixer_blend_i420;
|
2010-04-20 10:18:18 +00:00
|
|
|
#define gst_video_mixer_blend_yv12 gst_video_mixer_blend_i420
|
2012-09-07 21:20:57 +00:00
|
|
|
extern BlendFunction gst_video_mixer_blend_nv12;
|
|
|
|
extern BlendFunction gst_video_mixer_blend_nv21;
|
2010-04-20 10:18:18 +00:00
|
|
|
extern BlendFunction gst_video_mixer_blend_y41b;
|
|
|
|
extern BlendFunction gst_video_mixer_blend_y42b;
|
|
|
|
extern BlendFunction gst_video_mixer_blend_y444;
|
2010-01-04 09:24:45 +00:00
|
|
|
extern BlendFunction gst_video_mixer_blend_rgb;
|
|
|
|
#define gst_video_mixer_blend_bgr gst_video_mixer_blend_rgb
|
|
|
|
extern BlendFunction gst_video_mixer_blend_rgbx;
|
|
|
|
#define gst_video_mixer_blend_bgrx gst_video_mixer_blend_rgbx
|
|
|
|
#define gst_video_mixer_blend_xrgb gst_video_mixer_blend_rgbx
|
|
|
|
#define gst_video_mixer_blend_xbgr gst_video_mixer_blend_rgbx
|
2010-04-22 11:56:58 +00:00
|
|
|
extern BlendFunction gst_video_mixer_blend_yuy2;
|
|
|
|
#define gst_video_mixer_blend_uyvy gst_video_mixer_blend_yuy2;
|
|
|
|
#define gst_video_mixer_blend_yvyu gst_video_mixer_blend_yuy2;
|
2010-01-04 09:24:45 +00:00
|
|
|
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_argb;
|
2010-03-20 09:47:42 +00:00
|
|
|
#define gst_video_mixer_fill_checker_abgr gst_video_mixer_fill_checker_argb
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_bgra;
|
2010-03-20 09:47:42 +00:00
|
|
|
#define gst_video_mixer_fill_checker_rgba gst_video_mixer_fill_checker_bgra
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_ayuv;
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_i420;
|
2010-04-20 10:18:18 +00:00
|
|
|
#define gst_video_mixer_fill_checker_yv12 gst_video_mixer_fill_checker_i420
|
2012-09-07 21:20:57 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_nv12;
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_nv21;
|
2010-04-20 10:18:18 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_y41b;
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_y42b;
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_y444;
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_rgb;
|
|
|
|
#define gst_video_mixer_fill_checker_bgr gst_video_mixer_fill_checker_rgb
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_rgbx;
|
|
|
|
#define gst_video_mixer_fill_checker_bgrx gst_video_mixer_fill_checker_rgbx
|
|
|
|
#define gst_video_mixer_fill_checker_xrgb gst_video_mixer_fill_checker_rgbx
|
|
|
|
#define gst_video_mixer_fill_checker_xbgr gst_video_mixer_fill_checker_rgbx
|
2010-04-22 11:56:58 +00:00
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_yuy2;
|
|
|
|
#define gst_video_mixer_fill_checker_yvyu gst_video_mixer_fill_checker_yuy2;
|
|
|
|
extern FillCheckerFunction gst_video_mixer_fill_checker_uyvy;
|
2010-01-04 09:24:45 +00:00
|
|
|
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_argb;
|
2010-03-20 09:47:42 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_abgr;
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_bgra;
|
2010-03-20 09:47:42 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_rgba;
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_ayuv;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_i420;
|
2010-04-20 10:18:18 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_yv12;
|
2012-09-07 21:20:57 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_nv12;
|
|
|
|
#define gst_video_mixer_fill_color_nv21 gst_video_mixer_fill_color_nv12;
|
2010-04-20 10:18:18 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_y41b;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_y42b;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_y444;
|
2010-01-04 09:24:45 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_rgb;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_bgr;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_xrgb;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_xbgr;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_rgbx;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_bgrx;
|
2010-04-22 11:56:58 +00:00
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_yuy2;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_yvyu;
|
|
|
|
extern FillColorFunction gst_video_mixer_fill_color_uyvy;
|
2010-01-04 09:24:45 +00:00
|
|
|
|
|
|
|
void gst_video_mixer_init_blend (void);
|
|
|
|
|
|
|
|
#endif /* __BLEND_H__ */
|