1 GStreamer documentation notes
6 Please make sure you've read and understood everything in this file
7 before you try changing documentation.
9 Some of the docbook-related bits in this README might be out of date now that
10 quite a bit of the documentation has moved into the gst-docs repository.
15 GStreamer has two sets of documentation that we maintain:
16 * API references, using gtk-doc (gstreamer, gstreamer-libs)
17 * FAQ / Application Development Manual / Plugin Writer's Guide / Tutorials -
18 these are maintained in markdown format and live in the gst-docs repository.
23 OK, I've grown so tired of having to coax the docs to build every time I
24 get round to it that I've decided to note down some of the things that
25 are important to know.
29 * Our documentation should all be Docbook/XML. No SGML.
30 * The source for the documentation is:
31 - one or more .xml files, with the main one being gstreamer-(whatever).xml
34 - in .png (and maybe others)
35 * We want to generate docs in HTML, PS and PDF
36 * We want to use xml to to generate these
40 We stick to some simple conventions for writing docbook documentation.
42 - all id's start with chapter-, part-, section-, or misc-
43 - verify this is the case by looking at the generated file names in html/
44 - sections should also include the chapter name;
45 for example in a chapter called chapter-example, a section would be
46 called section-example-hello-world
48 HOW IMAGES ARE HANDLED
49 ----------------------
50 * the format of images used is:
55 * images may need to be converted from their source format to the end format
57 * a file called image.entities is generated that provides two entities:
59 ℑ is the file extension (png, ps, pdf)
60 * all generated images will be put in images/
62 HOW THE BUILD WORKS FOR EACH FORMAT
63 -----------------------------------
65 - xmlto html gstreamer-whatever.xml should produce the html docs.
66 - We do this in the html subdir of the doc builddir.
67 - images are copied to (builddir)/html/images
68 - PNGS should be set to all of the png's referenced for html, both
69 already there and auto-generated
72 - images are converted to .ps files in EPS format. Generated images are
74 - xmlto ps gstreamer-whatever.xml generates the ps file
78 - ps2pdf is the easiest
79 - we specify ps, PS as the image type, but using xmlto the build will fail
80 because it uses ps2pdf internally and it fails to generate the images
81 By hand-generating .pdf images before xmlto we can make the build succeed.
82 (This is why image-pdf has file ext pdf but type EPS; this tricks xmlto in
83 doing the right thing)
84 xmlto pdf gstreamer-whatever.xml generates pdf (but seems to fail on the
85 FAQ, so for now we use ps2pdf)
87 HOW THE BUILD SYSTEM IS SET UP
88 ------------------------------
89 * make all should build html, ps, and pdf
90 * html is built in a subdir, with the png/ps images copied there
91 * ps and pdf are built in the current dir, in one file
96 * aspell -b -c --mode=sgml --lang=en <file>.xml
97 unfortunately the curses-ui of aspell (0.50.5) has problems with the xml tags
103 * files under revision control:
105 - gstreamer-sections.txt
106 describes which symbols later appear on one api-doc page
107 configure which symbols are shown/invisible/private
109 the types file lists all get_type() functions that register the GObject types
110 - gstreamer-docs.sgml
111 defines the overall structure of the api documentation
113 - only add the file to CVS if you have at least filled the short description
114 (filename corresponds to the <FILE> tag in the sections file)
115 - document as much as possible in the source (*.c files)
117 * what to do when adding a new piece of API:
118 - add both an entity and use the entity in gstreamer-docs.sgml
119 - add a new <SECTION> to gstreamer-sections.txt in the correct alphabetical
120 position related to the other sections (so that it is easier to locate)
121 - add all documented symbols to gstreamer-sections.txt in the proper section
122 (default),<SUBSECTION Standard>,<SUBSECTION Private>
123 - document at least the Short_Description in tmpl/.sgml
124 - document symbols where they are defined, so that when one changes the
125 definition, the chaces are good that docs are updated.
126 - document functions, signals in the .c files
127 - document structs, typedefs, enums in the .h files
130 - make sure *-sections.txt has a <TITLE> set for each <FILE>
131 - add only *one* <TITLE> to each file, when you have multiple classes in one
132 source-file, create one <FILE> section for each class
133 - the <TITLE> *must* be named like the type of the GType, when it gets
134 registered (otherwise gtkdoc introspection fails)
135 - for clarity name the <FILE> like the <TITLE>, but all lowercase
137 * what to do when trying to improve the docs
138 - compare the output of
139 grep "_get_type" gstreamer-sections.txt | sort
140 with the types in XXX.types to detect entries that
142 - gtk docs does not warns about empty member docs!, run
143 find . -name "*.[c,h]" -exec egrep -Hn "^ +\* +@.*: *$" {} \;
144 in the project root to find them
145 - gtk docs does not warns about empty Returns: docs!, run
146 find . -name "*.[c,h]" -exec egrep -Hn "^ +\* +@Returns: *$" {} \;
147 in the project root to find them
149 * what happens during a gtk-doc build ?
151 - based on a $(MODULE).types file:
152 - gtkdoc-scangobj creates a gtkdoc-scan binary
153 - using CC, LD, CFLAGS, LDFLAGS env var
154 - using --type-init-func and --module parameters
155 - gtkdoc-scan creates
156 - $MODULE.signals.new
157 - $MODULE.hierarchy.new
158 - $MODULE.interfaces.new
159 - $MODULE.prerequisites.new
161 - generated source and objects get deleted
162 - gtkdoc-scangobj merges changes into the original files
164 - extracts decls of functions, macros, enums, structs, unions from headers
167 - $MODULE-decl-list.txt
168 - $MODULE-decl-list.txt then should get copied to $MODULE-sections.txt
169 - scan-build.stamp gets created
171 - Template generation step:
172 - gtkdoc-mktmpl --module=$MODULE
173 - reads in tmpl/*.sgml
174 - moves them to tmpl/*.sgml.bak
175 - recreates tmpl/*.sgml according to $MODULE-sections.txt
176 - moves unused stuff to $MODULE-unused.txt
177 - tmpl-build.stamp gets generated
179 * Possible errors and how to fix them
180 - Warning: multiple "IDs" for constraint linkend: gst-tag-register.
181 - check if gst_tag_register is listed more than once in -sections.txt
183 STYLE GUIDE FOR GTK-DOC
184 =======================
185 - this is in addition to gtk-doc's style-guide.txt
187 - when documenting signals, use "the #Gst..." for the object receiving the
188 signal; no trailing dot, and no "that received the signal"
189 - function/macro descriptions are descriptive, not imperative
190 ie, it uses the third person verb
191 - synopsis and description should have most-used/application functions at the
193 - functions that can return FALSE/NULL or fail should describe their failure
194 conditions like this:
195 * Returns NULL if no element with the given name is found in the bin, if
196 * the frobble was stuck in the froob, or the frizzle was frazzed.
197 - a line with function attributes should be added before Returns:
199 "MT safe." - the function is verified to be multithreadingsafe
200 "Caller owns returned reference" for refcounted classes
201 "Caller owns returned value" for other types (iterators, ..)
202 - we do this because, in contrast with GLib/GTK, we are more explicit
203 about threadsafety and related issues
204 - link to signals from the description like this:
205 * The <link linkend="GstBin-element-added">element-added</link> signal
207 WEBSITE DOCUMENTATION
208 =====================
210 Updating the online documentation is pretty simple.
212 a) have a working freedesktop.org account
213 b) $HOME/.ssh/config set up so that it has the right User for the Host
214 (for example, I have:
217 c) verify this works by doing ssh freedesktop.org and being logged in without
219 d) have verified your changes build documentation locally.
221 Then, after updating any of the docs, run "make upload" from that directory.
222 Or, run "make upload" from this (docs) directory.
226 As of september 2005 we have some system to document plugins and elements
227 in the various plugin packages.
229 - in a submodule, docs go in docs/plugins
230 - template can be copied from gst-plugins-base
231 - to add plugins documentation:
232 - create docs/plugins
233 - create Makefile.am and friends, add to configure.ac
234 - create docs/version.entities.in, add to configure.ac
236 - create $(module)-plugins.types with #include <gst/gst.h>
238 - edit the -docs.sgml
240 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
242 cvs add inspect/*.xml
243 - Additional types can be added to the documentation by placing them in
244 the .types file like this:
246 This is useful for documenting plugin-private types that implement
247 signals or properties. The GType is looked up by name after all the
248 element classes have been printed - so this is only useful for types
249 that are created as a consequence of loading plugins and registering
252 - to add a plugin to be documented:
253 - make sure inspect/ has generated a inspect/plugin-xxx.xml file for it.
254 - if it has not, make sure you have pygst installed and run 'make update'.
256 - add an xi:include in -docs.sgml in the Plugins chapter for that plugin
258 - to add an element to be documented:
259 - add an xi:include in the Elements chapter for the element
260 in the main -docs.sgml
261 - add a section for it in -sections.txt with
263 <FILE>element-(element)</FILE>
264 <TITLE>(element)</TITLE>
266 <SUBSECTION Standard>
275 - add a gtk-doc section to the source code like:
277 * SECTION:element-multifdsink
279 and fill it with documentation about the element, preferably inside
280 a <refsect2> docbook container.
282 - either a few pipelines, inside <programlisting>
283 - or a piece of code:
284 - create an example program (element)-example.c in the plugin dir
285 - add the full path (starting with $(top_srcdir)) for this example
286 to the EXAMPLE_CFILES variable in Makefile.am
287 - add an xinclude of a file named "element-(element)-example.xml"
288 to the docbook documentation piece in the element source code
289 - add the header to EXTRA_HFILES in Makefile.am to be able to document
290 signals and args; in that case, the object struct needs to be in
291 -sections.txt outside of the Standard Subsection (which is annoying,
293 (FIXME: are we sure we can both do the xinclude from the tmpl/ sgml,
294 as well as an override from the source itself ? maybe we should just
295 make sure the xinclude is in the source itself instead ?)
296 - if the plugin has no public header, don't add the c-file, add entries to the
297 -overrides.txt file (see playbin docs in plugins-base).
298 - to rebuild the docs, do:
302 - examples will only show up using gtk-doc 1.4 or later - it relies on
303 merging stuff from .sgml with inline docs. We might want to change
304 this to only get stuff from the source.
305 - you need to commit resulting files to git:
306 - changes to *.signals and *.args
307 - new files for your plugin created in inspect/
308 - if you get this warning:
309 " Documentation in template xxx for ./tmpl/element-yyy:Short_Description
310 being overridden by inline comments"
311 per-default the description from the GST_ELEMENT_DETAILS is put to the
312 Short_Description. This warning mean you have a different one in the section
313 docs as "@short_description:".
315 - the plugin-doc-list on the gstreamer homepage is updated along with other
319 - in gst-plugins-foo/docs/plugins/, run
320 make check-inspected-versions
321 to show plugins whose inspect information is not up-to-date (which is
322 usually either because they have been moved to a different module or
323 because they are not built on the maintainer's machine for some reason).
324 Whether it really makes sense to update the version number is debatable
325 (after all, the inspected information may be outdated and things may have
326 changed, in which case it would be bad to change the version number)
327 - find files that have docs
328 for file in `find . -name "*.c" -exec grep -l " * SECTION:element-" {} \; | sort`; do if [ -e ${file/.c/.h} ]; then echo ${file/.c/.h}; else echo "no header for $file"; fi; done
329 for file in `find . -name "*.cc" -exec grep -l " * SECTION:element-" {} \; | sort`; do if [ -e ${file/.cc/.h} ]; then echo ${file/.cc/.h}; else echo "no header for $file"; fi; done
330 - add those .h files to EXTRA_HFILES in Makefile.am
331 - update gst-plugins-xxx-docs.sgml
333 ls -1 xml/plugin-*.xml | sort | sed -e "s/\(.*\)/ \<xi:include href=\"\1\" \/\>/"
334 ls -1 xml/element-*.xml | grep -v -- "-details.xml" | sort | sed -e "s/\(.*\)/ \<xi:include href=\"\1\" \/\>/"
335 - maybe we can generate these lists after "make update" and just xi:include
336 them in gst-plugins-xxx-docs.sgml. They should be committed to the vcs.
339 - "multiple constraints for linkend ID":
340 check if each section in -sections.txt actually starts and ends with
341 <SECTION> and </SECTION>
342 - if a plugin does not show up:
343 - check inspect/plugin-xxx.xml and tmpl/elements-
345 RANDOM THINGS I'VE LEARNED
346 ==========================
348 * for clean builddir != srcdir separation, I wanted to use xmlto --searchpath
349 so the source xml could find the built entity file.
350 But xmlto --searchpath is (right now) for TeX input, not xml input.
351 xsltproc has a --path option (that xmlto doesn't use yet), but it
352 resolves single files to $(specified_path)/$(srcdir)/$(file)
353 For now, we need to hack around it by copying xml to the build dir.
358 Check https://wiki.gnome.org/Apps/Devhelp
359 It's a really nice development app allowing you to look up API stuff
360 from various gtk-doc'd libraries. GStreamer is one of these ;)
362 gtk-doc generates both html API docs and the matching .devhelp(2) books.
366 It's important to keep the original source format for images, to be able
367 to change and regenerate later on. Original files go in