Commit graph

163 commits

Author SHA1 Message Date
Sebastian Dröge
47e2c4cc10 discoverer: Check sinkpad existence before retrieving caps
Otherwise we would error out without releasing the caps first.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/655>
2020-05-06 11:52:20 +03:00
Sebastian Dröge
ceb705837d discoverer: Ensure that we have fixed, non-empty caps before passing passing to is_subtitle_caps()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/655>
2020-05-06 11:51:00 +03:00
Sebastian Dröge
350a7197e7 discoverer: Try to get negotiated caps first on pad-added and only then fall back to a caps query
The negotiated caps will be more accurate and are fixed caps in any
case.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/498

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/655>
2020-05-06 11:46:25 +03:00
Thibault Saunier
1e9da26b68 discoverer: Start discovering next URI from right thread
When using the cache, we were not using the right GMainContext to setup
next URI to discovery, fix that.
2020-02-10 17:16:42 -03:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Niels De Graef
0314b482f3 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-08-27 07:31:57 +02:00
Thibault Saunier
e0ebd29a17 discoverer: Plug some leaks in the cache loading path 2019-06-07 22:44:31 -04:00
Mathieu Duponchelle
d6847fe04d discoverer: unref "next" variant when parsing from variant 2019-06-05 20:51:47 +00:00
Aaron Boxer
6ade19cc15 discoverer: async_timeout_cb: don't clean up timeout_source
discoverer_collect() already does this. So, the second
unref triggers an assert.
2019-04-01 18:35:06 +00:00
Josep Torra
a1cc9ea6a9 discoverer: add casts to avoid warnings in osx builds
Fix the following warnings by adding casts.

gstdiscoverer.c:1801:17: error: format specifies type 'unsigned long' but the argument has type 'off_t' (aka 'long long') [-Werror,-Wformat]
      location, file_status.st_size, file_status.st_mtime);
                ^~~~~~~~~~~~~~~~~~~
gstdiscoverer.c:1801:38: error: format specifies type 'long long' but the argument has type '__darwin_time_t' (aka 'long') [-Werror,-Wformat]
      location, file_status.st_size, file_status.st_mtime);

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/570
2019-03-21 17:21:30 +01:00
Thibault Saunier
7bcd72f5b6 Revert "Revert "discoverer: Serialize/load "next" StreamInfo in GVariants""
This reverts commit 747f5a75c3.

This was never meant to be reverted in the first place but sliped in
during developement
2019-03-07 19:52:44 -03:00
Thibault Saunier
747f5a75c3 Revert "discoverer: Serialize/load "next" StreamInfo in GVariants"
This reverts commit 6ca357f5b67590c694a95013f5eb5fdd04cf46a9.
2019-03-07 20:59:29 +00:00
Thibault Saunier
c8eee6f0c6 dicoverer: Do not add container infos to the stream list
They are not added on actual discovery

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/398
2019-03-07 20:59:29 +00:00
Thibault Saunier
4014995d0c discoverer: Serialize/load "next" StreamInfo in GVariants
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/398
2019-03-07 20:59:29 +00:00
Thibault Saunier
54920276b0 discoverer: Implement GstDiscovererInfo caching
This uses the gst_discoverer_info_from/to_variant API and saves
the variants on disc (in the user data cache dir) allowing much
faster retrieval of the information after the cache has been built.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/398
2019-03-07 20:59:29 +00:00
Seungha Yang
b32b59ce76 discoverer: Hold GSource object instead of source id
g_source_remove() works only for a GSource which was attached
to default GMainContext, but the GSource might be attached to
custom context depending on how gst_discoverer_start() was called.

Whatever the attached context was, g_source_destroy() can clean it up.
2019-01-28 18:53:39 +09:00
Sebastian Dröge
14031f1c63 discoverer: Consider closedcaption/ as subtitles and improve subtitle caps detection
Generally all subtitle/, subpicture/, text/, closedcaption/ and
application/x-subtitle caps instead of hardcoding a small set of caps.

https://bugzilla.gnome.org/show_bug.cgi?id=797072
2018-09-04 11:59:46 +03:00
Tim-Philipp Müller
511a8d7ddd pbutils: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 22:08:16 +02:00
Thiago Santos
400ea72b06 pbutils: add some missing gi annotations
For allow-none parameters
2018-02-19 11:23:40 -08:00
Edward Hervey
4c2f91d69e discoverer: Don't remove element when switching to PLAYING
There is a race going on somewhere when we attempt to remove elements
*while* the parent container is switching to PLAYING.

