Commit Graph

1760 Commits

Author SHA1 Message Date
Jan Sebechlebsky
6a3515a5a4 avformat/utils: Add ff_format_output_open() function
Add ff_format_output_open utility function to wrap
io_open callback of AVFormatContext structure.

Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:29:44 +02:00
Jan Sebechlebsky
1732d89403 avformat/utils: Add ff_stream_encode_params_copy()
Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-07-16 01:15:00 +02:00
Hendrik Leppkes
c2e13d2ecd avformat/utils: update deprecated AVStream->codec when the context is updated
This ensures the AVStream->codec entry is kept in sync when new streams are
discovered mid-playback or changes to the context occur from other sources.

Fixes trac 5678.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-30 17:43:01 +02:00
Rodger Combs
af7e2734b9
lavf: update auto-bsf to new BSF API 2016-06-25 15:50:04 -05:00
Rodger Combs
150e5e13b1
lavf: deprecate av_apply_bitstream_filters 2016-06-25 15:50:03 -05:00
Clément Bœsch
8ca78d0fef lavf/utils: fix const warning at a find_decoder() call 2016-06-25 13:38:53 +02:00
Michael Niedermayer
99c3c3237b avformat/utils: Use internal->avctx for bitrate in estimate_timings_from_bit_rate() if needed
The internal avctx bitrate is copied into codecpar after estimate_timings()

Fixes Ticket5646

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-22 14:16:58 +02:00
Michael Niedermayer
4fecb97fd3 avformat/utils: change bit_rate to 64 bit in estimate_timings_from_bit_rate()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-22 14:16:58 +02:00
Aman Gupta
ddffafc0b0 avformat/utils: in debug mode, print number of streams found before avformat_find_stream_info()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-14 21:37:21 +02:00
Stefano Sabatini
4b5620446a lavf/utils: fix timestamp trace log in estimate_timings() function
Use the correct timebase, also replace "stream" with "format" in the
context of the format.
2016-06-14 12:11:04 +02:00
Michael Niedermayer
60de31e98c avformat/utils: Export coded dimensions unconditionally
This fixes a API regression
Probably fixes Ticket5451

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-13 13:07:55 +02:00
Michael Niedermayer
6826f16e4a avformat/utils: Do not overwrite, but use sample_fmt from context
Fixes Ticket 3759

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
218bb8b3f3 avformat/utils: Open decoder even if there are no packets if parameters are missing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
2a70e78a28 avformat/utils: Initialize st in loop
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-09 19:32:56 +02:00
Michael Niedermayer
ad72d7d299 avformat: Copy properties from internal context
Fixes Ticket5467 "Lossless j2k information no longer shown"

Based on suggestion by Hendrik Leppkes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-02 16:57:49 +02:00
Michael Niedermayer
c1ed78a591 avformat/utils: avoid overflow in compute_chapters_end() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 00:25:21 +02:00
Michael Niedermayer
2be3007ed5 avformat/utils: avoid overflow in update_stream_timings() with huge durations
Fixes: usan_granule_overflow

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 00:14:02 +02:00
Michael Niedermayer
7f5c6ea511 avformat/utils: Fix use of uninitialized variable
Fixes CID1361961

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-26 19:04:46 +02:00
Chris Cunningham
2875745d35 avformat/utils: Check negative bps before shifting in ff_get_pcm_codec_id()
Fixes: undefined shift.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-17 23:47:24 +02:00
Michael Niedermayer
635b2ec5f2 avformat/utils: Do not compute the bitrate from duration == 0
Fixes division by 0 in fate-acodec-ra144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-16 14:23:49 +02:00
Michael Niedermayer
ea791c080d avformat/utils: Check bps before using it in a shift in ff_get_pcm_codec_id()
Fixes undefined shift
Fixes: usan_shift

Found-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-11 00:32:32 +02:00
Michael Niedermayer
824906a541 avformat/utils: Do not detect video codecs when audio is expected
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-04 22:19:44 +02:00
wm4
656b07b5a9 lavf: use new decode API
From Libav commit 8bc4accc37, with
additional code for decoding subtitles (not present in Libav).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-04-21 14:23:36 +02:00
Michael Niedermayer
a0b92788a8 avformat/utils: Remove use of caps_internal as it is not public API
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-21 13:49:32 +02:00
Paul B Mahol
323b8c95e4 avformat: add AVFormatContext to ff_get_extradata()
Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-04-14 18:21:08 +02:00
Derek Buitenhuis
2691a8399f Revert "Merge commit '1ceb07eb313c2d51383408025e57a2fe50ccd164'"
Broke a lot of stuff and didn't fix anything.

