Commit graph

37 commits

Author SHA1 Message Date
Reynaldo H. Verdejo Pinochet
0f71d2e408 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 14:35:48 -07: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
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
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
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
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
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
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
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
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
9e1b75fda3 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Mark Nauwelaerts
c4b480b993 mpegtsmux: apply some more CLOCK_BASE to ensure slack for PCR offset
Conflicts:

	gst/mpegtsmux/tsmux/tsmux.c
2012-06-27 14:52:10 +02:00
Matej Knopp
6229305d7b mpegtsmux: port to 0.11
https://bugzilla.gnome.org/show_bug.cgi?id=678130
2012-06-16 19:22:35 +02:00
Mark Nauwelaerts
05dcabfe16 mpegtsmux: avoid memcpy due to temporary packet buffer
... by writing directly into the output buffer instead.
2012-06-11 16:52:49 +02:00
Mark Nauwelaerts
ead42a5e27 mpegtsmux: improve m2ts timestamp interpolation
* a known PCR should really belong to a packet holding that PCR
* interpolation can be extended backward for initial packets (PAT, PMT)
2012-06-08 11:30:03 +02:00
Mark Nauwelaerts
4cc905409e mpegtsmux: more header clarifications and remove some redundant fields 2012-06-06 10:32:05 +02:00
Mark Nauwelaerts
38bb55c472 mpegtsmux: avoid PID collision for auto-generated PID 2012-06-06 10:31:59 +02:00
Edward Hervey
e3a02ce49a mpegtsmux: Don't use g_list_first ()
Seriously ...
2012-06-06 10:31:48 +02:00
David Schleef
02daafb9ae mpegtsmux: use gst debug for tsmux library 2011-05-18 12:06:38 -07:00
Jan Schmidt
5111540ceb Use correct clock when checking whether to write a new PCR
The PCR clocks against the 27MHz SCR clock, so check it correctly
to avoid writing the PCR too often.

Partially fixes: #611046
2011-03-26 16:18:22 +11:00
Andoni Morales Alastruey
4668330bdc mpegtsmux: Initialize PES packet before getting the header size.
The PES header length is calculated before setting the dynamic flags, returning
a wrong value. Small frames that should be sent in a single TS packet are
spawned to a new packet because of that error. For audio streams where a single
frame can cope in one TS packet it introduces a huge overhead.

For a 100B packet, we prepare a TS packet with a payload of(100+9)B. Then, we
write the TS header using this value in tsmux_write_ts_header, and call
tsmux_stream_get_data(). The dynamic flags where not set yet and now
tsmux_stream_pes_header_length() returns 14B instead of 9B. The payload of the
TS packet is 114B, 5B more than what was calculated. 109B are sent in a first
packet and the remaining 5B are sent in another one.

Fixes bug #628548.
2010-09-04 15:01:30 +02:00
Marc-André Lureau
d335a55b49 mpegtsmux: take all the pmt in the streamheaders 2010-06-08 15:36:29 +02:00
Benjamin Otte
240f494aa7 Add -Wold-style-definition
and fix the warnings
2010-03-22 16:56:03 +01:00
Marc-André Lureau
1537023905 mpegtsmux: add pat-interval and pmt-interval properties
https://bugzilla.gnome.org/show_bug.cgi?id=608896
2010-02-03 18:26:12 +00:00
Marc-André Lureau
130cf80752 mpegtsmux: fix PAT/PMT insertion frequency
The current code is comparing timestamps with different clock.
Let's use only the clock for PTS values.

Also rename frequency to interval, to avoid confusion. And remove
documentation about value 0, which won't work like documented.

https://bugzilla.gnome.org/show_bug.cgi?id=608896
2010-02-03 18:26:09 +00:00
Marc-André Lureau
6d554a5560 mpegtsmux: marking non-delta unit, including pre-sections
This patch address the issue observed with KF timestamps
and delta flag. When a section is appended before the keyframe,
it is not marked as non-delta. It's preferable to mark the
first buffer non-delta.

This patch also simplify the initial patch written by thomas,
since it does not clutter tsmux/ with a delta flag passed
around only for GStreamer convenience.

