Commit graph

866 commits

Author SHA1 Message Date
Thor Andreassen
41d77e0327 tools: option '-u' occurs twice in gst-inspect-1.0.1
I have removed the erroneous one according to the source file.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/492>
2020-05-20 08:20:50 +00:00
Tim-Philipp Müller
df6cbe64cd tools: gst-stats: parse thread-id in windows debug logs properly
They don't seem to have the "0x" prefix.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/376>
2020-05-01 21:12:31 +00:00
Mathieu Duponchelle
c682579c5e gst-launch: go back down to GST_STATE_NULL in one step.
Going through each state on the way back down to GST_STATE_NULL
can cause deadlocks, for example:

gst-launch-1.0 audiotestsrc ! valve drop=true ! autoaudiosink

ctrl + C

Hangs forever when going to PAUSED, because the "final" state is
ASYNC, and the sink blocks waiting for a preroll buffer.

Going straight to NULL addresses this issue, and also helps
making teardown faster when piping sparse streams to a
sync sink.
2020-04-01 15:41:49 +02:00
Seungha Yang
0a185c24b5 gst-launch: Follow up to missing s/g_print/gst_print/g
Required to avoid broken log string on Windows but missed
in the commit of 493a3261a9
2020-03-03 18:57:45 +09:00
Johan Bjäreholt
ef0df31c5e gst-stats: Fix missing NULL checks
gst-inspect-1.0 segfaults on tracing logs where it fails to find
element stats. So on the pipelines where we get the following WARNING
during execution will afterwards crash with a segfault as the
g_ptr_array has a index for it but it is just a NULL pointer.

WARN default gst-stats.c:444:do_message_stats: no element stats found for ix=X

An example of an pipeline which can reproducibly create a trace log
where this occurs would be this

GST_DEBUG="GST_TRACER:7" GST_TRACERS="stats;rusage;latency" gst-launch-1.0 videotestsrc num-buffers=120 ! autovideosink &> trace.log
gst-stats-1.0 trace.log
2020-02-28 15:14:58 +00:00
Seungha Yang
2af630b0c1 gst-inspect: Add define guard for g_log_writer_supports_color()
g_log_writer_supports_color() was introduced since GLib 2.50.0
which is slightly higher version than our minimum required GLib version.
2020-02-26 22:35:26 +09:00
Nirbheek Chauhan
e9085043c1 Don't use glib format modifiers with sscanf or printf
We do not have a way to know the format modifiers to use with string
functions provided by the system. `G_GUINT64_FORMAT` and other string
modifiers only work for glib string formatting functions. We cannot
use them for string functions provided by the stdlib. See:
https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description

F.ex.:

```
 ../tools/gst-stats.c:921:11: error: too many arguments for format [-Werror=format-extra-args]
   printf ("Number of Buffers passed: %" G_GUINT64_FORMAT "\n", num_buffers);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tools/gst-stats.c:922:11: error: unknown conversion type character 'l' in format [-Werror=format=]
   printf ("Number of Events sent: %" G_GUINT64_FORMAT "\n", num_events);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/gtypes.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/galloca.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib.h:30,
                 from ../gst/gst.h:27,
                 from ../tools/tools.h:28,
                 from ../tools/gst-stats.c:30:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
```

and

```
../tests/misc/netclock-replay.c: In function 'main':
../tests/misc/netclock-replay.c:98:23: error: unknown conversion type character 'l' in format [-Werror=format=]
     if (sscanf (line, "%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %"
                       ^~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32,
                 from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib.h:30,
                 from ../tests/misc/../../libs/gst/net/gstntppacket.c:38,
                 from ../tests/misc/netclock-replay.c:31:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
 #define G_GUINT64_FORMAT "llu"
                            ^
```

