From 3db90e1d432196be2852a27f00ba7432b4590656 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 26 Nov 2010 10:14:46 -0300 Subject: [PATCH] camerabin2: Adds a stub element for camerabin2 Adds camerabin2 element, it is now a pile of stubs. --- gst/camerabin2/Makefile.am | 2 + gst/camerabin2/gstcamerabin2.c | 171 +++++++++++++++++++++++++++++++++++++++++ gst/camerabin2/gstcamerabin2.h | 55 +++++++++++++ gst/camerabin2/gstplugin.c | 3 + 4 files changed, 231 insertions(+) create mode 100644 gst/camerabin2/gstcamerabin2.c create mode 100644 gst/camerabin2/gstcamerabin2.h diff --git a/gst/camerabin2/Makefile.am b/gst/camerabin2/Makefile.am index e1278f4..92229d7 100644 --- a/gst/camerabin2/Makefile.am +++ b/gst/camerabin2/Makefile.am @@ -7,6 +7,7 @@ libgstcamerabin2_la_SOURCES = gstviewfinderbin.c \ gstbasecamerasrc.c \ gstcamerabin-enum.c \ gstv4l2camerasrc.c \ + gstcamerabin2.c \ gstplugin.c libgstcamerabin2_la_CFLAGS = \ @@ -28,4 +29,5 @@ noinst_HEADERS = gstviewfinderbin.h \ camerabingeneral.h \ gstbasecamerasrc.h \ gstv4l2camerasrc.h \ + gstcamerabin2.h \ gstcamerabin-enum.h diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c new file mode 100644 index 0000000..39f89a5 --- /dev/null +++ b/gst/camerabin2/gstcamerabin2.c @@ -0,0 +1,171 @@ +/* GStreamer + * Copyright (C) 2010 Thiago Santos + * + * 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-gstcamerabin + * + * The gstcamerabin element does FIXME stuff. + * + * + * Example launch line + * |[ + * gst-launch -v videotestsrc ! camerabin + * ]| + * FIXME Describe what the pipeline does. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstcamerabin2.h" + +/* prototypes */ + + +enum +{ + PROP_0 +}; + +/******************************** + * Standard GObject boilerplate * + ********************************/ + +static GstPipelineClass *parent_class; +static void gst_camera_bin_class_init (GstCameraBinClass * klass); +static void gst_camera_bin_base_init (gpointer klass); +static void gst_camera_bin_init (GstCameraBin * camera); +static void gst_camera_bin_dispose (GObject * object); +static void gst_camera_bin_finalize (GObject * object); + +GType +gst_camera_bin_get_type (void) +{ + static GType gst_camera_bin_type = 0; + + if (!gst_camera_bin_type) { + static const GTypeInfo gst_camera_bin_info = { + sizeof (GstCameraBinClass), + (GBaseInitFunc) gst_camera_bin_base_init, + NULL, + (GClassInitFunc) gst_camera_bin_class_init, + NULL, + NULL, + sizeof (GstCameraBin), + 0, + (GInstanceInitFunc) gst_camera_bin_init, + NULL + }; + + gst_camera_bin_type = + g_type_register_static (GST_TYPE_PIPELINE, "GstCameraBin2", + &gst_camera_bin_info, 0); + } + + return gst_camera_bin_type; +} + +/* Element class functions */ +static GstStateChangeReturn +gst_camera_bin_change_state (GstElement * element, GstStateChange trans); + +static void +gst_camera_bin_dispose (GObject * object) +{ + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static void +gst_camera_bin_finalize (GObject * object) +{ + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gst_camera_bin_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details_simple (element_class, "CameraBin2", + "Generic/Bin/Camera", "CameraBin2", + "Thiago Santos "); +} + +static void +gst_camera_bin_class_init (GstCameraBinClass * klass) +{ + GObjectClass *object_class; + GstElementClass *element_class; + + parent_class = g_type_class_peek_parent (klass); + object_class = G_OBJECT_CLASS (klass); + element_class = GST_ELEMENT_CLASS (klass); + + object_class->dispose = gst_camera_bin_dispose; + object_class->finalize = gst_camera_bin_finalize; + + element_class->change_state = GST_DEBUG_FUNCPTR (gst_camera_bin_change_state); +} + +static void +gst_camera_bin_init (GstCameraBin * camerabin) +{ +} + +static gboolean +gst_camera_bin_create_elements (GstCameraBin * camera) +{ + return TRUE; +} + +static GstStateChangeReturn +gst_camera_bin_change_state (GstElement * element, GstStateChange trans) +{ + GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; + GstCameraBin *camera = GST_CAMERA_BIN_CAST (element); + + switch (trans) { + case GST_STATE_CHANGE_NULL_TO_READY: + if (!gst_camera_bin_create_elements (camera)) { + return GST_STATE_CHANGE_FAILURE; + } + break; + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, trans); + + switch (trans) { + case GST_STATE_CHANGE_READY_TO_NULL: + break; + default: + break; + } + + return ret; +} + +gboolean +gst_camera_bin_plugin_init (GstPlugin * plugin) +{ + return gst_element_register (plugin, "camerabin2", GST_RANK_NONE, + gst_camera_bin_get_type ()); +} diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h new file mode 100644 index 0000000..c2927d3 --- /dev/null +++ b/gst/camerabin2/gstcamerabin2.h @@ -0,0 +1,55 @@ +/* GStreamer + * Copyright (C) 2010 Thiago Santos + * + * 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 _GST_CAMERA_BIN_H_ +#define _GST_CAMERA_BIN_H_ + +#include + +G_BEGIN_DECLS + +#define GST_TYPE_CAMERA_BIN (gst_camera_bin_get_type()) +#define GST_CAMERA_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERA_BIN,GstCameraBin)) +#define GST_CAMERA_BIN_CAST(obj) ((GstCameraBin *) obj) +#define GST_CAMERA_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERA_BIN,GstCameraBinClass)) +#define GST_IS_CAMERA_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERA_BIN)) +#define GST_IS_CAMERA_BIN_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERA_BIN)) + +typedef struct _GstCameraBin GstCameraBin; +typedef struct _GstCameraBinClass GstCameraBinClass; + +struct _GstCameraBin +{ + GstPipeline pipeline; + + GstPad *ghostpad; + + gboolean elements_created; +}; + +struct _GstCameraBinClass +{ + GstPipelineClass pipeline_class; +}; + +GType gst_camera_bin_get_type (void); +gboolean gst_camera_bin_plugin_init (GstPlugin * plugin); + +G_END_DECLS + +#endif diff --git a/gst/camerabin2/gstplugin.c b/gst/camerabin2/gstplugin.c index 872ad1e..517f9a6 100644 --- a/gst/camerabin2/gstplugin.c +++ b/gst/camerabin2/gstplugin.c @@ -27,6 +27,7 @@ #include "gstimagecapturebin.h" #include "gstvideorecordingbin.h" #include "gstv4l2camerasrc.h" +#include "gstcamerabin2.h" static gboolean plugin_init (GstPlugin * plugin) @@ -39,6 +40,8 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_v4l2_camera_src_plugin_init (plugin)) return FALSE; + if (!gst_camera_bin_plugin_init (plugin)) + return FALSE; return TRUE; } -- 2.7.4