summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
Commit message (Collapse)AuthorAge
* lavf: use new decode APIwm42016-03-23
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat_find_stream_info: move duration guessing after updating codec ↵Anton Khirnov2016-03-04
| | | | | | | | parameters This bitrate might not be known otherwise. Bug-Id: 926
* lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* lavf: use the io_open callbacks for files opened from open_input() as wellAnton Khirnov2016-02-22
| | | | There is no real reason to treat them differently.
* lavf: allow custom IO for all filesAnton Khirnov2016-01-24
| | | | | | | | | | | | | | Some (de)muxers open additional files beyond the main IO context. Currently, they call avio_open() directly, which prevents the caller from using custom IO for such streams. This commit adds callbacks to AVFormatContext that default to avio_open2()/avio_close(), but can be overridden by the caller. All muxers and demuxers using AVIO are switched to using those callbacks instead of calling avio_open()/avio_close() directly. (de)muxers that use the URLProtocol layer directly instead of AVIO remain unconverted for now. This should be fixed in later commits.
* avformat: expose av_stream_new_side_data helperJohn Stebbins2015-11-18
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavf: deprecate compute_pkt_fields2Anton Khirnov2015-11-09
| | | | | | | | | All encoders set pts and dts properly now (and have been doing that for a while), so there is no good reason to do any timestamp guessing in the muxer. The newly added AVStreamInternal will be later used for storing all the private fields currently living in AVStream.
* lavf: factor out freeing an AVStreamAnton Khirnov2015-11-08
| | | | It will be needed in other functions.
* lavf: initialize cur_dts to AV_NOPTS_VALUE for muxingAnton Khirnov2015-11-08
| | | | The reasoning for setting it to zero only applies to demuxing.
* avformat: Rework add_to_pktbufLuca Barbato2015-10-26
| | | | | Make it return an error and check its return value when it is used. Simplify the usage by calling `av_packet_ref` internally when needed.
* avpacket: Replace av_free_packet with av_packet_unrefLuca Barbato2015-10-26
| | | | | | | `av_packet_unref` matches the AVFrame ref-counted API and can be used as a drop in replacement. Deprecate `av_free_packet`.
* avformat: Always return ref-counted AVPacketLuca Barbato2015-10-26
| | | | And drop the av_dup_packet from the input_thread.
* lavc: Make AVPacket.duration int64, and deprecate convergence_durationwm42015-09-29
| | | | | | | | | Note that convergence_duration had another meaning, one which was in practice never used. The only real use for it was a 64 bit replacement for the duration field. It's better just to make duration 64 bits, and to get rid of it. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavc: Drop deprecated destruct_packet related functionsVittorio Giovara2015-08-28
| | | | Deprecated in 10/2012.
* lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-27
| | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavc: AV-prefix all codec capabilitiesVittorio Giovara2015-07-27
| | | | | | Express bitfields more simply. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* lavf: Fix variables constness in ff_iso8601_to_unix_time()Vittorio Giovara2015-04-20
| | | | | | warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
* Replace av_dlog with normal av_log at trace levelVittorio Giovara2015-04-19
| | | | This applies to every library where performance is not critical.
* parseutils: Make av_small_strptime publicLuca Barbato2015-04-07
| | | | | | And use it in libavformat. Based on a similar patch by Stefano Sabatini <stefasab@gmail.com>.
* lavf: move internal fields from public to internal contextwm42015-02-10
| | | | | | | This is not an API change; the fields were explicitly declared private before. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavf: add a convenience function for adding side data to a streamAnton Khirnov2015-01-27
|
* libavformat: Check for malloc failures in avformat_new_streamMartin Storsjö2015-01-04
| | | | | CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat: Make avformat_free_context handle NULLLuca Barbato2014-10-17
| | | | | | | Work as the other free()-like functions. Bug-Id: CID 1087081 CC: libav-stable@libav.org
* lavf: switch to AVCodecContext.framerate for demuxingAnton Khirnov2014-10-15
|
* lavf: Don't drop both pts and dts if timestamps are invalidMichael Niedermayer2014-10-12
| | | | | | | | | In these cases, only drop dts. Because if we drop both we have no timestamps at all for some files. This improves playback of HLS streams from GoPro cameras. Signed-off-by: Martin Storsjö <martin@martin.st>
* lavf: fix memleaks in avformat_find_stream_info()Justin Ruggles2014-09-29
| | | | | | | | When AVFMT_FLAG_NOBUFFER is set, the packets are not added to the AVFormatContext packet list, so they need to be freed when they are no longer needed. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* lavf: add AVFormatContext.max_ts_probeAnton Khirnov2014-08-25
| | | | | It allows to configure how long will avformat_find_stream_info() wait to get the first timestamp.
* lavf: eliminate ff_get_audio_frame_size()Anton Khirnov2014-08-13
| | | | | | | | | | | | | | | It is basically a wrapper around av_get_audio_frame_duration(), with a fallback to AVCodecContext.frame_size. However, that field is set only when the stream codec context is actually used for encoding or decoding, which is discouraged. For muxing, it is generally the responsibility of the caller to set the packet duration. For demuxing, if the duration is not stored at the container level, it should be set by the parser. Therefore, removing the frame_size fallback should not break any important case.
* Set protocol-level metadata in AVFormatContext any time a packet is read.Andrew Stone2014-08-13
| | | | | | | If any option named "metadata" is set inside the context, it is pulled up to the context and then the option is cleared. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat: Move av_probe_input* to format.cLuca Barbato2014-07-29
|
* avformat: Mark AVOutputFormat argument in avformat_query_codec as constDiego Biurrun2014-07-26
|
* avformat_new_stream: make the AVCodec parameter constRoman Savchenko2014-07-08
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* Replace av_malloc() and memset(0) by av_mallocz()Diego Biurrun2014-06-22
|
* lavf: switch to AVStream.time_base as the hint for the muxer timebaseAnton Khirnov2014-06-18
| | | | | | | | | | | | 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).
* lavf: group dump functions togetherVittorio Giovara2014-06-14
|
* lavf: add av_stream_get_side_dataJanne Grunau2014-05-20
|
* probe: Support AAC_LATM in set_codec_from_probe_dataLuca Barbato2014-05-03
|
* lavc: eliminate tb_unreliable()Anton Khirnov2014-04-28
| | | | | If framerate estimation is enabled, it makes sense to always apply it, instead of limiting it to a few specific cases.
* lavf: do not use the parser duration for videoAnton Khirnov2014-04-22
| | | | | The parser has no way of knowing video duration, and therefore no video parsers set it.
* lavf: add an AVStream field for exporting stream-global side dataAnton Khirnov2014-03-24
|
* avformat: Report the duration analysis reachedLuca Barbato2014-03-11
|
* lavf: ignore attachment streams for interleaving purposesAnton Khirnov2014-02-04
| | | | Those streams should never get any packets by definition.
* lavf: include 60 fps in guessed standard frame ratesJanne Grunau2014-01-31
| | | | | Due to what looks like an off-by-one error 60 * 12 * 1001 / 12 * 1001 is not tested as standard frame rate in avformat_find_stream_info().
* avformat: utils: Refactor duplicated PRINT macroDiego Biurrun2014-01-29
|
* avformat: utils: K&R formatting cosmeticsDiego Biurrun2014-01-26
| | | | Also adjust some comment wording / spelling and reorder header #includes.
* lavf: make av_probe_input_buffer more robustAnton Khirnov2014-01-13
| | | | | | | Always use the actually read size as the offset instead of making possibly invalid assumptions. Addresses: CVE-2012-6618
* lavf: use a fixed width typeAnton Khirnov2014-01-13
| | | | It's shorter and more consistent with the rest of the code.
* lavf: simplify handling of offset in av_probe_input_buuffer()Anton Khirnov2014-01-13
|
* lavf: remove a pointless checkAnton Khirnov2014-01-06
| | | | AVStream.codec is always non-NULL
* lavf: remove an unneeded call to avcodec_get_frame_defaults().Anton Khirnov2013-12-11
| | | | avcodec_decode_*() resets the frame itself.