This is needed for upgrading glib inside Cerbero which builds with
`-Werror` on Windows:
https://gitlab.freedesktop.org/gstreamer/cerbero/merge_requests/419
2020-02-25 21:22:28 +05:30
Stefan Sauer
19b28788cf parse: add support for presets
Add new parse syntax: @preset="<preset-name>" to load presets.
Fixes #86
2019-12-28 04:02:16 +00:00
Mathieu Duponchelle
4f9cac06e4 gst-launch: handle ERROR messages in the sync handler
Errors causing the pipeline to fail going from NULL to PAUSED
were not displayed, and the pipeline was not dumped either in
those cases.

In addition, dumping the pipeline from the sync handler means
the dump matches exactly the state of the pipeline at the
moment the error was posted.
2019-12-27 10:06:45 +00:00
Seungha Yang
b5c19c7426 gst-inspect: Increase array size for printing rank name
Now the rank value can be MAX_INT (2147483647)
2019-12-26 19:49:00 +00:00
Seungha Yang
c05cb9504d gst-launch: Disable printing current position by default when stdout is not a tty
... and add new option to force-enable printing position even if stdout
is not a tty.
2019-11-14 12:15:20 +00:00
Seungha Yang
0505bd76a1 gst-launch: Add support printing current position of pipeline
By default, gst-launch will print the current position of pipeline (with duration if available).
To disable it, use "--no-position" option.
2019-11-03 09:12:26 +00:00
Seungha Yang
15423723fe gst-launch: Port to the direct use of GMainLoop
... instead of custom event loop.
This can make it easy to use GMainLoop related APIs in code.
2019-11-03 09:12:26 +00:00
Seungha Yang
966d013bf0 gst-launch: Remove meaningless global variable 2019-11-03 09:12:26 +00:00
Tim-Philipp Müller
10d9e18f02 Remove autotools build system 2019-10-13 16:10:42 +01:00
Seungha Yang
493a3261a9 gst-launch: Use gst_print* instead of g_print* to fix broken stdout on Windows
Concurrent Windows' colored debug message and g_print will print
string hard to read. Instead, use gst_print* which serialize
debug output and the APIs call.
2019-08-24 12:15:56 +00:00
Guillaume Desmottes
35294f365e gst-stats: fix leaks
String returned from g_match_info_fetch() needs to be freed.
2019-07-08 13:16:08 +02:00
Guillaume Desmottes
71f1b5ec83 gst-stats: sort latency by first activity before displaying
We use to display the latency of each element in random order which is
not very convenient when comparing latency between different runs.
Sort them by "first activity" (the first latency reported for each
element) so it's consistent betwen runs.

This is the same logic when sorting and displaying element stats.
2019-07-08 13:13:40 +02:00
Thibault Saunier
a0c65067e0 Port to hotdoc 2019-05-13 16:34:09 -04:00
Guillaume Desmottes
ab60a330db gst-stats: format latency as GST_TIME
Latency is easier to read when formatted as time rather than displayed
as a flat number in ns.
Especially when displaying GST_CLOCK_TIME_NONE which is now formated as
99:99:99.999999999 instead of 18446744073709551615.
2019-04-25 06:28:26 +00:00
Andoni Morales Alastruey
38d535ff84 gst-inspect: fix unused-const-variable error in windows
../tools/gst-inspect.c:44:20: error: 'DEFAULT_PAGER' defined but not used [-Werror=unused-const-variable=]
2019-04-24 16:34:08 +00:00
Xavier Claessens
79ddce2043 gst-inspect: Do not print warning if 'less' is missing 2019-04-11 16:06:15 -04:00
Julian Bouzas
1ec8114717 tracer: latency: Show element id, element name and pad name 2019-04-09 08:50:16 -04:00
Julian Bouzas
e615a3ddee gst-stats: Add element latency support
This will output latency information when parsing a log file with gst-stats that
has latency trace information. It will show the min, max and mean latency for
the pipeline and all its elements. It will also show the reported latency for
each element of the pipeline. Output example:

