Commit Graph

417 Commits

Author SHA1 Message Date
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
Ben Avison
cabb168169 mpegts: Remove one memcpy per packet
This was being performed to ensure that a complete packet was held in
contiguous memory, prior to parsing the packet. However, the source buffer
is typically large enough that the packet was already contiguous, so it is
beneficial to return the packet by reference in most cases.

         Before          After
         Mean   StdDev   Mean   StdDev  Change
memcpy    720.7  32.7     649.8  25.1   +10.9%
Overall  2372.7  46.1    2291.7  21.8    +3.5%

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-05 15:14:31 +03:00
Marton Balint
d75d911223 mpegts: save last pcr of pcr pids in PES Context
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-02 03:27:47 +02:00
Michael Niedermayer
b009267910 mpegts: only reopen pmt_cb filter if its different from the previous.
Fixes Ticket2632

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-05 04:02:02 +02:00
Michael Niedermayer
8a8d9a7385 mpegts: use ffio_ensure_seekback()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-04 19:13:39 +02:00
Michael Niedermayer
4e99660493 mpegts: use seek_back() for all seek backs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-30 16:23:50 +02:00
Michael Niedermayer
a5f23d8da0 mpegts: factor seek_back() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-30 16:23:46 +02:00
Michael Niedermayer
b7c6685268 mpegts_read_header: goto fail instead of return directly
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-30 16:23:42 +02:00
Michael Niedermayer
231795270b Merge commit 'b164d66e35d349de414e2f0d7365a147aba8a620'
* commit 'b164d66e35d349de414e2f0d7365a147aba8a620':
  ape: make version-dependent decoding functions called via pointers
  mpegts: add support for stream_type 0x42, which is CAVS

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-15 13:28:38 +01:00
Can Wu
81cf53e133 mpegts: add support for stream_type 0x42, which is CAVS
This allows demuxing and muxing of CAVS TS streams.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-03-15 09:33:24 +01:00
Michael Niedermayer
a9ddb62489 Merge commit '1ecdf8912b9ced51b3267cdcdce5e394d0a3bf8e'
* commit '1ecdf8912b9ced51b3267cdcdce5e394d0a3bf8e':
  avformat: av_log_ask_for_sample() ---> avpriv_request_sample()

Conflicts:
	libavformat/mxfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 12:41:34 +01:00
Michael Niedermayer
fa92ee821b Merge commit '63d744e2be39466e3a734c2987cd713e0bac101e'
* commit '63d744e2be39466e3a734c2987cd713e0bac101e':
  av_log_missing_feature() ---> avpriv_report_missing_feature()

Conflicts:
	libavcodec/aacdec.c
	libavcodec/tta.c
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-14 12:30:19 +01:00
Diego Biurrun
1ecdf8912b avformat: av_log_ask_for_sample() ---> avpriv_request_sample() 2013-03-13 20:42:21 +01:00
Diego Biurrun
63d744e2be av_log_missing_feature() ---> avpriv_report_missing_feature() 2013-03-13 20:42:21 +01:00
Michael Niedermayer
806a66fd08 mpegts: clear avprograms only for removed programs
Fixes Ticket2186

Requested-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-10 02:28:05 +01:00
Michael Niedermayer
2653e12520 Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
  avpacket: use AVBuffer to allow refcounting the packets.

Conflicts:
	libavcodec/avpacket.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavformat/avidec.c
	libavformat/flacdec.c
	libavformat/id3v2.c
	libavformat/matroskaenc.c
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-08 19:12:03 +01:00
Anton Khirnov
1afddbe59e avpacket: use AVBuffer to allow refcounting the packets.
This will allow us to avoid copying the packets in many cases.

