2009-02-05 13:48:32 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
|
|
|
|
*
|
|
|
|
* 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_CAMERABIN_H__
|
|
|
|
#define __GST_CAMERABIN_H__
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gstbin.h>
|
|
|
|
#include <gst/interfaces/photography.h>
|
|
|
|
|
2009-10-28 10:47:19 +00:00
|
|
|
#include "gstcamerabin-enum.h"
|
2009-02-05 13:48:32 +00:00
|
|
|
#include "camerabinimage.h"
|
|
|
|
#include "camerabinvideo.h"
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
/* #defines don't like whitespacey bits */
|
|
|
|
#define GST_TYPE_CAMERABIN \
|
|
|
|
(gst_camerabin_get_type())
|
|
|
|
#define GST_CAMERABIN(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERABIN,GstCameraBin))
|
|
|
|
#define GST_CAMERABIN_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERABIN,GstCameraBinClass))
|
|
|
|
#define GST_IS_CAMERABIN(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERABIN))
|
|
|
|
#define GST_IS_CAMERABIN_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERABIN))
|
|
|
|
typedef struct _GstCameraBin GstCameraBin;
|
|
|
|
typedef struct _GstCameraBinClass GstCameraBinClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstCameraBin:
|
|
|
|
*
|
|
|
|
* The opaque #GstCameraBin structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _GstCameraBin
|
|
|
|
{
|
|
|
|
GstPipeline parent;
|
|
|
|
|
|
|
|
/* private */
|
|
|
|
GString *filename;
|
2009-10-28 10:47:19 +00:00
|
|
|
gint mode; /* MODE_IMAGE or MODE_VIDEO */
|
|
|
|
GstCameraBinFlags flags;
|
|
|
|
gboolean stop_requested; /* TRUE if capturing stop needed */
|
|
|
|
gboolean paused; /* TRUE if capturing paused */
|
2010-03-02 12:04:44 +00:00
|
|
|
gboolean block_viewfinder; /* TRUE if viewfinder blocks after capture */
|
2009-02-05 13:48:32 +00:00
|
|
|
|
2009-09-08 06:13:07 +00:00
|
|
|
/* Resolution of the buffers configured to camerabin */
|
2009-02-05 13:48:32 +00:00
|
|
|
gint width;
|
|
|
|
gint height;
|
2009-09-08 06:13:07 +00:00
|
|
|
/* Frames per second configured to camerabin */
|
2009-02-05 13:48:32 +00:00
|
|
|
gint fps_n;
|
|
|
|
gint fps_d;
|
|
|
|
|
2010-04-13 23:32:50 +00:00
|
|
|
gboolean video_capture_caps_update;
|
|
|
|
|
2009-08-20 14:55:26 +00:00
|
|
|
/* Image capture resolution */
|
2009-09-08 06:13:07 +00:00
|
|
|
gint image_capture_width;
|
|
|
|
gint image_capture_height;
|
2009-08-20 14:55:26 +00:00
|
|
|
|
2009-05-27 08:33:01 +00:00
|
|
|
/* Image tags are collected here first before sending to imgbin */
|
|
|
|
GstTagList *event_tags;
|
|
|
|
|
2009-02-05 13:48:32 +00:00
|
|
|
/* Caps applied to capsfilters when taking still image */
|
|
|
|
GstCaps *image_capture_caps;
|
2010-04-13 21:33:40 +00:00
|
|
|
gboolean image_capture_caps_update;
|
2009-02-05 13:48:32 +00:00
|
|
|
|
|
|
|
/* Caps applied to capsfilters when in view finder mode */
|
|
|
|
GstCaps *view_finder_caps;
|
|
|
|
|
|
|
|
/* Caps that videosrc supports */
|
|
|
|
GstCaps *allowed_caps;
|
|
|
|
|
2009-05-27 08:33:01 +00:00
|
|
|
/* Caps used to create preview image */
|
|
|
|
GstCaps *preview_caps;
|
|
|
|
|
2009-10-15 13:41:12 +00:00
|
|
|
/* Caps used to create video preview image */
|
|
|
|
GstCaps *video_preview_caps;
|
|
|
|
|
2009-02-05 13:48:32 +00:00
|
|
|
/* The digital zoom (from 100% to 1000%) */
|
|
|
|
gint zoom;
|
|
|
|
|
|
|
|
/* concurrency control */
|
|
|
|
GMutex *capture_mutex;
|
|
|
|
GCond *cond;
|
|
|
|
gboolean capturing;
|
2009-08-25 06:35:07 +00:00
|
|
|
gboolean eos_handled;
|
2009-02-05 13:48:32 +00:00
|
|
|
|
|
|
|
/* pad names for output and input selectors */
|
|
|
|
GstPad *pad_src_view;
|
|
|
|
GstPad *pad_view_src;
|
|
|
|
GstPad *pad_src_img;
|
|
|
|
GstPad *pad_src_vid;
|
|
|
|
GstPad *pad_view_vid;
|
2009-05-27 08:33:01 +00:00
|
|
|
GstPad *pad_src_queue;
|
2009-02-05 13:48:32 +00:00
|
|
|
|
2009-05-27 08:33:01 +00:00
|
|
|
GstElement *img_queue; /* queue for decoupling capture from
|
|
|
|
image-postprocessing and saving */
|
2009-02-05 13:48:32 +00:00
|
|
|
GstElement *imgbin; /* bin that holds image capturing elements */
|
|
|
|
GstElement *vidbin; /* bin that holds video capturing elements */
|
|
|
|
GstElement *active_bin; /* image or video bin that is currently in use */
|
2009-05-27 08:33:01 +00:00
|
|
|
GstElement *preview_pipeline; /* pipeline for creating preview images */
|
2009-10-15 13:41:12 +00:00
|
|
|
GstElement *video_preview_pipeline; /* pipeline for creating video preview image */
|
|
|
|
|
|
|
|
GstBuffer *video_preview_buffer; /* buffer for storing video preview */
|
2009-02-05 13:48:32 +00:00
|
|
|
|
|
|
|
/* source elements */
|
|
|
|
GstElement *src_vid_src;
|
|
|
|
GstElement *src_filter;
|
|
|
|
GstElement *src_zoom_crop;
|
|
|
|
GstElement *src_zoom_scale;
|
|
|
|
GstElement *src_zoom_filter;
|
|
|
|
GstElement *src_out_sel;
|
|
|
|
|
|
|
|
/* view finder elements */
|
|
|
|
GstElement *view_in_sel;
|
2009-02-20 10:08:04 +00:00
|
|
|
GstElement *aspect_filter;
|
2009-02-05 13:48:32 +00:00
|
|
|
GstElement *view_scale;
|
|
|
|
GstElement *view_sink;
|
|
|
|
|
2009-07-02 15:03:57 +00:00
|
|
|
/* Application configurable elements */
|
|
|
|
GstElement *app_vid_src;
|
|
|
|
GstElement *app_vf_sink;
|
2009-09-16 12:11:49 +00:00
|
|
|
GstElement *app_video_filter;
|
2009-10-19 11:31:54 +00:00
|
|
|
GstElement *app_viewfinder_filter;
|
2009-02-05 13:48:32 +00:00
|
|
|
|
|
|
|
/* Night mode handling */
|
|
|
|
gboolean night_mode;
|
|
|
|
gint pre_night_fps_n;
|
|
|
|
gint pre_night_fps_d;
|
2009-04-20 14:06:14 +00:00
|
|
|
|
2009-05-27 08:33:01 +00:00
|
|
|
/* Buffer probe id for captured image handling */
|
|
|
|
gulong image_captured_id;
|
2009-09-08 06:13:07 +00:00
|
|
|
|
|
|
|
/* Optional base crop for frames. Used to crop frames e.g.
|
|
|
|
due to wrong aspect ratio, before the crop related to zooming. */
|
|
|
|
gint base_crop_top;
|
|
|
|
gint base_crop_bottom;
|
|
|
|
gint base_crop_left;
|
|
|
|
gint base_crop_right;
|
2009-02-05 13:48:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstCameraBinClass:
|
|
|
|
*
|
|
|
|
* The #GstCameraBin class structure.
|
|
|
|
*/
|
|
|
|
struct _GstCameraBinClass
|
|
|
|
{
|
|
|
|
GstPipelineClass parent_class;
|
|
|
|
|
|
|
|
/* action signals */
|
|
|
|
|
2009-07-02 15:03:57 +00:00
|
|
|
void (*capture_start) (GstCameraBin * camera);
|
|
|
|
void (*capture_stop) (GstCameraBin * camera);
|
|
|
|
void (*capture_pause) (GstCameraBin * camera);
|
|
|
|
void (*set_video_resolution_fps) (GstCameraBin * camera, gint width,
|
|
|
|
gint height, gint fps_n, gint fps_d);
|
|
|
|
void (*set_image_resolution) (GstCameraBin * camera, gint width, gint height);
|
2009-02-05 13:48:32 +00:00
|
|
|
|
|
|
|
/* signals (callback) */
|
|
|
|
|
2009-09-08 06:13:07 +00:00
|
|
|
gboolean (*img_done) (GstCameraBin * camera, const gchar * filename);
|
2009-02-05 13:48:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstCameraBinMode:
|
|
|
|
* @MODE_IMAGE: image capture
|
|
|
|
* @MODE_VIDEO: video capture
|
|
|
|
*
|
|
|
|
* Capture mode to use.
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
MODE_IMAGE = 0,
|
|
|
|
MODE_VIDEO
|
|
|
|
} GstCameraBinMode;
|
|
|
|
|
|
|
|
GType gst_camerabin_get_type (void);
|
|
|
|
|
|
|
|
G_END_DECLS
|
2009-09-08 06:13:07 +00:00
|
|
|
#endif /* #ifndef __GST_CAMERABIN_H__ */
|