a74cddf7689924ba1a69e8d19acd37232eebb4bf
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapisurfaceproxy_priv.h
1 /*
2  *  gstvaapisurfaceproxy_priv.h - VA surface proxy (private definitions)
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_SURFACE_PROXY_PRIV_H
26 #define GST_VAAPI_SURFACE_PROXY_PRIV_H
27
28 #include "gstvaapiminiobject.h"
29 #include "gstvaapisurfaceproxy.h"
30 #include "gstvaapiobject_priv.h"
31 #include "gstvaapisurface_priv.h"
32
33 #define GST_VAAPI_SURFACE_PROXY(obj) \
34     ((GstVaapiSurfaceProxy *)(obj))
35
36 struct _GstVaapiSurfaceProxy {
37     /*< private >*/
38     GstVaapiMiniObject  parent_instance;
39     GstVaapiSurfaceProxy *parent;
40
41     GstVaapiVideoPool  *pool;
42     GstVaapiSurface    *surface;
43     GstClockTime        timestamp;
44     GstClockTime        duration;
45     GDestroyNotify      destroy_func;
46     gpointer            destroy_data;
47     GstVaapiRectangle   crop_rect;
48     guint               has_crop_rect   : 1;
49 };
50
51 #define GST_VAAPI_SURFACE_PROXY_FLAGS       GST_VAAPI_MINI_OBJECT_FLAGS
52 #define GST_VAAPI_SURFACE_PROXY_FLAG_IS_SET GST_VAAPI_MINI_OBJECT_FLAG_IS_SET
53 #define GST_VAAPI_SURFACE_PROXY_FLAG_SET    GST_VAAPI_MINI_OBJECT_FLAG_SET
54 #define GST_VAAPI_SURFACE_PROXY_FLAG_UNSET  GST_VAAPI_MINI_OBJECT_FLAG_UNSET
55
56 /**
57  * GST_VAAPI_SURFACE_PROXY_SURFACE:
58  * @proxy: a #GstVaapiSurfaceProxy
59  *
60  * Macro that evaluates to the #GstVaapiSurface of @proxy.
61  * This is an internal macro that does not do any run-time type check.
62  */
63 #undef  GST_VAAPI_SURFACE_PROXY_SURFACE
64 #define GST_VAAPI_SURFACE_PROXY_SURFACE(proxy) \
65     GST_VAAPI_SURFACE_PROXY(proxy)->surface
66
67 /**
68  * GST_VAAPI_SURFACE_PROXY_SURFACE_ID:
69  * @proxy: a #GstVaapiSurfaceProxy
70  *
71  * Macro that evaluates to the VA surface ID of the underlying @proxy
72  * surface.
73  *
74  * This is an internal macro that does not do any run-time type check.
75  */
76 #undef  GST_VAAPI_SURFACE_PROXY_SURFACE_ID
77 #define GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) \
78     GST_VAAPI_OBJECT_ID(GST_VAAPI_SURFACE_PROXY(proxy)->surface)
79
80 /**
81  * GST_VAAPI_SURFACE_PROXY_TIMESTAMP:
82  * @proxy: a #GstVaapiSurfaceProxy
83  *
84  * Macro that evaluates to the presentation timestamp of the
85  * underlying @proxy surface.
86  *
87  * This is an internal macro that does not do any run-time type check.
88  */
89 #undef  GST_VAAPI_SURFACE_PROXY_TIMESTAMP
90 #define GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy) \
91     GST_VAAPI_SURFACE_PROXY(proxy)->timestamp
92
93 /**
94  * GST_VAAPI_SURFACE_PROXY_DURATION:
95  * @proxy: a #GstVaapiSurfaceProxy
96  *
97  * Macro that evaluates to the presentation duration of the
98  * underlying @proxy surface.
99  *
100  * This is an internal macro that does not do any run-time type check.
101  */
102 #undef  GST_VAAPI_SURFACE_PROXY_DURATION
103 #define GST_VAAPI_SURFACE_PROXY_DURATION(proxy) \
104     GST_VAAPI_SURFACE_PROXY(proxy)->duration
105
106 /**
107  * GST_VAAPI_SURFACE_PROXY_CROP_RECT:
108  * @proxy: a #GstVaapiSurfaceProxy
109  *
110  * Macro that evaluates to the video cropping rectangle of the underlying @proxy surface.
111  *
112  * This is an internal macro that does not do any run-time type check.
113  */
114 #undef  GST_VAAPI_SURFACE_PROXY_CROP_RECT
115 #define GST_VAAPI_SURFACE_PROXY_CROP_RECT(proxy) \
116     (GST_VAAPI_SURFACE_PROXY(proxy)->has_crop_rect ? \
117      &GST_VAAPI_SURFACE_PROXY(proxy)->crop_rect : NULL)
118
119 #endif /* GST_VAAPI_SURFACE_PROXY_PRIV_H */