1 /* GStreamer Intel MSDK plugin
2 * Copyright (c) 2016, Intel Corporation
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
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.
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.
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.
32 #ifndef __GST_MSDKDEC_H__
33 #define __GST_MSDKDEC_H__
36 #include <gst/video/video.h>
38 #include "gstmsdkcontext.h"
39 #include "msdk-enums.h"
40 #include "gstmsdkdecproputil.h"
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))
57 #define MAX_BS_EXTRA_PARAMS 8
58 #define MAX_VIDEO_EXTRA_PARAMS 8
60 typedef struct _GstMsdkDec GstMsdkDec;
61 typedef struct _GstMsdkDecClass GstMsdkDecClass;
62 typedef struct _MsdkDecTask MsdkDecTask;
66 GstVideoDecoder element;
68 /* input description */
69 GstVideoCodecState *input_state;
70 /* aligned msdk pool info */
72 /* downstream pool info based on allocation query */
73 GstVideoInfo non_msdk_pool_info;
74 mfxFrameAllocResponse alloc_resp;
75 gboolean use_video_memory;
79 gboolean ds_has_no_msdk_allocator;
81 /* for packetization */
83 /* cap negotiation needed, allocation may or may not be required*/
85 /* re-allocation is mandatory if enabled */
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;
95 GstMsdkContext *context;
96 GstMsdkContext *old_context;
101 GList *locked_msdk_surfaces;
103 /* element properties */
105 gboolean report_error;
108 mfxExtBuffer *bs_extra_params[MAX_BS_EXTRA_PARAMS];
109 guint num_bs_extra_params;
111 mfxExtBuffer *video_extra_params[MAX_VIDEO_EXTRA_PARAMS];
112 guint num_video_extra_params;
114 #if (MFX_VERSION >= 1025)
115 mfxExtDecodeErrorReport error_report;
119 struct _GstMsdkDecClass
121 GstVideoDecoderClass parent_class;
123 gboolean (*configure) (GstMsdkDec * decoder);
125 /* adjust mfx parameters per codec after decode header */
126 gboolean (*post_configure) (GstMsdkDec * decoder);
128 /* reset mfx parameters per codec */
129 gboolean (*preinit_decoder) (GstMsdkDec * decoder);
130 /* adjust mfx parameters per codec */
131 gboolean (*postinit_decoder) (GstMsdkDec * decoder);
134 GType gst_msdkdec_get_type (void);
137 gst_msdkdec_add_bs_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param);
140 gst_msdkdec_add_video_extra_param (GstMsdkDec * thiz, mfxExtBuffer * param);
144 #endif /* __GST_MSDKDEC_H__ */