1 /*
2  * GStreamer
3  * Copyright (C) 2010 Texas Instruments, Inc
4  * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 
23 #ifndef __GST_WRAPPER_CAMERA_BIN_SRC_H__
24 #define __GST_WRAPPER_CAMERA_BIN_SRC_H__
25 
26 #include <gst/gst.h>
27 #include <gst/basecamerabinsrc/gstbasecamerasrc.h>
28 #include <gst/basecamerabinsrc/gstcamerabinpreview.h>
29 #include "camerabingeneral.h"
30 
31 G_BEGIN_DECLS
32 
33 #define GST_TYPE_WRAPPER_CAMERA_BIN_SRC \
34   (gst_wrapper_camera_bin_src_get_type())
35 #define GST_WRAPPER_CAMERA_BIN_SRC(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_WRAPPER_CAMERA_BIN_SRC,GstWrapperCameraBinSrc))
37 #define GST_WRAPPER_CAMERA_BIN_SRC_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_WRAPPER_CAMERA_BIN_SRC,GstWrapperCameraBinSrcClass))
39 #define GST_IS_WRAPPER_CAMERA_BIN_SRC(obj) \
40   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_WRAPPER_CAMERA_BIN_SRC))
41 #define GST_IS_WRAPPER_CAMERA_BIN_SRC_CLASS(klass) \
42   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_WRAPPER_CAMERA_BIN_SRC))
43     GType gst_wrapper_camera_bin_src_get_type (void);
44 
45 typedef struct _GstWrapperCameraBinSrc GstWrapperCameraBinSrc;
46 typedef struct _GstWrapperCameraBinSrcClass GstWrapperCameraBinSrcClass;
47 
48 enum GstVideoRecordingStatus {
49   GST_VIDEO_RECORDING_STATUS_DONE,
50   GST_VIDEO_RECORDING_STATUS_STARTING,
51   GST_VIDEO_RECORDING_STATUS_RUNNING,
52   GST_VIDEO_RECORDING_STATUS_FINISHING
53 };
54 
55 
56 /**
57  * GstWrapperCameraBinSrc:
58  *
59  */
60 struct _GstWrapperCameraBinSrc
61 {
62   GstBaseCameraSrc parent;
63 
64   GstCameraBinMode mode;
65 
66   GstPad *srcfilter_pad;
67   GstPad *vfsrc;
68   GstPad *imgsrc;
69   GstPad *vidsrc;
70 
71   /* video recording controls */
72   gint video_rec_status;
73 
74   /* image capture controls */
75   gint image_capture_count;
76 
77   /* source elements */
78   GstElement *src_vid_src;
79   GstElement *video_filter;
80   GstElement *src_filter;
81   GstElement *digitalzoom;
82 
83   /* Pad from our last element that is linked
84    * with the output pads */
85   GstPad *src_pad;
86 
87   GstPad *video_tee_vf_pad;
88   GstPad *video_tee_sink;
89 
90   gboolean elements_created;
91 
92   gulong src_event_probe_id;
93   gulong src_max_zoom_signal_id;
94   gulong image_capture_probe;
95   gulong video_capture_probe;
96 
97   /* Application configurable elements */
98   GstElement *app_vid_src;
99   GstElement *app_vid_filter;
100 
101   /* Caps that videosrc supports */
102   GstCaps *allowed_caps;
103 
104   /* Optional crop for frames. Used to crop frames e.g.
105      due to wrong aspect ratio. Done before the crop related to zooming. */
106   GstElement *src_crop;
107 
108   /* Caps applied to capsfilters when in view finder mode */
109   GstCaps *view_finder_caps;
110 
111   /* Caps applied to capsfilters when taking still image */
112   GstCaps *image_capture_caps;
113   gboolean image_renegotiate;
114   gboolean video_renegotiate;
115 };
116 
117 
118 /**
119  * GstWrapperCameraBinSrcClass:
120  *
121  */
122 struct _GstWrapperCameraBinSrcClass
123 {
124   GstBaseCameraSrcClass parent;
125 };
126 
127 gboolean gst_wrapper_camera_bin_src_plugin_init (GstPlugin * plugin);
128 
129 G_END_DECLS
130 
131 #endif /* __GST_WRAPPER_CAMERA_BIN_SRC_H__ */
132