Commit graph

178 commits

Author SHA1 Message Date
Sebastian Dröge
2609c394d7 tsmux: Simplify Opus caps parsing by using codecutils helpers
https://bugzilla.gnome.org/show_bug.cgi?id=757152
2015-11-03 20:35:41 +02:00
Sebastian Dröge
ecf7c7742c tsdemux/mux: Add support for GstAudioClippingMeta for Opus
https://bugzilla.gnome.org/show_bug.cgi?id=757153
2015-11-03 20:35:41 +02: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
Sebastian Dröge
23a9e4323a tsmux: Don't leak buffer in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=757049
2015-11-03 20:35:41 +02:00
Sebastian Dröge
4e803d0bb3 tsmux: Call prepare function for each collected buffer
Not when clipping buffers, as that doesn't happen for every buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=757049
2015-11-03 20:35:41 +02:00
Luis de Bethencourt
fa4b58f1cd mpegtsmux: use GST_STIME_ARGS for GstClockTimeDiff
No need to manually handle negative values of best->dts in
GST_DEBUG_OBJECT. Use GST_STIME_ARGS for this.
2015-11-02 17:02:51 +00:00
Tim-Philipp Müller
5bf7432f81 mpegtsmux: fix downstream key unit events handling with hlssink
The buffer timestamps in the collect function will already be
running time, don't try to convert them again to running time,
this would yield CLOCK_TIME_NONE now that the segment is shifted
to account for negative dts.

This fixes x264enc ! mpegtsmux ! hlssink, which was broken
because mpegtsmux would send a downstream key unit event with
running time NONE and then hlssink would immediately send
another one upstream and it would just be a flood of force
keyframe events in both directions after the first one. This
would then break hlssink because it uses multifilesink in
next-file=key-unit-event mode, and starting a new file after
every few kB does not work well for HLS.
2015-09-30 00:43:26 +01:00
Tim-Philipp Müller
d37fcff732 mpegtsmux: use GQueue instead of GList prepend/reverse 2015-07-29 17:30:15 +01:00
Jan Schmidt
55373e21a8 mpegtsmux: Don't clear the PID on reset.
The PID on a pad shouldn't change on a state change, only
if the pad is freed and a new one created. Clearing the PID
prevented mpegtsmux from being reused, because all packets
would end up muxed in PID 0

https://bugzilla.gnome.org/show_bug.cgi?id=752999
2015-07-29 23:10:49 +10:00
Jan Schmidt
0d170d51c7 mpegtsmux: Accumulate streamheaders in reverse
Accumulate streamheader packets in reverse into the
GList for efficiency, and reverse the list once when
processing.

Improves muxing speed when there are a lot of
streamheaders.
2015-07-29 23:10:49 +10:00
Tim-Philipp Müller
be22d8fb4a mpegtsmux: fix aac caps in pad template for raw aac
Raw aac doesn't need framed=true.

Fixes not-negotiated error with voaacenc ! mpegtsmux.
2015-07-20 12:38:28 +01:00
Tim-Philipp Müller
ec309dbd64 mpegtsmux: don't wait for data on sparse inputs like metadata or subtitle streams 2015-07-13 23:34:33 +01: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
6bf6429bc1 mpegtsmux: Remove redundant min_dts
After few iteration, this variable became the same as dts. It's not
the min as the name says, but the dts of the current buffer. Simply
remove and place with dts. Also move the debug trace to actually
print the signed version of the running-time dts.
2015-06-15 10:10:40 -04:00
Vineeth TM
95dd8d9662 mpegtsmux: fix build error
after e000a6f0a4, there is build error in bad plugins
this happens because, GST_CLOCK_STIME_IS_VALID () is being checked for pad_data
but it expects a GstClockTime parameter. Changing the check to 'dts'

https://bugzilla.gnome.org/show_bug.cgi?id=750961
2015-06-15 10:12:11 +02: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
Nicolas Dufresne
8432116df2 tsmux: Remove uneeded cast and cast macro
https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:10:29 -04:00
Nicolas Dufresne
91cbaa5ac7 mpegtsmux: Properly detect backward DTS
There was code to detect backward dts, but the marker min_dts
was never set. Setting it enable this feature that prevents
potential integer overflow when generating TS.

https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:10:29 -04:00
Yanko Kaneti
fa9fa5d460 mpegtsmux: Remove arbitrary constraint on prog-map program ids
https://bugzilla.gnome.org/show_bug.cgi?id=746765
2015-06-12 00:09:54 +10:00
Luis de Bethencourt
99a52f74e7 mpegtsmux: don't overwrite value
Value of res is reset to FALSE in each iteration of the while loop. We want to
conserve TRUE if any pad event succeeded until we arrive to done.

Also, buf is set to the value of *outbuf twice. Removing the first assignment
since the second one is outside of a conditional.
2015-05-27 13:25:27 +01:00
Edward Hervey
43621624c8 mpegtsmux: Carry over GST_BUFFER_FLAG_HEADER
In the same way we do it for the DELTA_UNIT flag

This allows downstream elements to know whether a given mpeg-ts
packet contains a corresponding HEADER elementary unit
2015-05-20 15:41:11 +02:00
Thiago Santos
d60c171ad2 mpegtsmux: the parent is provided in the function
No need to get it again
2015-05-13 13:35:14 -03:00
Luis de Bethencourt
925b65b02e Rename property enums from ARG_ to PROP_
Property enum items should be named PROP_ for consistency and readability.
2015-04-27 10:55:18 +01:00
Tim-Philipp Müller
5c3652dd22 mpegtsmux: drop some superfluous assertions
g_return_*_if_fail() is for public API to catch
programming errors. For internal code, we should
just use g_assert() to check internal state.
2015-03-15 16:10:31 +00:00
Jesper Larsen
67d46d9934 mpegtsmux: Fix namespace of some internal functions
https://bugzilla.gnome.org/show_bug.cgi?id=733347
2015-03-15 14:10:32 +00:00
Tim-Philipp Müller
09c05df889 mpegtsmux: make "alignment" property more useful for packetisation
Currently the alignment property just makes sure that we
output things in multiples of align*packet_size bytes, but
with no clear maximum size. When streaming MPEG-TS over
UDP one wants buffers with a maximum packet size of 1316.
The alignment property so far would just output buffers
that are a multiple of 1316 then.