Latency Statistics:
	pulsesrc0_src|fakesink0_sink: mean=190000043 min=190000043 max=190000043

Element Latency Statistics:
	flacparse0_src: mean=45561281 min=654988 max=90467575
	flacenc0_src: mean=89938883 min=81913512 max=97964254
	flacdec0_src: mean=45804881 min=228962 max=91380801

Element Reported Latency:
	pulsesrc0: min=10000000 max=200000000 ts=0:00:00.262846528
	flacenc0: min=104489795 max=104489795 ts=0:00:00.262898616
	flacparse0: min=0 max=0 ts=0:00:00.262927962
2019-04-08 12:28:07 -04:00
Antonio Ospite
90beb712a0 gst-inspect: fix printing the first field of a GstStructure
When printing a GstStructure property (e.g. the "stats" property in
rtpsession) the first field is printed on the same line of the type
description, and this is both inconsistent compared to  how Enum values
are printed and confusing as the reader might miss the first field.

To fix this, add a newline before printing GstStructure fields in
properties.

NOTE: this does not change the existing inconsistent behavior of an
extra newline *after* a GstStructure property, but the latter is not as
annoying and it would take more effort to fix because GstStructure
fields are printed in CAPS descriptions too.
2019-04-05 12:02:40 +02:00
Nirbheek Chauhan
febfabb39f misc: Fix various compiler warnings on MinGW
gstharness.c: Use G_GSIZE_FORMAT instead of hard-coding %zu
error: unknown conversion type character 'z' in format [-Werror=format]

gst-inspect.c: GPid is void* on non-UNIX, and we only use it on UNIX
error: initialization makes pointer from integer without a cast [-Werror]

gstmeta.c: Use and then discard value
error: value computed is not used [-Werror=unused-value]

With this, gstreamer builds with -Werror on MinGW
2019-02-05 18:45:54 +05:30
Nicolas Dufresne
35300f8299 gst-inspect: Re-add DEFAULT_LESS_OPTS with initial value
Commit 56b4fbef5e refactored the pipe code
to use GLib utility, but the patch was hading some other changed. LESS
env was now hardcoded in the middle instead of from a define and was
changed from FXR to -RX. The "-" is not even valid for LESS env, and
with the lost of F, we would still use a pager when the content fits the
terminal.
2019-01-24 22:47:23 -05:00
Seungha Yang
4b55be4728 gst-inspect: Don't setup pager too early
Setup it only if we have something to print out about inspected results.
Otherwise, gst_tools_print_version() output will be redirected to pager and also
exit immediately without waiting child process.
2019-01-17 20:51:54 +09:00
Seungha Yang
56b4fbef5e gst-inspect: Port to Glib's spawn API
Although we support pager just for *nix until now,
this can make more portable to Windows.

