2010-11-25 16:00:50 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2010 Texas Instruments, Inc
|
|
|
|
*
|
|
|
|
* 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_BASE_CAMERA_SRC_H__
|
|
|
|
#define __GST_BASE_CAMERA_SRC_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/gstbin.h>
|
|
|
|
#include <gst/interfaces/photography.h>
|
|
|
|
#include <gst/interfaces/colorbalance.h>
|
|
|
|
#include "gstcamerabin-enum.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))
|
2010-12-04 13:15:34 +00:00
|
|
|
#define GST_BASE_CAMERA_SRC_CAST(obj) \
|
|
|
|
((GstBaseCameraSrc *) (obj))
|
|
|
|
GType gst_base_camera_src_get_type (void);
|
2010-11-25 16:00:50 +00:00
|
|
|
|
|
|
|
typedef struct _GstBaseCameraSrc GstBaseCameraSrc;
|
|
|
|
typedef struct _GstBaseCameraSrcClass GstBaseCameraSrcClass;
|
|
|
|
|
2010-12-07 22:40:28 +00:00
|
|
|
#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"
|
2010-11-25 16:00:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstBaseCameraSrc:
|
|
|
|
*/
|
|
|
|
struct _GstBaseCameraSrc
|
|
|
|
{
|
|
|
|
GstBin parent;
|
|
|
|
|
2010-12-09 10:22:26 +00:00
|
|
|
GstCameraBinMode mode;
|
2010-12-04 13:15:34 +00:00
|
|
|
|
2010-12-05 14:18:09 +00:00
|
|
|
gboolean capturing;
|
|
|
|
GMutex *capturing_mutex;
|
|
|
|
|
2010-11-25 16:00:50 +00:00
|
|
|
/* XXX preview pads? */
|
|
|
|
|
|
|
|
/* Resolution of the buffers configured to camerabin */
|
|
|
|
gint width;
|
|
|
|
gint height;
|
|
|
|
|
|
|
|
/* The digital zoom (from 100% to 1000%) */
|
|
|
|
gint zoom;
|
|
|
|
|
|
|
|
/* Image capture resolution */
|
|
|
|
gint image_capture_width;
|
|
|
|
gint image_capture_height;
|
|
|
|
|
|
|
|
/* Frames per second configured to camerabin */
|
|
|
|
gint fps_n;
|
|
|
|
gint fps_d;
|
|
|
|
|
|
|
|
/* Night mode handling */
|
|
|
|
gboolean night_mode;
|
|
|
|
gint pre_night_fps_n;
|
|
|
|
gint pre_night_fps_d;
|
|
|
|
|
|
|
|
gpointer _gst_reserved[GST_PADDING_LARGE];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstBaseCameraSrcClass:
|
2010-12-09 10:23:01 +00:00
|
|
|
* @construct_pipeline: construct pipeline must be implemented by derived class
|
|
|
|
* @setup_pipeline: configure pipeline for the chosen settings
|
2010-11-25 16:00:50 +00:00
|
|
|
* @set_zoom: set the zoom
|
|
|
|
* @set_mode: set the mode
|
|
|
|
*/
|
|
|
|
struct _GstBaseCameraSrcClass
|
|
|
|
{
|
|
|
|
GstBinClass parent;
|
|
|
|
|
2010-12-07 22:40:28 +00:00
|
|
|
/* construct pipeline must be implemented by derived class */
|
|
|
|
gboolean (*construct_pipeline) (GstBaseCameraSrc *self);
|
2010-11-25 16:00:50 +00:00
|
|
|
|
|
|
|
/* optional */
|
|
|
|
gboolean (*setup_pipeline) (GstBaseCameraSrc *self);
|
|
|
|
|
|
|
|
/* set the zoom */
|
|
|
|
void (*set_zoom) (GstBaseCameraSrc *self, gint zoom);
|
|
|
|
|
|
|
|
/* set the mode */
|
|
|
|
gboolean (*set_mode) (GstBaseCameraSrc *self,
|
|
|
|
GstCameraBinMode mode);
|
|
|
|
|
|
|
|
/* */
|
|
|
|
GstCaps * (*get_allowed_input_caps) (GstBaseCameraSrc * self);
|
|
|
|
|
2010-12-05 14:18:09 +00:00
|
|
|
void (*private_start_capture) (GstBaseCameraSrc * src);
|
|
|
|
void (*private_stop_capture) (GstBaseCameraSrc * src);
|
|
|
|
gboolean (*start_capture) (GstBaseCameraSrc * src);
|
|
|
|
void (*stop_capture) (GstBaseCameraSrc * src);
|
|
|
|
|
2010-11-25 16:00:50 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING_LARGE];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define MIN_ZOOM 100
|
|
|
|
#define MAX_ZOOM 1000
|
|
|
|
#define ZOOM_1X MIN_ZOOM
|
|
|
|
|
|
|
|
GstPhotography * gst_base_camera_src_get_photography (GstBaseCameraSrc *self);
|
|
|
|
GstColorBalance * gst_base_camera_src_get_color_balance (GstBaseCameraSrc *self);
|
|
|
|
|
|
|
|
gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode);
|
|
|
|
void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self);
|
|
|
|
GstCaps * gst_base_camera_src_get_allowed_input_caps (GstBaseCameraSrc * self);
|
|
|
|
const GValue * gst_base_camera_src_find_better_framerate (
|
|
|
|
GstBaseCameraSrc * self, GstStructure * st, const GValue * orig_framerate);
|
|
|
|
|
2010-12-05 14:18:09 +00:00
|
|
|
void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self);
|
|
|
|
|
|
|
|
|
2010-11-25 16:00:50 +00:00
|
|
|
// XXX add methods to get/set img capture and vid capture caps..
|
|
|
|
|
|
|
|
#endif /* __GST_BASE_CAMERA_SRC_H__ */
|