Initialize Tizen 2.3
[framework/multimedia/gstreamer0.10.git] / mobile / docs / faq / developing.xml
1 <sect1 id="chapter-developing">
2   <title id="title-developing">Developing applications with GStreamer</title>
3   <qandaset defaultlabel="qanda">
4
5     <qandaentry>
6       <question id="developing-compile-programs">
7         <para>How do I compile programs that use GStreamer ?</para>
8       </question>
9
10       <answer>
11         <para>
12 GStreamer uses pkg-config to assist applications with compilation and 
13 linking flags. 
14 pkg-config is already used by GTK+, GNOME, SDL, and others; so if you are 
15 familiar with using it for any of those, you're set.
16         </para>
17         <para>
18 If you're not familiar with pkg-config to compile and link a small 
19 one-file program, pass the --cflags and --libs arguments to pkg-config.
20 For example:
21 <programlisting>
22 $ libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-&GST_MAJORMINOR;` -o myprog myprog.c
23 </programlisting>
24 would be sufficient for a gstreamer-only program. 
25 If (for example) your app also used GTK+ 2.0, you could use
26 <programlisting>
27 $ libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-&GST_MAJORMINOR; gtk+-2.0` -o myprog myprog.c
28 </programlisting>
29 Those are back-ticks (on the same key with the tilde on US keyboards), 
30 not single quotes.
31         </para>
32         <para>
33 For bigger projects, you should integrate pkg-config use in your Makefile,
34 or integrate with autoconf using the pkg.m4 macro (providing PKG_CONFIG_CHECK).
35         </para>
36       </answer>
37     </qandaentry>
38
39     <qandaentry>
40       <question id="developing-uninstalled-gstreamer">
41         <para>How do I develop against an uninstalled GStreamer copy ?</para>
42       </question>
43
44       <answer>
45         <para>
46 It is possible to develop and compile against an uninstalled copy of
47 gstreamer and gst-plugins-* (for example, against gits checkouts).
48 The easiest way to do this is to use a bash script like  this:
49 <ulink url="http://cgit.freedesktop.org/gstreamer/gstreamer/tree/scripts/gst-uninstalled">latest version of gst-uninstalled</ulink>.
50
51 If you put this script in your path, and symlink it to gst-git (if you want
52 to develop against git master) or to gst-released (if you want to develop
53 against the lastest release of each module), it will automatically use the
54 uninstalled version from that directory (ie. gst-git will look for a directory
55 called 'git', and gst-released will expect the uninstalled modules to be in
56 the 'released' directory; you are free to use any name or identifier you like
57 here).
58         </para>
59         <para>
60 This requires you to have put your checkouts of gstreamer and gst-plugins
61 under ~/gst/git (for the master version).  The program is easily modifiable
62 if this isn't the case.
63         </para>
64         <para>
65 After running this script, you'll be in an environment where the uninstalled
66 tools and plugins will be used by default.  Also, pkg-config will detect the
67 uninstalled copies before (and prefer them to) any installed copies.
68         </para>
69       </answer>
70     </qandaentry>
71
72     <qandaentry>
73       <question id="developing-gconf">
74         <para>How can I use GConf to get the system-wide defaults ?</para>
75       </question>
76
77       <answer>
78         <para>
79 For GNOME applications it's a good idea to use GConf to find the default ways
80 of outputting audio and video.  You can do this by using the 'gconfaudiosink'
81 and 'gconfvideosink' elements for audio and video output. They will take
82 care of everything GConf-related for you and automatically use the outputs
83 that the user configured. If you are using gconfaudiosink, your application
84 should set the 'profile' property.
85         </para>
86       </answer>
87     </qandaentry>
88
89     <qandaentry>
90       <question id="developing-libtool-scripts">
91         <para>
92 How do I debug these funny shell scripts that libtool makes ?
93         </para>
94       </question>
95
96       <answer>
97         <para>
98 When you link a program against uninstalled GStreamer using libtool, 
99 funny shell scripts are made to modify your shared object search path 
100 and then run your program. For instance, to debug gst-launch, try 
101 <programlisting>
102 libtool --mode=execute gdb /path/to/gst-launch
103 </programlisting>. 
104 If this does not work, you're probably using a broken version of libtool. 
105         </para>
106       </answer>
107     </qandaentry>
108
109     <qandaentry>
110       <question id="developing-mail-gstreamer-devel">
111         <para>Why is mail traffic so low on gstreamer-devel ?</para>
112       </question>
113
114       <answer>
115         <para>
116 Our main arena for coordination and discussion is IRC, not email. 
117 Join us in <ulink url="irc://irc.freenode.net/#gstreamer">#gstreamer on irc.freenode.net</ulink>
118 For larger picture questions or getting more input from more persons,
119 a mail to gstreamer-devel is never a bad idea.
120         </para>
121       </answer>
122     </qandaentry>
123
124     <qandaentry>
125       <question id="developing-versioning">
126         <para>What kind of versioning scheme does GStreamer use ?</para>
127       </question>
128
129       <answer>
130         <para>
131 For public releases, GStreamer uses a standard MAJOR.MINOR.MICRO version 
132 scheme.  If the release consists of mostly bug fixes or incremental changes, 
133 the MICRO version is incremented.
134 If the release contains big changes, the MINOR version is incremented.
135 If we're particularly giddy, we might even increase the MAJOR number.  
136 Don't hold your breath for that though.
137         </para>
138         <para>
139 During the development cycle, GStreamer also uses a fourth or NANO number.
140 If this number is 1, then it's a git development version.  
141 Any tarball or package that has a nano number of 1 is made from git and thus 
142 not supported.  Additionally, if you didn't get this package or tarball from
143 the GStreamer team, don't have high hopes on it doing whatever you want it
144 to do.
145         </para>
146         <para>
147 If the number is 2 or higher, it's an official pre-release in preparation 
148 of an actual complete release.  Your help in testing these tarballs and
149 packages is very much appreciated.
150         </para>
151       </answer>
152     </qandaentry>
153
154     <qandaentry>
155       <question id="developing-coding-style">
156         <para>What is the coding style for GStreamer code?</para>
157       </question>
158
159       <answer>
160         <para>
161 The core and almost all plugin modules are basically coded in K&amp;R with
162 2-space indenting. Just follow what's already there and you'll be fine.
163         </para>
164         <para>
165 Individual plugins in gst-plugins-* or plugins that you want considered for
166 addition to one of the gst-plugins-* modules should be coded in the same style.
167 It's easier if everything is consistent. Consistency is, of course, the goal. 
168         </para>
169         <para>
170 Simply run your code (only the *.c files, not the header files) through
171 <programlisting>
172 indent \
173   --braces-on-if-line \
174   --case-brace-indentation0 \
175   --case-indentation2 \
176   --braces-after-struct-decl-line \
177   --line-length80 \
178   --no-tabs \
179   --cuddle-else \
180   --dont-line-up-parentheses \
181   --continuation-indentation4 \
182   --honour-newlines \
183   --tab-size8 \
184   --indent-level2
185 </programlisting>
186 before submitting a patch. (This is using GNU indent.) There is also a
187 gst-indent script in the GStreamer core source tree in the tools directory
188 which wraps this and contains the latest option. The easiest way to get the
189 indenting right is probably to develop against a git checkout. The local
190 git commit hook will ensure correct indentation. We only require code files to
191 be indented, header files may be indented manually for better readability
192 (however, please use spaces for indenting, not tabs, even in header files).
193         </para>
194         <para>
195 As for the code itself, the 
196 <ulink url="http://developer.gnome.org/doc/guides/programming-guidelines/book1.html">GNOME coding guidelines</ulink> is a good read.
197 Where possible, we try to adhere to the spirit of GObject and use similar
198 coding idioms.
199         </para>
200         <para>
201 Patches should be made against git master or the latest release and should be
202 in 'unified context' format (use diff -u -p). They should be attached to
203 a bug report (or feature request) in
204 <ulink url="http://bugzilla.gnome.org">bugzilla</ulink> rather than
205 sent to the mailing list. Also see
206 <ulink url="http://gstreamer.freedesktop.org/wiki/SubmittingPatches">SubmittingPatches</ulink>
207 in the GStreamer wiki.
208         </para>
209       </answer>
210     </qandaentry>
211     <qandaentry>
212     <question id="developing-translations">
213     <para>I have translated one of the module .po files into a new language. How do I get it included?</para>
214     </question>
215     <answer>
216     <para>GStreamer translations are uniformly managed through the Translation Project (http://translationproject.org). There are some instructions on how to join the Translation Project team and submit new translations at http://translationproject.org/html/translators.html.</para>
217     <para>New translations submitted via the Translation Project are merged periodically into git by the maintainers by running 'make download-po' in the various modules.</para>
218     </answer>
219     </qandaentry>
220   </qandaset>
221 </sect1>