2 * This file is part of CameraPlus.
4 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
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; either
9 * version 2.1 of the License, or (at your option) any later version.
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
23 GST_DEBUG_CATEGORY_STATIC (gst_copy_debug);
24 #define GST_CAT_DEFAULT gst_copy_debug
27 #define PACKAGE "copy"
34 static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
37 GST_STATIC_CAPS ("ANY")
40 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
43 GST_STATIC_CAPS ("ANY")
46 GST_BOILERPLATE (GstCopy, gst_copy, GstBaseTransform,
47 GST_TYPE_BASE_TRANSFORM);
49 static GstFlowReturn gst_copy_transform_ip(GstBaseTransform *trans, GstBuffer *buf);
50 static GstFlowReturn gst_copy_prepare_output_buffer(GstBaseTransform *trans, GstBuffer *input,
51 gint size, GstCaps *caps, GstBuffer **buf);
54 gst_copy_base_init(gpointer gclass) {
55 GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
57 gst_element_class_set_details_simple(element_class,
61 "Mohammed Sameer <msameer@foolab.org>>");
63 gst_element_class_add_pad_template(element_class,
64 gst_static_pad_template_get(&src_factory));
65 gst_element_class_add_pad_template(element_class,
66 gst_static_pad_template_get(&sink_factory));
70 gst_copy_class_init(GstCopyClass *klass) {
71 GstBaseTransformClass *gstbasetrans_class = (GstBaseTransformClass *)klass;
73 gstbasetrans_class->transform_ip = GST_DEBUG_FUNCPTR(gst_copy_transform_ip);
74 gstbasetrans_class->prepare_output_buffer = GST_DEBUG_FUNCPTR(gst_copy_prepare_output_buffer);
78 gst_copy_init(GstCopy *copy, GstCopyClass *) {
79 GstBaseTransform *trans = GST_BASE_TRANSFORM(copy);
81 gst_base_transform_set_passthrough(trans, FALSE);
82 gst_base_transform_set_in_place(trans, TRUE);
86 gst_copy_transform_ip(GstBaseTransform *trans, GstBuffer *) {
87 GST_DEBUG_OBJECT(trans, "transform ip");
93 gst_copy_prepare_output_buffer(GstBaseTransform *trans, GstBuffer *input,
94 gint, GstCaps *, GstBuffer **buf) {
96 GST_DEBUG_OBJECT(trans, "prepare output buffer");
98 *buf = gst_buffer_copy(input);
104 copy_init(GstPlugin *copy) {
105 GST_DEBUG_CATEGORY_INIT(gst_copy_debug, "copy",
108 return gst_element_register(copy, "copy", GST_RANK_NONE,
113 GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, "copy", "Copy element",
114 copy_init, VERSION, "GPL", "", "")
116 gboolean qt_cam_copy_register() {
117 return gst_plugin_register_static(GST_VERSION_MAJOR, GST_VERSION_MINOR,
118 "copy", "Copy element",