This breaks ABI.
2013-03-08 07:33:45 +01:00
Carl Eugen Hoyos
f8b6d4818e Only try to auto-detect LATM in mpegts if the LOAS demuxer was configured.
This allows to decode LATM-in-mpegts without the LOAS demuxer.
2013-01-24 01:21:13 +01:00
Michael Niedermayer
c3f3c22563 Merge commit 'a717f9904227d7979473bad40c50eb40af41d01d'
* commit 'a717f9904227d7979473bad40c50eb40af41d01d':
  mpegts: Share the cleanup code between the demuxer and lavf-internal parser functions
  rtpdec_mpeg4: Return one AAC AU per AVPacket
  ppc: Include string.h for memset

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 13:45:36 +01:00
Martin Storsjö
a717f99042 mpegts: Share the cleanup code between the demuxer and lavf-internal parser functions
The lavf-internal parser functions are used when receiving
mpegts over RTP. This fixes memory leaks in this setup.

The normal mpegts demuxer close function was updated in ec7d0d2e in
2004 to fix leaks, but the parsing function used for RTP wasn't
updated and has been leaking ever since.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:14:17 +02:00
XBMC
4c41fc88df mpegts: update AVProgram after pmt change
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-25 20:30:36 +01:00
Michael Niedermayer
7726916c14 mpegts: check av_new_stream() return value.
Fixes CID703728
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-13 17:46:17 +01:00
Peter Ross
9282fbb9ad mpegts: demux asynchronous SMPTE 336M Key-Length-Value (KLV) metadata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-09 17:15:46 +01:00
Michael Niedermayer
57cee85023 Merge commit '096abfa15052977eed93f0b5e01afd2d47c53c1f'
* commit '096abfa15052977eed93f0b5e01afd2d47c53c1f':
  parser: fix large overreads
  bitstream: add get_bits64() to support reading more than 32 bits at once
  arm: detect cpu features at runtime on Linux

Conflicts:
	libavcodec/parser.c
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-08 14:58:56 +01:00
Michael Niedermayer
b2b12a1022 mpegts: rename get_bits64 to get_ts64
Renaming because of name conflict

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-08 14:52:50 +01:00
Michael Niedermayer
41540b36a1 bitstream: add get_bits64() to support reading more than 32 bits at once
Also remove a duplicate function in the MPEG-TS demuxer.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-12-07 16:15:02 -05:00
Michael Niedermayer
03290ffb57 mpegts: check that codec is not open in mpegts_find_stream_type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-03 17:34:38 +01:00
Michael Niedermayer
8897b5aa4c mpegts_set_stream_info: remove unneeded codec id check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-03 17:29:56 +01:00
Michael Niedermayer
eab022d863 mpegts: prevent freeing ones own section in pat_cb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 21:45:53 +01:00
Michael Niedermayer
4facddd568 mpegts: dont set stream info when a decoder has already been opened.
Fixes assertion failure.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 15:44:13 +01:00
Michael Niedermayer
327cd0d09b mpegts: prevent freeing ones own section in pmt_cb
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-13 15:44:13 +01:00
Michael Niedermayer
304ebed586 mpegts_probe: detect files with garbage at the begin.
Fixes Ticket1811

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-01 17:22:04 +01:00
Michael Niedermayer
f464b02d22 mpegts: fuzzy crc check for not so spec compliant files
Fixes Ticket598

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-08 05:25:27 +02:00
Michael Niedermayer
82db8ee321 Merge commit 'fd41cb43702498948ff14ba8c284fd5c15fc729d'
* commit 'fd41cb43702498948ff14ba8c284fd5c15fc729d':
  avconv: improve sample format negotiation for decoder request
  Opus encoder using libopus
  mpegts: Drop pointless casting of hex_dump_debug arguments
  avformat: const correctness for av_hex_dump / av_hex_dump_log
  wmadec: Adjust debug printf argument length modifier

Conflicts:
	Changelog
	ffmpeg.c
	libavcodec/libopusdec.c
	libavcodec/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-02 14:58:19 +02:00
