summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
Commit message (Collapse)AuthorAge
* avformat/mux: Check return code of av_packet_split_side_data()Michael Niedermayer2017-03-30
| | | | | | Fixes CID1403225 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-29
|
* lavf: fix usages of av_get_codec_tag_string()Clément Bœsch2017-03-29
|
* avcodec, avformat: deprecate anything related to side data mergingwm42017-03-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch deprecates anything that has to do with merging/splitting side data. Automatic side data merging (and splitting), as well as all API symbols involved in it, are removed completely. Two FF_API_ defines are dedicated to deprecating API symbols related to this: FF_API_MERGE_SD_API removes av_packet_split/merge_side_data in libavcodec, and FF_API_LAVF_KEEPSIDE_FLAG deprecates AVFMT_FLAG_KEEP_SIDE_DATA in libavformat. Since it was claimed that changing the default from merging side data to not doing it is an ABI change, there are two additional FF_API_ defines, which stop using the side data merging/splitting by default (and remove any code in avformat/avcodec doing this): FF_API_MERGE_SD in libavcodec, and FF_API_LAVF_MERGE_SD in libavformat. It is very much intended that FF_API_MERGE_SD and FF_API_LAVF_MERGE_SD are quickly defined to 0 in the next ABI bump, while the API symbols are retained for a longer time for the sake of compatibility. AVFMT_FLAG_KEEP_SIDE_DATA will (very much intentionally) do nothing for most of the time it will still be defined. Keep in mind that no code exists that actually tries to unset this flag for any reason, nor does such code need to exist. Code setting this flag explicitly will work as before. Thus it's ok for AVFMT_FLAG_KEEP_SIDE_DATA to do nothing once side data merging has been removed from libavformat. In order to avoid that anyone in the future does this incorrectly, here is a small guide how to update the internal code on bumps: - next ABI bump (probably soon): - define FF_API_LAVF_MERGE_SD to 0, and remove all code covered by it - define FF_API_MERGE_SD to 0, and remove all code covered by it - next API bump (typically two years in the future or so): - define FF_API_LAVF_KEEPSIDE_FLAG to 0, and remove all code covered by it - define FF_API_MERGE_SD_API to 0, and remove all code covered by it This forces anyone who actually wants packet side data to temporarily use deprecated API to get it all. If you ask me, this is batshit fucked up crazy, but it's how we roll. Making AVFMT_FLAG_KEEP_SIDE_DATA to be set by default was rejected as an ABI change, so I'm going all the way to get rid of this once and for all. Reviewed-by: James Almer <jamrial@gmail.com> Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mux: don't warn about missing timestamps on attached picturesRodger Combs2016-11-14
|
* Merge commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05'Hendrik Leppkes2016-11-13
|\ | | | | | | | | | | | | * commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05': movenc: Apply offsets on timestamps when peeking into interleaving queues Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * movenc: Apply offsets on timestamps when peeking into interleaving queuesMartin Storsjö2016-06-28
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | avformat/mux: remove unnecessary autobsf hackJames Almer2016-11-05
| | | | | | | | | | | | autobsf has been ported to the new bsf API. Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/mux: split side data before internal auto BSFMichael Niedermayer2016-11-04
| | | | | | | | | | | | | | | | | | The bitstream filters do not work with merged in side data This leaves the input packet split if it is being split. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | Revert "avformat/mux: split side data earlier in av_write_frame and ↵James Almer2016-11-04
| | | | | | | | | | | | | | | | | | | | | | av_interleaved_write_frame" This reverts commit fba2a8a254997e0db39a30438e96e5f3e44c669a. The changes were right for av_write_frame() but not for av_interleaved_write_frame(). The following commit will fix this in a simpler way. Signed-off-by: James Almer <jamrial@gmail.com>
* | avformat/mux: split side data earlier in av_write_frame and ↵James Almer2016-11-04
| | | | | | | | | | | | | | | | | | | | | | av_interleaved_write_frame Similarly, merge it back before returning. Fixes ticket #5927. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | lavf/mux: Add missing CR/LF to error messages.Carl Eugen Hoyos2016-11-04
| |
* | lavf/mux: add avformat_init_outputRodger Combs2016-10-24
| | | | | | | | | | | | This allows a consumer to run the muxer's init function without actually writing the header, which is useful in chained muxers that support automatic bitstream filtering.
* | lavf: add a flag to enable/disable automatic bitstream filteringRodger Combs2016-09-12
| | | | | | | | | | | | | | This is mostly useful for muxers that wrap other muxers, such as dashenc and segment. The actual duplicated bitstream filtering is largely harmless, but delaying the header can cause problems when the muxer intended the header to be written to a separate file.
* | avformat/mux: implement AVFMT_FLAG_SHORTESTMichael Niedermayer2016-09-11
| | | | | | | | | | | | This will allow fixing several bugs with the -shortest option Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mux: Restore original ts in write_packet on errorJan Sebechlebsky2016-08-22
| | | | | | | | | | | | | | | | | | | | Restore original timestamps in write_packet() if the actual write operation was not successfull. This allows to pass the same packet to nonblocking muxer repeatedly without corrupting the timestamps. Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mux: Fix some codecpar non usesMichael Niedermayer2016-07-21
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mux: Apply auto bsfs in av_write_frame() tooMichael Niedermayer2016-07-14
| | | | | | | | | | Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mux: Factor do_packet_auto_bsf() outMichael Niedermayer2016-07-14
| | | | | | | | | | Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf: update auto-bsf to new BSF APIRodger Combs2016-06-25
| |
* | avformat: Fix ff_interleaved_peek()Michael Niedermayer2016-06-25
| | | | | | | | | | | | Fixes assertion failures in movenc Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'e1eb0fc960163402bbb4e630185790488f7d28ed'Matthieu Bouron2016-06-23
|\| | | | | | | | | | | | | * commit 'e1eb0fc960163402bbb4e630185790488f7d28ed': movenc: Use packets in interleaving queues for the duration at the end of fragments Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
| * movenc: Use packets in interleaving queues for the duration at the end of ↵Martin Storsjö2016-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | fragments As long as caller only writes packets using av_interleaved_write_frame with no manual flushing, this should allow us to always have accurate durations at the end of fragments, since there should be at least one queued packet in each stream (except for the stream where the current packet is being written, but if the muxer itself does the cutting of fragments, it also has info about the next packet for that stream). Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'db7968bff4851c2be79b15b2cb2ae747424d2fca'Matthieu Bouron2016-06-23
|\| | | | | | | | | | | | | * commit 'db7968bff4851c2be79b15b2cb2ae747424d2fca': avio: Allow custom IO users to get labels for the output bytestream Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
| * avio: Allow custom IO users to get labels for the output bytestreamMartin Storsjö2016-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows callers with avio write callbacks to get the bytestream positions that correspond to keyframes, suitable for live streaming. In the simplest form, a caller could expect that a header is written to the bytestream during the avformat_write_header, and the data output to the avio context during e.g. av_write_frame corresponds exactly to the current packet passed in. When combined with av_interleaved_write_frame, and with muxers that do buffering (most muxers that do some sort of fragmenting or clustering), the mapping from input data to bytestream positions is nontrivial. This allows callers to get directly information about what part of the bytestream is what, without having to resort to assumptions about the muxer behaviour. One keyframe/fragment/block can still be split into multiple (if they are larger than the aviocontext buffer), which would call the callback with e.g. AVIO_DATA_MARKER_SYNC_POINT, followed by AVIO_DATA_MARKER_UNKNOWN for the second time it is called with the following data. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '11de006babf735aafa3462d43dd2c02bb6ac6e2f'Clément Bœsch2016-06-22
|\| | | | | | | | | | | | | * commit '11de006babf735aafa3462d43dd2c02bb6ac6e2f': Combine deprecation guards where appropriate Merged-by: Clément Bœsch <clement@stupeflix.com>
| * Combine deprecation guards where appropriateDiego Biurrun2016-05-13
| | | | | | | | Some code blocks use multiple bits of deprecated API.
| * Reduce the scope of some variablesDiego Biurrun2016-05-11
| | | | | | | | | | This avoids unused variable warnings after the next version bump. Also drop a trace level av_log() call that is in the way.
| * Drop pointless assert.h #includesDiego Biurrun2016-05-03
| |
* | avformat/mux: do not call write_packet with a flush packet if header is not ↵Marton Balint2016-06-20
| | | | | | | | | | | | written Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/mux: do not call write_header multiple times if it fails the first timeMarton Balint2016-06-20
| | | | | | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/mux: factorize header writing codeMarton Balint2016-06-13
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/mux: call deinit if write_header failsMarton Balint2016-06-13
| | | | | | | | | | | | | | | | Docs clearly states that av_write_trailer should only be called if avformat_write_header was successful, therefore we have to deinit if we return failure. Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/mux: Check that deinit is set before calling itMichael Niedermayer2016-04-24
| | | | | | | | | | | | Fixes null pointer dereference Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab'Derek Buitenhuis2016-04-17
|\| | | | | | | | | | | | | | | | | * commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab': lavc: add a new bitstream filtering API Conversions-by: Hendrik Leppkes <h.leppkes@gmail.com> Conversions-by: Derek Buitenguis <derek.buitenhuis@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * 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: allow BSFs to drop packets.Ronald S. Bultje2016-03-11
| | | | | | | | | | If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter() returns, the packet is considered dropped.
* | lavf/mux: do not fail in case of non strictly monotonically increasing DTS ↵Stefano Sabatini2016-02-26
| | | | | | | | | | | | values for data packets Consistent with what we already do with subtitles since ac08c5c0adcb7f2f9b5ea3eb473d1c2b9659aab2.
* | Merge commit '521dc78366c6ea54b7b69426dab302a57231f81e'Derek Buitenhuis2016-01-27
|\| | | | | | | Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * mux: drop the warning about global headersAnton Khirnov2016-01-12
| | | | | | | | | | The AVStream codec context is often not (and should not be) the actual encoding context, so this warning will be spurious in many cases.
* | avformat/mux: Fix error when writing uncoded frames.Matt Oliver2016-01-27
| | | | | | | | | | | | | | | | | | | | commit "avpacket: Deprecate av_dup_packet" broke the use av_interleaved_write_uncoded_frame as any input uncoded frame has an invalid packet size that will crash when av_packet_ref tries to allocate 'size' new memory. Since the packet is a temporary created within mux.c itself it can be used directly without needing a new ref. Signed-off-by: Matt Oliver <protogonoi@gmail.com>
* | lavf: add automatic bitstream filtering; bump versionRodger Combs2015-12-28
| | | | | | | | | | | | | | | | | | This solves the problem discussed in https://ffmpeg.org/pipermail/ffmpeg-devel/2015-September/179238.html by allowing AVCodec::write_header to be delayed until after packets have been run through required bitstream filters in order to generate global extradata. It also provides a mechanism by which a muxer can add a bitstream filter to a stream automatically, rather than prompting the user to do so.
* | avformat/mux: Rename compute_pkt_fields2(), the name is absolutely terribleMichael Niedermayer2015-11-12
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '8de1ee9f725aa3c550f425bd3120bcd95d5b2ea8'Hendrik Leppkes2015-11-11
|\| | | | | | | | | | | | | * commit '8de1ee9f725aa3c550f425bd3120bcd95d5b2ea8': lavf: deprecate compute_pkt_fields2 Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * 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.
* | Merge commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6'Hendrik Leppkes2015-10-29
|\| | | | | | | | | | | | | * commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6': avpacket: Deprecate av_dup_packet Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * avpacket: Deprecate av_dup_packetLuca Barbato2015-10-26
| | | | | | | | | | As documented, `av_dup_packet` is broken by design, `av_packet_ref` matches the AVFrame ref-counted API and can be safely used instead.
* | Merge commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457'Hendrik Leppkes2015-10-27
|\| | | | | | | | | | | | | * commit 'ce70f28a1732c74a9cd7fec2d56178750bd6e457': avpacket: Replace av_free_packet with av_packet_unref Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * 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`.