Elements should never use their standard
output for debugging (using functions such as printf
() or g_print ()). Instead,
elements should use the logging functions provided by GStreamer,
named GST_DEBUG (),
GST_LOG (), GST_INFO (),
GST_WARNING () and
GST_ERROR (). The various logging levels can
be turned on and off at runtime and can thus be used for solving
issues as they turn up. Instead of GST_LOG ()
(as an example), you can also use GST_LOG_OBJECT
() to print the object that you're logging output for.
Ideally, elements should use their own debugging category. Most elements use the following code to do that:
GST_DEBUG_CATEGORY_STATIC (myelement_debug);
#define GST_CAT_DEFAULT myelement_debug
[..]
static void
gst_myelement_class_init (GstMyelementClass *klass)
{
[..]
GST_DEBUG_CATEGORY_INIT (myelement_debug, "myelement",
0, "My own element");
}
At runtime, you can turn on debugging using the commandline option --gst-debug=myelement:5.