Commit Graph

576 Commits

Author SHA1 Message Date
James Almer 4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Carl Eugen Hoyos 79d232fc9f lavf/mpegts: Make a pointer cast explicit.
Silences an "assignment discards ‘const’ qualifier" warning.

Reviewed-by: Marton Balint
2017-02-12 13:57:59 +01:00
Andreas Cadhalpun 1bbb18fe82 mpegts: prevent division by zero
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-08 22:27:11 +01:00
Carlos Fernandez 728ccae8a2 lavf/mpegts: add missed fixes to scte35 section callback
They somehow got lost along the patch versions.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-10-23 00:10:34 +02:00
Andreas Cadhalpun 178eebd79e mpegts: handle AVMEDIA_TYPE_UNKNOWN correctly
It is negative, so can't be used for left shifting.

This fixes ubsan runtime error: shift exponent -1 is negative

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-22 19:23:12 +02:00
Carlos Fernandez 5db3c9476c lavf/mpegts: SCTE-35 extraction from mpegts
Reviewed-by: Marton Balint <cus@passwd.hu>
Acked-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Carlos Fernandez <carlos@ccextractor.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-10-21 20:41:19 +02:00
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
It is supposed to be a flag. The only currently defined value is
AVIO_SEEKABLE_NORMAL, but other ones may be added in the future.
However all the current lavf code treats this field as a bool (mainly
for historical reasons).
Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
2016-09-30 16:54:33 +02:00
Clément Bœsch 8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Aman Gupta 373b82066c avformat/mpegts: include stream type for aac
this removes the need to probe to discover aac streams
inside mpegts containers, thus speeding up initial playback.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-21 21:21:30 +02:00
Clément Bœsch 82439dec0f Merge commit '74d98d1b0e0e7af444c933ea3c472494de3ce6f2'
* commit '74d98d1b0e0e7af444c933ea3c472494de3ce6f2':
  mpegts: Validate the SL Packet Header Configuration

See e630ca5111

Our local timestamp_len > 64 is adjusted to > 63 to match the Libav
check and the actual specifications (14496-1, 10.2.2).

There is no need to request a sample as it violates the specifications
and such a file would likely be the result of a crafted/fuzzed sample.

On the other hand, the clipping of the value is kept for extra safety.

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-21 14:46:36 +02:00
Aman Gupta e9391ab121 avformat/mpegts: enhance logging in trace mode
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-14 21:34:23 +02:00
Michael Niedermayer 00c4861f13 avformat/mpegts: adjust probe score for low check_count
Fixes mis-detection of tiff as mpegts
Fixes Ticket5565

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-14 02:20:10 +02:00
Michael Niedermayer e01b19dece avformat/mpegts: Fix probing of mpegts with invalid ASC
Fixes Ticket5566

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-07 15:46:08 +02:00
Michael Niedermayer a5eb70ad95 avformat/mpegts: Do not trust BSSD descriptor, it is sometimes not an S302M stream
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-06 21:56:51 +02:00
Stefano Sabatini 4b38df82c2 lavf/mpegts: add ID3 entry to the REGD_types array
This allows to recognize ID3 packets from their corresponding descriptor
tag.
2016-05-19 18:26:32 +02:00
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Carl Eugen Hoyos 80d14de52d lavf/mpegts: Add E-AC3 registered stream specifier "EAC3".
Related to ticket #5501.
2016-05-03 10:51:35 +02:00
Luca Barbato 74d98d1b0e mpegts: Validate the SL Packet Header Configuration
timeStampLength, OCRLength and AU_Length have well specified upper
boundaries.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-05-03 14:21:45 +09:00
Carl Eugen Hoyos 88a849c714 lavf/mpegts: Return small probe score for very short transport streams.
Fixes Debian bug 823098.
2016-05-01 15:39:13 +02:00
Michael Niedermayer dbe1dd59e0 avformat/mpegts: Skip over broken 0x80 headers
This fixes demuxing of 01c56b0dc1.ts

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-24 02:51:50 +02:00
Michael Niedermayer ea41ab0987 avformat/mpegts: factor duplicate seek back code into mpegts_resync
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-24 02:51:50 +02:00
Derek Buitenhuis 0520d573db Merge commit '9765549f551ff40869aee1a6492b6a976c86cfe9'
* commit '9765549f551ff40869aee1a6492b6a976c86cfe9':
  mpegts: Forward the errors on mpeg4 objects parsing

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-14 14:01:31 +01:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Michael Niedermayer 38a6242b27 avformat/mpegts: Remove unused argument from analyze()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-10 13:32:26 +02:00
Michael Niedermayer ee7a642b0e avformat/mpegts: Check adaption field control in analyze() more instead of transport_error_indicator
transport_error_indicator is not required to be 0

