taglist, plugins: fix compiler warnings with GLib >= 2.76
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / msdk / gstmsdkcontext.h
1 /* GStreamer Intel MSDK plugin
2  * Copyright (c) 2018, Intel Corporation
3  * Copyright (c) 2018, Igalia S.L.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice,
10  *    this list of conditions and the following disclaimer.
11  *
12  * 2. Redistributions in binary form must reproduce the above copyright notice,
13  *    this list of conditions and the following disclaimer in the documentation
14  *    and/or other materials provided with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software
18  *    without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGDECE
29  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef GST_MSDK_CONTEXT_H
34 #define GST_MSDK_CONTEXT_H
35
36 #include "msdk.h"
37 #ifndef _WIN32
38 #include <va/va.h>
39 #include <va/va_drmcommon.h>
40 #else
41 #include <gst/d3d11/gstd3d11_fwd.h>
42 #endif
43
44 G_BEGIN_DECLS
45
46 #define GST_TYPE_MSDK_CONTEXT \
47   (gst_msdk_context_get_type ())
48 #define GST_MSDK_CONTEXT(obj) \
49   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MSDK_CONTEXT, \
50       GstMsdkContext))
51 #define GST_MSDK_CONTEXT_CLASS(klass) \
52   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MSDK_CONTEXT, \
53       GstMsdkContextClass))
54 #define GST_IS_MSDK_CONTEXT(obj) \
55   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MSDK_CONTEXT))
56 #define GST_IS_MSDK_CONTEXT_CLASS(klass) \
57   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MSDK_CONTEXT))
58 #define GST_MSDK_CONTEXT_CAST(obj) ((GstMsdkContext*)(obj))
59
60 typedef struct _GstMsdkContext GstMsdkContext;
61 typedef struct _GstMsdkContextClass GstMsdkContextClass;
62 typedef struct _GstMsdkContextPrivate GstMsdkContextPrivate;
63
64 typedef enum {
65   GST_MSDK_JOB_DECODER = 0x01,
66   GST_MSDK_JOB_ENCODER = 0x02,
67   GST_MSDK_JOB_VPP = 0x04,
68 } GstMsdkContextJobType;
69
70 /*
71  * GstMsdkContext:
72  */
73 struct _GstMsdkContext
74 {
75   GstObject parent_instance;
76
77   GstMsdkContextPrivate *priv;
78 };
79
80 /*
81  * GstMsdkContextClass:
82  */
83 struct _GstMsdkContextClass
84 {
85   GstObjectClass parent_class;
86 };
87
88 GType gst_msdk_context_get_type (void);
89
90 GstMsdkContext * gst_msdk_context_new (gboolean hardware, GstMsdkContextJobType job_type);
91 GstMsdkContext * gst_msdk_context_new_with_parent (GstMsdkContext * parent);
92 #ifndef _WIN32
93 GstMsdkContext * gst_msdk_context_new_with_va_display (GstObject * display_obj,
94     gboolean hardware, GstMsdkContextJobType job_type);
95 #else
96 GstMsdkContext * gst_msdk_context_new_with_d3d11_device (GstD3D11Device * device,
97     gboolean hardware, GstMsdkContextJobType job_type);
98 #endif
99 mfxSession gst_msdk_context_get_session (GstMsdkContext * context);
100
101 gpointer gst_msdk_context_get_handle (GstMsdkContext * context);
102 #ifndef _WIN32
103 GstObject * gst_msdk_context_get_va_display (GstMsdkContext * context);
104 #else
105 GstD3D11Device * gst_msdk_context_get_d3d11_device (GstMsdkContext * context);
106 #endif
107
108 /* GstMsdkContext contains mfxFrameAllocResponses,
109  * if app calls MFXVideoCORE_SetFrameAllocator.
110  */
111 typedef struct _GstMsdkAllocResponse GstMsdkAllocResponse;
112
113 struct _GstMsdkAllocResponse {
114   gint refcount;
115   mfxFrameAllocResponse response;
116   mfxFrameAllocRequest request;
117   GList *surfaces_avail;
118   GList *surfaces_used;
119   GList *surfaces_locked;
120 };
121
122 GstMsdkAllocResponse *
123 gst_msdk_context_get_cached_alloc_responses (GstMsdkContext * context,
124     mfxFrameAllocResponse * resp);
125
126 GstMsdkAllocResponse *
127 gst_msdk_context_get_cached_alloc_responses_by_request (GstMsdkContext * context,
128     mfxFrameAllocRequest * req);
129
130 void
131 gst_msdk_context_add_alloc_response (GstMsdkContext * context,
132     GstMsdkAllocResponse * resp);
133
134 gboolean
135 gst_msdk_context_remove_alloc_response (GstMsdkContext * context,
136     mfxFrameAllocResponse * resp);
137
138 mfxFrameSurface1 *
139 gst_msdk_context_get_surface_available (GstMsdkContext * context, mfxFrameAllocResponse * resp);
140
141 void
142 gst_msdk_context_put_surface_locked (GstMsdkContext * context, mfxFrameAllocResponse * resp, mfxFrameSurface1 * surface);
143
144 void
145 gst_msdk_context_put_surface_available (GstMsdkContext * context, mfxFrameAllocResponse * resp, mfxFrameSurface1 * surface);
146
147 GstMsdkContextJobType
148 gst_msdk_context_get_job_type (GstMsdkContext * context);
149
150 void
151 gst_msdk_context_add_job_type (GstMsdkContext * context, GstMsdkContextJobType job_type);
152
153 gint
154 gst_msdk_context_get_shared_async_depth (GstMsdkContext * context);
155
156 void
157 gst_msdk_context_add_shared_async_depth (GstMsdkContext * context, gint async_depth);
158
159 void
160 gst_msdk_context_set_frame_allocator (GstMsdkContext * context,
161     mfxFrameAllocator * allocator);
162
163 G_END_DECLS
164
165 #endif /* GST_MSDK_CONTEXT_H */