In order to avoid this issue with discoverer, make sure we never
remove elements while switching to PLAYING.
2017-11-15 10:55:56 +01:00
Edward Hervey
9c4b3b1ee7 discoverer: Don't add pads/elements when cleaning up
There is no need to add more pads/elements since we are already done.
2017-11-15 10:55:55 +01:00
Edward Hervey
4636b8dd6f discoverer: Remove probe when done 2017-11-15 10:55:55 +01:00
Edward Hervey
89238f9de1 discoverer: Don't switch to PLAYING if we saw an error
If we saw an error on the bus, we can't be guaranteed that element will
function properly anyway. Avoids weird state change races also
2017-11-04 19:48:13 +01:00
Edward Hervey
fcf09c18f2 Revert "discoverer: Avoid race of adding elements while stopping"
This reverts commit 9a8cb29970.

The problem is deeper down the stack
2017-11-04 19:09:19 +01:00
Edward Hervey
9a8cb29970 discoverer: Avoid race of adding elements while stopping
This would result in a lot of warnings regarding elements not being
in NULL state when removed, or even leaked elements.

Instead make sure we take the lock and check whether we are processing
or not before allocating or adding anything to the pipeline
2017-11-04 16:13:06 +01:00
Edward Hervey
7e28f6c076 discoverer: Check return values
The target pad of a ghostpad could have gone (due to shutdown taking
place for example). Check for it's existence before doing anything
with it.
2017-11-02 08:04:27 +01:00
Edward Hervey
39ba6427f1 discoverer: Uniquely name elements
Helps identifying actual queue/fakesink usage. There seems to be
a race in discoverer, this should help track it down.
2017-11-02 07:18:17 +01:00
Mathieu Duponchelle
545e0b003b API: gst_discoverer_info_get_live
https://bugzilla.gnome.org/show_bug.cgi?id=783722
2017-10-11 19:47:19 +02:00
Mathieu Duponchelle
2a26baf4be API: gst_discoverer_audio_info_get_channel_mask
https://bugzilla.gnome.org/show_bug.cgi?id=783722
2017-10-11 19:46:29 +02:00
Mathieu Duponchelle
5d6b3b60cb gst-discoverer: use state changes instead of ASYNC_DONE.
And monitor no_more_pads.

With live sources such as rtsp, uridecodebin only creates its
child decodebins between PAUSED and PLAYING.

This means that the ASYNC_DONE it posts when getting NO_PREROLL
in its change_state method gets immediately propagated by the
GstBin parent class, as opposed to a situation where a
decodebin has been added to it already, and has posted ASYNC_START.

The proposed solution, instead of simply waiting for ASYNC_DONE,
and finishing prematurely in that case, waits for three conditions
to be true:

* the uridecodebin needs to have emitted no_more_pads
* its current state must be PAUSED if not live, PLAYING otherwise
* There must be no "pending subtitle pads", ie pads where we haven't
  received tags yet.

All these conditions are checked in the message handler, as we
post custom messages on it when we get subtitle tags or no_more_pads.

https://bugzilla.gnome.org/show_bug.cgi?id=783257
2017-05-31 05:10:21 +02:00
Sebastian Dröge
cc281e80d6 discoverer: Clean up more fields to decide if parent/child streams are equivalent
https://bugzilla.gnome.org/show_bug.cgi?id=782780
2017-05-18 13:24:19 +03:00
Sebastian Dröge
5614862de1 Revert "discoverer: Consider parent/child streams the same if they have caps with the same name"
This reverts commit 478b7a8eb4.

video/mpeg,systemstream=true / false distinguishes between container and
elementary stream.
2017-05-18 13:13:58 +03:00
Sebastian Dröge
478b7a8eb4 discoverer: Consider parent/child streams the same if they have caps with the same name
Child streams could have more accurate width/height or various other
information added. If they have the same name, they are likely to be the
same streams.

https://bugzilla.gnome.org/show_bug.cgi?id=782697
2017-05-18 11:21:55 +03:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Thibault Saunier
d5fbc905e3 discoverer: Ignore more parser related fields when comparing streams
The parser might do some conversion on a stream but the stream keeps
being the same, and we need to make sure GstDiscoverer detects it is the
case.