Instead we now make the alignment property output
individual buffers with the alignment size, which
is entirely backwards compatible with the expected
behaviour up until now. For efficiency reason
collect all those buffers in a buffer list and
send that downstream.

Also collect data to push downstream in a buffer
list from the adapter if we don't align things,
which is still more efficient because of the
silly way the muxer currently creates output
packets.

https://bugzilla.gnome.org/show_bug.cgi?id=722129
2015-03-15 12:07:03 +00: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
Ilya Averyanov
2eac423273 mpegtsmux: Remove duplicate code
The muxer is already allocated in reset(), which is called soon afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=745506
2015-03-04 11:07:41 +01:00
Thiago Santos
e9c1d64895 mpegtsmux: avoid leaking force keyunit event when going to NULL
Do not set to NULL before unreffing the event or it will leak
2015-02-03 17:05:06 -03:00
Anton Gritsay
77bafb4dbc mpegtsmux: parse force key unit events with the correct function
Otherwise it won't be parsed and bogus values would be used.

https://bugzilla.gnome.org/show_bug.cgi?id=696032
2015-02-03 17:05:00 -03:00
Vineeth T M
14acb6fb37 gst: remove unnecessary GLIB_DISABLE_DEPRECATION_WARNINGS
There are unnecessary definitions for disabling deprecation warnings.
Since GLIB_DISABLE_DEPRECATION_WARNINGS is not needed anymore in these files,
removing the same.

https://bugzilla.gnome.org/show_bug.cgi?id=737559
2014-10-02 10:51:35 +03: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
Sebastian Dröge
dec5de073d mpegtsmux: Only require alignment and stream-format for h264, parsed is implicit 2014-04-25 17:40:56 +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
d47727c032 mpegtsmux: guard against _dispose being called mutiple times
_dispose calls _reset, so we need to make sure _reset handles
already NULLed fields.

Coverity 1139843
2014-04-09 13:53:13 +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
Edward Hervey
0ae5c15bf8 mpegtsmux: Initialize helper mpegts library
We now use that library, we need to initialize it so that debug
categories (amongst other things) get properly initialized
2014-04-08 07:47:15 +02:00
Sebastian Dröge
22b6ec3b2f mpegtsmux: Require parsed/framed input for most of the supported formats
https://bugzilla.gnome.org/show_bug.cgi?id=719519
2014-04-02 23:49:37 +02:00
Thiago Santos
2b3c3d485b mpegtsmux: forward tags that have global scope
Instead of dropping all tag events

https://bugzilla.gnome.org/show_bug.cgi?id=644395
2014-02-26 10:26:57 -03:00
Jesper Larsen
6a5f1354b3 mpegtsmux: Use mpeg-ts lib for PAT/PMT sections
Rewrite of the PAT/PMT section handling to use the mpeg-ts library
2014-02-06 15:57:50 +01:00
Jesper Larsen
93a8137be6 mpegtsmux: Add support for muxing SI tables
The muxer is now able to include DVB sections in the transport stream.

The si-interval property will determine how often the SI tables are
muxed into the stream.

The section is handled by the mpeg-ts library. Below is a small example
that will include a Netork Information Table with a Network Name
descriptor in the stream.

GstMpegTsNIT *nit;
GstMpegTsDescriptor *descriptor;
GstMpegTsSection *section;
GstElement *mpegtsmux;

gst_mpegts_initialize ();

nit = gst_mpegts_section_nit_new ();
nit->actual_network = TRUE;

descriptor = gst_mpegts_descriptor_from_dvb_network_name ("Network name");
g_ptr_array_add (nit->descriptors, descriptor);

section = gst_mpegts_section_from_nit (nit);

// mpegtsmux should be retrieved from the pipeline
gst_mpegts_section_send_event (section, mpegtsmux);
gst_mpegts_section_unref (section);
2014-02-06 15:55:46 +01:00
Justin Joy
99c2aa14c3 mpegtsmux: don't leak pad name when treating events
https://bugzilla.gnome.org/show_bug.cgi?id=722699
2014-01-22 10:07:11 +01:00
Jan Schmidt
14a56b6964 mpegtsmux: Don't disrupt buffer state in the clip function
Collectpads assumes that it can pass any buffer to the clip function
for adjustment, some of which are artificially injected - so don't
adjust global timestamp tracking there. Instead, only adjust the
buffer timestamps and use them directly in the collection function.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=698748
2013-12-31 23:23:18 +11:00
Thibault Saunier
da4f9c18ec mpegtsmux: Fix compilation when debug is disabled 2013-11-14 09:02:35 -03:00
Thibault Saunier
b148c22cec mpegtsmux: Properly add subtitle descriptor for DVb subpicture subtitles
We were adding an empty descriptor for them and it was not possible to
actually use them on muxed streams.
2013-11-13 17:56:07 -03:00
Matthieu Bouron
e7687dbaa2 mpegtsmux: fix uninitialized variable warning
https://bugzilla.gnome.org/show_bug.cgi?id=710759
2013-10-25 12:26:23 +01:00