This reverts commit 3c461eecd4, reversing
changes made to 884dd175f0.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-13 17:11:10 +01:00
Derek Buitenhuis
3c461eecd4 Merge commit '1ceb07eb313c2d51383408025e57a2fe50ccd164'
* commit '1ceb07eb313c2d51383408025e57a2fe50ccd164':
  avformat_find_stream_info: move duration guessing after updating codec parameters

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-13 15:36:55 +01:00
Michael Niedermayer
196cfc278d avformat/utils: use av_codec_g/set_lowres()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-04-12 04:21:12 +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
Hendrik Leppkes
6518cbc52a lavc/utils: Introduce ff_bprint_to_codecpar_extradata for avformat
It will be used by text subtitle demuxers to construct format instructions
straight into extradata. They all currently a similar function that accepts
an AVCodecContext instead.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-03 13:04:17 -04:00
Lou Logan
06eef96b69 fix some a/an typos
Signed-off-by: Lou Logan <lou@lrcd.com>
2016-03-28 14:13:17 -08:00
Michael Niedermayer
6e65b9bb1f avformat/utils: scan a bit farther for a keyframe in mpeg/mpegts (7 sec instead of 5, we already scan 90sec in some cases by default)
Fixes Ticket5305

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-21 20:46:29 +01:00
Marton Balint
25f707694c avformat/utils: increase detected start_time with skip_samples
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-03-20 19:51:05 +01:00
Michael Niedermayer
0ffa9e6eba avformat/utils: Do not wait for more than 1 frame on attachments
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-19 22:58:34 +01:00
Sasi Inguva
895dd09671 lavf/utils: Fix DTS for short H264 streams.
Fill DTS if all packets have been read in avformat_find_stream_info, and still
has_decode_delay_been_guessed returns false.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-12 14:48:07 +01:00
Sasi Inguva
e939dde48d avformat/utils: factor update_dts_from_pts() out
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-12 14:47:43 +01:00
Ronald S. Bultje
6d8ab358a3 lavf: allow BSFs to drop packets.
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
returns, the packet is considered dropped.
2016-03-11 11:19:10 -05:00
Michael Niedermayer
de1de49324 avformat/utils: fix dts from pts code in compute_pkt_fields() during ascending delay
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-08 02:56:33 +01:00
Derek Buitenhuis
93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Anton Khirnov
1ceb07eb31 avformat_find_stream_info: move duration guessing after updating codec parameters
This bitrate might not be known otherwise.

Bug-Id: 926
2016-03-04 08:26:34 +01:00
Mats Peterson
ba40b3520d lavf/utils: Normalize AVPacket.data to native endian in ff_get_packet_palette()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-04 04:02:19 +01:00
Marton Balint
e7dd97b5d8 avformat/utils: add a function to standardize creation time
This can be used for formats which write all format metadata as string to
files, therefore non-standard creation times such as 'now' will be parsed.

The standardized creation time is UTC ISO 8601 with microsecond precision.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-03-03 01:37:12 +01:00
Mats Peterson
2be0366a7f lavf/utils: Add ff_get_packet_palette()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-02 18:11:18 +01:00
Michael Niedermayer
77524ee2dc avformat/utils: Be slightly more tolerant with fps vs. stream timebase
Fixes regression with ticket2451

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-29 02:59:15 +01:00
Rodger Combs
a21a3c25dc probe TrueHD in MPEGTS 2016-02-27 16:27:27 -06: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
Anton Khirnov
7fbb3b5b98 lavf: use the io_open callbacks for files opened from open_input() as well
There is no real reason to treat them differently.
2016-02-22 11:28:35 +01:00
Marton Balint
51afd9f4e1 avformat/dvbtxt: add raw demuxer for dvb teletext probing
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-19 21:50:16 +01:00
Marton Balint
a573e6c103 avformat/utils: remove ff_iso8601_to_unix_time
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:51:14 +01:00
Marton Balint
e942454daf avformat/utils: add ff_parse_creation_time_metadata
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-14 01:51:14 +01:00