Commit Graph

457 Commits

Author SHA1 Message Date
Marton Balint
d2f60547c2 mpegts: fix teletext pts of streams with standalone pcr pid
Signed-off-by: Marton Balint <cus@passwd.hu>
2014-03-22 13:55:01 +01:00
Marton Balint
d83a5b5218 mpegts: add pcr filter for tracking standalone pcr pids
Signed-off-by: Marton Balint <cus@passwd.hu>
2014-03-22 13:55:01 +01:00
Marton Balint
6bab55b84c mpegts: factorize mpegts filter creator code
Signed-off-by: Marton Balint <cus@passwd.hu>
2014-03-22 13:54:59 +01:00
Marton Balint
4acc86bcfb mpegts: move last_pcr to MpegTSFilter level
Signed-off-by: Marton Balint <cus@passwd.hu>
2014-03-22 13:41:22 +01:00
Michael Niedermayer
7ae5cadb0a Merge commit 'ca80e15814b77efe8d0ff5a5b0220754bb6c4065'
* commit 'ca80e15814b77efe8d0ff5a5b0220754bb6c4065':
  mpegts: Forward error codes in various functions

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 13:30:20 +01:00
Michael Niedermayer
ceb0d79f46 Merge commit '86ba2327e1cf35c6f77d5fb516a1a7a8dce0b98a'
* commit '86ba2327e1cf35c6f77d5fb516a1a7a8dce0b98a':
  mpegts: K&R formatting cosmetics

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-18 13:19:24 +01:00
Keiji Costantini
ca80e15814 mpegts: Forward error codes in various functions
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-03-18 08:20:35 +01:00
Keiji Costantini
86ba2327e1 mpegts: K&R formatting cosmetics
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-03-18 08:07:43 +01:00
Marton Balint
d08bb065f2 mpegts: use goto out instead of break on truncated or invalid pmt tables
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 02:28:25 +01:00
Michael Niedermayer
8cc581fbf7 Merge commit '5397386effba2e53e4ff82852a86f6be4d59e9c1'
* commit '5397386effba2e53e4ff82852a86f6be4d59e9c1':
  mathops: move macro to the only place it is used

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-04 13:38:04 +01:00
Vittorio Giovara
5397386eff mathops: move macro to the only place it is used
This helps in disentangling lavf and lavc too.
2014-03-04 11:45:31 +01:00
Michael Niedermayer
0bf882864e Revert "mpegts: do not set pts for missing dts in video streams"
This reverts commit f65afef1df.

If only pts is coded then dts must be equal pts
See Rec. ITU-T H.222.0 (06/2012) / ISO/IEC 13818-1:2013 (E) 2.7.5

Found-by: Baptiste Coudurier
2014-03-02 13:12:31 +01:00
Michael Niedermayer
c849b00b80 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libavformat/mpegts: expose raw packet size

Conflicts:
	libavformat/mpegts.c

See: f9b997c337
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-20 02:10:05 +01:00
Leandro Dorileo
8370a6fa59 libavformat/mpegts: expose raw packet size
We cannot easily determine if an mpeg TS's packet size is DVHS, FEC
or so on, for that we need to expose the internal raw_packet_size
field.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-02-19 21:52:17 +01:00
mrlika
e2707a7cf7 avformat/mpegts: DVB subtitles multiple languages support
Copy multiple languages data from PMT to extradata. New 5 bytes
per language extradata format.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-14 00:01:28 +01:00
Michael Niedermayer
29986885ef avformat/mpegts: Continue parsing PMTs until at least 2 streams are found or 100kb are reached
This (ugly) hack fixes Ticket3348
If someone has an idea on how to fix this nicer, that would be very welcome
but the stream contains several PMTs with just one of the 2 streams at the start

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-29 05:44:03 +01:00
Michael Niedermayer
ad61419bbf avformat/mpegts: drop stray space
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-29 05:43:39 +01:00
Serhii Marchuk
1d07385053 mpegts demuxer: store PMT values of DVB teletext to extradata
* Using extradata by TS demuxer to store values from PMT
* Support of multiple languages in one DVB teletext stream:
  comma separated language codes in metadata "language" field

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-24 22:14:01 +01:00
Anssi Hannula
4a4437c0fb avformat/mpegts: demux timed ID3 metadata
Used in some HLS streams ("Timed Metadata for HTTP Live Streaming").

