plugins: re-indent all video processing related source code.

This commit is contained in:
Gwenole Beauchesne 2014-11-24 14:10:11 +01:00
parent cf352336b3
commit 9c888b8b8e
4 changed files with 1747 additions and 1794 deletions

View file

@ -56,6 +56,7 @@ GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapipostproc);
#endif
/* Default templates */
/* *INDENT-OFF* */
static const char gst_vaapipostproc_sink_caps_str[] =
GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_MODES "; "
@ -68,7 +69,9 @@ static const char gst_vaapipostproc_sink_caps_str[] =
"framerate = " GST_VIDEO_FPS_RANGE ", "
#endif
GST_CAPS_INTERLACED_MODES;
/* *INDENT-ON* */
/* *INDENT-OFF* */
static const char gst_vaapipostproc_src_caps_str[] =
GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
@ -86,28 +89,29 @@ static const char gst_vaapipostproc_src_caps_str[] =
"framerate = " GST_VIDEO_FPS_RANGE ", "
#endif
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-ON* */
/* *INDENT-OFF* */
static GstStaticPadTemplate gst_vaapipostproc_sink_factory =
GST_STATIC_PAD_TEMPLATE(
"sink",
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (gst_vaapipostproc_sink_caps_str));
/* *INDENT-ON* */
/* *INDENT-OFF* */
static GstStaticPadTemplate gst_vaapipostproc_src_factory =
GST_STATIC_PAD_TEMPLATE(
"src",
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (gst_vaapipostproc_src_caps_str));
/* *INDENT-ON* */
G_DEFINE_TYPE_WITH_CODE(
GstVaapiPostproc,
gst_vaapipostproc,
GST_TYPE_BASE_TRANSFORM,
GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES)
G_DEFINE_TYPE_WITH_CODE (GstVaapiPostproc, gst_vaapipostproc,
GST_TYPE_BASE_TRANSFORM, GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES);
enum {
enum
{
PROP_0,
PROP_FORMAT,
@ -198,8 +202,7 @@ ds_set_surfaces(GstVaapiDeinterlaceState *ds)
break;
meta = gst_buffer_get_vaapi_video_meta (buf);
ds->surfaces[ds->num_surfaces++] =
gst_vaapi_video_meta_get_surface(meta);
ds->surfaces[ds->num_surfaces++] = gst_vaapi_video_meta_get_surface (meta);
}
}
@ -210,8 +213,7 @@ find_filter_op(GPtrArray *filter_ops, GstVaapiFilterOp op)
if (filter_ops) {
for (i = 0; i < filter_ops->len; i++) {
GstVaapiFilterOpInfo * const filter_op =
g_ptr_array_index(filter_ops, i);
GstVaapiFilterOpInfo *const filter_op = g_ptr_array_index (filter_ops, i);
if (filter_op->op == op)
return filter_op;
}
@ -222,7 +224,8 @@ find_filter_op(GPtrArray *filter_ops, GstVaapiFilterOp op)
static inline gboolean
gst_vaapipostproc_ensure_display (GstVaapiPostproc * postproc)
{
return gst_vaapi_plugin_base_ensure_display(GST_VAAPI_PLUGIN_BASE(postproc));
return
gst_vaapi_plugin_base_ensure_display (GST_VAAPI_PLUGIN_BASE (postproc));
}
static gboolean
@ -244,8 +247,8 @@ gst_vaapipostproc_ensure_filter(GstVaapiPostproc *postproc)
if (!gst_vaapipostproc_ensure_display (postproc))
return FALSE;
postproc->filter = gst_vaapi_filter_new(
GST_VAAPI_PLUGIN_BASE_DISPLAY(postproc));
postproc->filter =
gst_vaapi_filter_new (GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
if (!postproc->filter)
return FALSE;
return TRUE;
@ -427,8 +430,7 @@ append_output_buffer_metadata(GstVaapiPostproc *postproc, GstBuffer *outbuf,
/* GstVideoCropMeta */
#if GST_CHECK_VERSION(1,0,0)
if (!postproc->use_vpp) {
GstVideoCropMeta * const crop_meta =
gst_buffer_get_video_crop_meta(inbuf);
GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (inbuf);
if (crop_meta) {
GstVideoCropMeta *const out_crop_meta =
gst_buffer_add_video_crop_meta (outbuf);
@ -541,28 +543,23 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_HUE) &&
!gst_vaapi_filter_set_hue(postproc->filter,
postproc->hue))
!gst_vaapi_filter_set_hue (postproc->filter, postproc->hue))
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_SATURATION) &&
!gst_vaapi_filter_set_saturation(postproc->filter,
postproc->saturation))
!gst_vaapi_filter_set_saturation (postproc->filter, postproc->saturation))
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_BRIGHTNESS) &&
!gst_vaapi_filter_set_brightness(postproc->filter,
postproc->brightness))
!gst_vaapi_filter_set_brightness (postproc->filter, postproc->brightness))
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_CONTRAST) &&
!gst_vaapi_filter_set_contrast(postproc->filter,
postproc->contrast))
!gst_vaapi_filter_set_contrast (postproc->filter, postproc->contrast))
return GST_FLOW_NOT_SUPPORTED;
if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_SCALE) &&
!gst_vaapi_filter_set_scaling(postproc->filter,
postproc->scale_method))
!gst_vaapi_filter_set_scaling (postproc->filter, postproc->scale_method))
return GST_FLOW_NOT_SUPPORTED;
inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf);
@ -571,8 +568,7 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
inbuf_surface = gst_vaapi_video_meta_get_surface (inbuf_meta);
#if GST_CHECK_VERSION(1,0,0)
GstVideoCropMeta * const crop_meta =
gst_buffer_get_video_crop_meta(inbuf);
GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (inbuf);
if (crop_meta) {
crop_rect = &tmp_rect;
crop_rect->x = crop_meta->x;
@ -624,8 +620,9 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
if (!outbuf_meta)
goto error_create_meta;
proxy = gst_vaapi_surface_proxy_new_from_pool(
GST_VAAPI_SURFACE_POOL(postproc->filter_pool));
proxy =
gst_vaapi_surface_proxy_new_from_pool (GST_VAAPI_SURFACE_POOL
(postproc->filter_pool));
if (!proxy)
goto error_create_proxy;
gst_vaapi_video_meta_set_surface_proxy (outbuf_meta, proxy);
@ -647,13 +644,11 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
if (deint_refs) {
ds_set_surfaces (ds);
if (!gst_vaapi_filter_set_deinterlacing_references(
postproc->filter, ds->surfaces, ds->num_surfaces,
NULL, 0))
if (!gst_vaapi_filter_set_deinterlacing_references (postproc->filter,
ds->surfaces, ds->num_surfaces, NULL, 0))
goto error_op_deinterlace;
}
}
else if (deint_changed) {
} else if (deint_changed) {
// Reset internal filter to non-deinterlacing mode
deint_method = GST_VAAPI_DEINTERLACE_METHOD_NONE;
if (!gst_vaapi_filter_set_deinterlacing (postproc->filter,
@ -681,8 +676,9 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
if (!outbuf_meta)
goto error_create_meta;
proxy = gst_vaapi_surface_proxy_new_from_pool(
GST_VAAPI_SURFACE_POOL(postproc->filter_pool));
proxy =
gst_vaapi_surface_proxy_new_from_pool (GST_VAAPI_SURFACE_POOL
(postproc->filter_pool));
if (!proxy)
goto error_create_proxy;
gst_vaapi_video_meta_set_surface_proxy (outbuf_meta, proxy);
@ -696,12 +692,13 @@ gst_vaapipostproc_process_vpp(GstBaseTransform *trans, GstBuffer *inbuf,
deint_method, deint_flags))
goto error_op_deinterlace;
if (deint_refs && !gst_vaapi_filter_set_deinterlacing_references(
postproc->filter, ds->surfaces, ds->num_surfaces, NULL, 0))
if (deint_refs
&& !gst_vaapi_filter_set_deinterlacing_references (postproc->filter,
ds->surfaces, ds->num_surfaces, NULL, 0))
goto error_op_deinterlace;
}
else if (deint_changed && !gst_vaapi_filter_set_deinterlacing(
postproc->filter, deint_method, 0))
} else if (deint_changed
&& !gst_vaapi_filter_set_deinterlacing (postproc->filter, deint_method,
0))
goto error_op_deinterlace;
outbuf_surface = gst_vaapi_video_meta_get_surface (outbuf_meta);
@ -797,8 +794,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
meta = gst_buffer_get_vaapi_video_meta (fieldbuf);
fieldbuf_flags = flags;
fieldbuf_flags |= deint ? (
tff ?
fieldbuf_flags |= deint ? (tff ?
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD :
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD) :
GST_VAAPI_PICTURE_STRUCTURE_FRAME;
@ -815,8 +811,7 @@ gst_vaapipostproc_process(GstBaseTransform *trans, GstBuffer *inbuf,
meta = gst_buffer_get_vaapi_video_meta (outbuf);
outbuf_flags = flags;
outbuf_flags |= deint ? (
tff ?
outbuf_flags |= deint ? (tff ?
GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD :
GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD) :
GST_VAAPI_PICTURE_STRUCTURE_FRAME;
@ -971,8 +966,7 @@ ensure_allowed_sinkpad_caps(GstVaapiPostproc *postproc)
if (raw_caps) {
out_caps = gst_caps_make_writable (out_caps);
gst_caps_append (out_caps, gst_caps_copy (raw_caps));
}
else
} else
GST_WARNING ("failed to create YUV sink caps");
}
postproc->allowed_sinkpad_caps = out_caps;
@ -1056,19 +1050,16 @@ find_best_size(GstVaapiPostproc *postproc, GstVideoInfo *vip,
if (postproc->width && postproc->height) {
width = postproc->width;
height = postproc->height;
}
else if (postproc->keep_aspect) {
} else if (postproc->keep_aspect) {
const gdouble ratio = (gdouble) width / height;
if (postproc->width) {
width = postproc->width;
height = postproc->width / ratio;
}
else if (postproc->height) {
} else if (postproc->height) {
height = postproc->height;
width = postproc->height * ratio;
}
}
else if (postproc->width)
} else if (postproc->width)
width = postproc->width;
else if (postproc->height)
height = postproc->height;
@ -1138,9 +1129,11 @@ gst_vaapipostproc_transform_caps_impl(GstBaseTransform *trans,
else {
GstCaps *peer_caps, *filter_caps;
GstVideoInfo peer_vi;
filter_caps = gst_caps_from_string (GST_VIDEO_CAPS_MAKE(GST_VIDEO_FORMATS_ALL));
peer_caps = gst_pad_peer_query_caps(
GST_BASE_TRANSFORM_SRC_PAD(trans), filter_caps);
filter_caps =
gst_caps_from_string (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL));
peer_caps =
gst_pad_peer_query_caps (GST_BASE_TRANSFORM_SRC_PAD (trans),
filter_caps);
if (!gst_caps_is_fixed (peer_caps))
peer_caps = gst_caps_fixate (peer_caps);
gst_video_info_from_caps (&peer_vi, peer_caps);
@ -1160,8 +1153,9 @@ gst_vaapipostproc_transform_caps_impl(GstBaseTransform *trans,
if (!out_caps)
return NULL;
feature = gst_vaapi_find_preferred_caps_feature(
GST_BASE_TRANSFORM_SRC_PAD(trans), out_format);
feature =
gst_vaapi_find_preferred_caps_feature (GST_BASE_TRANSFORM_SRC_PAD (trans),
out_format);
if (feature) {
feature_str = gst_vaapi_caps_feature_to_string (feature);
if (feature_str)
@ -1206,8 +1200,7 @@ gst_vaapipostproc_transform_caps_impl(GstBaseTransform *trans,
"framerate", GST_TYPE_FRACTION, GST_VIDEO_INFO_FPS_N (&vi),
GST_VIDEO_INFO_FPS_D (&vi),
"pixel-aspect-ratio", GST_TYPE_FRACTION, GST_VIDEO_INFO_PAR_N (&vi),
GST_VIDEO_INFO_PAR_D(&vi),
NULL);
GST_VIDEO_INFO_PAR_D (&vi), NULL);
gst_caps_set_interlaced (out_caps, &vi);
#endif
@ -1223,8 +1216,7 @@ gst_vaapipostproc_transform_caps(GstBaseTransform *trans,
caps = gst_vaapipostproc_transform_caps_impl (trans, direction, caps);
if (caps && filter) {
out_caps = gst_caps_intersect_full(caps, filter,
GST_CAPS_INTERSECT_FIRST);
out_caps = gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (caps);
return out_caps;
}
@ -1263,8 +1255,9 @@ gst_vaapipostproc_transform(GstBaseTransform *trans, GstBuffer *inbuf,
GstBuffer *buf;
GstFlowReturn ret;
ret = gst_vaapi_plugin_base_get_input_buffer(
GST_VAAPI_PLUGIN_BASE(postproc), inbuf, &buf);
ret =
gst_vaapi_plugin_base_get_input_buffer (GST_VAAPI_PLUGIN_BASE (postproc),
inbuf, &buf);
if (ret != GST_FLOW_OK)
return GST_FLOW_ERROR;
@ -1321,7 +1314,8 @@ ensure_srcpad_buffer_pool(GstVaapiPostproc *postproc, GstCaps *caps)
gst_video_info_change_format (&vi, postproc->format,
GST_VIDEO_INFO_WIDTH (&vi), GST_VIDEO_INFO_HEIGHT (&vi));
if (postproc->filter_pool && !video_info_changed(&vi, &postproc->filter_pool_info))
if (postproc->filter_pool
&& !video_info_changed (&vi, &postproc->filter_pool_info))
return TRUE;
postproc->filter_pool_info = vi;
@ -1369,13 +1363,15 @@ gst_vaapipostproc_query(GstBaseTransform *trans, GstPadDirection direction,
GST_INFO_OBJECT (trans, "query type `%s'", GST_QUERY_TYPE_NAME (query));
if (gst_vaapi_reply_to_query(query, GST_VAAPI_PLUGIN_BASE_DISPLAY(postproc))) {
if (gst_vaapi_reply_to_query (query,
GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc))) {
GST_DEBUG ("sharing display %p", GST_VAAPI_PLUGIN_BASE_DISPLAY (postproc));
return TRUE;
}
return GST_BASE_TRANSFORM_CLASS(gst_vaapipostproc_parent_class)->query(
trans, direction, query);
return
GST_BASE_TRANSFORM_CLASS (gst_vaapipostproc_parent_class)->query (trans,
direction, query);
}
#if GST_CHECK_VERSION(1,0,0)
@ -1414,12 +1410,8 @@ gst_vaapipostproc_finalize(GObject *object)
}
static void
gst_vaapipostproc_set_property(
GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec
)
gst_vaapipostproc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (object);
@ -1477,12 +1469,8 @@ gst_vaapipostproc_set_property(
}
static void
gst_vaapipostproc_get_property(
GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec
)
gst_vaapipostproc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (object);
@ -1563,15 +1551,13 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
trans_class->decide_allocation = gst_vaapipostproc_decide_allocation;
#endif
trans_class->prepare_output_buffer =
gst_vaapipostproc_prepare_output_buffer;
trans_class->prepare_output_buffer = gst_vaapipostproc_prepare_output_buffer;
gst_element_class_set_static_metadata (element_class,
"VA-API video postprocessing",
"Filter/Converter/Video;Filter/Converter/Video/Scaler;"
"Filter/Effect/Video;Filter/Effect/Video/Deinterlace",
GST_PLUGIN_DESC,
"Gwenole Beauchesne <gwenole.beauchesne@intel.com>");
GST_PLUGIN_DESC, "Gwenole Beauchesne <gwenole.beauchesne@intel.com>");
/* sink pad */
pad_template = gst_static_pad_template_get (&gst_vaapipostproc_sink_factory);
@ -1584,9 +1570,9 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
/**
* GstVaapiPostproc:deinterlace-mode:
*
* This selects whether the deinterlacing should always be applied or if
* they should only be applied on content that has the "interlaced" flag
* on the caps.
* This selects whether the deinterlacing should always be applied
* or if they should only be applied on content that has the
* "interlaced" flag on the caps.
*/
g_object_class_install_property
(object_class,
@ -1640,14 +1626,13 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
g_param_spec_uint ("width",
"Width",
"Forced output width",
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiPostproc:height:
*
* The forced output height in pixels. If set to zero, the height
* is calculated from the width if aspect ration is preserved, or
* The forced output height in pixels. If set to zero, the height is
* calculated from the width if aspect ration is preserved, or
* inherited from the sink caps height
*/
g_object_class_install_property
@ -1656,15 +1641,13 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
g_param_spec_uint ("height",
"Height",
"Forced output height",
0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiPostproc:force-aspect-ratio:
*
* When enabled, scaling respects video aspect ratio; when
* disabled, the video is distorted to fit the width and height
* properties.
* When enabled, scaling respects video aspect ratio; when disabled,
* the video is distorted to fit the width and height properties.
*/
g_object_class_install_property
(object_class,
@ -1672,8 +1655,7 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
g_param_spec_boolean ("force-aspect-ratio",
"Force aspect ratio",
"When enabled, scaling will respect original aspect ratio",
TRUE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
TRUE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstVaapiPostproc:denoise:
@ -1704,14 +1686,13 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
*/
filter_op = find_filter_op (filter_ops, GST_VAAPI_FILTER_OP_HUE);
if (filter_op)
g_object_class_install_property(object_class,
PROP_HUE, filter_op->pspec);
g_object_class_install_property (object_class, PROP_HUE, filter_op->pspec);
/**
* GstVaapiPostproc:saturation:
*
* The color saturation, expressed as a float value. Range is 0.0
* to 2.0. Default value is 1.0 and represents no modification.
* The color saturation, expressed as a float value. Range is 0.0 to
* 2.0. Default value is 1.0 and represents no modification.
*/
filter_op = find_filter_op (filter_ops, GST_VAAPI_FILTER_OP_SATURATION);
if (filter_op)
@ -1757,7 +1738,8 @@ gst_vaapipostproc_class_init(GstVaapiPostprocClass *klass)
static void
gst_vaapipostproc_init (GstVaapiPostproc * postproc)
{
gst_vaapi_plugin_base_init(GST_VAAPI_PLUGIN_BASE(postproc), GST_CAT_DEFAULT);
gst_vaapi_plugin_base_init (GST_VAAPI_PLUGIN_BASE (postproc),
GST_CAT_DEFAULT);
postproc->format = DEFAULT_FORMAT;
postproc->deinterlace_mode = DEFAULT_DEINTERLACE_MODE;

View file

@ -32,26 +32,17 @@ G_BEGIN_DECLS
#define GST_TYPE_VAAPIPOSTPROC \
(gst_vaapipostproc_get_type ())
#define GST_VAAPIPOSTPROC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_TYPE_VAAPIPOSTPROC, \
GstVaapiPostproc))
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPIPOSTPROC, GstVaapiPostproc))
#define GST_VAAPIPOSTPROC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_TYPE_VAAPIPOSTPROC, \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VAAPIPOSTPROC, \
GstVaapiPostprocClass))
#define GST_IS_VAAPIPOSTPROC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPIPOSTPROC))
#define GST_IS_VAAPIPOSTPROC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPIPOSTPROC))
#define GST_VAAPIPOSTPROC_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_TYPE_VAAPIPOSTPROC, \
(G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VAAPIPOSTPROC, \
GstVaapiPostprocClass))
typedef struct _GstVaapiPostproc GstVaapiPostproc;
@ -64,7 +55,8 @@ typedef struct _GstVaapiDeinterlaceState GstVaapiDeinterlaceState;
* @GST_VAAPI_DEINTERLACE_MODE_INTERLACED: Force deinterlacing.
* @GST_VAAPI_DEINTERLACE_MODE_DISABLED: Never perform deinterlacing.
*/
typedef enum {
typedef enum
{
GST_VAAPI_DEINTERLACE_MODE_AUTO = 0,
GST_VAAPI_DEINTERLACE_MODE_INTERLACED,
GST_VAAPI_DEINTERLACE_MODE_DISABLED,
@ -97,7 +89,8 @@ typedef enum {
*
* The set of operations that are to be performed for each frame.
*/
typedef enum {
typedef enum
{
GST_VAAPI_POSTPROC_FLAG_FORMAT = 1 << GST_VAAPI_FILTER_OP_FORMAT,
GST_VAAPI_POSTPROC_FLAG_DENOISE = 1 << GST_VAAPI_FILTER_OP_DENOISE,
GST_VAAPI_POSTPROC_FLAG_SHARPEN = 1 << GST_VAAPI_FILTER_OP_SHARPEN,
@ -124,7 +117,8 @@ typedef enum {
*
* Context used to maintain deinterlacing state.
*/
struct _GstVaapiDeinterlaceState {
struct _GstVaapiDeinterlaceState
{
GstBuffer *buffers[GST_VAAPI_DEINTERLACE_MAX_REFERENCES];
guint buffers_index;
GstVaapiSurface *surfaces[GST_VAAPI_DEINTERLACE_MAX_REFERENCES];
@ -133,7 +127,8 @@ struct _GstVaapiDeinterlaceState {
guint tff:1;
};
struct _GstVaapiPostproc {
struct _GstVaapiPostproc
{
/*< private >*/
GstVaapiPluginBase parent_instance;
@ -176,7 +171,8 @@ struct _GstVaapiPostproc {
guint keep_aspect:1;
};
struct _GstVaapiPostprocClass {
struct _GstVaapiPostprocClass
{
/*< private >*/
GstVaapiPluginBaseClass parent_class;
};

View file

@ -39,17 +39,16 @@
GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapi_uploader);
#define GST_CAT_DEFAULT gst_debug_vaapi_uploader
G_DEFINE_TYPE(GstVaapiUploader, gst_vaapi_uploader, G_TYPE_OBJECT)
G_DEFINE_TYPE (GstVaapiUploader, gst_vaapi_uploader, G_TYPE_OBJECT);
#define GST_VAAPI_UPLOADER_CAST(obj) \
((GstVaapiUploader *)(obj))
#define GST_VAAPI_UPLOADER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE((obj), \
GST_VAAPI_TYPE_UPLOADER, \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_VAAPI_TYPE_UPLOADER, \
GstVaapiUploaderPrivate))
struct _GstVaapiUploaderPrivate {
struct _GstVaapiUploaderPrivate
{
GstVaapiDisplay *display;
GstCaps *allowed_caps;
GstVaapiVideoPool *images;
@ -59,7 +58,8 @@ struct _GstVaapiUploaderPrivate {
guint direct_rendering;
};
enum {
enum
{
PROP_0,
PROP_DISPLAY,
@ -118,7 +118,8 @@ ensure_allowed_caps(GstVaapiUploader *uploader)
guint i;
gboolean success = FALSE;
enum { WIDTH = 64, HEIGHT = 64 };
enum
{ WIDTH = 64, HEIGHT = 64 };
if (priv->allowed_caps)
return TRUE;
@ -138,8 +139,7 @@ ensure_allowed_caps(GstVaapiUploader *uploader)
goto cleanup;
for (i = 0; i < formats->len; i++) {
const GstVideoFormat format =
g_array_index(formats, GstVideoFormat, i);
const GstVideoFormat format = g_array_index (formats, GstVideoFormat, i);
GstVaapiImage *image;
if (format == GST_VIDEO_FORMAT_UNKNOWN)
@ -307,11 +307,9 @@ gst_vaapi_uploader_class_init(GstVaapiUploaderClass *klass)
object_class->set_property = gst_vaapi_uploader_set_property;
object_class->get_property = gst_vaapi_uploader_get_property;
g_object_class_install_property(
object_class,
g_object_class_install_property (object_class,
PROP_DISPLAY,
g_param_spec_pointer(
"display",
g_param_spec_pointer ("display",
"Display",
"The GstVaapiDisplay this object is bound to",
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -336,10 +334,8 @@ gst_vaapi_uploader_new(GstVaapiDisplay *display)
}
gboolean
gst_vaapi_uploader_ensure_display(
GstVaapiUploader *uploader,
GstVaapiDisplay *display
)
gst_vaapi_uploader_ensure_display (GstVaapiUploader * uploader,
GstVaapiDisplay * display)
{
g_return_val_if_fail (GST_VAAPI_IS_UPLOADER (uploader), FALSE);
g_return_val_if_fail (display != NULL, FALSE);
@ -348,11 +344,8 @@ gst_vaapi_uploader_ensure_display(
}
gboolean
gst_vaapi_uploader_ensure_caps(
GstVaapiUploader *uploader,
GstCaps *src_caps,
GstCaps *out_caps
)
gst_vaapi_uploader_ensure_caps (GstVaapiUploader * uploader,
GstCaps * src_caps, GstCaps * out_caps)
{
GstVaapiUploaderPrivate *priv;
GstVaapiImage *image;
@ -391,11 +384,8 @@ gst_vaapi_uploader_ensure_caps(
}
gboolean
gst_vaapi_uploader_process(
GstVaapiUploader *uploader,
GstBuffer *src_buffer,
GstBuffer *out_buffer
)
gst_vaapi_uploader_process (GstVaapiUploader * uploader,
GstBuffer * src_buffer, GstBuffer * out_buffer)
{
GstVaapiVideoMeta *src_meta, *out_meta;
GstVaapiSurface *surface;
@ -418,8 +408,7 @@ gst_vaapi_uploader_process(
image = gst_vaapi_video_meta_get_image (src_meta);
if (!image || !gst_vaapi_image_unmap (image))
return FALSE;
}
else {
} else {
/* Regular GstBuffer that needs to be uploaded to a VA image */
image = gst_vaapi_video_meta_get_image (out_meta);
if (!image) {
@ -473,8 +462,9 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader)
goto error;
}
proxy = gst_vaapi_surface_proxy_new_from_pool(
GST_VAAPI_SURFACE_POOL(priv->surfaces));
proxy =
gst_vaapi_surface_proxy_new_from_pool (GST_VAAPI_SURFACE_POOL
(priv->surfaces));
if (!proxy) {
GST_WARNING ("failed to allocate VA surface");
goto error;
@ -489,7 +479,6 @@ gst_vaapi_uploader_get_buffer(GstVaapiUploader *uploader)
GST_WARNING ("failed to map VA image");
goto error;
}
#if !GST_CHECK_VERSION(1,0,0)
GST_BUFFER_DATA (buffer) = gst_vaapi_image_get_plane (image, 0);
GST_BUFFER_SIZE (buffer) = gst_vaapi_image_get_data_size (image);

View file

@ -31,40 +31,34 @@ G_BEGIN_DECLS
#define GST_VAAPI_TYPE_UPLOADER \
(gst_vaapi_uploader_get_type ())
#define GST_VAAPI_UPLOADER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_VAAPI_TYPE_UPLOADER, \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_VAAPI_TYPE_UPLOADER, \
GstVaapiUploader))
#define GST_VAAPI_UPLOADER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_VAAPI_TYPE_UPLOADER, \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_VAAPI_TYPE_UPLOADER, \
GstVaapiUploaderClass))
#define GST_VAAPI_IS_UPLOADER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_VAAPI_TYPE_UPLOADER))
#define GST_VAAPI_IS_UPLOADER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_VAAPI_TYPE_UPLOADER))
#define GST_VAAPI_UPLOADER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_VAAPI_TYPE_UPLOADER, \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_VAAPI_TYPE_UPLOADER, \
GstVaapiUploaderClass))
typedef struct _GstVaapiUploader GstVaapiUploader;
typedef struct _GstVaapiUploaderPrivate GstVaapiUploaderPrivate;
typedef struct _GstVaapiUploaderClass GstVaapiUploaderClass;
struct _GstVaapiUploader {
struct _GstVaapiUploader
{
/*< private >*/
GObject parent_instance;
GstVaapiUploaderPrivate *priv;
};
struct _GstVaapiUploaderClass {
struct _GstVaapiUploaderClass
{
/*< private >*/
GObjectClass parent_class;
};
@ -79,26 +73,18 @@ gst_vaapi_uploader_new(GstVaapiDisplay *display);
G_GNUC_INTERNAL
gboolean
gst_vaapi_uploader_ensure_display(
GstVaapiUploader *uploader,
GstVaapiDisplay *display
);
gst_vaapi_uploader_ensure_display (GstVaapiUploader * uploader,
GstVaapiDisplay * display);
G_GNUC_INTERNAL
gboolean
gst_vaapi_uploader_ensure_caps(
GstVaapiUploader *uploader,
GstCaps *src_caps,
GstCaps *out_caps
);
gst_vaapi_uploader_ensure_caps (GstVaapiUploader * uploader,
GstCaps * src_caps, GstCaps * out_caps);
G_GNUC_INTERNAL
gboolean
gst_vaapi_uploader_process(
GstVaapiUploader *uploader,
GstBuffer *src_buffer,
GstBuffer *out_buffer
);
gst_vaapi_uploader_process (GstVaapiUploader * uploader,
GstBuffer * src_buffer, GstBuffer * out_buffer);
G_GNUC_INTERNAL
GstCaps *