Commit Graph

303 Commits

Author SHA1 Message Date
James Almer
fe483ac428 avformat/mpegtsenc: fix usage of AVStream.codec
Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-04 18:39:27 -03:00
smallishzulu
77a7ff8f05 lavf/mpegtsenc: Define service_type "HEVC digital television service".
Fixes ticket #5455.
2016-05-03 21:35:21 +02:00
Carl Eugen Hoyos
fd0f1442eb lavf/mpegtsenc: Fix stream_type for low sample rate MP2/MP3. 2016-05-03 14:15:14 +02: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
26811fd946 avformat/mpegtsenc: Fix used service
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-24 12:35:19 +01:00
Michael Niedermayer
50d017a281 avformat/mpegtsenc: Keep track of the program for each service
Simplifies code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-24 12:27:23 +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
Hagen Schmidt
583a643146 mpegtsenc: Do not fail ADTS AAC muxing if the first frame is not ADTS
Fixes ticket 279.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-29 21:40:33 +01:00
Vittorio Gambaletta (VittGam)
8b02af1e6f avformat/mpegtsenc: Fix multi program so that it supports adding the same stream to multiple programs.
Signed-off-by: Vittorio Gambaletta <ffmpeg-dev@vittgam.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-25 19:47:16 +01:00
Rodger Combs
1b5bd4051d lavf/mpegtsenc: add automatic bitstream filtering 2015-12-28 08:40:37 -06:00
Stefan Pöschel
470749703e avformat/mpegtsenc: add flag to embed an AC-3/E-AC-3 ES the DVB way
So far an AC-3 elementary stream is refered to in the PMT according to
System A (ATSC). An E-AC-3 ES in contrast is embedded the System B (DVB) way.
To fix this inconsistency, this commit changes the default E-AC-3 behaviour to
use the ATSC way, too. Furthermore a new flag is added to optionally select the
DVB way (regarding both codecs and possible further differences in the future).

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-24 02:30:33 +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
Michael Niedermayer
edfc835a56 avformat/mpegtsenc: Add basic multi program support
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
Sebastian Dröge
eb3628d87f mpegtsenc: Fix off-by-one in indexing into Opus channel mapping arrays
Fixes, CID1338323, CID1338324

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 02:35:20 +01:00
Timo Teräs
64f7db554e mpegencts: Fix overflow in cbr mode period calculations
ts->mux_rate is int (signed 32-bit) type. The period calculations
will start to overflow when mux_rate > 5mbps. This fixes overflows
by converting first to 64-bit type.

Fixes #5044.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-03 17:43:30 +01:00
Hagen Schmidt
7bf465abf3 mpegtsenc: add vc-1 support to MPEG-TS muxer (ticket 2141)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 00:34:12 +01:00
Sebastian Dröge
7d6a4797f1 mpegtsenc: Implement writing of Opus trim_start/trim_end control values
Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 03:33:17 +01:00
Sebastian Dröge
01509cdf92 mpegtsenc: Add support for muxing Opus in MPEG-TS
Signed-off-by: Sebastian Dröge <sebastian@centricular.com>
Previous version reviewed-by: Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-06 03:32:40 +01:00
Derek Buitenhuis
4ffdba2418 mpegts: Make the sdt_period a double
Having it as a float didn't even allow enough precision to check
for INT_MAX/2.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-17 15:02:40 -04:00
Derek Buitenhuis
516d34de42 mpegts: Make the pat_period a double
Having it as a float didn't even allow enough precision to check
for INT_MAX/2.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-10-17 15:02:06 -04:00
Michael Niedermayer
b5e716ae13 avformat/mpegtsenc: Add sdt_period, similar to pat_period
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-18 23:26:05 +02:00
Michael Niedermayer
34da54fd1a avformat/mpegtsenc: Support a user specified PAT/PMT period
Can be used to fix Ticket3714

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-18 22:24:25 +02:00
Michael Niedermayer
a9c1545a33 avformat/mpegtsenc: support storing PAT/PMT per frame
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-18 22:19:19 +02: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
Michael Niedermayer
1680f9c588 Merge commit '4512ee78e19fdb011bdec1b3a8dc0b315c82a81e'
* commit '4512ee78e19fdb011bdec1b3a8dc0b315c82a81e':
  mpegts: Mark the muxer as supporting variable fps

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-15 21:29:12 +02:00
Carl Eugen Hoyos
1d5edad8cc lavf/mpegtsenc: Only fail aac muxing if the first frame is invalid.
Fixes ticket #3957.
2015-07-07 10:44:46 +02:00
Michael Niedermayer
40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +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
Carl Eugen Hoyos
d0c895d3c5 lavf/mpegtsenc: Accept 0x000001 as startcode for hevc.
Fixes ticket #4194.
2015-04-14 01:57:38 +02:00
Michael Niedermayer
5b97681eaa Merge commit '7d097a0fc57f0fa8385962a539c657c2f40b5ed0'
* commit '7d097a0fc57f0fa8385962a539c657c2f40b5ed0':
  mpegtsenc: Take max_delay into account when buffering multiple audio packets into one PES packet