This is just ID3 tags at arbitrary stream positions, but I still added
"timed" to the codec name to avoid confusion with regular non-stream ID3
tags.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2013-12-31 03:13:12 +02:00
Michael Niedermayer
e630ca5111 avformat/mpegts: check sl.timestamp_len
Fixes: msan_uninit-mem_7ff4404547ba_4883_dmbts.ts
Fixes assertion failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-27 11:53:53 +01:00
Leandro Dorileo
f9b997c337 libavformat/mpegts: expose raw packet size
We cannot easily determine if an mpeg TS's packet size is DVHS, FEC
or so on, for that we need to expose the internal raw_packet_size
field.

Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-19 19:06:32 +01:00
Joakim Plate
6eda91ad54 mpegts: stop analyzing when pmt for all programs have been found
This disables NOHEADER after finding PMT for all programs to
avoid find_stream_info always exhausting probe size for mpegts.

This is very important for live streams since read speed
will be limited. rtsp, udp and any protocol streaming a live
mpegts will have dramatically faster startup time.

Note, lack of codec parameters for streams can still cause
the full probe size to be exhausted.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-15 21:43:19 +01:00
Carl Eugen Hoyos
9fa75be96d mpegts: add HEVC registration descriptor 2013-12-12 16:10:15 +01:00
Rainer Hochecker
f65afef1df mpegts: do not set pts for missing dts in video streams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-04 02:18:04 +01:00
Michael Niedermayer
7d0e927a31 avformat/mpegts: fix resync seek
The seek ended up seeking before the begin, which caused problems
Fixes initial sync issues with libbluray
Fixes Ticket3117

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-18 16:38:12 +01:00
Michael Niedermayer
e624df5dc3 mpegts: only calculate stat index when its needed during probe
40% faster probe

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-09 16:09:26 +01:00
Michael Niedermayer
9825b99eca avformat/mpegts: do not hardcode type used in memset()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-09 16:03:41 +01:00
Mickaël Raulet
b6a4701612 mpegts: Support HEVC demuxing
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-31 20:20:57 +01:00
Peter Ross
69a042ee95 mpegts: demux synchronous SMPTE 336M Key-Length-Value (KLV) metadata
Fixes ticket #2579.
2013-10-28 19:31:58 +01:00
Carl Eugen Hoyos
d0b7d24b80 Support HEVC in transport streams. 2013-10-16 17:54:37 +02:00
Mickaël Raulet
93c1fe4de3 hevc: add ts demux support
cherry picked from commit 925ee44364a7bce58e2ac5bac91077ce0a75d883

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-15 23:48:00 +02:00
Paul B Mahol
a807c68253 avformat: use ff_alloc_extradata()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-10-13 20:13:38 +00:00
Michael Niedermayer
5dc6c0ea9e avformat/mpegts: check avio_tell() return code before using it
Fixes Ticket2962

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 16:43:55 +02:00
Michael Niedermayer
cbe47b1e84 Merge commit 'f369b9356c4606cd4d713d60f7db5de119d901fa'
* commit 'f369b9356c4606cd4d713d60f7db5de119d901fa':
  avformat: Use av_reallocp_array() where suitable

Conflicts:
	libavformat/asfenc.c
	libavformat/gxfenc.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-11 11:23:40 +02:00
Alexandra Khirnova
f369b9356c avformat: Use av_reallocp_array() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-10 12:38:32 +02:00
Michael Niedermayer
a660991921 avformat/mpegts: Ensure that mpegts_get_dts() only considers packets at or after the given position
This fixes an infinite loop
An alternative fix would be to revert d73cbc22c5
but that would worsen error resilience.

