Commit graph

184 commits

Author SHA1 Message Date
Jose Antonio Santos Cadenas
dcece2a878 gstinfo: Check threshold for category from macro
This way we can avoid to process parameters if log is not going
to be printed.
2020-03-24 11:39:32 +00:00
Nirbheek Chauhan
72daeee2c4 gstinfo: Add new API for getting debug log lines
If you're using a custom log handler, you had to reverse-engineer the
debug log format and create your own format function. Now, you can
call `gst_debug_log_get_line()` and it will return a string (without
ANSI escape color codes) representation instead.

This is useful in situations when you need to log the ordinary
gst_debug log to a resource that can't be opened as a `FILE` handle.

Also includes a test.
2019-12-25 08:50:17 +05:30
Sebastian Dröge
04a7334140 info: Deprecate gst_debug_category_free()
And change it to do nothing at all.

As debug categories don't use reference counting and they can be
retrieved from anywhere at any time by name, it is fundamentally unsafe
to free them at any point in time except for right before the end of the
process.

No code apart from a unit test seems to be currently using the function,
so deprecate it and also change it to do nothing at all.
2019-07-15 11:35:07 +03:00
Nirbheek Chauhan
145f8546c4 gstinfo: Add an explicit enum for GST_STACK_TRACE_SHOW_NONE
The code implicitly uses this value when the stack trace is not FULL.
Mostly useful for documenting the behaviour when each flag is passed
and for translating to/from strings.
2019-07-01 10:36:09 +00:00
Thibault Saunier
949fba4b1f doc: Fix hotdoc warnings
* Making sure that `static inline` function are in the GIR (by first
  defining them, and make sure to mark as skiped)
* Do not try to link to unexisting symbols
* Also generate GIR information about gst_tracers
2019-05-13 16:34:09 -04:00
Jordan Petridis
9251cd9bf5 gst: skip format specifiers from gir generation
GST_TIME_FORMAT, GST_TIME_ARGS, GST_STIME_FORMAT, GST_STIME_ARGS
GST_PTR_FORMAT, GST_SEGMENT_FORMAT, GST_FOURCC_FORMAT and
GST_FOURCC_ARGS are format specifiers.
They can't be used outside of C and should be generated in the gir.

https://bugzilla.gnome.org/show_bug.cgi?id=797320
2018-10-23 16:21:58 +01:00
luz.paz
4a402c1c7d Fix typos in comments and docs
Found via `codespell`

https://bugzilla.gnome.org/show_bug.cgi?id=795610
2018-05-01 11:18:03 +01:00
Tim-Philipp Müller
8983cce9f6 gst: GST_EXPORT -> GST_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 00:45:35 +00:00
Sebastian Dröge
f649f0a44f info: GstStackTraceFlags were added in 1.12 2017-09-17 18:55:43 +03:00
Sebastian Dröge
870a387e5d info: GstDebugColorFlags are flags, not an enum
Annotate as such.
2017-09-09 16:14:30 +03:00
Sebastian Dröge
ad0dd860c9 debug: Add a memory ringbuffer based debug logger
This stores debug logs in memory per thread and uses up to a
configurable amount of bytes per thread for the logs. Inactive threads
are timed out after a configurable amount of time.

https://bugzilla.gnome.org/show_bug.cgi?id=785035
2017-07-28 17:27:51 +01:00
Tim-Philipp Müller
92d3246f76 gst: mark symbols explicitly for export with GST_EXPORT
One omission: gst_allocator_sysmem_get_type() was
exported but never in any public header file.
2017-05-15 23:14:12 +01:00
Tim-Philipp Müller
c90d3e9d5a info: document that logging macros don't need newlines at the end
https://bugzilla.gnome.org/show_bug.cgi?id=779459
2017-03-03 12:53:26 +00:00
Wim Taymans
a15f7ad8f8 info: put () around macro arguments
Put braces around macro arguments or else we might run into problems
with operater precedence.
2017-02-20 12:16:32 +01:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Thibault Saunier
33616d47be info: Add a 'flags' parametter to gst_debug_get_stack_trace
This is an API break but that API has not been released yet.

We are passing a flag rather than a simple boolean as we can imagine
to implement more features in the future for example to retrieve a
stack trace for all the threads, etc..

Retrieving source file and line numbers is pretty
expensive while getting a stack trace, this new argument
allows the user to decide to retrieve a backtrace
without those infos instead which is much faster.

For example running $ GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG=GST_TRACER:7 \
GST_TRACERS=leaks time gst-launch-1.0 videotestsrc num-buffers=1 ! fakesink:

* With simple stack traces:

    0.04s user 0.02s system 99% cpu 0.060 total

