Commit graph

72 commits

Author SHA1 Message Date
Thibault Saunier
685731e989 meson: Add variables for gir files
And flatten list of sources for dependencies
2019-05-13 10:19:22 -04:00
Tim-Philipp Müller
dc29bc4e13 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 08:45:34 +01:00
Nirbheek Chauhan
a9cab426d0 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:40:43 +05:30
Antoine Jacoutot
c765649505 libs: g-ir-scanner: do not hardcode libtool path
https://bugzilla.gnome.org/show_bug.cgi?id=726571
2018-05-18 13:41:25 +02:00
Hyunjun Ko
56ab7e0e1d dmabufallocator: adds gst_dmabuf_allocator_alloc_with_flags
If we can guarantee the lifetime of the fd is longer than
the memory, we can use DONT_CLOSE flag not to close when release.
But it's not provided in gstdmabuf yet while gstfdmemory does.

For example, in case of using VA-API or MSDK, we would need this api.
Otherwise we should call dup to duplicate the fd.

https://bugzilla.gnome.org/show_bug.cgi?id=794829
2018-04-26 16:40:54 -04:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Nicolas Dufresne
681f41978a dmabufallocator: Fix build if LINUX_DMA_BUF_H is missing 2018-03-21 18:15:49 -04:00
Nicolas Dufresne
8ee306eb3f allocators: Add DMABuf synchronization
When doing CPU Access, some architecture may require caches to be
synchronize before use. Otherwise, some visual artifact may be
visible, as the CPU modification may still resides in cache.

https://bugzilla.gnome.org/show_bug.cgi?id=794216
2018-03-21 15:58:06 -04:00
Tim-Philipp Müller
75c32b8afc allocators: GST_EXPORT -> GST_ALLOCATORS_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 10:20:23 +00:00
Tim-Philipp Müller
98fc23062f docs: add GstPhysMemoryAllocator to docs 2018-03-08 01:01:53 +00:00
Nicolas Dufresne
f2726a2b4a doc: Fix since marker in dmabuf to match a stable release 2018-02-14 14:16:14 -05:00
Nicolas Dufresne
7d8208912a doc: Remove extra . after Since marker 2018-02-14 14:14:58 -05:00
Tim-Philipp Müller
6559bd75ac allocators: fix meson build after physmem move from -bad 2017-12-19 12:44:35 +00:00
Sebastian Dröge
1aec533d21 allocators: move GstPhysMemoryAllocator abstraction from -bad to -base
This can be used in a generic way as common interface by all platforms
that, in one way or another, pass around physical memory addresses.

This is used by the gl lib and seems useful enough, so might just as
well move it next to the other allocators.

https://bugzilla.gnome.org/show_bug.cgi?id=779067
2017-12-19 12:01:26 +00:00
Havard Graff
43985b363d meson: remove vs_module_defs
GST_EXPORT should handle it.
2017-10-05 13:53:14 +01:00
Sebastian Dröge
67fb3b12ee 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:52 +03:00
Sebastian Dröge
7185a7ac98 allocators: Annotate constructors with (transfer floating)
GstAllocator is a GstObject and as such uses floating references.

https://bugzilla.gnome.org/show_bug.cgi?id=702960
2017-05-17 10:40:52 +03:00
Tim-Philipp Müller
d6a12c0a8f allocators: mark symbols explicitly for export with GST_EXPORT 2017-05-16 01:11:46 +01:00
Tim-Philipp Müller
60e9629860 g-i: no need to load registry in g-i scanner 2017-05-04 23:55:20 +01:00
Rico Tzschichholz
07a427b403 meson: Pass --c-include accordingly to GIR builds 2017-04-13 12:23:32 +01: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
Julien Isorce
b68d9bbe43 gstfdmemory: log with GST_INFO instead of GST_ERROR on permission denied
For example mmap can fail with EACCES if the the fd has been open
with read only mode. And mapping the memory might be the only way
to check that. So no need to print out an error.

Ex: ioctl(dev, DRM_IOCTL_PRIME_HANDLE_TO_FD, flags & ~DRM_RDWR)

https://bugzilla.gnome.org/show_bug.cgi?id=765600
2016-11-21 21:22:47 +00:00
Nicolas Dufresne
a1a2a33315 dmabuf-allocator: Add missing padding in the class
This class was made subclassable, though for future growth of the code,
it's better if we have some room for add class members. Using the small
padding since this is unlikely.
2016-11-18 14:56:20 -05:00
Thibault Saunier
6917cb629e meson: Generate girs
https://bugzilla.gnome.org/show_bug.cgi?id=773944
2016-11-09 18:06:19 -03:00
Julien Isorce
f5eb366335 allocators: define GST_CAPS_FEATURE_MEMORY_DMABUF
Adds "memory:DMABuf" caps feature. Since 1.11 tag.
Useful when the the dma-buf buffer cannot be mapped to CPU for r/w requests.
Example: protected content or platform constraints.

