Commit graph

23 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
Arun Raghavan
70ed4fd438 mpegts: Fix a compiler warning
Causes the following warning on clang:

gst-dvb-section.c:567:36: error: format specifies type 'unsigned long' but the argument has type 'int' [-Werror,-Wformat]
          descriptors_loop_length, end - 4 - data);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
2015-02-24 19:06:30 +05:30
Ramprakash Jelari
f0e418b629 dvbsection: Fix format string compiler warning 2014-11-24 12:51:34 +01:00
Felix Schwarz
a2b82ba541 mpegts: fix typos in comments
https://bugzilla.gnome.org/show_bug.cgi?id=738072
2014-10-07 13:11:13 +01:00
Edward Hervey
8c53dfcfb6 mpegts: Expose GstMpegtsDescriptor free function
Nothing earth shattering, but avoids people having to use g_boxed_free()
2014-07-01 10:03:49 +02:00
Edward Hervey
22dfd9aef3 mpegts: Unify API : GstMpegts / gst_mpegts_ / GST_*_MPEGTS_
It was previously a mix and match of both variants, introducing just too much
confusion.

The prefix are from now on:
* GstMpegts for structures and type names (and not GstMpegTs)
* gst_mpegts_ for functions (and not gst_mpeg_ts_)
* GST_MPEGTS_ for enums/flags (and not GST_MPEG_TS_)
* GST_TYPE_MPEGTS_ for types (and not GST_TYPE_MPEG_TS_)

The rationale for chosing that is:
* the namespace is shorter/direct (it's mpegts, not mpeg_ts nor mpeg-ts)
* the namespace is one word under Gst
* it's shorter (yah)
2014-06-25 14:50:05 +02:00
Sebastian Dröge
752b3a503e dvb-section: Don't compare unsigned integers for >= 0
gst-dvb-section.c:93:12: error: comparison of unsigned expression >= 0 is always true
      [-Werror,-Wtautological-compare]
  if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0
      ~~~~ ^  ~
gst-dvb-section.c:93:40: error: comparison of unsigned expression >= 0 is always true
      [-Werror,-Wtautological-compare]
  if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0
                                ~~~~~~ ^  ~
gst-dvb-section.c:93:70: error: comparison of unsigned expression >= 0 is always true
      [-Werror,-Wtautological-compare]
  if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >= 0
                                                              ~~~~~~ ^  ~
2014-05-21 08:53:03 +02:00
Thiago Santos
0cdcc5a7b1 mpegts: Check hour:minute:second values before creating datetime
Avoids assertions when the packets are malformed and also add the case
where the time isn't specified, only the date.
2014-05-19 14:55:21 -03:00
Thiago Santos
f99fe4747e mpegts: sections: prevent assertion when packet parsing fails
the descriptors entry can be left as NULL and freeing the structure
will fail (assertion happens)
2014-05-15 19:25:06 -03:00
Vincent Penquerc'h
8f4123a881 mpegts: fix sdt length check
It was originally test for 9 bytes (as the comment says) and was
rewritten buggily. So rewrite it a third way, which is now
hopefully consistent with the original and the comment, while
being more sense-making to humans.

Coverity 1139654
2014-04-09 16:01:43 +01:00
Jesper Larsen
d43e7173d8 mpegts: Add support for creation of SDT
https://bugzilla.gnome.org/show_bug.cgi?id=724981
2014-02-25 14:34:29 +01:00
Jesper Larsen
3fe1608e83 mpegts: Add transport_stream_id to GstMpegTsSDT
The transport_stream_id is contained in the subtable extension.
Introduce a variable for readability.

https://bugzilla.gnome.org/show_bug.cgi?id=724981
2014-02-25 14:34:29 +01:00
Edward Hervey
4190a1717a mpeg-ts: Rename private function
Calling it _desc_checks when it was in fact used for sections was a
tad confusing ...
2014-02-20 18:14:51 +01:00
Jesper Larsen
972f7ea71f mpegts: Fix some packetizing bugs
- Length of NIT stream descriptors was not detected correct
- Reserved bits was not set according to EN 300 468, ISO/IEC 13818-1
- Also set output data size if the section was previously packetized

https://bugzilla.gnome.org/show_bug.cgi?id=723892
2014-02-08 16:59:47 +01:00
Jesper Larsen
8c26d69e2f mpegts: Add support for creating a NIT section
Functions that will enable user to create Network Information Tables.
2014-02-06 15:30:42 +01:00
Jesper Larsen
4632ccd5be mpegts: Add network_id to GstMpegTsNIT
The network_id is stored in the subtable extension. Make a field
in the GstMpegTsNIT for better code readability
2014-02-06 14:11:53 +01:00
Edward Hervey
5d06aed3e2 mpegts: ABI/API break: Use GPtrArray instead of GArray
While it was a great idea, various g-i based bindings don't support
GArray with entries greater than sizeof(gpointer) :(

So let's just make everybody happy by just using GPtrArray.

And since we're breaking the API, also rename the various descriptor fields
to no longer have the descriptor_ prefix.

It does cost a bit more in terms of memory/cpu usage, but makes it usable
from bindings.
2013-08-21 08:59:42 +02:00
Edward Hervey
ae4d6bb334 mpegts: Unify section checks and add BAT parsing
* Avoid repeating code everywhere, and instead provide all parsing
  information in one go.
* Add BAT support
* Refine BAT/CAT identification (by adding PID checks)
2013-07-09 12:25:11 +02:00
Edward Hervey
057d24811d mpegts: Properly handle UTC time in sections
* don't unref inexistant GstDateTime
* Fine-tune hour/min/sec BCD reading code
* Update example code accordingly
2013-07-06 12:39:49 +02:00
Edward Hervey
d95bb48864 mpegts: Fix NIT parsing
The size checks were wrong. The smallest size for a NIT is 16 bytes
(12 for the smallest content + 4 for crc) and the smallest size for
a inner stream loop is 6 bytes (without any descriptors).

Also remove FIXME that has already moved elsewhere
2013-07-06 10:59:55 +02:00
Edward Hervey
f24c0b62e3 mpegts: Improve documentation
* Add a base page for the library
* Add pages for the base MPEG-TS section and descriptors
* Add pages for the known variants
* Add documentation on more fields/sections/types
* Remove some fixmes that were ... fixed
2013-07-04 08:45:33 +02:00
Edward Hervey
6a611e5d3d mpegts: Fix TOT section parsing
And use it in example
2013-07-03 18:44:54 +02:00
Edward Hervey
982aee25c6 mpegts: Split files and implement free functions
* In order to avoid future clashing between table_id for the various
  mpeg-ts variants, use different enums.
* In order to keep everything clean(ish) and allow for cleaner growth,
  split into different files (will need the same for descriptors later)
* Also ... implement free functions for all table types :)
2013-07-03 17:59:02 +02:00