summaryrefslogtreecommitdiff
path: root/libavformat/webm_chunk.c
Commit message (Collapse)AuthorAge
* avformat: refactor ff_stream_encode_params_copy() to stream_params_copy()Pierre-Anthony Lemieux2022-08-12
| | | | | | Addresses http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299726.html Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move ff_stream_encode_params_copy() to mux_utils.cAndreas Rheinhardt2022-05-10
| | | | | | Only used by muxers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Add AVFMT_AVOID_NEG_TS_DISABLEDAndreas Rheinhardt2022-01-21
| | | | | | And also don't use explicit constants in the movenc test. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVFormatInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | | | | Do this by allocating AVFormatContext together with the data that is currently in AVFormatInternal; or rather: Put AVFormatContext at the beginning of a new structure called FFFormatContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVFormatInternal altogether. The biggest simplifications occured in avformat_alloc_context(), where one can now simply call avformat_free_context() in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify the API wrt AV(In|Out)putFormatAndreas Rheinhardt2021-04-27
| | | | | | | Also constify AVProbeData. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/webm_chunk: Use ff_stream_encode_params_copy()Andreas Rheinhardt2021-04-18
| | | | | | | It is simpler and more complete (e.g. it copies the framerate information which allows to write the default duration element). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/webm_chunk: Open AVIOContext before initializing sub-muxerAndreas Rheinhardt2020-05-23
| | | | | | | | | | | | The description of AVOutputFormat.init contains the statement that "this method must not write output". Due to this, the webm_chunk muxer defers opening the AVIOContext for the child muxer until avformat_write_header(), i.e. there is no AVIOContext when the sub-muxer's avformat_init_output() is called. But this violates the documentation of said function which requires the AVFormatContext to have an already opened AVIOContext. This commit fixes this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/Makefile: Remove false dependencies of WebM and Matroska muxerAndreas Rheinhardt2020-04-14
| | | | | | | | | | | These muxers don't depend on the WebM Chunk or the WebM DASH Manifest muxers. Furthermore, remove some #if checks in webm_chunk.c and webmdashenc.c. They are always true now that webm_chunk.c and webmdashenc.c are only compiled when their corresponding muxers are enabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Remove superfluous headersAndreas Rheinhardt2020-04-14
| | | | | | | libavutil/avstring.h is unnecessary since 8a632b3e. The other unnecessary headers were never used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: CosmeticsAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Check unchecked functions for errorsAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Add deinit functionAndreas Rheinhardt2020-03-26
| | | | | | | | This fixes memleaks if an error happens after one of the allocations in init; or if the trailer isn't written (e.g. because there was an error when writing a packet). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Add init functionAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Remove unnecessary variableAndreas Rheinhardt2020-03-26
| | | | | | | | chunk_start_index (which was set via an option) was only used to initialize chunk_index and otherwise unused. So initialize chunk_index directly via the option and remove chunk_start_index. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Don't copy header filenameAndreas Rheinhardt2020-03-26
| | | | | | | Instead just reuse the filename string that is given via an option for the child muxer's url field. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Don't keep pointer to AVOutputFormatAndreas Rheinhardt2020-03-26
| | | | | | | It is no longer needed given that the function pointers of the child muxer's AVOutputFormat are no longer called directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Avoid unnecessary flushesAndreas Rheinhardt2020-03-26
| | | | | | | | | | The webm_chunk muxer caches its output to a dynamic buffer and when it outputs anything, it explicitly flushes it. So set the flags indicating that flushing after each packet should not be done automatically (basically avoiding avio_write_marker() to be called by flush_if_needed() in libavformat/mux.c). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Use API functions for child muxerAndreas Rheinhardt2020-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of calling the write_header/packet/trailer functions directly via the function pointers. Also, use distinct AVStreams for the child AVFormatContext (up until now the two AVFormatContexts shared their AVStreams because allocating their own was deemed too onerous). Using the function pointers directly meant that the Matroska muxer's init-function was never called, because init-functions were only introduced a few months after webm_chunk has been added and no one thought of/bothered to adapt webm_chunk for this (when the init-function was added in b287d7ea, the code setting the timebase was moved to it, so that the timebases were no longer set to ms-precision when using the webm_chunk muxer; this has been fixed after some time in 42a635dd by setting the timebases direcly (instead of calling the init-function)). And when 982a98a0 added a deinit-function for the Matroska muxer, it introduced memleaks in webm_chunk, because the child muxer's internal structures were no longer freed when calling write_trailer directly. (Given that the init function has never ever been called, the child muxer has never ever been properly initialized, so that the deinit-function was not called when freeing the child context.) This commit stops calling the function pointers directly and instead uses the standard API functions for muxers. This fixes the above mentioned memleaks. (Memleaks are still possible on error. This will be fixed in a future commit that adds a deinit-function to webm_chunk itself.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Use appropriate initializer for AV_OPT_TYPE_STRINGAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Copy more information to the child AVFormatContextAndreas Rheinhardt2020-03-26
| | | | | | | In particular the flags are important so that AVFMT_FLAG_BITEXACT can be honoured by the child muxer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Close IO if writing header failsAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Don't use child AVFormatContext for loggingAndreas Rheinhardt2020-03-26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf/webm_chunk: Correct duration if start time > 0Andreas Rheinhardt2019-07-12
| | | | | | | Up until now, it was simply presumed that the first packet had a pts of zero; otherwise the duration of the first chunk was wrong. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf/webm_chunk: Fix NULL dereferenceAndreas Rheinhardt2019-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | The earlier version of the webm_chunk muxer had several bugs: 1. If the first packet of an audio stream didn't have a PTS of zero, then no chunk will be started before a packet is delivered to the underlying Matroska/WebM muxer, i.e. the AVFormatContext used to write these packets had a NULL as AVIOContext for output. This is behind the crash in ticket #5752. 2. If an error happens during writing a packet, the underlyimg Matroska/WebM muxer context is freed. This leads to a use-after-free coupled with a double-free in webm_chunk_write_trailer (which supposes that the underlying AVFormatContext is still valid). 3. Even when no error occurs at all, webm_chunk_write_trailer is still buggy: After the underlying Matroska/WebM muxer has written its trailer, ending the chunk implicitly flushes it again which is illegal at this point. These bugs have been fixed. Fixes #5752. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webm_chunk: Specify expected argument length of get_chunk_filename()Michael Niedermayer2019-05-25
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/webm_chunk: Check header filename lengthMichael Niedermayer2019-05-25
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/webm_chunk: Respect buffer sizeAndreas Rheinhardt2019-05-02
| | | | | | | | | The last argument of av_strlcpy is supposed to contain the size of the destination buffer, but it was filled with the size of the source string, effectively negating its very purpose. 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/webm_chunk: always use a static buffer for get_chunk_filenameMarton Balint2018-05-15
| | | | | | | | | | My conversation from AVFormatContext->filename to AVFormatContext->url was wrong in this case because get_chunk_filename uses filename as an output buffer, and not as an input buffer. Fixes ticket #7188. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: migrate to AVFormatContext->urlMarton Balint2018-01-28
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* libavformat/webm_chunk: Option to specify HTTP headerVignesh Venkatasubramanian2016-09-16
| | | | | | | | Add an option to specify HTTP header in the WebM Chunk Muxer (this works the same way as the 'method' parameter in the HLS muxer). Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/webm_chunk: Print an error if no header filename was provided.Carl Eugen Hoyos2016-09-03
|
* webm_chunk: Set pts precision to millisecondsVignesh Venkatasubramanian2016-08-25
| | | | | | | | Milliseconds is the de-factor precision for timestamps in Matroska/WebM media. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>
* Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'Derek Buitenhuis2016-02-10
| | | | | | | | | This also deprecates our old duplicated callbacks. * commit '9f61abc8111c7c43f49ca012e957a108b9cc7610': lavf: allow custom IO for all files Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* Update demuxers and protocols for protocol whitelist supportMichael Niedermayer2016-02-02
| | | | | Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/webm_chunk: Remove AVFMT_ALLOW_FLUSHVignesh Venkatasubramanian2015-06-09
| | | | | | | | The flag was set unintentionally and the code will break if a NULL packet is passed in. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/webm_chunk: Fix a memory leak.Vignesh Venkatasubramanian2015-04-30
| | | | | | | | | Fix a duplicate memory allocation. priv_data should be allocated in line 64 call to avformat_alloc_output_context2 since we pass the correct AVFormat to it. This removes the duplicate allocation. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/webm_chunk: Use dyn_buf to write chunksVignesh Venkatasubramanian2015-04-30
| | | | | | | | | | | Use dyn_duf to write chunks so that we create the actual chunk file only after the entire chunk data is available. This will help not confuse other software looking at the chunk file (e.g. a web server) by seeing a zero length file when ffmpeg is writing into it. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* libavformat/webm_chunk: Write first audio packet.Vignesh Venkatasubramanian2015-04-28
| | | | | | | | Fix a bug where the chunk muxer doesn't write the very first audio packet (with pts == 0). Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf: Add support for WebM Live MuxingVignesh Venkatasubramanian2015-04-07
This patch adds support for WebM Live Muxing by adding a new WebM Chunk muxer. It writes out live WebM Chunks which can be used for playback using Live DASH Clients. Please see muxers.texi for sample usage. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>