Commit graph

46 commits

Author SHA1 Message Date
Tim-Philipp Müller
b6411ae74c libs: fix API export/import and 'inconsistent linkage' on MSVC
For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

While we're at it, add new GST_API_EXPORT in config.h and use
that for GST_*_API decorators instead of GST_EXPORT.

The right export define depends on the toolchain and whether
we're using -fvisibility=hidden or not, so it's better to set it
to the right thing directly than hard-coding a compiler whitelist
in the public header.

We put the export define into config.h instead of passing it via the
command line to the compiler because it might contain spaces and brackets
and in the autotools scenario we'd have to pass that through multiple
layers of plumbing and Makefile/shell escaping and we're just not going
to be *that* lucky.

The export define is only used if we're compiling our lib, not by external
users of the lib headers, so it's not a problem to put it into config.h

Also, this means all .c files of libs need to include config.h
to get the export marker defined, so fix up a few that didn't
include config.h.

This commit depends on a common submodule commit that makes gst-glib-gen.mak
add an #include "config.h" to generated enum/marshal .c files for the
autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 14:45:56 +01:00
Nirbheek Chauhan
cea5e3fcdb meson: Maintain macOS ABI through dylib versioning
Requires Meson 0.48, but the feature will be ignored on older versions
so it's safe to add it without bumping the requirement.

Documentation:
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-manual.md#shared_library
2018-08-31 14:41:00 +05:30
Tim-Philipp Müller
86c1a7b4ad libs: Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 12:19:17 +02:00
Tim-Philipp Müller
665cc1c6f2 uridownloader: GST_EXPORT -> GST_URI_DOWNLOADER_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 13:05:45 +00:00
Havard Graff
22f0f11abf meson: remove vs_module_defs
The GST_EXPORT should handle it.
2017-10-05 13:57:48 +01:00
Tim-Philipp Müller
059cc73487 uridownloader: mark symbols explicitly for export with GST_EXPORT 2017-07-18 12:46:57 +01:00
Sebastian Dröge
634cd87c76 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:23 +03:00
Sebastian Dröge
58370ed6cf uridownloader: Use a GWeakRef to the parent to prevent a reference cycle
https://bugzilla.gnome.org/show_bug.cgi?id=780140
2017-04-03 11:35:51 +03:00
Thiago Santos
8cf858fb27 uridownloader: add new gst_uri_downloader_set_parent
If set, the parent is used to proxy need-context messages from
uridownloader's http source in order to get cookies/headers
from the pipeline.

Based on a patch from Philippe Normand

https://bugzilla.gnome.org/show_bug.cgi?id=726314
2017-04-03 11:35:51 +03:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Carlos Garcia Campos
429353337d uridownloader: Take the ownership of the src element
The URI downloader is creating the source element with
gst_element_factory_make() that returns a floating reference that nobody
is consuming. This is causing problems in WebKit, where the smart
pointers used to take references of the source elment get confused and
end up consuming the floating reference and then releasing the element,
which usually crashes because the URI downloader still tries to use its
src element. See https://bugs.webkit.org/show_bug.cgi?id=144040.
This commit adds two helper functions to ensure and destroy the source
element, to make the code simpler and less error prone. The ensure
method takes care of checking if we can reuse the existing one or we
need to create a new one, taking always its ownership. The destroy
method simply avoids duplicated code to set the source to NULL state and
then unref it.

https://bugzilla.gnome.org/show_bug.cgi?id=766053
2016-05-06 15:26:59 +02:00
Alex Ashley
93edd99bf7 dashdemux: add support for HTTP HEAD method of time sync
The urn:mpeg:dash:utc:http-head:2014 method of time synchronisation
uses an HTTP HEAD request to a specified URL and then parses the
Date: HTTP response header.

This commit adds support to dashdemux for this method of time
synchronisation by making a HEAD request and then parsing the Date:
response.

This commit adds support to gstfragment to return the HTTP headers
and to uridownloader to support HEAD requests. To avoid creating a
new API, the RANGE get function is re-used (abused?) with start=-1
and end=-1 to indicate a HEAD request.

