tizen2.0 init
[framework/multimedia/gst-plugins-ext0.10.git] / encodebin / src / gstencodebin.h
1 /*
2  * GStreamer encodebin
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>
7  *
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)
11  * any later version.
12  *
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.
17  *
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
21  *
22  */
23
24 #ifndef __GST_ENCODE_BIN_H__
25 #define __GST_ENCODE_BIN_H__
26
27 #include <gst/gst.h>
28 #include <gst/base/gstcollectpads.h>
29 #include <gst/riff/riff-ids.h>
30
31 G_BEGIN_DECLS
32
33 #define GST_CAT_DEFAULT gst_encode_bin_debug
34
35 #define GST_TYPE_ENCODE_BIN_PROFILE (gst_encode_bin_profile_get_type())
36 GType gst_encode_bin_profile_get_type (void);
37
38 #define GST_TYPE_ENCODE_BIN             (gst_encode_bin_get_type())
39 #define GST_ENCODE_BIN(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODE_BIN,GstEncodeBin))
40 #define GST_ENCODE_BIN_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ENCODE_BIN,GstEncodeBinClass))
41 #define GST_IS_ENCODE_BIN(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODE_BIN))
42 #define GST_IS_ENCODE_BIN_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ENCODE_BIN))
43
44 #define GST_ENCODE_BIN_GET_LOCK(encodebin) (((GstEncodeBin*)encodebin)->mutex)
45 #define GST_ENCODE_BIN_LOCK(encodebin)     g_mutex_lock (GST_ENCODE_BIN_GET_LOCK(encodebin))
46 #define GST_ENCODE_BIN_UNLOCK(encodebin)   g_mutex_unlock (GST_ENCODE_BIN_GET_LOCK(encodebin))
47
48 /* Signal enable */
49 #define GST_ENCODE_BIN_SIGNAL_ENABLE
50
51 typedef struct _GstEncodeBinPad {
52   GstCollectData *collect;
53
54   gboolean is_video;
55   gboolean connected;
56
57   gchar *tag;
58
59   gst_riff_strh hdr;
60 } GstEncodeBinPad;
61
62 typedef struct _GstEncodeBin GstEncodeBin;
63 typedef struct _GstEncodeBinClass GstEncodeBinClass;
64
65 struct _GstEncodeBin
66 {
67   GstBin bin;                   /* we extend GstBin */
68
69   GMutex *mutex;
70
71   /* pads */
72   GstPad              *srcpad;
73   GstPad              *video_sinkpad;
74   GstPad              *audio_sinkpad;
75   GstPad              *image_sinkpad;
76   GstPad              *mux_audio_sinkpad;
77   GstPad              *mux_video_sinkpad;
78
79   /* sinkpads, video first */
80   GSList              *sinkpads;
81
82   /* video restricted to 1 pad */
83   guint               video_pads, audio_pads;
84
85   gint          profile;
86   gint          fps;
87   gint          high_speed_fps; 
88   gint          multiple;  
89   gchar         *venc_name;
90   gchar         *aenc_name;
91   gchar         *ienc_name;  
92   gchar         *mux_name;
93
94
95   GstCaps       *vcaps;
96   GstCaps       *acaps;
97   GstCaps       *icaps;
98   
99   gboolean      auto_audio_convert;
100   gboolean      auto_audio_resample;
101   gboolean      auto_color_space;
102   gboolean      block;
103   gboolean      pause;
104   gboolean      use_video_toggle;
105   gboolean      use_venc_queue;
106   gboolean      use_aenc_queue;  
107   
108   GstElement *audio_queue;
109   GstElement *video_queue;  
110   GstElement *video_encode_queue;    
111   GstElement *audio_encode_queue;      
112   GstElement *image_queue;    
113   
114   GstElement *audio_encode;
115   GstElement *video_encode;
116   GstElement *image_encode;  
117
118   GstElement *vcapsfilter;  
119   GstElement *acapsfilter;    
120   GstElement *icapsfilter;      
121   
122   GstElement *video_toggle;
123   GstElement *image_toggle;  
124   GstElement *color_space;  
125   GstElement *audio_conv;  
126   GstElement *audio_sample;
127   
128   GstElement *mux;
129
130   /* pause/resume variables */
131   GstClockTime  paused_time;                    /* pipeline time when pausing */
132   GstClockTime  total_offset_time;              /* delayed time which is due to pause */
133   gulong                vsink_probeid;
134   gulong                vsink_hs_probeid;
135   gulong                asink_probeid;
136   gulong                veque_sig_id;
137   gulong                aeque_sig_id;  
138 };
139
140 struct _GstEncodeBinClass
141 {
142   GstBinClass parent_class;
143
144 #ifdef GST_ENCODE_BIN_SIGNAL_ENABLE
145   /* signal we fire when stream block/pause function called */
146   void (*stream_block) (GstElement * element, gboolean result);  
147   void (*stream_unblock) (GstElement * element, gboolean result);  
148   void (*stream_pause) (GstElement * element, gboolean result);
149   void (*stream_resume) (GstElement * element, gboolean result);
150 #endif
151
152 };
153
154 GType gst_encode_bin_get_type (void);
155
156 G_END_DECLS
157
158
159 #endif /* __GST_ENCODE_BIN_H__ */