Michael Niedermayer
31ab1575e5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avcodec: Convert some commented-out printf/av_log instances to av_dlog
  avcodec: Drop silly and/or broken printf debug output
  avcodec: Drop some silly commented-out av_log() invocations
  avformat: Convert some commented-out printf/av_log instances to av_dlog
  avformat: Remove non-compiling and/or silly commented-out printf/av_log statements
  Remove some silly disabled code.
  ac3dec: ensure get_buffer() gets a buffer for the correct number of channels

Conflicts:
	libavcodec/dnxhddec.c
	libavcodec/ffv1.c
	libavcodec/h264.c
	libavcodec/h264_parser.c
	libavcodec/mjpegdec.c
	libavcodec/motion_est_template.c
	libavcodec/mpegaudiodec.c
	libavcodec/mpegvideo_enc.c
	libavcodec/put_bits.h
	libavcodec/ratecontrol.c
	libavcodec/wmaenc.c
	libavdevice/timefilter.c
	libavformat/asfdec.c
	libavformat/avidec.c
	libavformat/avienc.c
	libavformat/flvenc.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-01 16:12:38 +02:00
Diego Biurrun
15d35bee83 mpegts: Drop pointless casting of hex_dump_debug arguments 2012-10-01 13:18:28 +02:00
Diego Biurrun
72eaba5e4f avformat: Convert some commented-out printf/av_log instances to av_dlog 2012-10-01 10:24:28 +02:00
Michael Niedermayer
c942e8b1d7 Merge commit '07584eaf4a95db3f11d3bc411f9786932829e82b'
* commit '07584eaf4a95db3f11d3bc411f9786932829e82b':
  mpegts: check substreams before discarding
  Add a smooth streaming segmenter muxer
  file: Add an avoption for disabling truncating existing files on open
  img2dec: always close AVIOContexts
  rtpdec_jpeg: Error out on other unsupported type values as well
  rtpdec_jpeg: Disallow using the reserved q values
  rtpdec_jpeg: Fold the default qtables case into an existing if statement
  rtpdec_jpeg: Store and reuse old qtables for q values 128-254
  rtpdec_jpeg: Simplify the calculation of the number of qtables
  rtpdec_jpeg: Add more comments about the fields in the SOF0 section
  rtpdec_jpeg: Clarify where the subsampling magic numbers come from
  rtpdec_jpeg: Don't use a bitstream writer for the EOI marker
  rtpdec_jpeg: Don't needlessly use a bitstream writer for the header
  rtpdec_jpeg: Simplify writing of the jpeg header
  rtpdec_jpeg: Merge two if statements
  rtpdec_jpeg: Write the DHT section properly

Conflicts:
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 15:22:16 +02:00
Christian Schmidt
07584eaf4a mpegts: check substreams before discarding
Allow to extract the AC3 core from TrueHD with the "copy" codec.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-09-12 23:43:53 +02:00
Michael Niedermayer
5710dbf88c mpegts: Fix potential memory leak in mpegts_read_packet()
This leak can happen in case of some error paths.

Found-by: Tanami, Ohad
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 05:21:47 +02:00
Michael Niedermayer
d46c1c72e4 Merge commit 'e6153f173a49e5bfa70b0c04d2f82930533597b9'
* commit 'e6153f173a49e5bfa70b0c04d2f82930533597b9':
  avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member

Conflicts:
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libx264.c
	libavcodec/mpeg12enc.c
	libavcodec/options_table.h
	libavcodec/snowenc.c
	libavcodec/tiffenc.c
	libavdevice/v4l2.c
	libavdevice/x11grab.c
	libavfilter/af_amix.c
	libavfilter/af_asyncts.c
	libavfilter/af_join.c
	libavfilter/buffersrc.c
	libavfilter/src_movie.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawtext.c
	libavformat/http.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/movenc.c
	libavformat/mpegenc.c
	libavformat/mpegtsenc.c
	libavformat/options_table.h
	libavformat/segment.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-05 14:33:32 +02:00