Found-by: Justin Ruggles
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-04 01:02:06 +02:00
Michael Niedermayer
d73cbc22c5 avformat/mpegts: resync from the smallest packet size on
This avoids the loss of a packet in many cases if the packet size was wrong.
It also improves detection of packet size changes

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 22:59:04 +02:00
Michael Niedermayer
b4429c259a mpegts_get_pcr: dont loose a packet when resyncing
This matches how read_packet() works

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 22:48:19 +02:00
Michael Niedermayer
0f2f65bd58 mpegts: fix pos47_full
The value was off by a packet

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 22:45:39 +02:00
Michael Niedermayer
ee7f2609a0 avformat/mpegts: print packet size warning only if new size differs from old
No case is known to have triggered this, but its more correct to check that the
new size differs.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 22:45:39 +02:00
Michael Niedermayer
c666c59ac1 mpegts: reanalyze packet size on mismatches
Fixes Ticket1812
Fixes Ticket2838

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-18 16:40:18 +02:00
Michael Niedermayer
a0fb608396 Merge commit '5afe1d27912be9b643ffb4ddc21f6d920260dbb0'
* commit '5afe1d27912be9b643ffb4ddc21f6d920260dbb0':
  avio: Add const qualifiers to ffio_read_indirect

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 12:04:46 +02:00
Ben Avison
5afe1d2791 avio: Add const qualifiers to ffio_read_indirect
This provides at least some protection against potential accidental
corruption of AVIO buffer workspace.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-08 11:09:00 +03:00
Michael Niedermayer
5b13778f93 mpegts: remove usage of MOD_UNLIKELY()
Its not needed and doing nothing is faster than doing a optimized MOD

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 19:56:20 +02:00
Michael Niedermayer
0df55e1ba8 Merge commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae'
* commit 'a22ae9f0c579793f411e2bd7a8db557091a3a4ae':
  mpegts: Remove one 64-bit integer modulus operation per packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 16:23:32 +02:00
Michael Niedermayer
5dd8ca7d1b Merge commit 'c84ea750cf765c9d8845fca5546eb0ae25b9c855'
* commit 'c84ea750cf765c9d8845fca5546eb0ae25b9c855':
  mpegts: Make discard_pid() faster for single-program streams

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 15:16:35 +02:00
Michael Niedermayer
4ed0b28a45 Merge commit 'cabb1681697555e2c319c37c1f30f149207e9434'
* commit 'cabb1681697555e2c319c37c1f30f149207e9434':
  mpegts: Remove one memcpy per packet

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 15:11:55 +02:00
Marton Balint
a7bb12a307 mpegts: add fix_teletext_pts mpegts demuxer option
Changes since v1 of the patch:
- enable option by default
- add documentation
- move up PTS override code after PES header parsing, to ensure we use the
  last PCR before the first packet of the teletext PES packet.

The option overrides teletext packet PTS and DTS values with the timestamps
calculated from the PCR of the first program which the teletext stream is part
of and is not discarded.

Using the same teletext PID for multiple programs is possible, therefore we
need some kind of heuristics to know which program PCR we should synchronize
to. Using the first non-discarded PCR pid among the programs of the teletext
stream seemed like a good choice.

The patch does not do PCR interpolation to estimate the PCR of the teltetext
packet, it just uses the last PCR of the program, which may cause a slight
error (0.1 sec) in the teletext packet pts-es.

Based on a patch by Reimar Döffinger.
http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2012-September/131610.html

Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 02:47:38 +02:00
Ben Avison
a22ae9f0c5 mpegts: Remove one 64-bit integer modulus operation per packet
The common case of the pointer having increased by one packet (which results
in no change to the modulus) can be detected with a 64-bit subtraction,
which is far cheaper than a division on many platforms.

           Before          After
           Mean   StdDev   Mean   StdDev  Change
Divisions   248.3  8.8      51.5   7.4    +381.7%
Overall    2773.2 25.6     2372.5 43.1     +16.9%

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-05 19:25:55 +03:00
Ben Avison
c84ea750cf mpegts: Make discard_pid() faster for single-program streams
When a stream contains a single program, there's no point in doing a
PID -> program lookup. Normally the one and only program isn't disabled,
so no packets should be discarded.

              Before          After
              Mean   StdDev   Mean   StdDev  Change
discard_pid()   73.8  9.4       20.2  1.5    +264.8%
Overall       2300.8 28.0     2253.1 20.6      +2.1%

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-05 15:18:42 +03:00