https://bugzilla.gnome.org/show_bug.cgi?id=752413
2015-08-14 06:47:21 -03:00
Tim-Philipp Müller
699452ef31 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:59:32 +01:00
Vincent Penquerc'h
0b499484b4 uridownloader: a few leak fixes 2015-01-16 11:43:22 +00:00
Vincent Penquerc'h
59bd35aed1 fragment: fix caps and buffer leaks in get_property 2015-01-16 11:43:22 +00:00
Thibault Saunier
4ed2a66f1e libs:uridownloader: Properly declare APIs as UNSTABLE 2014-06-21 17:02:50 +02:00
Sebastian Dröge
e3af42ae82 uridownloader: Include the debug string in the error messages we propagate from t source 2014-06-19 18:34:05 +02:00
Sebastian Dröge
8372fa6ecc uridownloader: Store URI and redirect target in the downloaded fragments 2014-05-28 09:44:24 +02:00
Sebastian Dröge
706a88ccb3 uridownloader: Add parameter to disallow caching as required by HLS 2014-05-05 09:41:51 +02:00
Sebastian Dröge
aa875604c9 uridownloader: Add refresh parameter to hint caches that they should check if they're up to date 2014-05-02 10:36:21 +02:00
Sebastian Dröge
dede842409 uridownloader: Unset referer if none was specified later on 2014-04-28 10:12:52 +02:00
Sebastian Dröge
fbbe73a62e uridownloader: Add API to specify the referer of a request 2014-04-28 10:04:25 +02:00
Sebastian Dröge
cfc32a1ec4 uridownloader: Set source state to NULL if downloading failed for whatever reason 2014-04-25 14:42:35 +02:00
Sebastian Dröge
dbb42d914f uridownloader: Fix string order in warning message 2014-03-13 14:41:06 +01:00
Sebastian Dröge
73b188cfb9 uridownload: Handle no buffers before EOS as error instead of crashing 2014-03-07 16:24:18 +01:00
Sebastian Dröge
cd02546089 hlsdemux: Implement handling of byte ranges 2014-03-06 16:36:10 +01:00
Sebastian Dröge
6fb3427729 uridownloader: Fix debug output to describe the new reality 2014-02-27 12:02:19 +01:00
Sebastian Dröge
3fd5b74f73 uridownloader: Warning messages are not fatal
Also they need to be parsed with gst_message_parse_warning(),
gst_message_parse_error() does not work on them.
2014-02-27 11:53:51 +01:00
Sebastian Dröge
a1d9f6c796 uridownloader: Keep alive connections if the source supports that 2014-02-13 10:44:58 +01:00
Sebastian Dröge
c76ea2919f uridownloader: Re-use old source element if possible
Allows to implement keep-alive handling in the source element.
2014-02-13 10:06:48 +01:00
Sebastian Dröge
d436844434 uridownloader: Fix potential deadlock
The streaming thread might use our lock, so shutting
down the element while holding that lock calls for problems.
2014-02-12 18:06:43 +01:00
Sebastian Dröge
8cd6208b7d uridownloader: Shutdown the source element before unlinking it
Otherwise we might get warnings about pushing to unlinked pads.

Based on a patch by Andoni Morales.
2014-02-12 18:01:10 +01:00
Sebastian Dröge
2a38c1409b uridownloader: Add support for compressed downloads
Very useful for playlists, less useful for media files.
2014-02-12 13:08:29 +01:00
Sebastian Dröge
3726c00b95 uridownloader: Reset cancelled state after fetching an URI
Otherwise it will never ever be able to fetch anything after an
error until the user resets it manually.
2014-02-11 15:26:01 +01:00
Sebastian Dröge
d445374067 uridownloader: Provide some more details about errors if downloading fails 2014-02-11 14:13:30 +01:00
Duncan Palmer
06dd8839f4 uridownloader: Fix race condition between EOS handling and downloading a range
https://bugzilla.gnome.org/show_bug.cgi?id=723134
2014-02-04 12:53:00 +01:00
Duncan Palmer
06fec6709d uridownloader: Always release the object lock in gst_uri_downloader_fetch_uri_with_range()
even if downloader->priv->urisrc is not set. This avoids deadlock under some
some conditions on cancel.

https://bugzilla.gnome.org/show_bug.cgi?id=723127
2014-01-29 20:38:57 +01:00
Thiago Santos
5a5f6d1b7a uridownloader: fix deadlock near EOS
A deadlock can happen when the source sends EOS when
being put to NULL as the object lock is being held by the
thread that sets the element to NULL and is needed by
the event handler.
2013-12-24 17:07:52 -03:00
Thiago Santos
c62137b832 uridownloader: fix crash when download is null
Do no try to unref a NULL download attribute
2013-07-08 23:39:49 -03:00
Thiago Santos
9e313eb0a7 uridownloader: do not set cancelled unless explicitly called by user
Cancelled is a 'permanent' state of the uridownloader and is only
removed by a call to _reset. When a download fails we just want to
return NULL on the fetch function and leave the downloader ready
for another fetch, otherwise the user has to call _reset after
failed downloader, even when it didn't call _cancel.
2013-07-08 23:39:49 -03:00
Thiago Santos
cd26bd51a1 uridownloader: Simplify locking to fix deadlocks
Use object lock to protect variables from concurrent access and
use download_lock to only allow one download running
2013-07-03 10:23:45 -03:00
Thiago Santos
e76f3e95fd uridownloader: add support for range based downloads
Adds a new API gst_uri_downloader_fetch_uri_with_range that allows
downloading only a byte range from an URI. It uses a seek event
sent to the source to signal the range to be downloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=702206
2013-07-01 14:22:01 -03:00
Louis-Francis Ratté-Boulianne
f0211e5b7b uridownloader: unlock mutex when switching urisrc state to NULL to avoid deadlock
When chain method was called after gst_uri_downloader_stop and before state has been changed to NULL, execution was blocking on g_mutex_lock.

Conflicts:
	gst-libs/gst/uridownloader/gsturidownloader.c
2013-05-07 20:02:41 -03:00
Thiago Santos
99efe87b5d uridownloader: properly unref the urisrc between downloads
This prevents leaking the element. Also sets the bus to flushing
to completely reset the downloader state
2013-05-07 20:02:41 -03:00
Andre Moreira Magalhaes (andrunko)
f72869816c uridownloader: make cancelled state 'permanent' until a reset
When downloading and cancelling quickly the uridownloader object and the
element using it could miss the cancelled window and the uridownloader
would fetch the wrong URI and block on subsequent fetches.

This was also problematic when stopping elements, while one task would
call the cancel, another element thread could issue a new fetch_uri. As
the cancel state isn't 'permanent' this fetch_uri would block and
prevent the whole element from stopping and going to NULL.

This patch makes the 'cancelled' state permanent until a
gst_uri_downloader_reset is called. This way the element knows the
window where the uridownloader isn't active and only reactivate it when
ready.
2013-05-07 20:02:41 -03:00
Thiago Santos
859635ca01 uridownloader: refactor gsturidownloader to its own lib
gsturidownloader can be reused by other plugins, better have it
into its own lib
2013-05-07 20:02:41 -03:00