2005-11-18 18:38:41 +00:00
|
|
|
Moving around plug-ins between source modules
|
|
|
|
---------------------------------------------
|
|
|
|
|
2020-05-19 09:30:50 +00:00
|
|
|
Last updated: 2020-05-19
|
2005-11-18 18:38:41 +00:00
|
|
|
|
2009-08-11 01:54:55 +00:00
|
|
|
Contents:
|
|
|
|
1. How to get your plug-in out of -bad and into -good or -ugly (ie. policies)
|
|
|
|
2. How to move plugins between modules with git (ie. technical howto)
|
|
|
|
|
|
|
|
==============================================================
|
|
|
|
1. How to get your plug-in out of -bad and into -good or -ugly
|
|
|
|
==============================================================
|
2005-11-18 18:38:41 +00:00
|
|
|
|
|
|
|
Since GStreamer 0.9.x, we have four plugin modules: -base, -good, -ugly,
|
|
|
|
and -bad. Plug-ins are by default added to -bad. They can only move
|
|
|
|
to -good or -ugly if a number of conditions are met:
|
|
|
|
|
2006-09-02 13:36:44 +00:00
|
|
|
PEOPLE
|
|
|
|
------
|
2005-11-18 18:38:41 +00:00
|
|
|
- People involved:
|
|
|
|
- There should be a person who is actively going to maintain this element;
|
|
|
|
presumably this is the person writing the plug-in in the first place
|
2006-09-02 13:36:44 +00:00
|
|
|
and opening the move request
|
2005-11-18 18:38:41 +00:00
|
|
|
- There should be a GStreamer hacker who is willing to sponsor the element;
|
|
|
|
this would be someone who is going to help out getting all the conditions
|
2006-09-02 13:36:44 +00:00
|
|
|
met, act as a mentor if necessary,...
|
|
|
|
- There should be a core developer who verifies that the checklist is
|
2005-11-18 18:38:41 +00:00
|
|
|
met
|
|
|
|
|
|
|
|
The three roles can be filled by two people, but not just one.
|
|
|
|
|
2006-09-02 13:36:44 +00:00
|
|
|
In addition, an admin needs to perform the actual move, which involves
|
2020-05-19 09:30:50 +00:00
|
|
|
GIT surgery.
|
2006-09-02 13:36:44 +00:00
|
|
|
|
|
|
|
PROCESS
|
|
|
|
-------
|
2020-05-19 09:30:50 +00:00
|
|
|
- Issue in gitlab gets filed by someone requesting a move from bad
|
2006-09-02 13:36:44 +00:00
|
|
|
to good/ugly
|
|
|
|
This is "requesting" the move.
|
|
|
|
- a second person reviews the request and code, and verifies that the
|
2006-09-02 19:10:56 +00:00
|
|
|
plugin meets the checklist items below, by commenting on the bug
|
2006-09-02 13:36:44 +00:00
|
|
|
and giving a rundown of what still needs to be done
|
|
|
|
This is "sponsoring" the move.
|
|
|
|
- when the checklist is met, a third person can approve the move.
|
|
|
|
This is "approving" the move.
|
|
|
|
- an admin performs the move.
|
|
|
|
This is "performing" the move. (Are you laughing yet ?)
|
|
|
|
|
|
|
|
CHECKLIST
|
|
|
|
---------
|
2005-11-21 10:04:18 +00:00
|
|
|
- The plug-in's code:
|
|
|
|
- should descend from an applicable base class if possible
|
2013-12-13 22:51:32 +00:00
|
|
|
- make use of G_DEFINE_TYPE macros
|
2005-11-21 10:04:18 +00:00
|
|
|
- conform to the GStreamer coding style
|
|
|
|
- use a custom debug category
|
|
|
|
- use GST_(DEBUG/*)_OBJECT
|
2005-11-23 15:49:06 +00:00
|
|
|
- use dashes in object property names to separate words
|
|
|
|
- use correct value, name, nick for enums
|
2006-04-29 00:35:48 +00:00
|
|
|
- use underscores in macros/function names/structs
|
|
|
|
e.g.: GST_BASE_SINK, GstBaseSink, gst_base_sink_
|
2007-07-20 07:26:39 +00:00
|
|
|
- use g_assert(), g_return_if_fail(), g_return_val_if_fail() for pre/post
|
|
|
|
condition checks
|
2008-06-20 11:07:05 +00:00
|
|
|
- must not have any functional code within g_assert(), g_return_if_fail() or
|
|
|
|
g_return_val_if_fail() statements, since those would be turned into NO-OPS
|
|
|
|
if the code is compiled with -DG_DISABLE_CHECKS (as is often done on
|
|
|
|
embedded systems).
|
2006-04-29 00:35:48 +00:00
|
|
|
|
|
|
|
- The plug-in's build:
|
2020-05-19 09:30:50 +00:00
|
|
|
- should be correctly integrated with Meson buildsystem
|
2006-04-29 00:35:48 +00:00
|
|
|
- files implementing elements should be named according to their class name,
|
|
|
|
e.g GstBaseSink -> gstbasesink.c
|
2005-11-21 10:04:18 +00:00
|
|
|
|
|
|
|
- The compiled plug-in:
|
|
|
|
- should show up correct in gst-inspect output; no warnings, no unknown
|
|
|
|
types, ...
|
|
|
|
|
2005-11-18 18:38:41 +00:00
|
|
|
- The plug-in should be put in the correct location inside the module:
|
|
|
|
sys/: plug-ins that include system headers/link to system libraries;
|
|
|
|
usually platform-dependent as well
|
2006-04-29 00:35:48 +00:00
|
|
|
name after whatever system "thing" they use (oss, v4l, ...)
|
2012-09-28 19:38:20 +00:00
|
|
|
gst/: plug-ins with no external dependencies, only GLib/GStreamer/liborc
|
2005-11-18 18:38:41 +00:00
|
|
|
ext/: plug-ins with external dependencies
|
|
|
|
|
|
|
|
- The plug-in is documented:
|
2006-09-27 13:19:55 +00:00
|
|
|
- the compiled-in descriptions (element details) should be correct
|
2005-11-18 18:38:41 +00:00
|
|
|
- every element in the plug-in should have gtk-doc documentation:
|
|
|
|
- longer description of element
|
|
|
|
- why you would use this element
|
|
|
|
- example launch line OR example source code
|
|
|
|
(for example, see
|
|
|
|
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audiotestsrc.html
|
|
|
|
for the first and
|
|
|
|
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-level.html
|
|
|
|
for the second)
|
|
|
|
- if the element has custom messages, they should be documented
|
|
|
|
- signals and properties should be documented
|
|
|
|
|
|
|
|
- The plug-in should come with tests:
|
|
|
|
- preferably, a unit test should be written, testing things like:
|
|
|
|
- setup and teardown
|
|
|
|
- push in buffers in all supported formats and verify they are handled
|
|
|
|
properly
|
|
|
|
- push in buffers that trigger error cases, and verify errors are
|
|
|
|
correctly thrown
|
|
|
|
|
|
|
|
for example, see gst-plugins-base/check/elements/audioconvert
|
|
|
|
|
|
|
|
The unit test should be put in check/elements/(nameofelement)
|
|
|
|
and be added to check_PROGRAMS and Makefile.am
|
|
|
|
|
|
|
|
- if a unit test is not appropriate (for example, device elements),
|
|
|
|
a test application should be written that can be run manually
|
|
|
|
|
|
|
|
- The tests should be leak-free, tested with valgrind
|
|
|
|
- the unit tests in check/ dirs are valgrinded by default
|
|
|
|
- the manual tests should have a valgrind target
|
|
|
|
- leaks in the supporting library (and verified to be in the supporting
|
2006-09-02 19:10:56 +00:00
|
|
|
library !) can be added to suppression files
|
2005-11-18 18:38:41 +00:00
|
|
|
|
|
|
|
- The elements should not segfault under any circumstance. This includes:
|
|
|
|
- wrong pipelines
|
|
|
|
- bad data
|
|
|
|
|
2010-04-12 14:13:57 +00:00
|
|
|
- The element must not rely on a running GLib main loop, meaning it can't
|
|
|
|
use g_idle_add(), g_timeout_add(), g_io_add_watch(), etc.
|
|
|
|
|
2005-11-18 18:38:41 +00:00
|
|
|
- The plugins need to be marked correctly for translations.
|
|
|
|
- All error conditions should be correctly handled using GST_ELEMENT_ERROR
|
|
|
|
and following practice outlined in
|
|
|
|
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstGError.html
|
2006-09-02 19:03:41 +00:00
|
|
|
- this includes:
|
2007-07-20 07:26:39 +00:00
|
|
|
- message strings need to be marked for translation
|
2006-09-02 19:03:41 +00:00
|
|
|
- should be short, well-written, clear
|
|
|
|
- in particular, should *not* contain debug info, strerror, errno, ...
|
2006-11-04 12:54:08 +00:00
|
|
|
No, really ! NO STRERROR, NO ERRNO. If you are too lazy to provide
|
|
|
|
the user of your library with a nice experience, put your crap in
|
|
|
|
the debug string
|
2005-11-18 18:38:41 +00:00
|
|
|
|
|
|
|
- Decision should be made if it should go into good (LGPL license,
|
|
|
|
LGPL dependencies, no patent issues) or ugly
|
2005-11-23 19:55:09 +00:00
|
|
|
|
|
|
|
- plugin documentation needs to be added:
|
2006-04-29 00:35:48 +00:00
|
|
|
- see gstreamer/docs/README; section on adding plugins and elements
|
2005-11-23 19:55:09 +00:00
|
|
|
- "make update" in docs/plugins and commit the new file
|
|
|
|
- edit -docs.sgml and add an include for the file
|
2009-08-11 01:54:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
============================================
|
|
|
|
2. Moving plugins with GIT (technical howto)
|
|
|
|
============================================
|
|
|
|
|
|
|
|
Let's say we are moving the 'weneedthis' plugins from -bad/gst/weneedthis/ to
|
|
|
|
-good.
|
|
|
|
|
|
|
|
We want to end up with the following situation after the plugin move:
|
|
|
|
|
|
|
|
* weneedthis is no longer usable/visible in HEAD of -bad
|
|
|
|
* weneedthis is present and usable in HEAD of -good
|
|
|
|
* The whole history of commits concerning weneedthis are visible in -good
|
|
|
|
* The whole history of commits concerning weneedthis are visible in -bad
|
|
|
|
* If we go back to the previous release commit for -good, the 'weneedthis'
|
|
|
|
plugin code and commit history are not visible.
|
|
|
|
* If we go back to the previous release commit for -bad, the 'weneedthis'
|
|
|
|
plugin code and commits are visible.
|
|
|
|
|
|
|
|
|
|
|
|
# Four steps for moving plugins
|
|
|
|
----------
|
|
|
|
|
|
|
|
For this, we use git-format-patch which will extract the various commits
|
|
|
|
involving the plugin we want to move into individual numbered patches.
|
|
|
|
|
|
|
|
> cd gst-plugins-bad.git/
|
|
|
|
> git format-patch -o ../patches/ --subject-prefix="MOVED FROM BAD" start..HEAD -- gst/weneedthis/ tests/check/elements/weneedthis.c
|
|
|
|
or (without the prefix)
|
|
|
|
> git format-patch -o ../patches/ --no-numbered --subject-prefix='' start..HEAD -- gst/weneedthis/ tests/check/elements/weneedthis.c
|
|
|
|
|
|
|
|
We can then take those patches and commit them into -good.
|
|
|
|
For safety, it is recommended to do all this work in a temporary branch
|
|
|
|
|
|
|
|
> cd ../gst-plugins-good.git/
|
|
|
|
> git checkout -b moving-weneedthis
|
|
|
|
> git am -k ../patches/*.patch
|
|
|
|
|
|
|
|
At this point, we have all the commits related to gst/weneedthis/ in -bad.
|
|
|
|
|
|
|
|
We also need to move the other related parts in:
|
2020-05-19 09:30:50 +00:00
|
|
|
* meson.build
|
|
|
|
* meson_options.txt
|
2009-08-11 01:54:55 +00:00
|
|
|
* i18n
|
|
|
|
* documentation
|
|
|
|
|
|
|
|
All those modifications should be committed as one commit with an obvious
|
|
|
|
summary:
|
|
|
|
"Moved 'weneedthis' from -bad to -good"
|
|
|
|
> git commit -v -m "Moved 'weneedthis' from -bad to -good" <modified files>
|
|
|
|
|
|
|
|
We can now merge the branch into master and push it out for everybody.
|
|
|
|
|
|
|
|
> git checkout master
|
|
|
|
> git merge moving-weneedthis
|
|
|
|
|
|
|
|
The last step is to remove the plugin from the original module:
|
|
|
|
|
|
|
|
> git rm gst/weneedthis/
|
|
|
|
|
|
|
|
Remove all the code that was moved from configure, makefiles, documentations,
|
|
|
|
and commit that with the *SAME* commit message as the last commit we did in
|
|
|
|
-good:
|
|
|
|
> git commit -v -m "Moved 'weneedthis' from -bad to -good" <modified files>
|
|
|
|
|