1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
From 9820616aad713a23aa9d0e2afe44835d9e9278e5 Mon Sep 17 00:00:00 2001
From: Rob Clark <rob@ti.com>
Date: Thu, 30 Jul 2009 20:41:18 -0500
Subject: [PATCH 02/24] stridetransform: skeletal implementation of stridetransform element
---
configure.ac | 2 +
gst/stride/Makefile.am | 15 ++++
gst/stride/gststridetransform.c | 178 +++++++++++++++++++++++++++++++++++++++
gst/stride/gststridetransform.h | 66 ++++++++++++++
gst/stride/plugin.c | 45 ++++++++++
5 files changed, 306 insertions(+), 0 deletions(-)
create mode 100644 gst/stride/Makefile.am
create mode 100644 gst/stride/gststridetransform.c
create mode 100644 gst/stride/gststridetransform.h
create mode 100644 gst/stride/plugin.c
diff --git a/configure.ac b/configure.ac
index 3325abc..af6cd52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -427,6 +427,7 @@ AG_GST_CHECK_PLUGIN(ffmpegcolorspace)
AG_GST_CHECK_PLUGIN(gdp)
AG_GST_CHECK_PLUGIN(playback)
AG_GST_CHECK_PLUGIN(audioresample)
+AG_GST_CHECK_PLUGIN(stride)
AG_GST_CHECK_PLUGIN(subparse)
AG_GST_CHECK_PLUGIN(tcp)
AG_GST_CHECK_PLUGIN(typefind)
@@ -925,6 +926,7 @@ gst/ffmpegcolorspace/Makefile
gst/gdp/Makefile
gst/playback/Makefile
gst/audioresample/Makefile
+gst/stride/Makefile
gst/subparse/Makefile
gst/tcp/Makefile
gst/typefind/Makefile
diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am
new file mode 100644
index 0000000..1adc197
--- /dev/null
+++ b/gst/stride/Makefile.am
@@ -0,0 +1,15 @@
+plugin_LTLIBRARIES = libgststridetransform.la
+
+libgststridetransform_la_SOURCES = \
+ gststridetransform.c \
+ plugin.c
+
+libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
+libgststridetransform_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgststridetransform_la_LIBADD = \
+ $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \
+ $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
+libgststridetransform_la_LIBTOOLFLAGS = --tag=disable-static
+
+noinst_HEADERS = \
+ gststridetransform.h
diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c
new file mode 100644
index 0000000..21f2d6e
--- /dev/null
+++ b/gst/stride/gststridetransform.c
@@ -0,0 +1,178 @@
+/* GStreamer
+ *
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: V4L2 sink element
+ * Created on: Jul 30, 2009
+ * Author: Rob Clark <rob@ti.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/**
+ * SECTION:element-stridetransform
+ *
+ * stridetransform can be used to convert between video buffers
+ * with and without stride, or between buffers with differing
+ * stride
+ *
+ * <refsect2>
+ * <title>Example launch lines</title>
+ * |[
+ * gst-launch ???? TODO
+ * ]| This pipeline ???? TODO
+ * </refsect2>
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gststridetransform.h"
+#include "gst/gst-i18n-plugin.h"
+
+
+static const GstElementDetails stridetransform_details =
+GST_ELEMENT_DETAILS ("Stride transform",
+ "Filter/Converter/Video",
+ "Convert between video buffers with and without stride, or with differing stride",
+ "Rob Clark <rob@ti.com>,");
+
+GST_DEBUG_CATEGORY (stridetransform_debug);
+#define GST_CAT_DEFAULT stridetransform_debug
+
+/* type functions */
+static void gst_stride_transform_dispose (GObject * obj);
+
+/* GstBaseTransform functions */
+static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base,
+ GstCaps * caps, guint * size);
+static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base,
+ GstPadDirection direction, GstCaps * caps);
+static void gst_stride_transform_fixate_caps (GstBaseTransform * base,
+ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
+static gboolean gst_stride_transform_set_caps (GstBaseTransform * base,
+ GstCaps * incaps, GstCaps * outcaps);
+static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base,
+ GstBuffer * inbuf, GstBuffer * outbuf);
+static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base,
+ GstBuffer * buf);
+
+GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER);
+
+
+static void
+gst_stride_transform_base_init (gpointer g_class)
+{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element");
+
+ gst_element_class_set_details (gstelement_class, &stridetransform_details);
+}
+
+static void
+gst_stride_transform_class_init (GstStrideTransformClass * klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
+
+ gobject_class->dispose = gst_stride_transform_dispose;
+
+ basetransform_class->get_unit_size =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size);
+ basetransform_class->transform_caps =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps);
+ basetransform_class->fixate_caps =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps);
+ basetransform_class->set_caps =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps);
+ basetransform_class->transform_ip =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip);
+ basetransform_class->transform =
+ GST_DEBUG_FUNCPTR (gst_stride_transform_transform);
+
+ basetransform_class->passthrough_on_same_caps = TRUE;
+}
+
+static void
+gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass)
+{
+ GST_DEBUG_OBJECT (self, "not implemented");
+}
+
+
+static void
+gst_stride_transform_dispose (GObject * object)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (object);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
+static gboolean
+gst_stride_transform_get_unit_size (GstBaseTransform * base,
+ GstCaps * caps, guint * size)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ return FALSE;
+}
+
+static GstCaps *
+gst_stride_transform_transform_caps (GstBaseTransform * base,
+ GstPadDirection direction, GstCaps * caps)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ return NULL;
+}
+
+static void
+gst_stride_transform_fixate_caps (GstBaseTransform * base,
+ GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+}
+
+static gboolean
+gst_stride_transform_set_caps (GstBaseTransform * base,
+ GstCaps * incaps, GstCaps * outcaps)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ return FALSE;
+}
+
+static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base,
+ GstBuffer * inbuf, GstBuffer * outbuf)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ return GST_FLOW_ERROR;
+}
+
+static GstFlowReturn
+gst_stride_transform_transform_ip (GstBaseTransform * base,
+ GstBuffer * buf)
+{
+ GstStrideTransform *self = GST_STRIDE_TRANSFORM (base);
+ GST_DEBUG_OBJECT (self, "not implemented");
+ return GST_FLOW_ERROR;
+}
diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h
new file mode 100644
index 0000000..b4f7d59
--- /dev/null
+++ b/gst/stride/gststridetransform.h
@@ -0,0 +1,66 @@
+/* GStreamer
+ *
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: V4L2 sink element
+ * Created on: Jul 2, 2009
+ * Author: Rob Clark <rob@ti.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GSTSTRIDETRANSFORM_H__
+#define __GSTSTRIDETRANSFORM_H__
+
+
+#include <gst/video/gstvideofilter.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_STRIDE_TRANSFORM \
+ (gst_stride_transform_get_type())
+#define GST_STRIDE_TRANSFORM(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransform))
+#define GST_STRIDE_TRANSFORM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransformClass))
+#define GST_IS_STRIDE_TRANSFORM(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STRIDE_TRANSFORM))
+#define GST_IS_STRIDE_TRANSFORM_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STRIDE_TRANSFORM))
+
+typedef struct _GstStrideTransform GstStrideTransform;
+typedef struct _GstStrideTransformClass GstStrideTransformClass;
+
+/**
+ * GstStrideTransform:
+ *
+ * Opaque datastructure.
+ */
+struct _GstStrideTransform {
+ GstVideoFilter videofilter;
+
+};
+
+struct _GstStrideTransformClass {
+ GstVideoFilterClass parent_class;
+};
+
+GType gst_stride_transform_get_type (void);
+
+G_END_DECLS
+
+
+#endif /* __GSTSTRIDETRANSFORM_H__ */
diff --git a/gst/stride/plugin.c b/gst/stride/plugin.c
new file mode 100644
index 0000000..7672bdc
--- /dev/null
+++ b/gst/stride/plugin.c
@@ -0,0 +1,45 @@
+/* GStreamer
+ *
+ * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/
+ *
+ * Description: V4L2 sink element
+ * Created on: Jul 30, 2009
+ * Author: Rob Clark <rob@ti.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gststridetransform.h"
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+ if (!gst_element_register (plugin, "stridetransform",
+ GST_RANK_PRIMARY, gst_stride_transform_get_type ()))
+ return FALSE;
+
+ return TRUE;
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "stridetransform",
+ "Convert video from strided to non-strided, or between different row-strides",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
--
1.7.1
|