Commit Graph

166 Commits

Author SHA1 Message Date
Diego Biurrun c454dfcff9 Use ISO C printf conversion specifiers where appropriate 2016-10-28 13:24:44 +02:00
Francois Cartegnie 393596f9d5 mpegtsenc: stop impersonating ses in sdt
Unless specified, users must use non registered
range for network id

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2016-05-17 10:29:36 +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
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
Stefan Pöschel dbce017913 mpegtsenc: add flag to embed an AC-3 ES the DVB way
So far an AC-3 elementary stream is refered to in the PMT according to
System A (ATSC). However System B (DVB) has a different way to signal an AC-3
ES within the PMT. This different way can be enabled by a new flag. The flag is
more generally named 'system_b' as there are further differences between ATSC
and DVB (e.g. the signalling of E-AC-3) which should then also be covered by it
in the future.

Bug-Id: 73

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-12-14 15:16:33 +01:00
Luca Barbato 4512ee78e1 mpegts: Mark the muxer as supporting variable fps
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-07-15 19:43:48 +02:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Martin Storsjö 7d097a0fc5 mpegtsenc: Take max_delay into account when buffering multiple audio packets into one PES packet
Make sure we don't buffer up more than max_delay worth of data
before writing a PES packet, even if pes_payload_size is set to
a larger value.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-04-03 14:06:15 +03:00
Martin Storsjö 8e32b1f096 libavformat: Use ffio_free_dyn_buf where applicable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:47 +02:00
Martin Storsjö e2ce163922 mpegts: Support running the write_trailer function without an AVIOContext
If opening and closing dynamic buffers as AVIOContext, we may
not have any AVIOContext available when wanting to close and
deallocate the muxer. Allow calling write_trailer despite this.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-19 23:13:04 +02:00
Florent Le Coz 2e0935965b Drop the unofficial extension prefix for MPEG and MPEG-TS formats
As per the RFCs:
http://tools.ietf.org/html/rfc3555#page-38
http://tools.ietf.org/html/rfc3003

CC: libav-stable@libav.org
2014-12-02 15:28:22 +00:00
Jean-Baptiste Mardelle 7319a47c7e mpegtsenc: recognize .mts as MPEG Transport Stream 2014-12-02 15:28:22 +00:00
Fredrik Axelsson 8f8caca224 Add support for BDAV/m2ts-mode muxing
Signed-off-by: Fredrik Axelsson <fraxbe@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 15:28:22 +00:00
Martin Storsjö 28816050e4 lavf: Set the stream time base hint properly for chained muxers
This avoids warnings about using the codec time base as time
base hint.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-06 23:30:52 +03:00
Luca Barbato e8049af132 mpegts: Do not try to write a PMT larger than SECTION_SIZE
Prevent out of array writes.

Similar to what Michael Niedermayer did to address the same issue.

Bug-Id: CVE-2014-2263
CC: libav-stable@libav.org

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-13 12:43:26 -07:00
Nidhi Makhijani 8dca0877e3 mpegts: Return proper error code on invalid input data
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-10 07:24:30 -07:00
Diego Biurrun 454697603e mpegts: Use av_free() to free memory allocated by av_strdup() 2014-08-08 03:12:57 -07:00
Diego Biurrun 5b220e1e19 mpegts: Fix memory leaks and related crashes in mpegs_write_header() 2014-08-07 07:52:17 -07:00
Diego Biurrun f8ab9f2fe3 mpegts: Avoid unnecessary variable shadowing 2014-08-07 07:52:17 -07:00
Diego Biurrun 6d6bd3a3db mpegts: Drop some unnecessary parentheses 2014-08-07 07:52:17 -07:00
Diego Biurrun b7b1bf9166 mpegts: K&R formatting cosmetics 2014-08-07 07:48:54 -07:00
Femi Adeyemi-Ejeye 2601a9447e mpegts: Add HEVC definitions
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-05 11:30:50 +02:00
Luca Barbato 89616408e3 mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including
the 4-byte CRC.
2014-08-04 22:22:54 +02:00
Anton Khirnov 194be1f43e lavf: switch to AVStream.time_base as the hint for the muxer timebase
Previously, AVStream.codec.time_base was used for that purpose, which
was quite confusing for the callers. This change also opens the path for
removing AVStream.codec.

