Commit graph

88 commits

Author SHA1 Message Date
Vivia Nikolaidou
fecd38c8f6 tsmux: Ability for streams to disappear and reappear
Until now, any streams in tsmux had to be present when the element
started its first buffer. Now they can appear at any point during the
stream, or even disappear and reappear later using the same PID.
2020-04-15 09:07:24 +00:00
Kyrylo Polezhaiev
6af38c6ffe tsmux: Fix copying of buffer region 2019-11-18 07:31:33 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Edward Hervey
ef16d7558f mpegtsmux: Add SCTE-35 support
This adds two properties:
* scte-35-pid: If not 0, enables the SCTE-35 support for the current
  program. This will write the proper PMT and send SCTE-35 NULL
  commands (i.e. heartbeats) at a regular interval
* scte-35-null-interval: This specifies the interval at which the
  NULL commands should be sent

Sending SCTE-35 commands is done by creating the appropriate SCTE-35
GstMpegtsSection and then sending them on the muxer. See the
associated example
2019-10-31 12:31:27 +00:00
Edward Hervey
5464775aef tsmux: Disable bluray-isms from PMT
We were unconditionally adding top-level descriptors in the PMT which
were only related to bluray support for PS3 (from 10 years ago).

These should be re-added conditionally
2019-10-31 12:31:27 +00:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Mathieu Duponchelle
73f92371b8 basetsmux: expose pcr-interval property
Instead of using a static hardcoded PCR interval, allow the user
to configure it.

Also revert back the default to a 40 ms interval, that was changed
in recent patches for no good reason.
2019-07-31 15:54:13 +02:00
Mathieu Duponchelle
9996ae9ae0 tsmux: output smoothly increasing PTS when in CBR mode
Thanks to that, when its output is plugged into eg a udp sink, the
outgoing data can be output in a smoother way, reducing burstiness
2019-07-04 23:28:42 +00:00
Seungha Yang
1c99c37548 tsmuxstream: Do not try return from void function
../subprojects/gst-plugins-bad/gst/mpegtsmux/tsmux/tsmuxstream.c(1082): warning C4098:
  'tsmux_stream_get_es_descrs': 'void' function returning a value
2019-07-04 19:43:42 +09:00
Seungha Yang
00b2b599d6 mpegtsmux: Remove white space 2019-07-04 19:42:48 +09:00
Mathieu Duponchelle
76c3d98962 basetsmux: preserve user-specified sections across resets
As sections can be provided by the user through send_event
when the element state is NULL, their lifetime is expected
to match that of the muxer, and they must be preserved when
the state changes
2019-05-30 13:53:05 +00:00
Mathieu Duponchelle
5d41740ff6 tsmux: maintain packet counters in a global array
We can have multiple TsMuxPacketInfo objects for the same PID
with user-provided sections, for example ATSC requires multiple
tables with the same PID.
2019-05-30 13:53:05 +00:00
Mathieu Duponchelle
9190541e3c tsmux: refactor logic for when to (re)transmit tables
In order to output them at regular intervals in the bitstream
when a bitrate is specified.
2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
3c7c08e7c4 tsmux: fix continuity counter for packets with no payload 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
a1cadd11b8 mpegtsmux: aggregator port 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
a57f4dc8d9 mpegtsmux: spring cleanup, no functional change 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
649cc2d5e8 mpegtsmux: extract an actual base class 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
4e7f94f5fa mpegtsmux: expose the vmethods necessary for ATSC E-AC-3 handling 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
ea011a3266 mpegtsmux: provide API for subclasses to override stream creation 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
98c98c7c53 tsmux: Calculate PCR from number of bytes written in CBR mode 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
07235bbf46 mpegtsmux: Expose bitrate property
This allows outputting a Transport Stream with a constant bitrate,
by inserting null packets.
2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
4d53a7ac09 tsmux: actually respect the PCR frequency we target 2019-05-19 19:40:48 +00:00
Mathieu Duponchelle
dc2b28d456 tsmux: Use DTS over PTS 2019-05-19 19:40:48 +00:00
Sebastian Dröge
bb135ba764 mpegtsmux: Handle zero-sized buffers correctly without going into an infinite loop
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/844
2018-12-10 14:20:14 +00:00
Mathieu Duponchelle
14b9a34f54 mpegtsmux: add custom AC-3 descriptor
tsdemux expects a custom descriptor (GST_MTS_DESC_AC3_AUDIO_STREAM)
to detect a stream as AC3 and not EAC3.

Note that tsdemux expects this descriptor because mpegtsmux writes
a stream with a HDMV registration descriptor.

Fixes:

gst-launch-1.0 -v audiotestsrc ! avenc_ac3 ! ac3parse ! mpegtsmux ! \
tsdemux ! ac3parse ! avdec_ac3 ! audioconvert ! autoaudiosink

https://bugzilla.gnome.org/show_bug.cgi?id=797220
2018-09-27 17:34:10 +02:00
Sebastian Dröge
93e56ed473 mpegtsmux: Explicitly resend PAT/SI/PMT on force-keyunit events
And don't randomly change the PCR stream, which would cause a new PMT
version to be generated instead and could confuse players.
2018-03-21 13:42:30 +02:00
Sebastian Dröge
e3740b58d7 tsmux: Don't use GST_DEBUG_OBJECT() with non-GObject types 2018-03-21 10:59:29 +02:00
Reynaldo H. Verdejo Pinochet
0f71d2e408 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 14:35:48 -07:00
Sebastian Dröge
3fe65ad854 tsmux: Store PES payload size in a 32 bit integer
While the size in the packet is only 16 bits, we need to handle bigger
sizes without overflowing. For video streams this can happen, 0 is
written to the stream instead.

