Commit Graph

134 Commits

Author SHA1 Message Date
Paul B Mahol 2a08faba88 avformat/mpegenc: extend muxing PCM-DVD to other depths
Fixes #6783.
2018-12-01 19:42:17 +01:00
Gyan Doshi 4f8c691040 avformat/mpegenc - log error msgs for unsupported LPCM streams
The MPEG-PS muxer only accepts PCM streams having up to 8 channels
and the following sampling rates: 32/44.1/48/96 kHz.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-22 00:29:27 +01:00
Gyan Doshi f0809bc0fa avformat/mpegenc - accept PCM_DVD streams
PCM_S16BE stream packets in MPEG-PS have a 3-byte header and
are recognized as PCM_DVD by the demuxer which prevents their
correct remuxing in MPEG-1/2 PS.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-16 21:53:22 +01:00
Gyan Doshi b99e77b9f7 avformat/mpegenc - fix typo in VBV warning
Default VBV buffer size is 230KB, not 130KB.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-30 05:28:22 +01:00
Michael Niedermayer 9b9e4a71c5 avformat/mpegenc: Check for av_mallocz() failure
Fixes CID1257787

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-21 23:41:49 +01: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
Vittorio Giovara 41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +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
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
Hendrik Leppkes 079b5d4ef8 Merge commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca'
* commit '8bcadaacc2b8dc3c5d6569835a5ca20e62d3efca':
  mpegenc: use the CPB props side data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:55:39 +01:00
Anton Khirnov 8bcadaacc2 mpegenc: use the CPB props side data
Do not access the encoder options, since it makes no sense when the
AVStream codec context is not the encoding context.
2015-12-06 10:26:13 +01:00
Stefano Sabatini 57cd2f7777 lavf/mpegenc: provide better feedback in case of invalid media type 2015-08-27 18:07:43 +02:00
Michael Niedermayer 343654c288 avformat/mpegenc: Replace *0.7 by *7/10
This avoids another float computation, avoiding a potential source of
rounding issues

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-25 13:34:34 +02:00
Michael Niedermayer 73f7179924 avformat/mpegenc: Do not use floats for vcd_padding_bitrate
This reduces the risk for rounding differences.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-25 12:43:51 +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
Michael Niedermayer e72f8ceabd avformat/mpegenc: Ignore max_delay if no other options remain
Fixes assertion failure
Fixes Ticket4335

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-01 16:47:36 +01:00
Michael Niedermayer a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Michael Niedermayer 0e1bb03cb0 Merge commit '01168bf1405ddbf671f1074a927b951b8777adbb'
* commit '01168bf1405ddbf671f1074a927b951b8777adbb':
  mpeg: Remove unused field

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-07 22:48:24 +01:00
Luca Barbato 01168bf140 mpeg: Remove unused field 2015-01-07 13:49:10 +01:00
Michael Niedermayer 47b9481d9d avformat/mpegenc: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-21 19:24:11 +01:00
Michael Niedermayer 869b56cae6 avformat/mpegenc: replace always enabled asserts by av_assert0()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 15:18:31 +01:00
Michael Niedermayer 1d242f9816 avformat/mpegenc: assert that premux_packet is non null
Based on: 065923b078
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 16:54:06 +01:00
Vittorio Giovara 065923b078 mpegenc: prevent a NULL pointer dereference
CC: libav-stable@libav.org
Bug-Id: CID 29261
2014-11-24 01:30:14 +00:00
Anton Khirnov 75bbaf2493 mpegenc: limit the maximum muxrate
It is written to the file as a 22-bit value.

CC: libav-stable@libav.org
2014-08-27 06:21:54 +00:00
Michael Niedermayer cf0e8e7ad4 Merge commit '4e9e6fa99f3ff83cedbf6c378d62065ae419a3b9'
* commit '4e9e6fa99f3ff83cedbf6c378d62065ae419a3b9':
  mpeg: Write H264 streams at offset 2

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-26 14:05:07 +02:00
Luca Barbato 4e9e6fa99f mpeg: Write H264 streams at offset 2
It hints that the content is H264 according to HD-DVD.
2014-08-26 03:43:13 +02:00
Michael Niedermayer e18d9d90f1 Merge commit '8c6f430291374cf6d2cfb85cdbb809803b5a7d83'
* commit '8c6f430291374cf6d2cfb85cdbb809803b5a7d83':
  mpeg: Suppress a compiler warning on callback type

