4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
8 * This library is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; either version 2.1 of the License, or (at your option)
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 * License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software Foundation, Inc., 51
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef __GSTCAMERASRC_H__
25 #define __GSTCAMERASRC_H__
28 #include <gst/base/gstpushsrc.h>
34 #include <gst/interfaces/colorbalance.h>
35 #include <gst/interfaces/cameracontrol.h>
37 #include "camerasrc.h"
39 #ifndef _SPEED_UP_RAW_CAPTURE
41 #define _SPEED_UP_RAW_CAPTURE
43 #endif /* _SPEED_UP_RAW_CAPTURE */
46 #define GST_TYPE_CAMERA_SRC (gst_camerasrc_get_type())
47 #define GST_CAMERA_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERA_SRC,GstCameraSrc))
48 #define GST_CAMERA_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERA_SRC,GstCameraSrcClass))
49 #define GST_IS_CAMERA_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERA_SRC))
50 #define GST_IS_CAMERA_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERA_SRC))
57 GST_CAMERASRC_QUALITY_LOW, /**< Low quality */
58 GST_CAMERASRC_QUALITY_HIGH, /**< High quality */
59 } GstCameraSrcQuality;
61 #define MAX_USR_BUFFER_NUM 12
63 typedef struct _GstCameraSrc GstCameraSrc;
64 typedef struct _GstCameraSrcClass GstCameraSrcClass;
65 typedef struct _GstCameraBuffer GstCameraBuffer;
68 struct _GstCameraBuffer {
70 int v4l2_buffer_index;
71 GstCameraSrc *camerasrc;
72 gboolean is_alloc_data;
80 void *v4l2_handle; /**< video4linux2 handle */
82 int sensor_mode; /**< sensor mode - camera or movie(camcorder) */
83 gboolean vflip; /**< flip camera input vertically */
84 gboolean hflip; /**< flip camera input horizontally */
88 int cap_count_current; /**< current capture count */
89 int cap_count_reverse; /**< current capture count (reverse counting) */
90 unsigned long cap_next_time; /**< next shot time for capture */
91 GQueue *command_list; /**< Command list(Start capture, Stop capture) queue */
97 int width; /**< Width */
98 int height; /**< Height */
99 int fps; /**< Video source fps */
101 guint32 fourcc; /**< Four CC */
102 int pix_format; /**< Image format of video source */
103 int colorspace; /**< Colorspace of video source */
104 int high_speed_fps; /**< Video source fps for high speed recording */
105 gboolean fps_auto; /**< Auto Video source fps */
107 gboolean req_negotiation; /**< Video source fps for high speed recording */
109 int rotate; /**< Video source rotate */
110 gboolean use_rotate_caps; /**< Use or not rotate value in caps */
111 int external_videofd; /**< video FD from external module */
115 gboolean buffer_running; /* with lock */
116 gint num_live_buffers; /* with lock */
118 gboolean bfirst; /* temp */
119 #ifdef _SPEED_UP_RAW_CAPTURE
120 gboolean cap_stream_diff; /* whether preview and capture streams are different each other */
122 GQueue *pad_alloc_list;
123 GMutex *pad_alloc_mutex;
124 gint current_buffer_data_index;
125 gboolean first_invokation;
127 GstBuffer *usr_buffer[MAX_USR_BUFFER_NUM];
128 gboolean use_pad_alloc;
131 /* Colorbalance , CameraControl interface */
133 GList *camera_controls;
137 guint32 cap_fourcc; /**< gstreamer fourcc value(GST_MAKE_FOURCC format) for raw capturing */
138 GstCameraSrcQuality cap_quality; /**< Capture quality */
139 int cap_width; /**< Capture width */
140 int cap_height; /**< Capture height */
141 int cap_interval; /**< Capture interval */
142 int cap_count; /**< Capture count */
143 int cap_jpg_quality; /**< Capture quality for jpg compress ratio */
144 gboolean cap_provide_exif; /**< Is exif provided? */
147 gboolean signal_still_capture; /**< enable still capture signal */
148 gboolean hold_af_after_capturing; /**< Whether to hold af after capturing */
149 gboolean create_jpeg;
153 struct _GstCameraSrcClass {
154 GstPushSrcClass parent_class;
156 void (*still_capture) (GstElement *element, GstBuffer *main, GstBuffer *sub, GstBuffer *scrnl);
157 void (*nego_complete) (GstElement *element);
158 void (*register_trouble) (GstElement *element);
163 INTERFACE_COLOR_BALANCE,
164 INTERFACE_CAMERA_CONTROL,
168 void gst_camerasrc_set_capture_command(GstCameraSrc* camerasrc, GstCameraControlCaptureCommand cmd);
171 GType gst_camerasrc_get_type(void);
175 #endif /* __GSTCAMERASRC_H__ */