From 5323a782c4e8c42781f22ce2f488962a18f82554 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 3 Aug 2022 21:02:36 +0300 Subject: Jabber: initial version of Jingle support --- .../basecamerabinsrc/basecamerabinsrc-prelude.h | 35 +++++ include/gst/basecamerabinsrc/gstbasecamerasrc.h | 159 +++++++++++++++++++++ include/gst/basecamerabinsrc/gstcamerabin-enum.h | 68 +++++++++ include/gst/basecamerabinsrc/gstcamerabinpreview.h | 69 +++++++++ 4 files changed, 331 insertions(+) create mode 100644 include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h create mode 100644 include/gst/basecamerabinsrc/gstbasecamerasrc.h create mode 100644 include/gst/basecamerabinsrc/gstcamerabin-enum.h create mode 100644 include/gst/basecamerabinsrc/gstcamerabinpreview.h (limited to 'include/gst/basecamerabinsrc') diff --git a/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h b/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h new file mode 100644 index 0000000000..ec9a766085 --- /dev/null +++ b/include/gst/basecamerabinsrc/basecamerabinsrc-prelude.h @@ -0,0 +1,35 @@ +/* GStreamer BaseCameraBinSrc Library + * Copyright (C) 2018 GStreamer developers + * + * basecamerasrc-prelude.h: prelude include header for gst-basecamerasrc library + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__ +#define __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__ + +#include + +#ifndef GST_BASE_CAMERA_BIN_SRC_API +# ifdef BUILDING_GST_BASE_CAMERA_BIN_SRC +# define GST_BASE_CAMERA_BIN_SRC_API GST_API_EXPORT /* from config.h */ +# else +# define GST_BASE_CAMERA_BIN_SRC_API GST_API_IMPORT +# endif +#endif + +#endif /* __GST_BASE_CAMERA_BIN_SRC_PRELUDE_H__ */ diff --git a/include/gst/basecamerabinsrc/gstbasecamerasrc.h b/include/gst/basecamerabinsrc/gstbasecamerasrc.h new file mode 100644 index 0000000000..9318c01c68 --- /dev/null +++ b/include/gst/basecamerabinsrc/gstbasecamerasrc.h @@ -0,0 +1,159 @@ +/* + * GStreamer + * Copyright (C) 2010 Texas Instruments, Inc + * Copyright (C) 2011 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef __GST_BASE_CAMERA_SRC_H__ +#define __GST_BASE_CAMERA_SRC_H__ + +#ifndef GST_USE_UNSTABLE_API +#warning "GstBaseCameraSrc is unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + +#include +#include +#include "basecamerabinsrc-prelude.h" +#include "gstcamerabin-enum.h" +#include "gstcamerabinpreview.h" + +G_BEGIN_DECLS + +#define GST_TYPE_BASE_CAMERA_SRC \ + (gst_base_camera_src_get_type()) +#define GST_BASE_CAMERA_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrc)) +#define GST_BASE_CAMERA_SRC_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_BASE_CAMERA_SRC, GstBaseCameraSrcClass)) +#define GST_BASE_CAMERA_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_CAMERA_SRC,GstBaseCameraSrcClass)) +#define GST_IS_BASE_CAMERA_SRC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_CAMERA_SRC)) +#define GST_IS_BASE_CAMERA_SRC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_CAMERA_SRC)) +#define GST_BASE_CAMERA_SRC_CAST(obj) \ + ((GstBaseCameraSrc *) (obj)) +GST_BASE_CAMERA_BIN_SRC_API +GType gst_base_camera_src_get_type (void); + +typedef struct _GstBaseCameraSrc GstBaseCameraSrc; +typedef struct _GstBaseCameraSrcClass GstBaseCameraSrcClass; + +#define GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME "vfsrc" +#define GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME "imgsrc" +#define GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME "vidsrc" + +#define GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME "preview-image" + +/** + * GstBaseCameraSrc: + */ +struct _GstBaseCameraSrc +{ + GstBin parent; + + GstCameraBinMode mode; + + gboolean auto_start; + gboolean capturing; + GMutex capturing_mutex; + + /* Preview convert pipeline */ + GstCaps *preview_caps; + gboolean post_preview; + GstElement *preview_filter; + GstCameraBinPreviewPipelineData *preview_pipeline; + + /* Resolution of the buffers configured to camerabin */ + gint width; + gint height; + + gfloat zoom; + gfloat max_zoom; + + gpointer _gst_reserved[GST_PADDING_LARGE]; +}; + + +/** + * GstBaseCameraSrcClass: + * @construct_pipeline: construct pipeline + * @setup_pipeline: configure pipeline for the chosen settings + * @set_zoom: set the zoom + * @set_mode: set the mode + */ +struct _GstBaseCameraSrcClass +{ + GstBinClass parent; + + /* Construct pipeline. (called in GST_STATE_CHANGE_NULL_TO_READY) Optional. */ + gboolean (*construct_pipeline) (GstBaseCameraSrc *self); + + /* (called in GST_STATE_CHANGE_READY_TO_PAUSED). Optional. */ + gboolean (*setup_pipeline) (GstBaseCameraSrc *self); + + /* Set the zoom. If set, called when changing 'zoom' property. Optional. */ + void (*set_zoom) (GstBaseCameraSrc *self, gfloat zoom); + + /* Set the mode. If set, called when changing 'mode' property. Optional. */ + gboolean (*set_mode) (GstBaseCameraSrc *self, + GstCameraBinMode mode); + + /* Set preview caps. If set, called called when setting new 'preview-caps'. Optional. */ + gboolean (*set_preview) (GstBaseCameraSrc *self, + GstCaps *preview_caps); + + /* Called by the handler for 'start-capture'. Mandatory. */ + gboolean (*start_capture) (GstBaseCameraSrc * src); + + /* Called by the handler for 'stop-capture'. Mandatory. */ + void (*stop_capture) (GstBaseCameraSrc * src); + + gpointer _gst_reserved[GST_PADDING_LARGE]; +}; + + +/* FIXME: these should be properly namespaced if they're meant as exposed API */ +#ifndef __GI_SCANNER__ +#define MIN_ZOOM 1.0f +#define MAX_ZOOM 10.0f +#define ZOOM_1X MIN_ZOOM +#endif /* !__GI_SCANNER__ */ + +GST_BASE_CAMERA_BIN_SRC_API +gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode); + +GST_BASE_CAMERA_BIN_SRC_API +void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self); + +GST_BASE_CAMERA_BIN_SRC_API +void gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, GstCaps * preview_caps); + +GST_BASE_CAMERA_BIN_SRC_API +void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self); + + +GST_BASE_CAMERA_BIN_SRC_API +void gst_base_camera_src_post_preview (GstBaseCameraSrc *self, GstSample * sample); +// XXX add methods to get/set img capture and vid capture caps.. + +G_END_DECLS + +#endif /* __GST_BASE_CAMERA_SRC_H__ */ diff --git a/include/gst/basecamerabinsrc/gstcamerabin-enum.h b/include/gst/basecamerabinsrc/gstcamerabin-enum.h new file mode 100644 index 0000000000..bba15c0b1f --- /dev/null +++ b/include/gst/basecamerabinsrc/gstcamerabin-enum.h @@ -0,0 +1,68 @@ +/* + * GStreamer + * Copyright (C) 2009 Nokia Corporation + * + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GST_CAMERABIN_ENUM_H__ +#define __GST_CAMERABIN_ENUM_H__ + +#ifndef GST_USE_UNSTABLE_API +#warning "camerabin enums are unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + +#include +#include "basecamerabinsrc-prelude.h" + +G_BEGIN_DECLS + +/* FIXME: these should be properly namespaced if they're meant as exposed API */ +#ifndef __GI_SCANNER__ +#define DEFAULT_WIDTH 640 +#define DEFAULT_HEIGHT 480 +#define DEFAULT_CAPTURE_WIDTH 800 +#define DEFAULT_CAPTURE_HEIGHT 600 +#define DEFAULT_FPS_N 0 /* makes it use the default */ +#define DEFAULT_FPS_D 1 +#define DEFAULT_ZOOM MIN_ZOOM +#endif /* !__GI_SCANNER__ */ + + +/* FIXME: properly namespace these enums */ +/** + * GstCameraBinMode: + * @MODE_IMAGE: image capture + * @MODE_VIDEO: video capture + * + * Capture mode to use. + */ +typedef enum +{ + /* MODE_PREVIEW = 0, No use for this */ + MODE_IMAGE = 1, + MODE_VIDEO = 2, +} GstCameraBinMode; + +/* FIXME: should be CAMERA_BIN_MODE and camera_bin_mode */ +#define GST_TYPE_CAMERABIN_MODE (gst_camerabin_mode_get_type ()) +GST_BASE_CAMERA_BIN_SRC_API +GType gst_camerabin_mode_get_type (void); + +G_END_DECLS + +#endif /* #ifndef __GST_CAMERABIN_ENUM_H__ */ diff --git a/include/gst/basecamerabinsrc/gstcamerabinpreview.h b/include/gst/basecamerabinsrc/gstcamerabinpreview.h new file mode 100644 index 0000000000..a0f3c0f0ce --- /dev/null +++ b/include/gst/basecamerabinsrc/gstcamerabinpreview.h @@ -0,0 +1,69 @@ +/* + * GStreamer + * Copyright (C) 2008 Nokia Corporation + * 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., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __CAMERABIN_PREVIEW_H_ +#define __CAMERABIN_PREVIEW_H_ + +#ifndef GST_USE_UNSTABLE_API +#warning "camera bin preview is unstable API and may change in future." +#warning "You can define GST_USE_UNSTABLE_API to avoid this warning." +#endif + +#include +#include "basecamerabinsrc-prelude.h" + +/** + * GstCameraBinPreviewPipelineData: (skip) + */ +typedef struct +{ + GstElement *pipeline; + + GstElement *appsrc; + GstElement *filter; + GstElement *appsink; + GstElement *vscale; + + GstElement *element; + + GstCaps *pending_preview_caps; + guint processing; + GMutex processing_lock; + GCond processing_cond; + +} GstCameraBinPreviewPipelineData; + +GST_BASE_CAMERA_BIN_SRC_API +GstCameraBinPreviewPipelineData *gst_camerabin_create_preview_pipeline (GstElement * element, GstElement * filter); + +GST_BASE_CAMERA_BIN_SRC_API +void gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData * preview); + +GST_BASE_CAMERA_BIN_SRC_API +gboolean gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview, GstSample * sample); + +GST_BASE_CAMERA_BIN_SRC_API +void gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview, GstCaps * caps); + +GST_BASE_CAMERA_BIN_SRC_API +gboolean gst_camerabin_preview_set_filter (GstCameraBinPreviewPipelineData * preview, GstElement * filter); + +#endif /* #ifndef __CAMERABIN_PREVIEW_H_ */ -- cgit v1.2.3