taglist, plugins: fix compiler warnings with GLib >= 2.76
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / msdk / gstmsdkdec.h
1 /* GStreamer Intel MSDK plugin
2  * Copyright (c) 2016, Intel Corporation
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *    this list of conditions and the following disclaimer in the documentation
13  *    and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
28  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 #ifndef __GST_MSDKDEC_H__
33 #define __GST_MSDKDEC_H__
34
35 #include <gst/gst.h>
36 #include <gst/video/video.h>
37 #include "msdk.h"
38 #include "gstmsdkcontext.h"
39 #include "msdk-enums.h"
40 #include "gstmsdkdecproputil.h"
41
42 G_BEGIN_DECLS
43
44 #define GST_TYPE_MSDKDEC \
45   (gst_msdkdec_get_type())
46 #define GST_MSDKDEC(obj) \
47   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKDEC,GstMsdkDec))
48 #define GST_MSDKDEC_CLASS(klass) \
49   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKDEC,GstMsdkDecClass))
50 #define GST_MSDKDEC_GET_CLASS(obj) \
51   (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_MSDKDEC,GstMsdkDecClass))
52 #define GST_IS_MSDKDEC(obj) \
53   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKDEC))
54 #define GST_IS_MSDKDEC_CLASS(klass) \
55   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKDEC))
56
57 #define MAX_BS_EXTRA_PARAMS             8
58 #define MAX_VIDEO_EXTRA_PARAMS          8
59
60 typedef struct _GstMsdkDec GstMsdkDec;
61 typedef struct _GstMsdkDecClass GstMsdkDecClass;
62 typedef struct _MsdkDecTask MsdkDecTask;
63
64 struct _GstMsdkDec
65 {
66   GstVideoDecoder element;
67
68   /* input description */
69   GstVideoCodecState *input_state;
70   /* aligned msdk pool info */
71   GstBufferPool *pool;
72   /* downstream pool info based on allocation query */
73   GstVideoInfo non_msdk_pool_info;
74   mfxFrameAllocResponse alloc_resp;
75   gboolean use_video_memory;
76   gboolean use_dmabuf;
77   gboolean initialized;
78   gboolean sfc;
79   gboolean ds_has_no_msdk_allocator;
80
81   /* for packetization */
82   GstAdapter *adapter;
83   /* cap negotiation needed, allocation may or may not be required*/
84   gboolean do_renego;
85   /* re-allocation is mandatory if enabled */
86   gboolean do_realloc;
87   /* force reset on resolution change */
88   gboolean force_reset_on_res_change;
89   /* minimum number of buffers to be allocated, this should
90    * include downstream requirement, msdk suggestion and extra
91    * surface allocation for smooth display in render pipeline */
92   guint min_prealloc_buffers;
93
94   /* MFX context */
95   GstMsdkContext *context;
96   GstMsdkContext *old_context;
97   mfxVideoParam param;
98   GArray *tasks;
99   guint next_task;
100
101   GList *locked_msdk_surfaces;
102
103   /* element properties */
104   gboolean hardware;
105   gboolean report_error;
106   guint async_depth;
107
108   mfxExtBuffer *bs_extra_params[MAX_BS_EXTRA_PARAMS];
109   guint num_bs_extra_params;
110
111   mfxExtBuffer *video_extra_params[MAX_VIDEO_EXTRA_PARAMS];
112   guint num_video_extra_params;
113
114 #if (MFX_VERSION >= 1025)
115   mfxExtDecodeErrorReport error_report;
116 #endif
117 };
118
119 struct _GstMsdkDecClass
120 {
121   GstVideoDecoderClass parent_class;
122
123   gboolean (*configure) (GstMsdkDec * decoder);
124
125   /* adjust mfx parameters per codec after decode header */
126   gboolean (*post_configure) (GstMsdkDec * decoder);
127
128   /* reset mfx parameters per codec */
129   gboolean (*preinit_decoder) (GstMsdkDec * decoder);
130   /* adjust mfx parameters per codec */
131   gboolean (*postinit_decoder) (GstMsdkDec * decoder);
132 };
133
134 GType gst_msdkdec_get_type (void);
135
136 void
137 gst_msdkdec_add_bs_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param);
138
139 void
140 gst_msdkdec_add_video_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param);
141
142 G_END_DECLS
143
144 #endif /* __GST_MSDKDEC_H__ */