* With full stack traces:

    0.66s user 0.23s system 96% cpu 0.926 total

https://bugzilla.gnome.org/show_bug.cgi?id=775423
2016-12-12 15:06:20 -03:00
Tim-Philipp Müller
66d2bae604 Add gst_print(), gst_println(), gst_printerr(), gst_printerrln()
Useful for debugging.

https://bugzilla.gnome.org/show_bug.cgi?id=766470
2016-11-12 10:43:55 +00:00
Thibault Saunier
a8d4857555 gst: Use libunwind/libdw to generate backtraces if avalaible
Making the gst_debug_print_trace function more generally useful.

API:
  + gst_debug_get_trace

https://bugzilla.gnome.org/show_bug.cgi?id=772555
2016-11-04 14:22:05 -03:00
Jan Schmidt
17f9ac5657 gstinfo: Avoid gcc 6 warning that breaks the tests build
gcc 6 has problems detecting and avoiding throwing
a warning for tautological compares in macros (they
should only trigger for compares outside macros).

Avoid them with a nasty cast of one parameter to void *

https://bugzilla.gnome.org/show_bug.cgi?id=764526
2016-07-01 22:38:01 +10:00
Tim-Philipp Müller
09d5ff4097 info: flesh out GST_PTR_FORMAT docs a bit 2016-06-14 19:16:33 +01:00
Evan Nemerson
d11e657412 docs: annotate C examples as such
https://bugzilla.gnome.org/show_bug.cgi?id=731292
2016-02-15 17:45:15 +00:00
Matthew Waters
347734e529 info: expose debugging printf functions
Other gst libraries and/or elements may want to add some debug logging to an
external debug system or implement delayed debugging for performance reasons.

Exposes the internal __gst_vasprintf as gst_info_vasprintf which has a fallback
to g_vasprintf if the debug system is disabled.

API: gst_info_vasprintf
API: gst_info_strdup_vprintf
API: gst_info_strdup_printf

https://bugzilla.gnome.org/show_bug.cgi?id=760421
2016-01-13 11:56:14 +11:00
Lukasz Forynski
7e2aae7942 info: fix compiler warning with -Wpedantic and gcc 5
Gstreamer compiled with gcc 5.2 and -Wpedantic produces the
following warning:

'ISO C does not support '__FUNCTION__' predefined identifier [-Wpedantic]
  const char *s = __FUNCTION__;'

Since gcc 5 enables C99 by default, use __func__ if it's available
instead of the non-standard __FUNCTION__ (as suggested in [2]).

[1]: https://gcc.gnu.org/gcc-5/changes.html
[2]: https://gcc.gnu.org/gcc-5/porting_to.html

https://bugzilla.gnome.org/show_bug.cgi?id=758541
2015-11-24 09:34:59 +00:00
Tim-Philipp Müller
62bd514c8e docs: info: remove 0.8 terminology from log level description
We don't "iterate" bins or pipelines any more.
2015-07-30 17:29:25 +01:00
Stefan Sauer
7326d4d71b docs: fix two gtk-doc warnings
One by correcting the end-of-comment marker and one by making sure the function
prototype in the header is in sync with the c file and doc-blob.
2014-12-29 12:05:27 +01:00
Edward Hervey
d92e18b722 gstinfo: Add new maximum level debugging
API: GST_LEVEL_MAX

By compiling gstreamer (or plugins) with GST_LEVEL_MAX defined, only
the debugging statements at or below that level will be compiled in.

This allows compiling in some debugging (like errors and warnings) which
helps in debugging, but without the full cpu/memory overhead of all debugging
enabled.
2014-12-19 11:35:24 +01:00
Evan Nemerson
4088363aea introspection: add some missing allow-none annotations to in params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 19:00:58 +02:00
Evan Nemerson
e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Sebastian Rasmussen
53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Edward Hervey
29353c1b59 gst: minor docstring fixups to make g-i happy
note: the #ifndef move is actually a move of the "SECTION" docstring
2013-08-14 07:05:04 +02:00
Руслан Ижбулатов
797fcd1d49 info: Add debug color mode option
This allows to explicitely set the debug output color
mode to UNIX on every platform, enable it (use platform
default color mode) or enable it.

https://bugzilla.gnome.org/show_bug.cgi?id=674320
2013-07-18 14:30:44 +02:00
Nicolas Dufresne
4656d18fd5 Add few missing allow-none annotation 2013-07-03 14:25:07 -04:00
Tim-Philipp Müller
fe7f7135e0 printf: add infrastructure for pointer extensions hook
Does not do anything yet. On a sidenote, we can't just use
%p\001 or so to signal the extension because g-i complains
about an invalid ascii character then, so have to resort to
something more elaborate, such as %p\aA etc.