This fixes muxing of buffers >= 2**16.
2017-07-21 09:33:31 +03:00
Aaron Boxer
bbbdc2cd7e tsmux/tsdemux: Add support for JPEG2000
Based on patches by Milos Seleceni.

https://bugzilla.gnome.org/show_bug.cgi?id=753323
2017-07-21 09:33:31 +03:00
Vincent Penquerc'h
1630d2a0d7 mpegtsmux: fix buffer size mismatch in M2TS mode
In M2TS mode, we need an extra 4 bytes in the buffer, so need
to ensure the buffer can contain these. The allocation site
does not know the mode, so this is done in all cases.
2016-10-17 12:32:58 +01:00
Thiago Santos
1b1beded51 mpegtsmux: effectively check if there is a language
'language' is an array and not a pointer.

CID 1358835
2016-04-29 17:19:19 -03:00
Thiago Santos
9cc00bf2c9 mpegtsmux: write language descriptor when language is available
Adds a new function to mpegts lib to create a iso639 language
descriptor from a language and use it in mpegtsmux to add
a language descriptor to audio streams that have a language set.

https://bugzilla.gnome.org/show_bug.cgi?id=763647
2016-04-26 23:45:34 -03:00
Hyunjun Ko
a274299f48 mpegtsmux: set non-0 payload length in PES header if video ES packet is small enough
https://bugzilla.gnome.org/show_bug.cgi?id=748507
2016-01-19 19:32:27 +00:00
Hyunjun Ko
f9ef150652 mpegtsmux: reset pes_bytes_written when starting to write new PES packet
In case of an unbounded packet (video usually), pes_bytes_written was
no reset.

https://bugzilla.gnome.org/show_bug.cgi?id=748507
2016-01-19 19:19:38 +00:00
Tim-Philipp Müller
ab5aab60a9 mpegtsmux: add support for H.265/HEVC video
https://bugzilla.gnome.org/show_bug.cgi?id=744367
2016-01-19 17:08:50 +00:00
Bob Holcomb
cb520dce26 mpegtsmux: fix reserve bits so they are 1's
The MPEG standard (ISO-13880-1) says the reserve bits need to be set
to one (2.1.64). This is causing transport streams to fail validation
on some systems.

https://bugzilla.gnome.org/show_bug.cgi?id=760127
2016-01-09 16:38:04 +00:00
Tim-Philipp Müller
b79cfc68cb tsmux: fix wrong log message level
ERROR level is debugging left-over.
2015-12-01 17:07:44 +00:00
Reynaldo H. Verdejo Pinochet
86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08:00
Sebastian Dröge
e75a9edff1 tsmux: Add support for Opus
https://bugzilla.gnome.org/show_bug.cgi?id=757049
2015-11-03 20:35:41 +02:00
Tim-Philipp Müller
c05a9424be mpegtsmux: add basic support for asynchronous KLV metadata streams
This is defined in SMPTE Rp 217. In this case the
metadata PES packets carry no timestamps of their
own and no Metadata Access Unit Wrappers are used.
2015-07-13 23:34:31 +01:00
Vineeth TM
39d657c274 tsmux: code style fix
trivial patch to add proper ( while checking for if(G_UNLIKELY())

https://bugzilla.gnome.org/show_bug.cgi?id=751305
2015-06-22 10:12:45 +01:00
Nicolas Dufresne
e000a6f0a4 tsmux: Add negative DTS support
Use the saved DTS, make it signed and pass that to the stream muxer. This
preserves the running time sign. All usage of -1 as invalid TS are now
replaced with G_MININT64. Negative values will be seen as wrap-around
point, but the delta between PTS and DTS will remain correct. Demuxers
don't care about absolute values, they only cares about deltas.

https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:10:29 -04:00
Luis de Bethencourt
3e38d3ae02 mpegtsmux: fall through switch statement
Adding a comment makes coverity happy and quells the issue.

CID #1139748
2015-03-06 14:27:48 +00: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
Jesper Larsen
f9a4d559eb mpegtsmux: Remove unused data in TsMuxSection
https://bugzilla.gnome.org/show_bug.cgi?id=721685
2014-05-06 14:10:06 +02:00
Edward Hervey
998e19896b mpegtsmux: Remove unneeded unref
packet_buffer has already been cleared in all code paths leading
to this point.

CID #1199696
2014-04-11 11:34:26 +02:00
Vincent Penquerc'h
931150cb91 Revert "tsmux: catch alloc failure"
Turns out glib aborts on allocation failure, so this is pointless.
We'll just ignore Coverity warnings on such constructs.

This reverts commit d347809a82.
2014-04-09 16:01:43 +01:00
Vincent Penquerc'h
d6dc066527 tsmux: prevent possible double free on error path
Spotted while looking at a Coverity issue in the area.
2014-04-09 13:44:59 +01:00
Vincent Penquerc'h
d347809a82 tsmux: catch alloc failure
While it will probably not trigger, it should silence a Coverity
warning about the fail code path testing for NULLness before
freeing, where the buffer was already dereferenced. It seems
safest to keep that test, in case future goto fail statements
happen to have a NULL buffer there.

Coverity 1139851
2014-04-09 13:44:45 +01:00