https://bugzilla.gnome.org/show_bug.cgi?id=778298
2017-02-08 15:56:34 -03:00
Vineeth TM
c0a18df468 discoverer: Add support to dump dot files
Dump graphs during error/warning messages and discover is done

https://bugzilla.gnome.org/show_bug.cgi?id=758259
2016-12-25 11:49:49 +00:00
Sebastian Dröge
15123c0455 discoverer: Get caps from the element's srcpad if possible
The caps put into the stream topology by decodebin are the caps at the
moment the pads are exposed on it. This is usually before decoders
received any buffers.
In discoverer we however wait for pre-roll, which ensures that each
decoder handled buffers already. At this point, there might be more
information known about the caps already that we could make use of.

One example here is extra information stored in the SEI of H264, like
the multiview-mode. This will be known if there is a SEI before the
first keyframe, but decodebin won't put this into the topology as it
only waits for the initial caps of h264parse (which come directly after
SPS/PPS).

With this change, the multiview-mode is in the caps reported by
discoverer in many cases.
2016-12-17 22:01:10 +02:00
Sebastian Dröge
7e24acc67f discoverer: Handle NULL/ANY/EMPTY caps without crashing 2016-11-28 19:46:10 +02:00
Sebastian Dröge
4efc15dffb discoverer: Extract video information from caps manually without GstVideoInfo
The caps might not be fixated (which is required by GstVideoInfo) and we
would assert otherwise. However the caps often contain useful
information in the already-fixed parts that we can use here.
2016-11-28 10:12:49 +02:00
Sebastian Dröge
bd74b102fa discoverer: Also stop waiting for subtitles if we get EOS
We're not going to get a buffer or GAP event anymore after EOS and would
wait forever otherwise.
2016-11-28 10:04:38 +02:00
Thibault Saunier
0c0dfbd455 discoverer: Do not try to unref the bus if it has not been set yet
It might happen if creation of the discoverer failed
2016-11-15 15:22:45 -03:00
Jonathan Matthew
7b8aa8cf7e pbutils: store missing-plugin structure in current_info->misc again
This allows gst_discoverer_info_get_misc to work again, until it
finally gets removed.

https://bugzilla.gnome.org/show_bug.cgi?id=770643
2016-09-04 16:48:40 +01:00
Sebastian Dröge
26f63db498 discoverer: Only allow serializing OK discoverer infos to GVariants
They will be incomplete otherwise and we can't generate the full serialized
information, and instead will crash somewhere on the way.

https://bugzilla.gnome.org/show_bug.cgi?id=767859
2016-06-21 10:24:15 +03:00
Edward Hervey
f9b9472ad4 discoverer: Also consider XSUB as a subtitle format 2015-12-02 16:37:50 +01:00
Thibault Saunier
629b63d1f2 discoverer: Check API arguments and assert if needed 2015-11-07 00:46:47 +01:00
Vineeth TM
fd7724b6e1 pbutils: discoverer: Set GError when NULL info is being returned.
When discovering the URI, if info is NULL, then instead of just returning NULL,
set the GError, so the error can be printed and notified.

https://bugzilla.gnome.org/show_bug.cgi?id=753701
2015-08-18 12:13:41 +03:00
Mathieu Duponchelle
decea41ac7 discoverer: Serialize the top level DiscovererInfo
Which contains fields such as duration, uri and tags.

https://bugzilla.gnome.org/show_bug.cgi?id=749673
2015-06-04 19:16:40 +02:00
Tim-Philipp Müller
a24b9cd5c2 discoverer: don't crash on unknown info types when deserializing
Handle unknown info types when deserializing instead of
dereferencing NULL pointers.

Coverity CID 1302394
2015-05-29 15:30:41 +01:00
Mathieu Duponchelle
2e423dd129 discoverer: Add serialization methods.
[API] gst_discoverer_info_to_variant
[API] gst_discoverer_info_from_variant
[API] GstDiscovererSerializeFlags

+ Serializes as a GVariant
+ Adds a test
+ Does not serialize potential GstToc (s)

https://bugzilla.gnome.org/show_bug.cgi?id=748814
2015-05-19 18:48:07 +02:00
Guillaume Desmottes
d7d8fc5652 discoverer: fix GstToc leak when parsing toc messages
gst_message_parse_toc() returns a reffed GstToc which is owned by the
GstDiscovererInfo. But we have to make sure we unref its previous value before
setting the new one.

https://bugzilla.gnome.org/show_bug.cgi?id=747103
2015-04-17 14:49:01 +01:00