Fixes #342
2019-01-17 20:51:54 +09:00
Nirbheek Chauhan
7d2938ddca gst-inspect: Fix ANSI escape sequence usage on Windows
Either disable it when it's not supported, or setup the console to
interpret them correctly when it's supported.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/351
2019-01-17 01:34:53 +05:30
Nicolas Dufresne
01ecc85983 gst-inspect: Disable colors when piped
This follows what git and systemd tools would do.
2018-12-19 16:55:57 -05:00
Nicolas Dufresne
8f136e8d9f gst-inspect: Fix pager color with less
Fixes #341
2018-12-19 16:06:40 -05:00
Edward Hervey
e4c07997d1 gst-inspect: Remove dead assignment
readable is set just after before usage since 906bbd3817
2018-12-15 10:53:55 +01:00
Zeeshan Ali
5dba53a6f9 gst-inspect: Fix colors for "URI handling" section
They seemed incompatible with other colors.
2018-11-29 12:54:46 +01:00
Zeeshan Ali
d3fa67c08e gst-inspect: Avoid use of non-bright blue color
Simple blue doesn't work on Linux console, which also happens to be a
gnome-terminal theme. Use bright-blue instead.
2018-11-28 18:10:06 +01:00
Zeeshan Ali
c45b386b54 gst-inspect: Use only original 16 colors
Not only this will make colored output work on old terminals and console
as well, terminals can theme the actual colors this way to make it fit
with their different themes this way.
2018-11-27 02:25:49 +00:00
Zeeshan Ali
ed4f8e368a gst-inspect: Tell less to parse color codes
This change was originally part of 2cf16838c5 (gst-inspect: Colored
output) but got lost during the recent rebase.
2018-11-24 12:06:38 +01:00
Zeeshan Ali
2cf16838c5 gst-inspect: Colored output
Let's make the output a bit pretty to read. The colored output can be
disabled with `--no-colors` option or by setting `GST_INSPECT_NO_COLORS'
env (to any value).

The chosen colors are based on the popular Solarized theme, which is
targeted for both dark and light backgrounds.

Note:

* We only support true colors. If the terminal doesn't signal support for
  that via 'COLORTERM' env, we disable colored output.

* We don't add colors to --print-plugin-auto-install-info output, as
  that's meant for machines, not humans. Not only machines don't care
  about beauty, the existing ones will likely not expect colors and choke
  on it and we'll get angry mob at our doors.

[1] https://ethanschoonover.com/solarized
2018-11-23 16:15:19 +01:00
Zeeshan Ali
d3811ca5cd gst-inspect: Remove redundant plugin name from output
When printing info about a specific plugin, there is no need to prefix
some of the details with plugin's name. It's not only redundant but also
inconsistent and makes the task of adding consistent coloring to the
output (which we'll do in a follow patch), harder.
2018-11-23 16:14:06 +01:00
Nirbheek Chauhan
a3abe8b9ae gst-inspect: Use less -F -X everywhere as the pager
This emulates the default behaviour of git help pages, and also fixes
a bug on macOS where `less -F` doesn't display anything at all when
the output is shorter than one terminal screen.

Also moved the DEFAULT_PAGER define to after the includes, because
it's an unprefixed define.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/330
2018-11-23 20:31:27 +05:30
Zeeshan Ali
ef58a84571 gst-inspect: Pipe stderr to pager as well
If stderr is not redirected by the user, also page that.
2018-11-09 12:27:18 +00:00
Zeeshan Ali
8abe052590 gst-inspect: Don't page if output fits the screen 2018-10-30 15:30:38 +01:00
Zeeshan Ali
4fbd3baf1e gst-inspect: Flush stdout before closing stdout FD
Otherwise, last line can be lost.
2018-10-30 14:53:00 +01:00
Zeeshan Ali
5d115a5d64 gst-inspect: Pipe stdout to less if not piped already
https://bugzilla.gnome.org/show_bug.cgi?id=797344
2018-10-28 13:19:47 +00:00
Tim-Philipp Müller
ce4698487e meson: add option to disable parse-launch pipeline string parser 2018-08-10 00:08:43 +01:00
Nirbheek Chauhan
38ec95460f meson: Don't add static printf library to executables
They should only need to link to libgstreamer.
2018-07-25 16:02:06 +05:30
Thibault Saunier
d93076f826 gst-inspect: Sort properties names
Making it simpler to find properties you are looking for when reading.
2018-07-13 08:54:01 -04:00
Stefan Sauer
ffc85bf7f6 inspect: add comment for how to improve tracer support 2017-12-26 12:17:53 +01:00
Tim-Philipp Müller
906bbd3817 tools: gst-inspect: fix readable flag printing for pad properties 2017-11-28 23:37:47 +00:00
Tim-Philipp Müller
ec6d2304bd tools: gst-inspect: don't print element flags whch are always 'none'
We print the interesting flags like clocking capabilities separately
later, this function just always prints 'none', so remove it.
2017-11-26 00:20:13 +00:00