summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
Commit message (Collapse)AuthorAge
* avformat/mux: Unify setting number of muxed packetsAndreas Rheinhardt2020-03-14
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Remove redundant checks for write errorsAndreas Rheinhardt2020-03-14
| | | | | | | | | | | | | | | If writing a packet didn't directly return an error, the AVIOContext's error flag is checked for errors (if existing) by write_packet(). And if write_packet() didn't indicate an error, its callers checked the error flag of the AVIOContext (if existing). The latter check is redundant. The reason for checking twice lies in the FFmpeg-Libav split: The check in write_packet() has been added in 9ad1e0c1 in Libav. FFmpeg already had the other checks (since aec9390a), but when 9ad1e0c1 was merged (in 1f1c1008), no one noticed the redundant checks. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: CosmeticsAndreas Rheinhardt2020-02-25
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Don't use av_ prefix for static functionsAndreas Rheinhardt2020-01-27
| | | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: Don't unnecessarily zero-initialize AVPacketListAndreas Rheinhardt2020-01-26
| | | | | | | | | If no error occurs and this AVPacketList is used at all, its packet substructure will be overwritten and its next pointer explicitly set, so every field will still be initialized even when using av_malloc. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Move packet referencesAndreas Rheinhardt2020-01-26
| | | | | | | | | | | | | | | | | | | In the common case that the input packet was already refcounted, ff_interleave_add_packet would allocate a new AVPacketList, use av_packet_ref to create a new reference to the buffer for the AVPacketList's packet, interleave the packet and finally unreference the original input packet. This commit changes this: It uses av_packet_move_ref to transfer the packet to its destination. In case the input packet is refcounted, this saves an allocation and a free (of an AVBufferRef); if not, the packet is made refcounted before moving it. When the input packet has side data, one saves even more than one allocation+free. Furthermore, when the packet is in reality an uncoded frame, a hacky ad-hoc variant of av_packet_move_ref has been employed. Not any more. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: call AVOutputFormat->deinit() when freeing the contextJames Almer2019-10-21
| | | | | | | | | | | | Despite the doxy stating that it's called when the muxer is destroyed, this was not true in practice. It's only called by av_write_trailer() and on init() failure. An AVFormatContext may be closed without writing the trailer if errors ocurred while muxing packets, so in order to prevent memory leaks, it should effectively be called when freeing the muxer. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: Use av_packet_rescale_tsAndreas Rheinhardt2019-08-15
| | | | | | | | | ff_write_chained essentially duplicated the functionality of av_packet_rescale_ts. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: Use const AVPacket * in compare functionsAndreas Rheinhardt2019-08-15
| | | | | | | | | There is no reason for these functions to modify the given packets at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mux: correct error msg for when BSF filtering failsGyan Doshi2019-07-20
|
* libavformat/mux: Fix mixed delarations and codeAndreas Rheinhardt2019-06-27
| | | | | | This commit fixes mixed declarations and code introduced in 1889e316. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavformat/mux: Fix audio_preloadAndreas Rheinhardt2019-06-26
| | | | | | | | | | | | | | | | | Commit 31f9032b added the audio_preload feature; its goal is to interleave audio earlier than the rest. Unfortunately, it has never ever worked, because the check for whether a packet should be interleaved before or after another packet was completely wrong: When audio_preload vanishes, interleave_compare_dts returns 1 if the new packet should be interleaved earlier than the packet it is compared with and that is what the rest of the code expects. But the codepath used when audio_preload is set does the opposite. Also fixes potential undefined behaviour (namely signed integer overflow). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify AVOutputFormat pointer.Carl Eugen Hoyos2019-03-20
|
* avformat: correct fdebug loglevelGyan Doshi2018-08-14
| | | | | fftools/cmdutils sets loglevel for fdebug to DEBUG but all fdebug output except for two were emitted at TRACE.
* avformat: deprecate AVFormatContext filename fieldMarton Balint2018-01-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: add url field to AVFormatContextMarton Balint2018-01-28
| | | | | | | | | This will replace the 1024 character limited filename field. Compatiblity for output contexts are provided by copying filename field to URL if URL is unset and by providing an internal function for muxers to set both url and filename at once. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mux: factorize AVFormatContext->avoid_negative_ts initializationJames Almer2017-12-12
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: stop delaying writing the headerJames Almer2017-12-06
| | | | | | | Every bitstream filter behaves as intended now, so there's no need to wait for the first packet of every stream. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: move priv_pts from AVStream to an internal structJames Almer2017-11-07
| | | | | | | It has no reason to be in a public header, even if defined as private. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mux: be less strict with bitstream filter failuresJames Almer2017-11-01
| | | | | | | | | | | This makes the autobsf feature behave the same as the manual bitstream filtering in ffmpeg.c Fixes ticket #6794 Reviewed-by: rcombs Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: remove ABI portion of the side data merging APIJames Almer2017-10-22
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '63fe79a3368cc53e6faf7fa265a9a1a8bec46a88'James Almer2017-10-21
|\ | | | | | | | | | | | | * commit '63fe79a3368cc53e6faf7fa265a9a1a8bec46a88': lavf: Drop deprecated hint to set muxer timebase Merged-by: James Almer <jamrial@gmail.com>
| * lavf: Drop deprecated hint to set muxer timebaseVittorio Giovara2017-03-23
| | | | | | | | Deprecated in 05/2014.
* | Merge commit '5e71299758d3aa7c93c3cca618a8e048a9483794'James Almer2017-10-21
|\| | | | | | | | | | | | | * commit '5e71299758d3aa7c93c3cca618a8e048a9483794': lavf: Drop deprecated bitexact functionality Merged-by: James Almer <jamrial@gmail.com>
| * lavf: Drop deprecated bitexact functionalityVittorio Giovara2017-03-23
| | | | | | | | Deprecated in 05/2014.
| * Use correct printf conversion specifiers for POSIX integer typesDiego Biurrun2016-12-23
| |
* | avformat: make flush_packets a tri-state and set it to -1 (auto) by defaultMarton Balint2017-06-24
| | | | | | | | | | | | | | | | | | If flushing is not disabled, then mux.c will signal the end of the packets with an AVIO_DATA_MARKER_FLUSH_POINT, and aviobuf will be able to decide to flush or not based on the preferred minimum packet size set by the used protocol. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
* | avformat/mux: Fix copy an paste typoMichael Niedermayer2017-05-27
| | | | | | | | | | Found-by: Roger Scott <rscott@grammatech.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/mux: remove autobsf extradata propagation hackJames Almer2017-05-24
| | | | | | | | | | | | The offending bitstream filter was fixed, so this is no longer needed. Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit 'cdcfa97dc49d83b5eefd0a651db6bb0a6f98e8f2'Clément Bœsch2017-04-26
|\| | | | | | | | | | | | | * commit 'cdcfa97dc49d83b5eefd0a651db6bb0a6f98e8f2': libavformat: Fix a faulty api deprecation guard in prepare_input_packet Merged-by: Clément Bœsch <u@pkh.me>
| * libavformat: Fix a faulty api deprecation guard in prepare_input_packetMartin Storsjö2016-12-15
| | | | | | | | | | | | | | | | | | | | | | This seems to have been added by mistake in 11de006b, by not noticing the negation for the existing condition. This block does not contain any code that accesses the codec field in AVStream. This function is meant to serve as a complement to compute_pkt_fields2, which is guarded by FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avformat: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | | | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* | 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>