Conflicts:
	libavformat/mpegenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 02:20:54 +02:00
Luca Barbato 8c6f430291 mpeg: Suppress a compiler warning on callback type 2014-08-09 21:39:36 +02:00
Michael Niedermayer a698efbc9d Merge commit 'e4c9e59a4547adaaa0ce9f25b0d0c5b91ae15472'
* commit 'e4c9e59a4547adaaa0ce9f25b0d0c5b91ae15472':
  mpeg: K&R formatting cosmetics

Conflicts:
	libavformat/mpegenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 21:31:54 +02:00
Luca Barbato e4c9e59a45 mpeg: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-08 05:22:09 -07:00
Lukasz Marek ce1eefe691 lavf: use av_fifo_freep
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-07 23:39:47 +02:00
Michael Niedermayer 572f5eb1af avformat/mpegenc: try to improve the VBV buffer warning
Maybe fixes Ticket 3494
Part of the message suggested by: rogerdpack
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-16 17:20:07 +02:00
Carl Eugen Hoyos e043298cb1 lavf/mpegenc: Print a warning if ac3, pcm_s16be or dts are muxed into mpeg1.
Some media players don't play the resulting files.
The warning should help users to avoid the issues described in ticket #1720.
2013-11-24 10:37:52 +01:00
Michael Niedermayer ccdfa3e271 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add missing #includes for *INT64_MAX and *INT64_C

Conflicts:
	ffmpeg.c
	ffmpeg_filter.c
	ffplay.c
	libavformat/assdec.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-24 05:21:19 +01:00
Diego Biurrun 8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Michael Niedermayer f2eb474a5a avformat/mpegenc: check, warn and clip muxrate to syntactical possible values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-29 17:02:57 +02:00
Michael Niedermayer 8c1253c934 avformat/mpegenc: check, warn and clip VBV value to within syntactically possible values
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-29 17:02:06 +02:00
Michael Niedermayer 28d35dbe9f avformat/mpegenc: fix muxrates AVOption maximum value
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-29 17:00:54 +02:00
Michael Niedermayer cd05c4060a avformat/mpegenc: minor simplification / use AV_WB16()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 13:36:45 +02:00
Michael Niedermayer 32cde96296 avformat/mpegenc: Better heuristic for ordering packets
This prevents underflows in quite constrained cases

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 03:13:38 +02:00
Michael Niedermayer 930406325c avformat/mpegenc: Better default for max_delay
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 03:12:20 +02:00
Michael Niedermayer b637118086 avformat/mpegenc: change assert to av_assert0
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 02:16:12 +02:00
Michael Niedermayer ddd0e23d58 avformat/mpegenc: improve field names in underflow error message
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 01:07:24 +02:00
Michael Niedermayer 5c2ccf83df Merge commit '7abd35a1ffaecfd79fa07b801621ee11ab595c43'
* commit '7abd35a1ffaecfd79fa07b801621ee11ab595c43':
  avformat: Add av_cold attributes to init functions missing them

Conflicts:
	libavformat/rtpdec_xiph.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-06 10:19:56 +02:00
Diego Biurrun 7abd35a1ff avformat: Add av_cold attributes to init functions missing them 2013-05-05 18:33:04 +02:00
Michael Niedermayer fa11f36876 mpegpsenc: avoid shifting dts/pts
Only shift if needed to avoid negative scr when requested
or for dvd.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 20:58:59 +01:00
Michael Niedermayer cf369d4449 mpegpsenc: show first SCR/DTS at debug level
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 20:58:59 +01:00
Michael Niedermayer 9fd0cf8a3b mpegpsenc: move preload recalculation to where its needed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 20:58:59 +01:00