Conflicts:
	libavformat/mpegtsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-03 21:01:40 +02: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
Carl Eugen Hoyos
56ffde3f61 Allow muxing h264 into ts with startcode "001" instead of "0001".
Fixes ticket #2220.
Fixes ticket #4324.
2015-02-25 15:08:33 +01:00
Michael Niedermayer
7f03f75ce7 Merge commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a'
* commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a':
  libavformat: Use ffio_free_dyn_buf where applicable

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:48:50 +01: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
Michael Niedermayer
33650e0e42 avformat/mpegtsenc: Do not create invalid files from annex b streams without SPS/PPS
use global headers to create SPS/PPS when they are available

Fixes Ticket4248

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-12 23:13:15 +01:00
Matt Oliver
22504396fe avformat/mpegtsenc: Fix build with msvc
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 15:15:50 +01:00
Michael Niedermayer
c348a42dcc Revert "avformat/mpegtsenc: Change the service_type field to enum"
This isnt safe due to AVOption accessing this field as int
i just realized a moment after pushing

This reverts commit 0935453e84.
2015-02-02 22:30:56 +01:00
Michael Niedermayer
0935453e84 avformat/mpegtsenc: Change the service_type field to enum
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-02 22:15:39 +01:00
dhead666
48e36f8a12 libavformat/mpegtsenc: allow to set service_type in sdt
This adds an option to set the service type in mpegts as defined in ETSI 300 468.

I added what I believe are the most useful service types as pre defined values,
the others can be sent by using their hexdecimal form directly (e.g. -mpegts_service_type digital_radio, -mpegts_service_type 0x07).

I've been using this patch in order to pipe internet radio stream (originally as HLS/m3u8) from ffmpeg to tvheadend,
when the service type set right tvheadend recognize the mpegts stream as a radio channel.

The patch in its original form was written by linuxstb from freenode's hts channel which allowed me pushing it upstream.

This close issue 4118.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-02 22:02:26 +01:00
Michael Niedermayer
f7a4589b36 avformat/mpegtsenc: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-21 19:25:17 +01:00
Michael Niedermayer
6b0f54ddc7 Merge commit 'e2ce16392205d8efe9143329ed3fb5fcb15498fa'
* commit 'e2ce16392205d8efe9143329ed3fb5fcb15498fa':
  mpegts: Support running the write_trailer function without an AVIOContext

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-20 00:33:40 +01: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
Michael Niedermayer
d76adfae9c Merge commit '8f8caca2242e1fe05f37493cfabcd3f4de198550'
* commit '8f8caca2242e1fe05f37493cfabcd3f4de198550':
  Add support for BDAV/m2ts-mode muxing

Conflicts:
	libavformat/mpegtsenc.c

See: 09a858da7d
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 22:42:35 +01: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
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
Jean-Baptiste Mardelle
7319a47c7e mpegtsenc: recognize .mts as MPEG Transport Stream 2014-12-02 15:28:22 +00:00
dedicatedbroadcastsolutions
873dac50f5 avformat/mpegtsenc: change the min value for mpegts_start_pid to allow ATSC PIDs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-19 00:49:18 +01:00
Michael Niedermayer
3726d07a2a Merge commit '28816050e47b6dba430a52e429d21a864cffda8e'
* commit '28816050e47b6dba430a52e429d21a864cffda8e':
  lavf: Set the stream time base hint properly for chained muxers

Conflicts:
	libavformat/segment.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-07 02:51:08 +02:00