https://bugzilla.gnome.org/show_bug.cgi?id=759358
2016-11-03 13:19:12 -04:00
Nicolas Dufresne
c37b1e8c56 dmabuf: Make the allocator sub-classable
This should allos for cleaner code when implement such allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=768794
2016-11-03 13:19:12 -04:00
Nirbheek Chauhan
5c4f4ac1bd Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.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:09:51 +01:00
Wim Taymans
38622ee1e8 fdmemory: add flag to avoid close of the fd
Add GST_FD_MEMORY_FLAG_DONT_CLOSE to avoid closing the fd when the
memory is freed. When you can guarantee the lifetime of the fd is
longer than the memory, this can save a dup() call.
2016-08-19 09:27:01 +02:00
Tim-Philipp Müller
d52a74f32e g-i: pass compiler env to g-ir-scanner
It's what introspection.mak does as well. Should
fix spurious build failures on gnome-continuous.
2016-05-24 00:44:21 +01:00
Vivia Nikolaidou
a0cf3b4262 fdmemory, rtpbasedepayload: Ran gst-indent
https://bugzilla.gnome.org/show_bug.cgi?id=764948
2016-04-12 17:34:18 +03:00
Xavier Claessens
429860e51f base: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 13:39:43 -05:00
Reynaldo H. Verdejo Pinochet
4ed7b0a0e6 Drop usage of deprecated g-ir-scanner --strip-prefix flag 2015-12-02 20:19:43 -08:00
William Manley
aae0dc37c9 allocators: add debug category for fd memory and allocator
Debugging can now be viewed by setting GST_DEBUG=fdmemory:9

https://bugzilla.gnome.org/show_bug.cgi?id=758744
2015-11-27 15:33:47 +00:00
Aurélien Zanelli
94e0279c44 fdmemory: remove 'allow-none' annotation in gst_fd_allocator_alloc() doc
gst_fd_allocator_alloc() ensure that passed allocator is a fd memory
allocator, so that we can't pass NULL allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=754833
2015-09-23 10:01:41 -04:00
Aurélien Zanelli
4559feb69e dmabuf: remove 'allow-none' annotation in gst_dmabuf_allocator_alloc() doc
gst_dmabuf_allocator_alloc() ensure that passed allocator is a DMABuf
allocator, so that we can't pass NULL allocator.

https://bugzilla.gnome.org/show_bug.cgi?id=754833
2015-09-23 10:01:41 -04:00
George Kiagiadakis
7860060536 allocators: include gstfdmemory.h in the main library header, allocators.h 2015-08-29 21:38:52 +02:00
Stefan Sauer
b8a6aefa38 docs: add fdmemory to docs 2015-05-18 20:56:28 +02:00
Stefan Sauer
b364f5576d docs: a random set of trivial fixes for the library docs
All those where super straight forward from the warnings gtkdoc prints. It kind
of makes sense to apply them before the list of warnings is >100 and people
complain that gtkdoc is noisy.
2015-05-18 20:45:45 +02:00
Tim-Philipp Müller
c680e324bc Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:42:34 +01:00
Wim Taymans
7c059b4530 allocators: make GstFdAllocator non-abstract
Make the GstFdAllocator non-abstract because it is perfectly possible
to make memory from a generic fd. Mark the memory as simply "fd".
2015-04-17 09:31:40 +02:00
Edward Hervey
3eb35c77cc introspection: Don't use g-ir-scanner cache at compile time
It pollutes user directories and we don't need to cache it

https://bugzilla.gnome.org/show_bug.cgi?id=747095
2015-03-31 11:21:43 +02:00
Luis de Bethencourt
90d428a553 Revert "fdmemory: freed pointer will always be 0"
This reverts commit 7fbcefb753.
2015-03-24 10:46:44 +00:00
Luis de Bethencourt
7fbcefb753 fdmemory: freed pointer will always be 0 2015-03-24 10:20:05 +00:00
Wim Taymans
3205e90e83 fdmemory: make a base class for allocating fd-backed memory
Make a base class that can help with allocating fd-backed memory.
Make dmabuf extend from the base class.
We can now make methods to check if memory has an fd and get the fd for
all the different types of fd-backed memory.
2015-03-18 15:12:03 +01:00
Wim Taymans
e6cb520036 fdmemory: add flags to control behaviour
Add some flags to the GstFdMemory to control how memory is mapped and
unmapped.
2015-03-15 17:27:33 +01:00
Wim Taymans
4e6fba8604 fdmemory: add fd backed GstMemory to separate file
Make a separate file for the code to handle the fd backed memory.
This would make it possible later to add other allocators also using
fd backed memory.
2015-03-15 15:26:28 +01:00
William Manley
c97f10d7d8 docs: gst_dmabuf_allocator_alloc: Improve documentation
https://bugzilla.gnome.org/show_bug.cgi?id=739545
2014-11-03 09:02:46 -05:00
Nicolas Dufresne
f260baf23b dmabuf: Ensure _get_fd() works even for shared memory
Fixes regression introduced by:

commit b60888fd4b
Author: Michael Olbrich <m.olbrich@pengutronix.de>
Date:   Tue May 20 11:18:56 2014 +0200

    dmabuf: share the mapping with shared copies of the memory

https://bugzilla.gnome.org/show_bug.cgi?id=730441
2014-07-11 09:47:04 +02:00
Michael Olbrich
42623c995e dmabuf: fix checking mmap flags
A simple '&' is not sufficiant. With mmapping_flags == PROT_READ and
prot == PROT_READ|PROT_WRITE the check produces the wrong result.
Change the check to make sure that prot is a subset of mmapping_flags.

https://bugzilla.gnome.org/show_bug.cgi?id=730559
2014-06-04 10:01:27 -04:00
Michael Olbrich
b60888fd4b dmabuf: share the mapping with shared copies of the memory
With lots of shared memory instances (e.g. created by a RTP payloader) the
overhead of duplicating the file descriptor and creating extra mappings is
significant. To avoid this, the parent memory maps the whole region and the
shared copies just reuse the same mapping.

https://bugzilla.gnome.org/show_bug.cgi?id=730441
2014-05-20 09:42:02 -04:00