Fixes probing
Fixes Ticket 4862

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-10 13:32:25 +02:00
Luca Barbato 9765549f55 mpegts: Forward the errors on mpeg4 objects parsing
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-03-20 01:04:12 +01:00
Stefano Sabatini 14f7a3d55a lavc/lavf: transmit stream_id information for mpegts KLV data packets
This allows to copy information related to the stream ID from the demuxer
to the muxer, thus allowing for example to retain information related to
synchronous and asynchronous KLV data packets. This information is used
in the muxer when remuxing to distinguish the two kind of packets (if the
information is lacking, data packets are considered synchronous).

The fate reference changes are due to the use of
av_packet_merge_side_data(), which increases the size of the output
packet size, since side data is merged into the packet data.
2016-02-23 18:44:12 +01:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Michael Niedermayer 4bec36f98c avformat/mpegts: consider stream_type 4 just a hint toward mp3 and not definite
Fixes Ticket 4864

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-24 20:47:25 +01:00
Michael Niedermayer 676a93f2d8 avformat: Add av_program_add_stream_index()
This will be used by the subsequent commit(s)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-11 22:27:25 +01:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Nicolas George 085ab74972 lavf/mpegts: use AVERROR_INVALIDDATA instead of AVERROR(EINTR). 2015-12-03 19:16:12 +01:00
Michael Niedermayer 3692d859f4 avformat/mpegts: Only start probing data streams within probe_packets
Fixes assertion failure
Fixes: 4321db8ac331f5967ebfbfe80ce5eb78/signal_sigabrt_7ffff6ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-05 17:06:02 +01:00
Hendrik Leppkes 6255bf3d0d mpegts: Fix FATE seek test 2015-10-27 15:42:59 +01:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Hendrik Leppkes 7f5af80ba4 Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'
* commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457':
  avpacket: Replace av_free_packet with av_packet_unref

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 14:28:56 +01:00
Luca Barbato ce70f28a17 avpacket: Replace av_free_packet with av_packet_unref
`av_packet_unref` matches the AVFrame ref-counted API and can be used as
a drop in replacement.

Deprecate `av_free_packet`.
2015-10-26 18:00:55 +01:00
Hendrik Leppkes 4b7685b6c6 Merge commit 'cc8db760616a7ec3bd39b22ca45888c01326db13'
* commit 'cc8db760616a7ec3bd39b22ca45888c01326db13':
  mpegts: use avcodec_get_type() to set codec_type

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-29 13:45:23 +02:00
wm4 cc8db76061 mpegts: use avcodec_get_type() to set codec_type
Note that this slightly changes behavior: it sets AVMEDIA_TYPE_UNKNOWN
if the codec type is unknown. This should be ok.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-09-28 10:50:50 +02:00
James Almer 655b6dcb34 lavc/lavf: remove incompatible abi checks for the new 64bit fields
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-09-17 11:36:16 -03:00
Carl Eugen Hoyos b290972b8f lavf: Switch probesize and max_analyze_duration to 64bit.
Both are only accessible through AVOptions.
2015-09-15 18:02:51 +02:00
Petri Hintukainen 5d12d7de2c mpegts: demux BluRay text subtitles
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-01 14:35:32 +02:00
Petri Hintukainen 757cb0f286 mpegts: fix demuxing PES private stream 2
PES header size is 6 bytes (00 00 01 bf XX XX), not 0.
BluRay text subtitles use private stream 2.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-01 14:35:32 +02:00
Carl Eugen Hoyos 670d8ecfae lavf: Remove probesize32 and max_analyze_duration32 on version bump.
Add FF_API_PROBESIZE_32 to allow removing 32bit probesize and 32bit
max_analyze_duration after the next libavformat version bump.
2015-09-01 09:19:49 +02:00
Ronald S. Bultje 229843aa35 Replace av_dlog with ff_dlog.
ff_dlog checks compilability, and is non-public. av_dlog is deprecated
and no longer exists if FF_API_DLOG=0.
2015-08-18 10:24:01 -04:00
Stefano Sabatini fedc422684 lavf/mpegts: apply misc option description fixes
Use impersonal form, drop capitalization and ending dot.
2015-08-14 12:08:57 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Michael Niedermayer c8c86b8f9b avformat/mpegts: Replace silent cliping of language_count by asserts
Failure should not be possible, if it does occur then the code is
buggy and should be fixed not silently clip

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 18:15:17 +02:00
Michael Niedermayer 42aa02418e avformat/mpegts: Use DVB_TELETEXT timestamp heuristic also for DVB subtitles
Fixes Ticket4200

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 15:38:40 +02:00