https://bugzilla.gnome.org/show_bug.cgi?id=604908
2010-02-03 16:37:27 +00:00
Thomas Vander Stichele
5fab65aafb mpegtsmux: mark delta-unit on outgoing buffers
Signed-off-by: Marc-André Lureau <mlureau@flumotion.com>
2010-01-08 13:07:53 +01:00
vanista
751555b5c3 gst/mpegtsmux/: Improve muxing of AC3/h264 streams a bit. Fixes bug #550613.
Original commit message from CVS:
Patch by: vanista <vanista at gmail dot com>
* gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_create_stream):
* gst/mpegtsmux/tsmux/tsmux.c: (tsmux_write_pmt):
* gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new),
(tsmux_stream_write_pes_header), (tsmux_stream_get_es_descrs):
* gst/mpegtsmux/tsmux/tsmuxstream.h:
Improve muxing of AC3/h264 streams a bit. Fixes bug #550613.
2009-01-05 11:28:49 +00:00
Edward Hervey
d5e8bc1472 gst/mpegtsmux/tsmux/tsmux.c: Fix build on macosx.
Original commit message from CVS:
* gst/mpegtsmux/tsmux/tsmux.c: (tsmux_write_ts_header):
Fix build on macosx.
2008-09-02 09:46:04 +00:00
Sebastian Dröge
7ac077828f gst/mpegtsmux/mpegtsmux_aac.c: Allocate a fixed size buffer on the stack instead of using malloc().
Original commit message from CVS:
* gst/mpegtsmux/mpegtsmux_aac.c: (mpegtsmux_prepare_aac):
Allocate a fixed size buffer on the stack instead of using malloc().
* gst/mpegtsmux/tsmux/tsmux.c: (tsmux_new), (tsmux_free),
(tsmux_program_new), (tsmux_program_free):
* gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new),
(tsmux_stream_free), (tsmux_stream_consume),
(tsmux_stream_add_data):
Use GSlice.
2008-09-01 17:49:59 +00:00
Sebastian Dröge
845094c32e Add Fluendo MPEG-TS muxer and libtsmux to gst-plugins-bad. This is renamed to mpegtsmux to prevent conflicts. Also al...
Original commit message from CVS:
* configure.ac:
* gst/mpegtsmux/Makefile.am:
* gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_base_init),
(mpegtsmux_class_init), (mpegtsmux_init), (mpegtsmux_dispose),
(gst_mpegtsmux_set_property), (gst_mpegtsmux_get_property),
(release_buffer_cb), (mpegtsmux_create_stream),
(mpegtsmux_create_streams), (mpegtsmux_choose_best_stream),
(mpegtsmux_collected), (mpegtsmux_request_new_pad),
(mpegtsmux_release_pad), (new_packet_cb),
(mpegtsdemux_prepare_srcpad), (mpegtsmux_change_state),
(plugin_init):
* gst/mpegtsmux/mpegtsmux.h:
* gst/mpegtsmux/mpegtsmux_aac.c: (mpegtsmux_prepare_aac):
* gst/mpegtsmux/mpegtsmux_aac.h:
* gst/mpegtsmux/mpegtsmux_h264.c: (mpegtsmux_prepare_h264):
* gst/mpegtsmux/mpegtsmux_h264.h:
* gst/mpegtsmux/tsmux/Makefile.am:
* gst/mpegtsmux/tsmux/crc.h:
* gst/mpegtsmux/tsmux/tsmux.c: (tsmux_new), (tsmux_set_write_func),
(tsmux_set_pat_frequency), (tsmux_get_pat_frequency), (tsmux_free),
(tsmux_program_new), (tsmux_set_pmt_frequency),
(tsmux_get_pmt_frequency), (tsmux_program_add_stream),
(tsmux_program_set_pcr_stream), (tsmux_get_new_pid),
(tsmux_create_stream), (tsmux_find_stream), (tsmux_packet_out),
(tsmux_write_adaptation_field), (tsmux_write_ts_header),
(tsmux_write_stream_packet), (tsmux_program_free),
(tsmux_write_section), (tsmux_write_section_hdr),
(tsmux_write_pat), (tsmux_write_pmt):
* gst/mpegtsmux/tsmux/tsmux.h:
* gst/mpegtsmux/tsmux/tsmuxcommon.h:
* gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new),
(tsmux_stream_get_pid), (tsmux_stream_free),
(tsmux_stream_set_buffer_release_func), (tsmux_stream_consume),
(tsmux_stream_at_pes_start), (tsmux_stream_bytes_avail),
(tsmux_stream_bytes_in_buffer), (tsmux_stream_get_data),
(tsmux_stream_pes_header_length),
(tsmux_stream_find_pts_dts_within),
(tsmux_stream_write_pes_header), (tsmux_stream_add_data),
(tsmux_stream_get_es_descrs), (tsmux_stream_pcr_ref),
(tsmux_stream_pcr_unref), (tsmux_stream_is_pcr),
(tsmux_stream_get_pts):
* gst/mpegtsmux/tsmux/tsmuxstream.h:
Add Fluendo MPEG-TS muxer and libtsmux to gst-plugins-bad. This
is renamed to mpegtsmux to prevent conflicts. Also all relevant
informations about copyright and license are added to the top of
every file but apart from that no changes compared to the latest
SVN versions happened.
2008-09-01 16:38:40 +00:00