2020-08-16 07:18:11 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2020 Igalia, S.L.
|
|
|
|
* Author: Víctor Jáquez <vjaquez@igalia.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-10-27 03:08:39 +00:00
|
|
|
#include <gst/va/gstva.h>
|
2020-08-16 07:18:11 +00:00
|
|
|
#include <gst/video/video.h>
|
|
|
|
|
2021-05-06 10:23:23 +00:00
|
|
|
#include <va/va.h>
|
2021-02-24 12:06:51 +00:00
|
|
|
#include <va/va_vpp.h>
|
|
|
|
|
2020-08-16 07:18:11 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GST_TYPE_VA_FILTER (gst_va_filter_get_type())
|
|
|
|
G_DECLARE_FINAL_TYPE (GstVaFilter, gst_va_filter, GST, VA_FILTER, GstObject)
|
|
|
|
|
2020-12-21 17:17:24 +00:00
|
|
|
typedef enum {
|
|
|
|
GST_VA_DEINTERLACE_BOB = VAProcDeinterlacingBob,
|
|
|
|
GST_VA_DEINTERLACE_WEAVE = VAProcDeinterlacingWeave,
|
|
|
|
GST_VA_DEINTERLACE_ADAPTIVE = VAProcDeinterlacingMotionAdaptive,
|
|
|
|
GST_VA_DEINTERLACE_COMPENSATED = VAProcDeinterlacingMotionCompensated,
|
|
|
|
} GstVaDeinterlaceMethods;
|
|
|
|
|
2020-08-16 07:18:11 +00:00
|
|
|
enum {
|
|
|
|
GST_VA_FILTER_PROP_DENOISE = 1,
|
|
|
|
GST_VA_FILTER_PROP_SHARPEN,
|
|
|
|
GST_VA_FILTER_PROP_SKINTONE,
|
|
|
|
GST_VA_FILTER_PROP_VIDEO_DIR,
|
|
|
|
GST_VA_FILTER_PROP_HUE,
|
|
|
|
GST_VA_FILTER_PROP_SATURATION,
|
|
|
|
GST_VA_FILTER_PROP_BRIGHTNESS,
|
|
|
|
GST_VA_FILTER_PROP_CONTRAST,
|
|
|
|
GST_VA_FILTER_PROP_AUTO_SATURATION,
|
|
|
|
GST_VA_FILTER_PROP_AUTO_BRIGHTNESS,
|
|
|
|
GST_VA_FILTER_PROP_AUTO_CONTRAST,
|
2020-12-21 17:17:24 +00:00
|
|
|
GST_VA_FILTER_PROP_DEINTERLACE_METHOD,
|
2021-10-25 11:41:49 +00:00
|
|
|
GST_VA_FILTER_PROP_HDR,
|
2020-08-16 07:18:11 +00:00
|
|
|
GST_VA_FILTER_PROP_LAST
|
|
|
|
};
|
|
|
|
|
2022-04-26 16:06:17 +00:00
|
|
|
#define GST_TYPE_VA_SCALE_METHOD gst_va_scale_method_get_type()
|
|
|
|
GType gst_va_scale_method_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2021-01-23 11:53:25 +00:00
|
|
|
typedef struct _GstVaSample GstVaSample;
|
|
|
|
struct _GstVaSample
|
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
guint32 flags;
|
|
|
|
|
2021-08-24 11:53:12 +00:00
|
|
|
/* references for (de)interlacing */
|
|
|
|
VASurfaceID *forward_references;
|
|
|
|
guint num_forward_references;
|
|
|
|
VASurfaceID *backward_references;
|
|
|
|
guint num_backward_references;
|
|
|
|
|
2021-10-16 08:58:53 +00:00
|
|
|
/* borders to preserve dar */
|
|
|
|
gint borders_h;
|
|
|
|
gint borders_w;
|
|
|
|
|
2021-01-23 11:53:25 +00:00
|
|
|
/*< private >*/
|
|
|
|
VASurfaceID surface;
|
|
|
|
VARectangle rect;
|
|
|
|
};
|
|
|
|
|
2022-04-26 16:06:17 +00:00
|
|
|
typedef struct _GstVaComposeSample GstVaComposeSample;
|
|
|
|
struct _GstVaComposeSample
|
|
|
|
{
|
|
|
|
/* input buffer (transfer full) */
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
VARectangle input_region;
|
|
|
|
VARectangle output_region;
|
|
|
|
|
|
|
|
gdouble alpha;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GstVaComposeTransaction GstVaComposeTransaction;
|
|
|
|
struct _GstVaComposeTransaction
|
|
|
|
{
|
|
|
|
/* input sample iterator function */
|
|
|
|
GstVaComposeSample* (*next) (gpointer user_data);
|
|
|
|
|
|
|
|
/* the output buffer to compose onto */
|
|
|
|
GstBuffer *output;
|
|
|
|
|
|
|
|
/* user data parameter for "next" function */
|
|
|
|
gpointer user_data;
|
|
|
|
};
|
|
|
|
|
2020-08-16 07:18:11 +00:00
|
|
|
GstVaFilter * gst_va_filter_new (GstVaDisplay * display);
|
|
|
|
gboolean gst_va_filter_open (GstVaFilter * self);
|
|
|
|
gboolean gst_va_filter_close (GstVaFilter * self);
|
|
|
|
gboolean gst_va_filter_is_open (GstVaFilter * self);
|
2021-02-24 12:06:51 +00:00
|
|
|
gboolean gst_va_filter_has_filter (GstVaFilter * self,
|
|
|
|
VAProcFilterType type);
|
2020-08-16 07:18:11 +00:00
|
|
|
gboolean gst_va_filter_install_properties (GstVaFilter * self,
|
|
|
|
GObjectClass * klass);
|
2020-12-21 17:17:24 +00:00
|
|
|
gboolean gst_va_filter_install_deinterlace_properties
|
|
|
|
(GstVaFilter * self,
|
|
|
|
GObjectClass * klass);
|
2022-06-23 15:11:16 +00:00
|
|
|
gboolean gst_va_filter_set_scale_method (GstVaFilter * self,
|
|
|
|
guint32 method);
|
2020-08-16 07:18:11 +00:00
|
|
|
gboolean gst_va_filter_set_orientation (GstVaFilter * self,
|
|
|
|
GstVideoOrientationMethod orientation);
|
|
|
|
GstVideoOrientationMethod gst_va_filter_get_orientation (GstVaFilter * self);
|
2021-03-04 14:19:25 +00:00
|
|
|
void gst_va_filter_enable_cropping (GstVaFilter * self,
|
|
|
|
gboolean cropping);
|
2020-08-16 07:18:11 +00:00
|
|
|
const gpointer gst_va_filter_get_filter_caps (GstVaFilter * self,
|
|
|
|
VAProcFilterType type,
|
|
|
|
guint * num_caps);
|
|
|
|
guint32 gst_va_filter_get_mem_types (GstVaFilter * self);
|
|
|
|
GArray * gst_va_filter_get_surface_formats (GstVaFilter * self);
|
|
|
|
GstCaps * gst_va_filter_get_caps (GstVaFilter * self);
|
2021-07-18 10:46:08 +00:00
|
|
|
gboolean gst_va_filter_set_video_info (GstVaFilter * self,
|
2021-02-18 08:53:09 +00:00
|
|
|
GstVideoInfo * in_info,
|
|
|
|
GstVideoInfo * out_info);
|
2020-08-16 07:18:11 +00:00
|
|
|
gboolean gst_va_filter_add_filter_buffer (GstVaFilter * self,
|
|
|
|
gpointer data,
|
|
|
|
gsize size,
|
|
|
|
guint num);
|
2021-08-24 11:33:29 +00:00
|
|
|
gboolean gst_va_filter_add_deinterlace_buffer(GstVaFilter * self,
|
|
|
|
VAProcDeinterlacingType method,
|
|
|
|
guint32 * forward,
|
|
|
|
guint32 * backward);
|
2021-03-12 12:50:59 +00:00
|
|
|
gboolean gst_va_filter_drop_filter_buffers (GstVaFilter * self);
|
2021-07-24 11:19:39 +00:00
|
|
|
gboolean gst_va_filter_process (GstVaFilter * self,
|
2021-01-23 11:53:25 +00:00
|
|
|
GstVaSample * src,
|
|
|
|
GstVaSample * dest);
|
2020-08-16 07:18:11 +00:00
|
|
|
|
2021-10-05 15:41:57 +00:00
|
|
|
guint32 gst_va_buffer_get_surface_flags (GstBuffer * buffer,
|
|
|
|
GstVideoInfo * info);
|
|
|
|
|
2022-01-24 10:14:14 +00:00
|
|
|
gboolean gst_va_filter_has_video_format (GstVaFilter * self,
|
|
|
|
GstVideoFormat format,
|
|
|
|
GstCapsFeatures * feature);
|
|
|
|
|
2022-04-26 16:06:17 +00:00
|
|
|
gboolean gst_va_filter_has_compose (GstVaFilter * self);
|
|
|
|
gboolean gst_va_filter_compose (GstVaFilter * self,
|
|
|
|
GstVaComposeTransaction * tx);
|
|
|
|
|
2020-08-16 07:18:11 +00:00
|
|
|
G_END_DECLS
|