Commit Graph

283 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
Martin Storsjö e6153f173a avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Diego Biurrun 0177b7d23a Improve descriptiveness of a number of codec and container long names 2012-07-30 20:46:55 +02:00
Ronald S. Bultje ae2bb52cd2 mpegts: remove unused/incomplete/broken seeking code 2012-06-19 00:56:43 +01:00
Alex Converse a8656cd425 mpegts: Remove disabled extension matching probe. 2012-06-07 12:27:04 -07:00
Joakim Plate 68b9ed8391 mpegts: Some additional HDMV types and reg descriptors for mpegts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-05-03 12:13:28 -04:00
Martin Storsjö df8aa4598c mpegts: Make sure we don't return uninitialized packets
This fixes crashes, where the demuxer could return 0 even
if the returned AVPacket isn't initialized at all. This
could happen if running into EOF or running out of probesize
with non-seekable sources.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-27 20:05:37 +03:00
Martin Storsjö 269cb6751b mpegts: Try seeking back even for nonseekable protocols
The mpegts demuxer reads 5 KB at startup just for discovering
the packet size. Since the default avio buffer size is 32 KB,
the seek back to the start will in most cases be within the
avio buffer, and will in most cases succeed even if the actual
protocol isn't seekable.

This makes the demuxer startup faster/with less data when
reading data from a non-seekable input, by not skipping
the first few KB.

If it fails, don't warn if the protocol isn't seekable, making
it behave as before in the failure case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-23 00:02:49 +03:00
Martin Storsjö 20234a4bd7 cosmetics: Align muxer/demuxer declarations
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 19:19:59 +03:00
Alex Converse c9024a9fd7 mpegts: Fix dead error checks 2012-03-26 17:53:51 -07:00
Alex Converse 100c3fb2d1 mpegts: Always honor a registration descriptor if present and there is no other codec information. 2012-03-09 09:48:14 -08:00
Alex Converse 1aa708988a mpegts: Pad the packet buffer in handle_packet().
This allows it to be used with get_bits without the thread of overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-02 15:44:42 -08:00
Alex Converse 4df369692e mpegts: Do not call read_sl_header() when no bytes remain in the buffer.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-02 15:44:42 -08:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Alex Converse 41bdd4adc4 mpegts: Suppress invalid timebase warnings on DMB streams.
timestamp_len and timestamp_res intialize to zero.
2011-12-20 09:52:05 -08:00
Alex Converse d9b89b23df mpegts: Fix typo in handling sections in the PMT.
This was an error rebasing 4682a1dc3a for
commit. The "pes" variable guaranteed to be NULL in that block.
2011-12-20 09:52:04 -08:00
Vladimir Pantelic 65a25adc97 mpegts: replace some magic numbers with the existing define
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-16 11:45:36 +02:00
Anton Khirnov cd3716b9aa Replace all uses of av_close_input_file() with avformat_close_input(). 2011-12-12 20:34:38 +01:00
Anton Khirnov 3a7f7678eb lavf: deprecate av_close_input_stream().
And remove all its uses.
2011-12-12 20:21:47 +01:00
Diego Biurrun da9cea77e3 Fix a bunch of common typos. 2011-12-11 00:32:25 +01:00
Anton Khirnov c3f9ebf743 lavf: make av_set_pts_info private.
It's supposed to be called only from (de)muxers.
2011-11-30 20:34:45 +01:00
Anton Khirnov 3110ad8329 mpegts: set stream id on just created stream, not an unrelated variable
Bug introduced in 84ad31ff18.
Thanks to Uoti Urpala for finding it.
2011-11-08 18:56:39 +01:00
Diego Biurrun 124e28847b Remove some stray unnecessary ffmpeg references. 2011-11-02 10:42:54 +01:00
Alex Converse ca65932bbf mpegts: MP4 SL support 2011-10-28 14:54:14 -07:00
Alex Converse c530267024 mpegts: MP4 OD support 2011-10-28 14:54:14 -07:00
Alex Converse 4682a1dc3a mpegts: Add support for Sections in PMT 2011-10-28 14:54:14 -07:00
Alex Converse fec2836483 mpegts: Replace the MP4 descriptor parser with a recursive parser. 2011-10-28 14:54:14 -07:00
Alex Converse c3bc6096f2 mpegts: Add support for multiple mp4 descriptors 2011-10-28 14:54:13 -07:00
Alex Converse 476d04a56a mpegts: Parse mpeg2 SL descriptors. 2011-10-28 14:54:13 -07:00
Anton Khirnov a2faa95151 lavf: make some seeking functions private
Specifically av_update_cur_dts(), av_seek_frame_binary() and
av_gen_search().

They are not supposed to be called outside lavf.
2011-10-28 09:23:24 +02:00
Anton Khirnov 84ad31ff18 lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit.

In many cases, the id is some constant made up number (e.g. 0 for video
and 1 for audio), which is then not used in the demuxer for anything.
Those ids are removed.
2011-10-19 17:02:11 +02:00
Anton Khirnov 3b3bbdd3e6 lavf,lavd: replace av_new_stream->avformat_new_stream part I.
Trivial replacements with sed are done in this commit:
sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/'
2011-10-19 17:02:11 +02:00
Anton Khirnov 145f741e11 AVOptions: rename FF_OPT_TYPE_* => AV_OPT_TYPE_* 2011-10-12 16:51:16 +02:00
Diego Biurrun 35a6855868 Fix av_dlog invocations with wrong or missing logging context.
This fixes build failures with -DDEBUG in CPPFLAGS.
2011-09-21 09:57:32 +02:00
Georgi Chorbadzhiyski f1f15c3c1a mpegts: improve error reporting
When reporting continuity error show pid, expected and received cc.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-11 09:27:13 -04:00
Aviad Rozenhek 162f1fbc14 mpegts: on seek, reset the cc for all PIDs
Prevent false positive continuity counter error logs.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-11 09:26:21 -04:00