1 GStreamer documentation notes
6 Please make sure you've read and understood everything in this file
7 before you try changing documentation.
12 GStreamer has two sets of documentation that we maintain:
13 * API references, using gtk-doc (gstreamer, gstreamer-libs)
14 * "books", using DocBook/XML (faq, manual, pwg)
19 OK, I've grown so tired of having to coax the docs to build every time I
20 get round to it that I've decided to note down some of the things that
21 are important to know.
25 * Our documentation should all be Docbook/XML. No SGML.
26 * The source for the documentation is:
27 - one or more .xml files, with the main one being gstreamer-(whatever).xml
30 - in .png (and maybe others)
31 * We want to generate docs in HTML, PS and PDF
32 * We want to use xml to to generate these
36 We stick to some simple conventions for writing docbook documentation.
38 - all id's start with chapter-, part-, section-, or misc-
39 - verify this is the case by looking at the generated file names in html/
40 - sections should also include the chapter name;
41 for example in a chapter called chapter-example, a section would be
42 called section-example-hello-world
44 HOW IMAGES ARE HANDLED
45 ----------------------
46 * the format of images used is:
51 * images may need to be converted from their source format to the end format
53 * a file called image.entities is generated that provides two entities:
55 ℑ is the file extension (png, ps, pdf)
56 * all generated images will be put in images/
58 HOW THE BUILD WORKS FOR EACH FORMAT
59 -----------------------------------
61 - xmlto html gstreamer-whatever.xml should produce the html docs.
62 - We do this in the html subdir of the doc builddir.
63 - images are copied to (builddir)/html/images
64 - PNGS should be set to all of the png's referenced for html, both
65 already there and auto-generated
68 - images are converted to .ps files in EPS format. Generated images are
70 - xmlto ps gstreamer-whatever.xml generates the ps file
74 - ps2pdf is the easiest
75 - we specify ps, PS as the image type, but using xmlto the build will fail
76 because it uses ps2pdf internally and it fails to generate the images
77 By hand-generating .pdf images before xmlto we can make the build succeed.
78 (This is why image-pdf has file ext pdf but type EPS; this tricks xmlto in
79 doing the right thing)
80 xmlto pdf gstreamer-whatever.xml generates pdf (but seems to fail on the
81 FAQ, so for now we use ps2pdf)
83 HOW THE BUILD SYSTEM IS SET UP
84 ------------------------------
85 * make all should build html, ps, and pdf
86 * html is built in a subdir, with the png/ps images copied there
87 * ps and pdf are built in the current dir, in one file
93 * spell checking with aspell
94 * aspell -b -c --mode=sgml --lang=en <file>.xml
95 unfortunately the curses-ui of aspell (0.50.5) has problems with the xml tags
101 * files under CVS control:
103 - gstreamer-sections.txt
104 describes which symbols later appear on one api-doc page
105 configure which symbols are shown/invisible/private
107 the types file lists all get_type() functions that register the GObject types
108 - gstreamer-docs.sgml
109 defines the overall structure of the api documentation
111 - only add the file to CVS if you have at least filled the short description
112 (filename corresponds to the <FILE> tag in the sections file)
113 - document as much as possible in the source (*.c files)
115 * what to do when adding a new piece of API:
116 - add both an entity and use the entity in gstreamer-docs.sgml
117 - add a new <SECTION> to gstreamer-sections.txt in the correct alphabetical
118 position related to the other sections (so that it is easier to locate)
119 - add all documented symbols to gstreamer-sections.txt in the proper section
120 (default),<SUBSECTION Standard>,<SUBSECTION Private>
121 - document at least the Short_Description in tmpl/.sgml
122 - document symbols where they are definied, so that when one changes the
123 definition, the chaces are good that docs are updated.
124 - document functions, signals in the .c files
125 - document structs, typedefs, enums in the .h files
128 - make sure *-sections.txt has a <TITLE> set for each <FILE>
129 - add only *one* <TITLE> to each file, when you have multiple classes in one
130 source-file, create one <FILE> section for each class
131 - the <TITLE> *must* be named like the type of the GType, when it gets
132 registered (otherwise gtkdoc introspection fails)
133 - for clarity name the <FILE> like the <TITLE>, but all lowercase
135 * what to do when trying to improve the docs
136 - compare the output of
137 grep "_get_type" gstreamer-sections.txt | sort
138 with the types in XXX.types to detect entries that
140 - gtk docs does not warns about empty member docs!, run
141 find . -name "*.[c,h]" -exec egrep -Hn "^ +\* +@.*: *$" {} \;
142 in the project root to find them
143 - gtk docs does not warns about empty Returns: docs!, run
144 find . -name "*.[c,h]" -exec egrep -Hn "^ +\* +@Returns: *$" {} \;
145 in the project root to find them
147 * what happens during a gtk-doc build ?
149 - based on a $(MODULE).types file:
150 - gtkdoc-scangobj creates a gtkdoc-scan binary
151 - using CC, LD, CFLAGS, LDFLAGS env var
152 - using --type-init-func and --module parameters
153 - gtkdoc-scan creates
154 - $MODULE.signals.new
155 - $MODULE.hierarchy.new
156 - $MODULE.interfaces.new
157 - $MODULE.prerequisites.new
159 - generated source and objects get deleted
160 - gtkdoc-scangobj merges changes into the original files
162 - extracts decls of functions, macros, enums, structs, unions from headers
165 - $MODULE-decl-list.txt
166 - $MODULE-decl-list.txt then should get copied to $MODULE-sections.txt
167 - scan-build.stamp gets created
169 - Template generation step:
170 - gtkdoc-mktmpl --module=$MODULE
171 - reads in tmpl/*.sgml
172 - moves them to tmpl/*.sgml.bak
173 - recreates tmpl/*.sgml according to $MODULE-sections.txt
174 - moves unused stuff to $MODULE-unused.txt
175 - tmpl-build.stamp gets generated
177 * Possible errors and how to fix them
178 - Warning: multiple "IDs" for constraint linkend: gst-tag-register.
179 - check if gst_tag_register is listed more than once in -sections.txt
181 STYLE GUIDE FOR GTK-DOC
182 =======================
183 - this is in addition to gtk-doc's style-guide.txt
185 - when documenting signals, use "the #Gst..." for the object receiving the
186 signal; no trailing dot, and no "that received the signal"
187 - function/macro descriptions are descriptive, not imperative
188 ie, it uses the third person verb
189 - synopsis and description should have most-used/application functions at the
191 - functions that can return FALSE/NULL or fail should describe their failure
192 conditions like this:
193 * Returns NULL if no element with the given name is found in the bin, if
194 * the frobble was stuck in the froob, or the frizzle was frazzed.
195 - a line with function attributes should be added before Returns:
197 "MT safe." - the function is verified to be multithreadingsafe
198 "Caller owns returned reference" for refcounted classes
199 "Caller owns returned value" for other types (iterators, ..)
200 - we do this because, in contrast with GLib/GTK, we are more explicit
201 about threadsafety and related issues
202 - link to signals from the description like this:
203 * The <link linkend="GstBin-element-added">element-added</link> signal
204 - the bottom of the description should say when the doc was last reviewed
206 * Last reviewed on 2005-10-28 (0.9.4)
208 WEBSITE DOCUMENTATION
209 =====================
211 Updating the online documentation is pretty simple.
213 a) have a working freedesktop.org account
214 b) $HOME/.ssh/config set up so that it has the right User for the Host
215 (for example, I have:
218 c) verify this works by doing ssh freedesktop.org and being logged in without
220 d) have verified your changes build documentation locally.
222 Then, after updating any of the docs, run "make upload" from that directory.
223 Or, run "make upload" from this (docs) directory.
227 As of september 2005 we have some system to document plugins and elements
228 in the various plugin packages.
230 - in a submodule, docs go in docs/plugins
231 - template can be copied from gst-plugins-base
232 - to add plugins documentation:
233 - create docs/plugins
234 - create Makefile.am and friends, add to configure.ac
235 - create docs/version.entities.in, add to configure.ac
237 - create $(module)-plugins.types with #include <gst/gst.h>
239 - edit the -docs.sgml
241 cvs add *-plugins-docs.sgml *-plugins.args *-plugins.hierarchy *-plugins.interfaces *-plugins.prerequisites *-plugins.signals *-plugins.types inspect-build.stamp inspect.stamp scanobj-build.stamp
243 cvs add inspect/*.xml
245 - to add an element to be documented:
246 - add an include href in the Elements chapter for the element
248 - add a section for it in -sections.txt with
249 <FILE>element-(element)</FILE>
250 <TITLE>(element)</TITLE>
251 - add a gtk-doc section to the source code like:
253 * SECTION:element-multifdsink
255 and fill it with documentation about the element, preferably inside
256 a <refsect2> docbook container.
258 - either a few pipelines, inside <programlisting>
259 - or a piece of code:
260 - create an example program (element)-example.c in the plugin dir
261 - add the full path (starting with $(top_srcdir)) for this example
262 to the EXAMPLE_CFILES variable in Makefile.am
263 - add an xinclude of a file named "element-(element)-example.xml"
264 to the docbook documentation piece in the element source code
265 - add the header to EXTRA_HFILES in Makefile.am to be able to document
266 signals and args; in that case, the object struct needs to be in
267 -sections.txt outside of the Standard Subsection (which is annoying,
269 (FIXME: are we sure we can both do the xinclude from the tmpl/ sgml,
270 as well as an override from the source itself ? maybe we should just
271 make sure the xinclude is in the source itself instead ?)
272 - to rebuild the docs, do:
276 - examples will only show up using gtk-doc 1.4 or later - it relies on
277 merging stuff from .sgml with inline docs. We might want to change
278 this to only get stuff from the source.
280 - to add a plugin to be documented:
281 - make sure inspect/ has generated a .xml file for it
283 - add an include in -docs.sgml in the Plugins list for that plugin
286 "multiple constraints for linkend ID": check if each section in
287 -sections.txt actually starts and ends with <SECTION> and </SECTION>
289 RANDOM THINGS I'VE LEARNED
290 ==========================
292 * for clean builddir != srcdir separation, I wanted to use xmlto --searchpath
293 so the source xml could find the built entity file.
294 But xmlto --searchpath is (right now) for TeX input, not xml input.
295 xsltproc has a --path option (that xmlto doesn't use yet), but it
296 resolves single files to $(specified_path)/$(srcdir)/$(file)
297 For now, we need to hack around it by copying xml to the build dir.
300 Building GStreamer documentation
303 (old) DOCUMENTATION BUILDING NOTES
304 ----------------------------------
306 To build the GStreamer documentation you need the following installed (based on
307 Red Hat packages). These packages comes from rawhide and are the ones that
308 will be in Red Hat 7.3/8.0
313 openjade (needs to be rebuilt from SRPM for Red Hat 7.2)
340 Check http://www.imendio.com/projects/devhelp/
341 It's a really nice development app allowing you to look up API stuff
342 from various gtk-doc'd libraries. GStreamer is one of these ;)
344 gtk-doc generates both html API docs and the matching .devhelp files