Add initial infrastructure for video processing.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapifilter.h
1 /*
2  *  gstvaapifilter.h - Video processing abstraction
3  *
4  *  Copyright (C) 2013 Intel Corporation
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public License
8  *  as published by the Free Software Foundation; either version 2.1
9  *  of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free
18  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301 USA
20  */
21
22 #ifndef GST_VAAPI_FILTER_H
23 #define GST_VAAPI_FILTER_H
24
25 #include <gst/vaapi/gstvaapisurface.h>
26 #include <gst/vaapi/video-format.h>
27
28 G_BEGIN_DECLS
29
30 typedef struct _GstVaapiFilter                  GstVaapiFilter;
31 typedef struct _GstVaapiFilterOpInfo            GstVaapiFilterOpInfo;
32
33 /**
34  * @GST_VAAPI_FILTER_OP_FORMAT: Force output pixel format (#GstVideoFormat).
35  *
36  * The set of operations that could be applied to the filter.
37  */
38 typedef enum {
39     GST_VAAPI_FILTER_OP_FORMAT = 1,
40 } GstVaapiFilterOp;
41
42 /**
43  * GstVaapiFilterOpInfo:
44  * @operation: the #GstVaapiFilterOp
45  * @pspec: the #GParamSpec describing the associated configurable value
46  *
47  * A #GstVaapiFilterOp descriptor.
48  */
49 struct _GstVaapiFilterOpInfo {
50     const GstVaapiFilterOp      op;
51     GParamSpec * const          pspec;
52 };
53
54 /**
55  * GstVaapiFilterStatus:
56  * @GST_VAAPI_FILTER_STATUS_SUCCESS: Success.
57  * @GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED: No memory left.
58  * @GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED: Operation failed.
59  * @GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER: Invalid parameter.
60  * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION: Unsupported operation.
61  * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT: Unsupported target format.
62  *
63  * Video processing status for gst_vaapi_filter_process().
64  */
65 typedef enum {
66     GST_VAAPI_FILTER_STATUS_SUCCESS = 0,
67     GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED,
68     GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED,
69     GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER,
70     GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION,
71     GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT,
72 } GstVaapiFilterStatus;
73
74 GstVaapiFilter *
75 gst_vaapi_filter_new(GstVaapiDisplay *display);
76
77 GstVaapiFilter *
78 gst_vaapi_filter_ref(GstVaapiFilter *filter);
79
80 void
81 gst_vaapi_filter_unref(GstVaapiFilter *filter);
82
83 void
84 gst_vaapi_filter_replace(GstVaapiFilter **old_filter_ptr,
85     GstVaapiFilter *new_filter);
86
87 GPtrArray *
88 gst_vaapi_filter_get_operations(GstVaapiFilter *filter);
89
90 gboolean
91 gst_vaapi_filter_set_operation(GstVaapiFilter *filter, GstVaapiFilterOp op,
92     const GValue *value);
93
94 GstVaapiFilterStatus
95 gst_vaapi_filter_process(GstVaapiFilter *filter, GstVaapiSurface *src_surface,
96     GstVaapiSurface *dst_surface, guint flags);
97
98 GArray *
99 gst_vaapi_filter_get_formats(GstVaapiFilter *filter);
100
101 gboolean
102 gst_vaapi_filter_set_format(GstVaapiFilter *filter, GstVideoFormat format);
103
104 #endif /* GST_VAAPI_FILTER_H */