2 * Copyright (C) 2007-2009 Nokia Corporation.
4 * Author: Felipe Contreras <felipe.contreras@nokia.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation
9 * version 2.1 of the License.
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.
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 Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef GSTOMX_BASE_FILTER_H
23 #define GSTOMX_BASE_FILTER_H
26 #include <gst/base/gstadapter.h>
27 #include "gstomx_util.h"
28 #include <async_queue.h>
31 #define GST_OMX_BASE_FILTER_TYPE (gst_omx_base_filter_get_type ())
32 #define GST_OMX_BASE_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_OMX_BASE_FILTER_TYPE, GstOmxBaseFilter))
33 #define GST_OMX_BASE_FILTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_OMX_BASE_FILTER_TYPE, GstOmxBaseFilterClass))
34 #define GST_OMX_BASE_FILTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_OMX_BASE_FILTER_TYPE, GstOmxBaseFilterClass))
35 typedef struct GstOmxBaseFilter GstOmxBaseFilter;
36 typedef struct GstOmxBaseFilterClass GstOmxBaseFilterClass;
37 typedef void (*GstOmxBaseFilterCb) (GstOmxBaseFilter * self);
38 typedef gboolean (*GstOmxBaseFilterEventCb) (GstPad * pad, GstEvent * event);
41 /* using common scmn_imgb format */
42 #define SCMN_IMGB_MAX_PLANE (4) /* max channel count */
44 /* image buffer definition
45 +------------------------------------------+ ---
48 | +---------------------------+ --- | |
50 | |<---------- w[] ---------->| | | |
58 | +---------------------------+ --- | |
60 +------------------------------------------+ ---
62 |<----------------- s[] ------------------>|
67 int w[SCMN_IMGB_MAX_PLANE]; /* width of each image plane */
68 int h[SCMN_IMGB_MAX_PLANE]; /* height of each image plane */
69 int s[SCMN_IMGB_MAX_PLANE]; /* stride of each image plane */
70 int e[SCMN_IMGB_MAX_PLANE]; /* elevation of each image plane */
71 void * a[SCMN_IMGB_MAX_PLANE]; /* user space address of each image plane */
72 void * p[SCMN_IMGB_MAX_PLANE]; /* physical address of each image plane, if needs */
73 int cs; /* color space type of image */
74 int x; /* left postion, if needs */
75 int y; /* top position, if needs */
76 int __dummy2; /* to align memory */
77 int data[16]; /* arbitrary data */
80 int fd[SCMN_IMGB_MAX_PLANE];
82 /* flag for buffer share */
86 /* MODIFICATION: Add extended_color_format */
87 typedef enum _EXT_OMX_COLOR_FORMATTYPE {
88 OMX_EXT_COLOR_FormatNV12TPhysicalAddress = 0x7F000001, /**< Reserved region for introducing Vendor Extensions */
89 OMX_EXT_COLOR_FormatNV12LPhysicalAddress = 0x7F000002,
90 OMX_EXT_COLOR_FormatNV12Tiled = 0x7FC00002,
91 OMX_EXT_COLOR_FormatNV12TFdValue = 0x7F000012,
92 OMX_EXT_COLOR_FormatNV12LFdValue = 0x7F000013
93 }EXT_OMX_COLOR_FORMATTYPE;
95 typedef enum GstOmxReturn
102 typedef enum GstOmxChangeState
106 GstOmx_IdleToExcuting
109 struct GstOmxBaseFilter
120 gboolean use_timestamps; /** @todo remove; timestamps should always be used */
124 GstOmxBaseFilterCb omx_setup;
125 GstOmxBaseFilterEventCb pad_event;
126 GstFlowReturn last_pad_push_return;
127 GstBuffer *codec_data;
129 /* MODIFICATION: state-tuning */
130 gboolean use_state_tuning;
132 GstAdapter *adapter; /* adapter */
135 /* MODIFICATION: set output buffer duration as average */
136 GstClockTime duration;
139 struct GstOmxBaseFilterClass
141 GstElementClass parent_class;
143 GstOmxReturn (*process_input_buf)(GstOmxBaseFilter *omx_base_filter, GstBuffer **buf);
144 GstOmxReturn (*process_output_buf)(GstOmxBaseFilter *omx_base_filter, GstBuffer **buf, OMX_BUFFERHEADERTYPE *omx_buffer);
145 void (*process_output_caps)(GstOmxBaseFilter *omx_base_filter, OMX_BUFFERHEADERTYPE *omx_buffer);
149 GType gst_omx_base_filter_get_type (void);
152 #endif /* GSTOMX_BASE_FILTER_H */