summaryrefslogtreecommitdiffstats
path: root/libavformat/internal.h
Commit message (Collapse)AuthorAgeFilesLines
* avformat/mux: Set AV_PKT_FLAG_KEY for is_intra_only packetLimin Wang2020-05-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch will make audio and subtitle packets be marked as AV_PKT_FLAG_KEY. For audio, it'll caused the audio sample to be sync sample. To verify ref/fate/movenc results: 1. Get the movenc test data [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_old && mv *.mp4 audio_old_ After applied the patch: [lmwang@vpn ffmpeg]$ make fate-movenc SAMPLES=../fate-suite [lmwang@vpn ffmpeg]$ libavformat/tests/movenc -w && mkdir -p audio_key && mv *.mp4 audio_key 2. Get l-smash and build boxdumper https://github.com/l-smash/l-smash.git 3. dump the box of crc change mp4 and diff -u [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_key/non-empty-moov-no-elst.mp4 > audio_key/non-empty-moov-no-elst.log [lmwang@vpn ffmpeg]$ ../l-smash/cli/boxdumper --box audio_old/non-empty-moov-no-elst.mp4 > audio_old/non-empty-moov-no-elst.log [lmwang@vpn ffmpeg]$ diff -u audio_key/non-empty-moov-no-elst.log audio_old/non-empty-moov-no-elst.log - default_sample_flags = 0x02000000 - independent - sync sample + default_sample_flags = 0x01010000 + dependent + non-sync sample 4. have checked the change of crc are caused by default_sample_flags non-empty-moov.mp4, non-empty-moov-elst.mp4, non-empty-moov-no-elst.mp4, empty-moov.mp4, delay-moov-content.mp4, empty-moov-second-frag.mp4, empty-moov-second-frag-discont.mp4, delay-moov-second-frag-discont.mp4, delay-moov-elst-second-frag.mp4 etc 5 For subtitle, it'll effect for tests/ref/fate/binsub-movtextenc and tests/ref/fate/sub2video, that's expecting result for the subtitle is marked as keyframe. Below is the checking result of binsub-movtextenc: [lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_key/binsub-movtextenc.mp4 [lmwang@vpn ffmpeg]$ ./ffmpeg -i ../fate-suite/sub/MovText_capability_tester.mp4 -map 0 -scodec mov_text -f mp4 -flags +bitexact -fflags +bitexact -movflags frag_keyframe+empty_moov audio_old/binsub-movtextenc.mp4 [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_key/binsub-movtextenc.mp4 > audio_key/binsub-movtextenc.log [lmwang@vpn ffmpeg]$../l-smash/cli/boxdumper audio_old/binsub-movtextenc.mp4 > audio_old/binsub-movtextenc.log [lmwang@vpn ffmpeg]$ diff -u audio_key/binsub-movtextenc.log audio_old/binsub-movtextenc.log .... // the key difference is the flag for sync sample - flags = 0x000701 + flags = 0x000301 data-offset-present sample-duration-present sample-size-present - sample-flags-present sample_count = 6 - data_offset = 188 + data_offset = 164 sample[0] sample_duration = 1570000 sample_size = 21 - sample_flags = 0x02000000 - independent - sync sample - degradation_priority = 0 sample[1] sample_duration = 510000 sample_size = 2 - sample_flags = 0x01010000 - dependent - non-sync sample - degradation_priority = 0 sample[2] sample_duration = 1690000 sample_size = 9 - sample_flags = 0x02000000 - independent - sync sample - degradation_priority = 0 Suggested-by: Andreas Rheinhardt <[email protected]> Suggested-by: Nicolas George <[email protected]> Signed-off-by: Limin Wang <[email protected]>
* avformat/utils: move is_intra_only() to header and rename to ff_is_intra_only()Limin Wang2020-05-061-0/+2
| | | | Signed-off-by: Limin Wang <[email protected]>
* avformat/aviobuf, nutenc: Move ff_puv_v, ff_get_v_length to nutenc.cAndreas Rheinhardt2020-05-051-10/+0
| | | | | | | | | | | | | | and make it static again. These functions have been moved from nutenc to aviobuf and internal.h in f8280ff4c00eeaa245085fa9691035203abd168c in order to use them in a forthcoming patch in utils.c. Said patch never happened, so this commit moves them back and makes them static, effectively reverting said commit as well as f8280ff4c00eeaa245085fa9691035203abd168c (which added the ff-prefix to these functions). Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat: only allow a single bitstream filter when muxingMarton Balint2020-04-261-3/+2
| | | | | | | | | | | | Current muxers only use a single bitstream filter, so there is no need to maintain code which operates on a list of bitstream filters. When multiple bitstream filters are needed muxers can simply use a list bitstream filter. If there is a use case in the future when different bitstream filters should be added at subsequent packets then a new API possibly involving reconfiguring the list bitstream filter can be added knowing the exact requirements. Signed-off-by: Marton Balint <[email protected]>
* libavformat/mux, mxfenc: Don't initialize unnecessarilyAndreas Rheinhardt2020-04-181-2/+2
| | | | | | | | | | | When no packet could be output, the interleavement functions nevertheless initialized the packet destined for output (with the exception of the data and size fields, making the initialization pointless), although it will not be used at all. So remove the initializations. Reviewed-by: Marton Balint <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mux: Remove redundant resettingAndreas Rheinhardt2020-04-181-7/+4
| | | | | | | | | | | | | | Now that ff_interleave_add_packet() always returns blank packets, the input packet to ff_interleave_packet_per_dts() will always be blank on return as well (if supplied) and the same goes for interleave_packet() in mux.c. Document these facts and remove the redundant resetting that happened in av_interleaved_write_frame(). The last reference to the (long removed) destruct field that AVPackets once had has been removed as well when updating the documentation of ff_interleave_packet_per_dts(). Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mux: Fix leak when adding packet to interleavement queue failsAndreas Rheinhardt2020-04-181-2/+2
| | | | | | | | | | | | | | When an error happened in ff_interleave_add_packet() when adding a packet to the packet queue, said packet would not be unreferenced in ff_interleave_add_packet(), but would be zeroed in av_interleaved_write_frame(), which results in a memleak. This has been fixed: ff_interleave_add_packet() now always unreferences the input packet on error; as a result, it always returns blank packets which has been documented. Relying on this a call to av_packet_unref() in ff_audio_rechunk_interleave() can be removed. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/avio: fix ff_rename to respect used protocolMarton Balint2020-01-191-4/+4
| | | | | | | | | | | Also simplify it and make it always log the error. This fixes for example the image2 muxer when used with an URL which also contains the protocol: ffmpeg -f lavfi -i testsrc -vframes 10 -atomic_writing 1 file:out%d.png Signed-off-by: Marton Balint <[email protected]>
* avformat/avio: move ff_rename implementation from internal.h to avio.cMarton Balint2020-01-191-13/+1
| | | | Signed-off-by: Marton Balint <[email protected]>
* Revert "avformat/utils: make ff_ntp_time() accept a timestamp as input argument"James Almer2020-01-161-1/+1
| | | | Signed-off-by: James Almer <[email protected]>
* avformat/utils: make ff_ntp_time() accept a timestamp as input argumentJames Almer2020-01-151-1/+1
| | | | | | Will be needed by the next patch. Signed-off-by: James Almer <[email protected]>
* avformat: Add max_probe_packets optionAndriy Gelman2019-11-031-2/+0
| | | | | | | Allows user to set maximum number of buffered packets when probing a codec. It was a hard-coded parameter before this commit. Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/utils: ensure that all packets in AVPacketList are reference countedAndreas Rheinhardt2019-09-251-1/+2
| | | | | | | This is done so that its data is really owned by the packet. This was already true for the current callers. Signed-off-by: James Almer <[email protected]>
* avformat/internal: Improve documentation of ff_packet_list_getAndreas Rheinhardt2019-09-181-1/+4
| | | | | | | | | | | | | | | The documentation of ff_packet_list_get currently didn't match the actual usage: 1. It said that the destination packet is supposed to be initialized. But this makes no sense given that it will be overwritten completely and flacenc, mp3enc and ttaenc ignored this. 2. ff_packet_list_get returns an int, although it can't fail in case the packet list is not empty (for which there is an assert). Again, several callers didn't check for any return value. In both cases, the documentation has been adapted to match actual usage. Signed-off-by: Andreas Rheinhardt <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/mux: Use const AVPacket * in compare functionsAndreas Rheinhardt2019-08-151-1/+1
| | | | | | | | | There is no reason for these functions to modify the given packets at all. Signed-off-by: Andreas Rheinhardt <[email protected]> Reviewed-by: Paul B Mahol <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* lavf/avio: remove ffio_open2_wrapper functionJun Zhao2019-07-211-3/+0
| | | | | | Remove the function ffio_open2_wrapper, it's not being used anymore. Signed-off-by: Jun Zhao <[email protected]>
* avformat/utils: move mkdir_p to utilsSteven Liu2018-09-251-0/+8
| | | | | | | Because it will be used by avformat/segment.c or other module which need to automatically create sub-directories operation. Signed-off-by: Steven Liu <[email protected]>
* avformat/utils: function to get the formatted ntp timeVishwanath Dixit2018-05-291-0/+8
| | | | | | | This utility function creates 64-bit NTP time format as per the RFC 5905. A simple explaination of 64-bit NTP time format is here http://www.beaglesoft.com/Manual/page53.htm
* lavf/aviobuf: add ff_get_chomp_lineJun Zhao2018-04-121-0/+10
| | | | | | | Same as ff_get_line but strip the white-space characters in the string tail. Signed-off-by: Jun Zhao <[email protected]>
* avformat/utils: make AVPacketList helper functions sharedJames Almer2018-04-041-0/+39
| | | | | | Based on a patch by Luca Barbato. Signed-off-by: James Almer <[email protected]>
* lavf: move avpriv function definition to internal.hJosh de Kock2018-04-021-0/+1
| | | | Signed-off-by: Josh de Kock <[email protected]>
* Revert "lavd: add new API for iterating input and output devices"Josh de Kock2018-03-311-7/+0
| | | | | | | | | | This reverts commit 0fd475704e871ef3a535947596a012894bae3cbd. Revert "lavd: fix iterating of input and output devices" This reverts commit ce1d77a5e7cebce11074bf6f9e38ad6da37338ff. Signed-off-by: Josh de Kock <[email protected]>
* avformat/internal: Document the freeing behavior of ff_alloc_extradata()Michael Niedermayer2018-03-071-0/+2
| | | | Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/aviobuf: add ff_read_line_to_bprint and ↵Marton Balint2018-02-241-0/+26
| | | | | | | | ff_read_line_to_bprint_overwrite functions To be able to read lines longer than a static buffer size. Signed-off-by: Marton Balint <[email protected]>
* lavd: add new API for iterating input and output devicesJosh de Kock2018-02-061-0/+7
| | | | | This also adds an avpriv function to register devices in libavformat
* avformat: add url field to AVFormatContextMarton Balint2018-01-281-0/+7
| | | | | | | | | 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 <[email protected]>
* avformat/hlsenc, utils: Moved is_http_proto from hlsenc to utils for re-useKarthick Jeyapal2017-12-291-0/+8
| | | | | Reviewed-by: Aman Gupta <[email protected]> Reviewed-by: Steven Liu <[email protected]>
* lavc, lavf: move avformat static mutex from avcodec to avformatwm42017-12-261-0/+4
| | | | | | | | It's completely absurd that libavcodec would care about libavformat locking, but it was there because the lock manager was in libavcodec. This is more stright forward. Changes ABI, but we don't require ABI compatibility currently.
* avformat/internal: fix compile error with some versions of g++Aman Gupta2017-12-231-2/+5
| | | | | | Fixes #6926 Signed-off-by: Aman Gupta <[email protected]>
* avformat/internal: log underlying error with ff_rename failureAman Gupta2017-12-221-1/+1
| | | | | Signed-off-by: Aman Gupta <[email protected]> Signed-off-by: wm4 <[email protected]>
* avformat/mux: stop delaying writing the headerJames Almer2017-12-061-6/+0
| | | | | | | 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 <[email protected]>
* avformat: move priv_pts from AVStream to an internal structJames Almer2017-11-071-0/+2
| | | | | | | It has no reason to be in a public header, even if defined as private. Reviewed-by: Michael Niedermayer <[email protected]> Signed-off-by: James Almer <[email protected]>
* lavf: consider codec framerate for framerate detectionwm42017-06-071-0/+5
| | | | | | | Fixes detection of some TV sample as 24.5 FPS. With the patch applied, it's detected as 25 FPS. This is enabled for mpegts only.
* lavf: use the new bitstream filter for extracting extradataJames Almer2017-04-071-0/+9
| | | | | | | | | | | | | | | | | This merges commits 8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4 and 096a8effa3f8f3455292c958c3ed07e798def7bd by Anton Khirnov, with the following change: - extract_extradata_check() is added to know if the codec is supported by the bsf before trying to initialize it. This behaviour is similar to the old AVCodecParser.split checks. The FATE reference changes are due to the filtered out NAL units that the old AVCodecParser.split implementation left alone. Decoding is unchanged as the functions that parse extradata simply ignored said unnecessary NAL units. Signed-off-by: James Almer <[email protected]>
* Revert "Merge commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4'"James Almer2017-03-231-9/+0
| | | | | | | | This reverts commit 1c193ac1f9cfe703d6a1c36795f309ba5d14bf6e, reversing changes made to 7ebc9f8df4035ecaa84ad4429480986e3e7597ae. Several FATE tests started failing after this merge, so it's reverted until it can be properly fixed.
* Merge commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4'James Almer2017-03-231-0/+9
|\ | | | | | | | | | | | | * commit '8e2ea691351c5079cdab245ff7bfa5c0f3e3bfe4': lavf: use the new bitstream filter for extracting extradata Merged-by: James Almer <[email protected]>
| * lavf: use the new bitstream filter for extracting extradataAnton Khirnov2016-10-161-0/+9
| | | | | | | | | | | | | | | | | | This also fixes a minor bug introduced in the codecpar conversion, where the termination condition for extracting the extradata does not match the actual extradata setting code. As a result, the packet durations made up by lavf go back to their values before the codecpar conversion. That is of little consequence since that code should eventually be dropped completely.
* | avformat: Ignore ID3v2 tags if other tags are present e.g. vorbisPaul Arzelier2017-01-281-0/+5
| | | | | | | | | | Reviewed-by: wm4 <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* | Merge commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05'Hendrik Leppkes2016-11-131-7/+6
|\| | | | | | | | | | | | | * commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05': movenc: Apply offsets on timestamps when peeking into interleaving queues Merged-by: Hendrik Leppkes <[email protected]>
| * movenc: Apply offsets on timestamps when peeking into interleaving queuesMartin Storsjö2016-06-281-5/+6
| | | | | | | | Signed-off-by: Martin Storsjö <[email protected]>
* | lavf/mux: add avformat_init_outputRodger Combs2016-10-241-0/+10
| | | | | | | | | | | | 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.
* | doc: fix spelling errorsAndreas Cadhalpun2016-10-211-1/+1
| | | | | | | | | | | | | | | | Thanks to Mathieu Malaterre <[email protected]> for reporting the Que/Queue typo. (https://bugs.debian.org/839542) Reviewed-by: Lou Logan <[email protected]> Signed-off-by: Andreas Cadhalpun <[email protected]>
* | avformat/mux: implement AVFMT_FLAG_SHORTESTMichael Niedermayer2016-09-111-0/+5
| | | | | | | | | | | | This will allow fixing several bugs with the -shortest option Signed-off-by: Michael Niedermayer <[email protected]>
* | lavf/utils: add some const to pointers parameters in a few functionsClément Bœsch2016-08-171-1/+1
| |
* | avformat/utils: Add ff_format_output_open() functionJan Sebechlebsky2016-07-161-0/+10
| | | | | | | | | | | | | | | | Add ff_format_output_open utility function to wrap io_open callback of AVFormatContext structure. Signed-off-by: Jan Sebechlebsky <[email protected]> Signed-off-by: Marton Balint <[email protected]>
* | avformat/utils: Add ff_stream_encode_params_copy()Jan Sebechlebsky2016-07-161-0/+9
| | | | | | | | | | Signed-off-by: Jan Sebechlebsky <[email protected]> Signed-off-by: Marton Balint <[email protected]>
* | lavf: update auto-bsf to new BSF APIRodger Combs2016-06-251-2/+3
| |
* | avformat: Fix ff_interleaved_peek()Michael Niedermayer2016-06-251-1/+3
| | | | | | | | | | | | Fixes assertion failures in movenc Signed-off-by: Michael Niedermayer <[email protected]>
* | Merge commit 'e1eb0fc960163402bbb4e630185790488f7d28ed'Matthieu Bouron2016-06-231-0/+10
|\| | | | | | | | | | | | | * commit 'e1eb0fc960163402bbb4e630185790488f7d28ed': movenc: Use packets in interleaving queues for the duration at the end of fragments Merged-by: Matthieu Bouron <[email protected]>
| * movenc: Use packets in interleaving queues for the duration at the end of ↵Martin Storsjö2016-05-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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ö <[email protected]>