1 /*
2  *  gstvaapibufferproxy_priv.h - Buffer proxy abstraction (private definitions)
3  *
4  *  Copyright (C) 2014 Intel Corporation
5  *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
6  *
7  *  This library is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU Lesser General Public License
9  *  as published by the Free Software Foundation; either version 2.1
10  *  of the License, or (at your option) any later version.
11  *
12  *  This library is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  *  Lesser General Public License for more details.
16  *
17  *  You should have received a copy of the GNU Lesser General Public
18  *  License along with this library; if not, write to the Free
19  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  *  Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef GST_VAAPI_BUFFER_PROXY_PRIV_H
24 #define GST_VAAPI_BUFFER_PROXY_PRIV_H
25 
26 #include "gstvaapibufferproxy.h"
27 #include "gstvaapiobject.h"
28 #include "gstvaapiminiobject.h"
29 
30 G_BEGIN_DECLS
31 
32 /**
33  * GST_VAAPI_BUFFER_PROXY_TYPE:
34  * @buf: a #GstVaapiBufferProxy
35  *
36  * Macro that evaluates to the type of the underlying VA buffer @buf
37  */
38 #undef  GST_VAAPI_BUFFER_PROXY_TYPE
39 #define GST_VAAPI_BUFFER_PROXY_TYPE(buf) \
40   (GST_VAAPI_BUFFER_PROXY (buf)->type)
41 
42 /**
43  * GST_VAAPI_BUFFER_PROXY_HANDLE:
44  * @buf: a #GstVaapiBufferProxy
45  *
46  * Macro that evaluates to the handle of the underlying VA buffer @buf
47  */
48 #undef  GST_VAAPI_BUFFER_PROXY_HANDLE
49 #define GST_VAAPI_BUFFER_PROXY_HANDLE(buf) \
50   (GST_VAAPI_BUFFER_PROXY (buf)->va_info.handle)
51 
52 /**
53  * GST_VAAPI_BUFFER_PROXY_SIZE:
54  * @buf: a #GstVaapiBufferProxy
55  *
56  * Macro that evaluates to the size of the underlying VA buffer @buf
57  */
58 #undef  GST_VAAPI_BUFFER_PROXY_SIZE
59 #define GST_VAAPI_BUFFER_PROXY_SIZE(buf) \
60   (GST_VAAPI_BUFFER_PROXY (buf)->va_info.mem_size)
61 
62 struct _GstVaapiBufferProxy {
63   /*< private >*/
64   GstVaapiMiniObject    parent_instance;
65   GstVaapiObject       *parent;
66 
67   GDestroyNotify        destroy_func;
68   gpointer              destroy_data;
69   guint                 type;
70   VABufferID            va_buf;
71   VABufferInfo          va_info;
72   GstMemory             *mem;
73 };
74 
75 G_GNUC_INTERNAL
76 GstVaapiBufferProxy *
77 gst_vaapi_buffer_proxy_new_from_object (GstVaapiObject * object,
78     VABufferID buf_id, guint type, GDestroyNotify destroy_func, gpointer data);
79 
80 G_GNUC_INTERNAL
81 guint
82 from_GstVaapiBufferMemoryType (guint type);
83 
84 G_GNUC_INTERNAL
85 guint
86 to_GstVaapiBufferMemoryType (guint va_type);
87 
88 G_END_DECLS
89 
90 #endif /* GST_VAAPI_BUFFER_PROXY_PRIV_H */
91