2018-03-06 13:51:05 +00:00
|
|
|
/* GStreamer Intel MSDK plugin
|
|
|
|
* Copyright (c) 2018, Intel Corporation, Inc.
|
|
|
|
* Author : Sreerenj Balachandran <sreerenj.balachandran@intel.com>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_MSDKVPP_H__
|
|
|
|
#define __GST_MSDKVPP_H__
|
|
|
|
|
|
|
|
#include "gstmsdkcontext.h"
|
2018-03-21 14:45:35 +00:00
|
|
|
#include "msdk-enums.h"
|
|
|
|
#include <gst/base/gstbasetransform.h>
|
2018-03-06 13:51:05 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_MSDKVPP \
|
|
|
|
(gst_msdkvpp_get_type())
|
|
|
|
#define GST_MSDKVPP(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MSDKVPP,GstMsdkVPP))
|
|
|
|
#define GST_MSDKVPP_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MSDKVPP,GstMsdkVPPClass))
|
|
|
|
#define GST_MSDKVPP_GET_CLASS(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_MSDKVPP,GstMsdkVPPClass))
|
|
|
|
#define GST_IS_MSDKVPP(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MSDKVPP))
|
|
|
|
#define GST_IS_MSDKVPP_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MSDKVPP))
|
|
|
|
|
|
|
|
#define MAX_EXTRA_PARAMS 8
|
|
|
|
|
|
|
|
typedef struct _GstMsdkVPP GstMsdkVPP;
|
|
|
|
typedef struct _GstMsdkVPPClass GstMsdkVPPClass;
|
|
|
|
|
2018-03-06 13:51:32 +00:00
|
|
|
typedef enum {
|
2018-03-21 17:57:27 +00:00
|
|
|
GST_MSDK_FLAG_DENOISE = 1 << 0,
|
|
|
|
GST_MSDK_FLAG_ROTATION = 1 << 1,
|
|
|
|
GST_MSDK_FLAG_DEINTERLACE = 1 << 2,
|
|
|
|
GST_MSDK_FLAG_HUE = 1 << 3,
|
|
|
|
GST_MSDK_FLAG_SATURATION = 1 << 4,
|
|
|
|
GST_MSDK_FLAG_BRIGHTNESS = 1 << 5,
|
|
|
|
GST_MSDK_FLAG_CONTRAST = 1 << 6,
|
|
|
|
GST_MSDK_FLAG_DETAIL = 1 << 7,
|
|
|
|
GST_MSDK_FLAG_MIRRORING = 1 << 8,
|
|
|
|
GST_MSDK_FLAG_SCALING_MODE = 1 << 9,
|
2018-03-22 16:04:02 +00:00
|
|
|
GST_MSDK_FLAG_FRC = 1 << 10,
|
2019-08-23 01:51:20 +00:00
|
|
|
GST_MSDK_FLAG_VIDEO_DIRECTION = 1 << 11,
|
2018-03-06 13:51:32 +00:00
|
|
|
} GstMsdkVppFlags;
|
|
|
|
|
2018-03-06 13:51:05 +00:00
|
|
|
struct _GstMsdkVPP
|
|
|
|
{
|
|
|
|
GstBaseTransform element;
|
|
|
|
|
|
|
|
/* sinkpad info */
|
|
|
|
GstPad *sinkpad;
|
|
|
|
GstVideoInfo sinkpad_info;
|
|
|
|
GstVideoInfo sinkpad_buffer_pool_info;
|
|
|
|
GstBufferPool *sinkpad_buffer_pool;
|
|
|
|
|
|
|
|
/* srcpad info */
|
|
|
|
GstPad *srcpad;
|
|
|
|
GstVideoInfo srcpad_info;
|
|
|
|
GstVideoInfo srcpad_buffer_pool_info;
|
|
|
|
GstBufferPool *srcpad_buffer_pool;
|
|
|
|
|
|
|
|
/* MFX context */
|
|
|
|
GstMsdkContext *context;
|
2020-01-17 05:37:47 +00:00
|
|
|
GstMsdkContext *old_context;
|
2018-03-06 13:51:05 +00:00
|
|
|
mfxVideoParam param;
|
|
|
|
guint in_num_surfaces;
|
|
|
|
mfxFrameAllocResponse in_alloc_resp;
|
|
|
|
mfxFrameAllocResponse out_alloc_resp;
|
|
|
|
|
2018-06-07 23:29:29 +00:00
|
|
|
gboolean initialized;
|
2018-03-06 13:51:05 +00:00
|
|
|
gboolean use_video_memory;
|
2018-04-30 20:39:52 +00:00
|
|
|
gboolean use_sinkpad_dmabuf;
|
|
|
|
gboolean use_srcpad_dmabuf;
|
2018-03-06 13:51:05 +00:00
|
|
|
gboolean shared_context;
|
|
|
|
gboolean add_video_meta;
|
2018-04-30 20:40:32 +00:00
|
|
|
gboolean need_vpp;
|
2018-03-06 13:51:32 +00:00
|
|
|
guint flags;
|
2018-03-06 13:51:05 +00:00
|
|
|
|
|
|
|
/* element properties */
|
|
|
|
gboolean hardware;
|
|
|
|
guint async_depth;
|
2018-03-06 13:51:32 +00:00
|
|
|
guint denoise_factor;
|
|
|
|
guint rotation;
|
2018-03-06 13:52:04 +00:00
|
|
|
guint deinterlace_mode;
|
|
|
|
guint deinterlace_method;
|
2018-03-21 14:45:35 +00:00
|
|
|
gfloat hue;
|
|
|
|
gfloat saturation;
|
|
|
|
gfloat brightness;
|
|
|
|
gfloat contrast;
|
2018-03-21 17:14:04 +00:00
|
|
|
guint detail;
|
2018-03-21 17:22:18 +00:00
|
|
|
guint mirroring;
|
2018-03-21 17:57:27 +00:00
|
|
|
guint scaling_mode;
|
2018-03-21 18:17:11 +00:00
|
|
|
gboolean keep_aspect;
|
2018-03-22 16:04:02 +00:00
|
|
|
guint frc_algm;
|
2019-08-23 01:51:20 +00:00
|
|
|
guint video_direction;
|
2019-10-16 18:59:32 +00:00
|
|
|
guint crop_left;
|
|
|
|
guint crop_right;
|
|
|
|
guint crop_top;
|
|
|
|
guint crop_bottom;
|
2018-03-21 14:45:35 +00:00
|
|
|
|
2018-03-22 16:04:02 +00:00
|
|
|
GstClockTime buffer_duration;
|
2018-03-06 13:51:32 +00:00
|
|
|
|
|
|
|
/* MFX Filters */
|
|
|
|
mfxExtVPPDoUse mfx_vpp_douse;
|
|
|
|
mfxExtVPPDenoise mfx_denoise;
|
|
|
|
mfxExtVPPRotation mfx_rotation;
|
2018-03-06 13:52:04 +00:00
|
|
|
mfxExtVPPDeinterlacing mfx_deinterlace;
|
2018-03-21 14:45:35 +00:00
|
|
|
mfxExtVPPProcAmp mfx_procamp;
|
2018-03-21 17:14:04 +00:00
|
|
|
mfxExtVPPDetail mfx_detail;
|
2018-03-21 17:22:18 +00:00
|
|
|
mfxExtVPPMirroring mfx_mirroring;
|
2018-03-21 17:57:27 +00:00
|
|
|
mfxExtVPPScaling mfx_scaling;
|
2018-03-22 16:04:02 +00:00
|
|
|
mfxExtVPPFrameRateConversion mfx_frc;
|
2018-03-06 13:51:32 +00:00
|
|
|
|
|
|
|
/* Extended buffers */
|
|
|
|
mfxExtBuffer *extra_params[MAX_EXTRA_PARAMS];
|
|
|
|
guint num_extra_params;
|
2020-05-19 07:14:34 +00:00
|
|
|
|
2020-05-19 06:59:25 +00:00
|
|
|
mfxFrameAllocRequest request[2];
|
2020-05-19 07:14:34 +00:00
|
|
|
GList* locked_msdk_surfaces;
|
2018-03-06 13:51:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstMsdkVPPClass
|
|
|
|
{
|
|
|
|
GstBaseTransformClass parent_class;
|
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_msdkvpp_get_type (void);
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_MSDKVPP_H__ */
|