Commit graph

160 commits

Author SHA1 Message Date
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
Jesper Larsen e4a0c4d509 mpegtsmux: Set the program number from prog-map
The prog-map property of mpegtsmux only allows you to group pids together in a program.
The program number set in the PAT/PMT tables cannot be set explicitly.

This patch will set the program number according to the prog-map.
If a program id of 0 is given, the first vacant program number starting from 1 will be used.

https://bugzilla.gnome.org/show_bug.cgi?id=697239
2013-08-21 13:02:02 +02:00
Tim-Philipp Müller 646ba6b3df mpegts: private/teletext -> application/x-teletext 2013-07-30 16:08:17 +01:00
Edward Hervey 97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Vincent Penquerc'h 5c82a510d9 mpegtsmux: avoid using clipped out buffers
If a buffer was entirely clipped out (ie, it's out of the segment
entirely), we'll end up with a NULL buffer, which we don't want
to process/dereference.
2013-07-25 15:06:12 +01:00
Sebastian Dröge f0a1935119 mpegtsmux: Push stream-start event before anything else 2013-05-15 11:38:35 +02:00
Greg Rutz 4d4fd09a3a mpegtsmux: Fix memory leak when using prepare_func
prepare_func will allocate a new buffer to replace the original
one. Instead of using gst_buffer_replace (which causes an extra
refcount increment on the new buffer), we just unref the original
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=699786
2013-05-07 16:37:49 +02:00
Sebastian Dröge e51cd4fe2f gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
Kevin Thornberry 72c5c70b90 mpegtsmux: fix creation of ADTS header for AAC audio in MPEG-TS
https://bugzilla.gnome.org/show_bug.cgi?id=695412
2013-03-18 10:31:51 +00:00
Krzysztof Konopko 13910f5154 mpegtsmux: crashes when trying to re-use the element
A crash occured after pushing buffers and changing mpegtsmux state to
NULL/READ and then back to PLAYING/PAUSED.

The crash was caused by holding a dangling pointer in the MpegTsMux
program table.

Additionally stream headers were leaked when resetting the element:
mux->streamheader set to NULL in mpegtsmux_reset() before it's released
later in the same function.

Added a unit test: test_multiple_state_change

https://bugzilla.gnome.org/show_bug.cgi?id=689107
2012-11-27 19:00:25 +00:00
Krzysztof Konopko 76b8e8be51 mpegtsmux: propagate flow returns
And add a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=688870
2012-11-23 00:14:53 +00:00
Tim-Philipp Müller 9f7e7d305d gst_adapter_prev_timestamp -> gst_adapter_prev_pts 2012-11-14 12:41:27 +00:00
Kevin Thornberry c2d4c0da5e mpegtsmux: fix DTS value being used for PTS
https://bugzilla.gnome.org/show_bug.cgi?id=687806
2012-11-07 20:34:38 +00:00
Tim-Philipp Müller 9e1b75fda3 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Jan Schmidt 119c27c9b9 tsmux: Slightly reflow collected buffer handler for clarity. 2012-10-30 10:00:08 +11:00
Jan Schmidt 5888c60570 mpegtsmux: Don't make the same buffer writable twice.
Fixes Bug 686327 - mpegtsmux: fix refcount issue with input buffers
2012-10-22 01:41:41 +11:00
Tim-Philipp Müller 32ba17cd0f Use gst_element_class_set_static_metadata()
where possible. Avoids some string copies. Also re-indent
some stuff. Also some indent fixes here and there.
2012-10-17 17:46:34 +01:00
Mark Nauwelaerts 578861abea replace gst_element_class_set_details_simple with gst_element_class_set_metadata 2012-09-14 17:27:49 +02:00
Stefan Sauer 27cd08ad95 collectpads: remove gst_collect_pads_add_pad_full
Rename gst_collect_pads_add_pad_full() to gst_collect_pads_add_pad() and fix all
invocations.
2012-09-12 21:13:35 +02:00