2010-11-26 13:14:46 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2011-07-07 22:55:59 +00:00
|
|
|
#ifndef _GST_CAMERA_BIN2_H_
|
|
|
|
#define _GST_CAMERA_BIN2_H_
|
2010-11-26 13:14:46 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2011-01-11 12:12:24 +00:00
|
|
|
#include <gst/pbutils/encoding-profile.h>
|
2010-11-26 13:14:46 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-07-07 22:55:59 +00:00
|
|
|
#define GST_TYPE_CAMERA_BIN2 (gst_camera_bin2_get_type())
|
|
|
|
#define GST_CAMERA_BIN2(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERA_BIN2,GstCameraBin2))
|
|
|
|
#define GST_CAMERA_BIN2_CAST(obj) ((GstCameraBin2 *) obj)
|
|
|
|
#define GST_CAMERA_BIN2_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERA_BIN2,GstCameraBin2Class))
|
|
|
|
#define GST_IS_CAMERA_BIN2(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERA_BIN2))
|
|
|
|
#define GST_IS_CAMERA_BIN2_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERA_BIN2))
|
2010-11-26 13:14:46 +00:00
|
|
|
|
2011-06-30 09:09:44 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
/* matches GstEncFlags GST_ENC_FLAG_NO_AUDIO_CONVERSION in encodebin */
|
|
|
|
GST_CAM_FLAG_NO_AUDIO_CONVERSION = (1 << 0),
|
|
|
|
/* matches GstEncFlags GST_ENC_FLAG_NO_VIDEO_CONVERSION in encodebin */
|
2011-08-23 14:58:33 +00:00
|
|
|
GST_CAM_FLAG_NO_VIDEO_CONVERSION = (1 << 1),
|
|
|
|
/* maps to 'disable-converters' property in viewfinderbin */
|
2011-09-01 13:57:50 +00:00
|
|
|
GST_CAM_FLAG_NO_VIEWFINDER_CONVERSION = (1 << 2),
|
|
|
|
/* maps to GstEncFlags GST_ENC_FLAG_NO_VIDEO_CONVERSION in the image bin's
|
|
|
|
* encodebin */
|
|
|
|
GST_CAM_FLAG_NO_IMAGE_CONVERSION = (1 << 3)
|
2011-06-30 09:09:44 +00:00
|
|
|
} GstCamFlags;
|
|
|
|
|
|
|
|
|
2011-11-10 19:11:56 +00:00
|
|
|
typedef enum _GstCameraBinVideoState
|
|
|
|
{
|
|
|
|
GST_CAMERA_BIN_VIDEO_IDLE=0,
|
|
|
|
GST_CAMERA_BIN_VIDEO_STARTING=1,
|
|
|
|
GST_CAMERA_BIN_VIDEO_RECORDING=2,
|
|
|
|
GST_CAMERA_BIN_VIDEO_FINISHING=3
|
|
|
|
} GstCameraBinVideoState;
|
|
|
|
|
2011-07-07 22:55:59 +00:00
|
|
|
typedef struct _GstCameraBin2 GstCameraBin2;
|
|
|
|
typedef struct _GstCameraBin2Class GstCameraBin2Class;
|
2010-11-26 13:14:46 +00:00
|
|
|
|
2011-07-07 22:55:59 +00:00
|
|
|
struct _GstCameraBin2
|
2010-11-26 13:14:46 +00:00
|
|
|
{
|
|
|
|
GstPipeline pipeline;
|
|
|
|
|
2010-11-26 20:24:58 +00:00
|
|
|
GstElement *src;
|
2010-12-13 19:36:19 +00:00
|
|
|
GstElement *user_src;
|
2010-11-30 21:19:20 +00:00
|
|
|
gulong src_capture_notify_id;
|
|
|
|
|
2011-04-28 13:11:36 +00:00
|
|
|
GstElement *video_encodebin;
|
|
|
|
gulong video_encodebin_signal_id;
|
2010-12-27 14:29:42 +00:00
|
|
|
GstElement *videosink;
|
2010-12-13 14:53:59 +00:00
|
|
|
GstElement *videobin_capsfilter;
|
2010-12-04 03:27:17 +00:00
|
|
|
|
2010-12-13 14:53:59 +00:00
|
|
|
GstElement *viewfinderbin;
|
|
|
|
GstElement *viewfinderbin_queue;
|
|
|
|
GstElement *viewfinderbin_capsfilter;
|
2010-12-10 15:08:48 +00:00
|
|
|
|
2011-04-28 13:11:36 +00:00
|
|
|
GstElement *image_encodebin;
|
|
|
|
gulong image_encodebin_signal_id;
|
|
|
|
GstElement *imagesink;
|
2010-12-13 14:53:59 +00:00
|
|
|
GstElement *imagebin_capsfilter;
|
2010-11-30 23:13:27 +00:00
|
|
|
|
2011-01-26 18:27:19 +00:00
|
|
|
GstElement *video_filter;
|
|
|
|
GstElement *image_filter;
|
|
|
|
GstElement *viewfinder_filter;
|
2011-08-11 21:59:07 +00:00
|
|
|
GstElement *audio_filter;
|
2011-01-26 18:27:19 +00:00
|
|
|
GstElement *user_video_filter;
|
|
|
|
GstElement *user_image_filter;
|
|
|
|
GstElement *user_viewfinder_filter;
|
2011-08-11 21:59:07 +00:00
|
|
|
GstElement *user_audio_filter;
|
2011-01-26 18:27:19 +00:00
|
|
|
|
2011-01-20 12:34:39 +00:00
|
|
|
GstElement *audio_src;
|
|
|
|
GstElement *user_audio_src;
|
2011-01-21 13:56:52 +00:00
|
|
|
GstElement *audio_volume;
|
2011-01-20 12:34:39 +00:00
|
|
|
GstElement *audio_capsfilter;
|
|
|
|
|
2011-03-15 18:11:01 +00:00
|
|
|
gint processing_counter; /* atomic int */
|
|
|
|
|
2011-06-22 19:27:00 +00:00
|
|
|
/* Index of the auto incrementing file index for captures */
|
2011-06-22 21:58:29 +00:00
|
|
|
gint capture_index;
|
2011-06-22 19:27:00 +00:00
|
|
|
|
2011-11-09 15:21:37 +00:00
|
|
|
GMutex *image_capture_mutex;
|
2011-06-22 19:27:00 +00:00
|
|
|
/* stores list of image locations to be pushed to the image sink
|
|
|
|
* as file location change notifications, they are pushed before
|
|
|
|
* each buffer capture */
|
|
|
|
GSList *image_location_list;
|
2011-11-09 12:41:44 +00:00
|
|
|
/* Store also tags and push them before each captured image */
|
|
|
|
GSList *image_tags_list;
|
2010-11-26 20:24:58 +00:00
|
|
|
|
2011-10-12 02:13:00 +00:00
|
|
|
/*
|
|
|
|
* Similar to above, but used for giving names to previews
|
|
|
|
*
|
|
|
|
* Need to protect with a mutex as this list is used when the
|
|
|
|
* camera-source posts a preview image. As we have no control
|
|
|
|
* on how the camera-source will behave (we can only tell how
|
|
|
|
* it should), the preview location list might be used in an
|
|
|
|
* inconsistent way.
|
|
|
|
* One example is the camera-source posting a preview image after
|
|
|
|
* camerabin2 was put to ready, when this preview list will be
|
|
|
|
* freed and set to NULL. Concurrent access might lead to crashes in
|
|
|
|
* this situation. (Concurrency from the state-change freeing the
|
|
|
|
* list and the message handling function looking at preview names)
|
|
|
|
*/
|
2011-09-29 21:03:25 +00:00
|
|
|
GSList *preview_location_list;
|
2011-10-12 02:13:00 +00:00
|
|
|
GMutex *preview_list_mutex;
|
2011-09-29 21:03:25 +00:00
|
|
|
|
2011-04-28 13:11:36 +00:00
|
|
|
gboolean video_profile_switch;
|
|
|
|
gboolean image_profile_switch;
|
2011-03-11 19:20:52 +00:00
|
|
|
|
2011-08-21 17:41:28 +00:00
|
|
|
gboolean audio_drop_eos;
|
|
|
|
|
2011-11-10 19:11:56 +00:00
|
|
|
GMutex *video_capture_mutex;
|
2011-11-10 19:53:40 +00:00
|
|
|
GCond *video_state_cond;
|
2011-11-10 19:11:56 +00:00
|
|
|
GstCameraBinVideoState video_state;
|
|
|
|
|
2010-11-26 20:24:58 +00:00
|
|
|
/* properties */
|
|
|
|
gint mode;
|
2011-06-22 21:58:29 +00:00
|
|
|
gchar *location;
|
2010-12-30 03:27:03 +00:00
|
|
|
gboolean post_previews;
|
|
|
|
GstCaps *preview_caps;
|
2011-01-27 17:39:19 +00:00
|
|
|
GstElement *preview_filter;
|
2011-01-11 12:12:24 +00:00
|
|
|
GstEncodingProfile *video_profile;
|
2011-04-28 13:11:36 +00:00
|
|
|
GstEncodingProfile *image_profile;
|
2011-03-08 08:43:58 +00:00
|
|
|
gfloat zoom;
|
2011-03-18 14:49:12 +00:00
|
|
|
gfloat max_zoom;
|
2011-06-30 09:09:44 +00:00
|
|
|
GstCamFlags flags;
|
2010-11-26 13:14:46 +00:00
|
|
|
|
|
|
|
gboolean elements_created;
|
|
|
|
};
|
|
|
|
|
2011-07-07 22:55:59 +00:00
|
|
|
struct _GstCameraBin2Class
|
2010-11-26 13:14:46 +00:00
|
|
|
{
|
|
|
|
GstPipelineClass pipeline_class;
|
2010-11-26 20:24:58 +00:00
|
|
|
|
|
|
|
/* Action signals */
|
2011-07-07 22:55:59 +00:00
|
|
|
void (*start_capture) (GstCameraBin2 * camera);
|
|
|
|
void (*stop_capture) (GstCameraBin2 * camera);
|
2010-11-26 13:14:46 +00:00
|
|
|
};
|
|
|
|
|
2011-07-07 22:55:59 +00:00
|
|
|
GType gst_camera_bin2_get_type (void);
|
|
|
|
gboolean gst_camera_bin2_plugin_init (GstPlugin * plugin);
|
2010-11-26 13:14:46 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif
|