https://bugzilla.gnome.org/show_bug.cgi?id=613081
2013-04-12 23:05:57 +01:00
Tim-Philipp Müller
7b19944280 info: use new internal printf for debug message printing
and remove all the printf extension/specifier stuff for
the system printf. Next we need to add back the custom
specifiers to our own printf implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=613081
2013-04-12 23:05:57 +01:00
Tim-Philipp Müller
666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Thibault Saunier
e513ed1810 info: add a function to set debug threshold from a GST_DEBUG-style string
Use the same format as with the GST_DEBUG environment variable.

API: gst_debug_set_threshold_from_string()

https://bugzilla.gnome.org/show_bug.cgi?id=679152
2012-10-27 13:42:51 +01:00
Edward Hervey
d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Wim Taymans
7da1d23a9b info: add destroy notify to gst_debug_add_log_function() 2012-06-20 13:28:08 +02:00
Evan Nemerson
8620b30df9 introspection: rename some "data" arguments to "user_data"
GObject Introspection will automatically treat "user_data" arguments
as closure data.
2012-06-19 16:09:10 -07:00
Matej Knopp
efdd0a2a82 win32: fix exported variables for VS 2010
https://bugzilla.gnome.org/show_bug.cgi?id=666219
2011-12-27 23:26:07 +00:00
Tim-Philipp Müller
4b57054ae2 info: move FIXME log level after WARNING
So it's now ERROR < WARNING < FIXME < INFO and *:5 becomes *:6.
2011-11-30 12:46:10 +00:00
Tim-Philipp Müller
ac40ab45b3 info: make _gst_debug_init() private for now
This was a FIXME for 0.11. I guess a case could be made to keep it around
separately for apps or libraries that only want to use GStreamer's debugging
system, but it seems more likely they'd just copy the two source files into
their own tree if the case. Also, things like types wouldn't be initialised
without gst_init(). We can still make it public again if anyone needs it,
but then we should make it a proper function and not hide it behind
underscores.
2011-10-08 20:15:46 +01:00
Tim-Philipp Müller
5df82c88c9 info: rename __gst_debug_* to _gst_debug_* and fix symbol export regexp
Only export GStreamer symbols with one leading underscore, not two
or more leading underscores.

Requires a rebuild of the entire stack, sorry.
2011-10-08 14:27:12 +01:00
Javier Jardón
5d25e4a204 Use "const" instead G_CONST_RETURN
G_CONST_RETURN will be deprecated soon.

https://bugzilla.gnome.org/show_bug.cgi?id=652211
2011-06-09 17:54:27 +01:00
Stefan Kost
218bc52c7f info: avoid redefinition of symbols when debugging is off
The refactoring of gst_debug_add_log_function() now causes build failure when
debug-logging is turned off. Just move it to the conditional part of the header.
2011-05-06 12:02:52 +03:00
Tim-Philipp Müller
609a75eae2 info: make adding/removing of gst_debug_log_default() work properly
Make adding/removing gst_debug_log_default() work reliably in all
circumstances. The problem was that depending on platform and linker
flags the function argument might resolve to different addresses,
which made it impossible to remove the default log function added
in gst_init() from application code (because the pointer values
didn't match). The new approach should keep things simple by passing
NULL for the default function, which the code in libgstreamer can
then handle.

https://bugzilla.gnome.org/show_bug.cgi?id=625396
https://bugzilla.gnome.org/show_bug.cgi?id=640771
2011-02-03 10:53:27 +00:00
Tim-Philipp Müller
05918f28dc gstinfo: remove random MSVC compatibility define for M_PI that doesn't belong here
Code that needs this should include gst/math-compat.h or use G_PI.
2010-10-05 18:31:58 +01:00
Arun Raghavan
00a0f4fd0b docs: Trivial cleanup for GST_DEBUG_CATEGORY_GET 2010-08-30 21:27:28 -03:00
Tim-Philipp Müller
29cc802269 info: add dummy TRACE log level macros for when debugging is disabled
Forgot those when adding the original API, just like the API markers
in the commit message:

API: GST_TRACE
API: GST_TRACE_OBJECT
API: GST_CAT_TRACE
API: GST_CAT_TRACE_OBJECT
API: GST_LEVEL_TRACE

Fixes compilation with --disable-gst-debug
2010-06-15 10:46:08 +01:00
Tim-Philipp Müller
a76412747d docs: fix example to use a category name that actually exists 2010-06-14 12:28:42 +01:00