This chapter contains a fairly random selection of things to take care of when writing an element. It's up to you how far you're going to stick to those guidelines. However, keep in mind that when you're writing an element and hope for it to be included in the mainstream GStreamer distribution, it has to meet those requirements. As far as possible, we will try to explain why those requirements are set.
Make sure the state of an element gets reset when going to
NULL
. Ideally, this should set all
object properties to their original state. This function
should also be called from _init.
Make sure an element forgets everything
about its contained stream when going from
PAUSED
to READY
. In
READY
, all stream states are reset. An
element that goes from PAUSED
to
READY
and back to
PAUSED
should start reading the
stream from he start again.
People that use gst-launch for testing have the tendency to not care about cleaning up. This is wrong. An element should be tested using various applications, where testing not only means to "make sure it doesn't crash", but also to test for memory leaks using tools such as valgrind. Elements have to be reusable in a pipeline after having been reset.