The change in the lavf-mkv test is due to the native timebase (1/1000)
being used instead of the default one (1/90000), so the packets are now
sent to the crc muxer in the same order in which they are demuxed
(previously some of them got reordered because of inexact timestamp
conversion).
2014-06-18 15:12:34 +02:00
Luca Barbato f121dbd9f7 mpegts: Provide an option to override the pcr period
Certain hardware demuxer have specific restrictions for PCR periodicity.
2014-06-10 22:05:44 +02:00
Luca Barbato 3f7e94eccd mpegts: Move the option section to the bottom
Makes it consistent with the rest of the formats and ease usage
of macros constants for the defaults.
2014-06-10 22:05:44 +02:00
Martin Storsjö f1e9398621 lavc: Rename avpriv_mpv_find_start_code after moving out from mpegvideo
Also move the declaration to internal.h, and add restrict qualifiers
to the declaration (as in the implementation).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-26 09:50:02 +02: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
Luca Barbato 82569b01a1 mpegtsenc: set muxing type notification to verbose 2012-10-10 18:56:54 +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
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
Martin Storsjö d58dd4b5b5 avopt: Store defaults for AV_OPT_TYPE_FLAGS in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:38 +03:00
Martin Storsjö 124134e424 avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +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
Jindřich Makovička 84e430dd7b mpegtsenc: use avio_open_dyn_buf(), zero pointers after freeing
Per suggestion by Michael Niedermayer.

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-04 15:41:09 +03:00
Jindrich Makovicka 2439bd8681 mpegtsenc: Support LATM packetization for AAC
This adds the avoption mpegts_flags and converts the existing
resend_headers option into a flag, keeping the old option as
fallback for now.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-03 01:20:41 +03:00
Jindrich Makovicka b1c56eabe8 mpegtsenc: use AVFormatContext for AAC packetization
This removes the dependency on adts.c internals, and simplifies
adding other packetization formats.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-03 01:17:48 +03:00
Jindrich Makovicka d1a3a3d4b2 mpegtsenc: use AVERROR() for return codes
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-03 01:13:35 +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
Jindrich Makovicka 3fadb29baf mpegtsenc: allow user triggered PES packet flushing
Signed-off-by: Jindrich Makovicka <jindrich.makovicka@nangu.tv>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-26 11:41:18 +03:00
Martin Storsjö 4fa57d524f libavformat: Set the default for the max_delay option to -1
Make the muxers/demuxers that use the field handle the default
-1 in the same way as 0.

This allows distinguishing an intentionally set 0 from the default
value where the user hasn't set it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-20 10:53:47 +02:00
Martin Storsjö ddf422803b mpegtsenc: Add an AVOption for forcing a new PAT/PMT/SDT to be written
When segmenting the output from the mpegts muxer, one can
now set this option when cutting to a new segment, to make sure
the next segment starts with PAT/PMT/SDT.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-13 17:31:05 +02:00
Mike Melanson cc09dc7863 s/vbsf/bsf/
-vbsf doesn't exist anymore. It got renamed to -bsf somewhere along the
line. Update print statement accordingly.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-01-30 07:30:21 +01:00
Anton Khirnov f0cb13958d lavf: remove disabled FF_API_MUXRATE cruft 2012-01-27 10:52:43 +01:00
Jindřich Makovička 891ce00c8d mpegts: adjustable minimum PES payload
With the current default PES packet size, and very small audio bitrates,
audio packet duration gets too long. For players, which wait for a whole
audio packet (or more) it takes a very long time to start playing sound.

For 24kbps audio, one PES packet is about 1 second long. On Motorola STBs,
we observe about 3 second delay before the playback starts with the
default setting.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-28 20:31:54 +01:00
Jindřich Makovička 6fa9843b4b mpegts: properly output large audio packets
Do not assume the audio packets being always smaller than
DEFAULT_PES_PAYLOAD_SIZE.

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-28 20:31:15 +01:00
Luca Barbato 1c66862472 mpegts: rename payload_index to payload_size
It holds the size of the current payload.
2011-12-19 18:31:28 +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