1 /*
2  *  gstvaapisubpicture.h - VA subpicture abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6  *  Copyright (C) 2011-2013 Intel Corporation
7  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8  *
9  *  This library is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU Lesser General Public License
11  *  as published by the Free Software Foundation; either version 2.1
12  *  of the License, or (at your option) any later version.
13  *
14  *  This library is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  *  Lesser General Public License for more details.
18  *
19  *  You should have received a copy of the GNU Lesser General Public
20  *  License along with this library; if not, write to the Free
21  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA 02110-1301 USA
23  */
24 
25 #ifndef GST_VAAPI_SUBPICTURE_H
26 #define GST_VAAPI_SUBPICTURE_H
27 
28 #include <gst/vaapi/gstvaapiobject.h>
29 #include <gst/vaapi/gstvaapidisplay.h>
30 #include <gst/vaapi/gstvaapiimage.h>
31 #include <gst/video/video-overlay-composition.h>
32 
33 G_BEGIN_DECLS
34 
35 #define GST_VAAPI_SUBPICTURE(obj) \
36     ((GstVaapiSubpicture *)(obj))
37 
38 typedef struct _GstVaapiSubpicture              GstVaapiSubpicture;
39 
40 /**
41  * GstVaapiSubpictureFlags:
42  * @GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA:
43  *   subpicture has RGB pixels with pre-multiplied alpha
44  * @GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA:
45  *   subpicture needs to be blended with some global-alpha value at
46  *   rendering time
47  *
48  * The set of all subpicture rendering flags for #GstVaapiSubpicture.
49  */
50 typedef enum {
51     GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA    = (1 << 0),
52     GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA           = (1 << 1),
53 } GstVaapiSubpictureFlags;
54 
55 GstVaapiSubpicture *
56 gst_vaapi_subpicture_new(GstVaapiImage *image, guint flags);
57 
58 GstVaapiSubpicture *
59 gst_vaapi_subpicture_new_from_overlay_rectangle(
60     GstVaapiDisplay          *display,
61     GstVideoOverlayRectangle *rect
62 );
63 
64 GstVaapiID
65 gst_vaapi_subpicture_get_id(GstVaapiSubpicture *subpicture);
66 
67 guint
68 gst_vaapi_subpicture_get_flags(GstVaapiSubpicture *subpicture);
69 
70 GstVaapiImage *
71 gst_vaapi_subpicture_get_image(GstVaapiSubpicture *subpicture);
72 
73 gboolean
74 gst_vaapi_subpicture_set_image(GstVaapiSubpicture *subpicture,
75     GstVaapiImage *image);
76 
77 gfloat
78 gst_vaapi_subpicture_get_global_alpha(GstVaapiSubpicture *subpicture);
79 
80 gboolean
81 gst_vaapi_subpicture_set_global_alpha(GstVaapiSubpicture *subpicture,
82     gfloat global_alpha);
83 
84 G_END_DECLS
85 
86 #endif /* GST_VAAPI_SUBPICTURE_H */
87