summaryrefslogtreecommitdiff
path: root/libavformat/webmdashenc.c
Commit message (Collapse)AuthorAge
* avformat/webmdashenc: fix on-demand profile stringJames Almer2022-04-07
| | | | | | Fixes ticket #9596 Signed-off-by: James Almer <jamrial@gmail.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf/webmdashenc.c: Allow AV1 video in WebMMatthieu Patou2021-06-20
| | | | Suggested-By: ffmpeg@fb.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/webmdashenc: Don't pass NULL to memcmpAndreas Rheinhardt2021-03-28
| | | | | | | Affects the FATE-tests webm-dash-manifest-unaligned-video-streams, webm-dash-manifest and webm-dash-manifest-representations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Use av_strstart instead of strncmpAndreas Rheinhardt2021-02-28
| | | | | | | It makes the intent clearer and avoids calculating the length separately. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: CosmeticsAndreas Rheinhardt2020-07-26
| | | | | | | | | Mostly using intermediate pointers for accesses (i.e. storing s->pb in a variable pb and then using pb for writing instead of s->pb) to improve readability. Furthermore, the opening brace '{' of a function has been moved into a line of its own in instances where it wasn't before. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Only check for existence of metadata if it is usedAndreas Rheinhardt2020-07-26
| | | | | | | Also return proper error codes when it is absent: AVERROR(EINVAL) instead of AVERROR_INVALIDDATA. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Avoid allocations, fix memleakAndreas Rheinhardt2020-07-26
| | | | | | | | | | | | | | | | | | | When using the WebM DASH Manifest muxer, every stream of each adaptation set has to contain a metadata entry containing the filename of the source file. In case of live stream manifests, said filename has to conform to a pattern of <file_description>_<representation_id>.<extension>. These pieces are used to create the other strings that are actually output. Up until now, these other strings would be allocated, used once and then freed directly after usage. This commit changes this: The function that allocated and assembled these strings now returns pointers to the '_' and '.' delimiters and so that the caller can easily pick substrings from it without needing to copy the string. Avoiding allocations also fixes a memleak: One of the allocated strings would leak upon a subsequent allocation failure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Fix segfault when no filename is given when liveAndreas Rheinhardt2020-07-26
| | | | | | by checking a bit earlier. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Simplify parsing stringsAndreas Rheinhardt2020-05-23
| | | | | | | | | Don't use the functions for searching substrings when all one is looking for is a char anyway. Given that there is already a standard library function for "find last occurence of a char in a string" also allows one to remove a custom loop. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Don't segfault on invalid argumentsAndreas Rheinhardt2020-05-23
| | | | | | | | | | | | | The current parsing process for adaptation_sets does not guarantee every adaptation set to contain at least one stream, because the loop exits immediately as soon as the end of the string has been reached, without checking whether the currently active adaptation set group is lacking a stream. This would lead to segfaults lateron as the rest of the code presumed that every adaptation set contains a stream. This commit fixes this by erroring out when the last adaptation set group is incomplete. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Remove possibility of infinite loopAndreas Rheinhardt2020-05-23
| | | | | | | | | | | | | | | | The WebM DASH manifest muxer uses a loop to parse the adaptation_sets string (which is given by the user and governs which AVStreams are mapped to what adaptation set) and the very beginning of this loop is "if (*p == ' ') continue;". This of course leads to an infinite loop if the condition is true. It is true if e.g. the string begins with ' ' or if there are more than one ' ' between different adaptation set groups. To fix this, the parsing process has been modified to consume the space if it is at a place where it can legitimately occur, i.e. when a new adaptation set group is expected. The latter restriction implies that an error is returned if a space exists where none is allowed to exist. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Be more strict when parsing stream indicesAndreas Rheinhardt2020-05-23
| | | | | | | | | | | | The syntax of the adaptation_sets string by which the user determines the mapping of AVStreams to adaptation sets is "id=x,streams=a,b,c id=y,streams=d,e" (means: the streams with the indices a, b and c belong to the adaptation set with id x). Yet there was no check for whether these indices were actual numbers and if there is a number whether it really extends to the next ',', ' ' or to the end of the string or not. This commit adds a check for this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Avoid allocation for parsing a numberAndreas Rheinhardt2020-05-23
| | | | | | | | | | | In order to parse a number from a string, the WebM DASH manifest muxer would duplicate (via heap-allocation) the part of the string that contains the number, then read the number via atoi() and then free the duplicate again. This has been replaced by simply using strtoll() (which in contrast to atoi() has defined behaviour when the number is not representable). 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/webmdashenc: Remove unnecessary headerAndreas Rheinhardt2020-04-14
| | | | | | | avio_internal.h has been included in this muxer since the beginning and was never needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Use AVCodecDescriptors for codec namesAndreas Rheinhardt2020-04-07
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Check codec typesAndreas Rheinhardt2020-04-07
| | | | | | | | | | | | | The WebM DASH Manifest muxer only supports VP8, VP9, Vorbis and Opus, but there was no check for this. The codec type is used to get a pointer to a string containing the codec name or NULL if it is not one of those four codecs. Said pointer has then been used without further checks as string for the %s conversion specifier in an avio_printf()) call which is undefined behaviour. This commit adds a check for the supported codec types. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavf, lavfi: Remove uses of sizeof(char).Carl Eugen Hoyos2020-04-04
| | | | The C standard requires sizeof(char) == 1.
* avformat/webmdashenc: Fix memleak upon realloc failureAndreas Rheinhardt2020-03-26
| | | | | | | The classical ptr = av_realloc(ptr, size). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Don't use custom option for bitexactnessAndreas Rheinhardt2020-03-25
| | | | | | | | | | | | | | | | | | The WebM DASH Manifest muxer can write manifests for live streams and these contain an entry that depends on the time the manifest is written; an AVOption to make the output reproducible has been added for tests. But this is unnecessary, as there already is a method for reproducible output: The AVFMT_FLAG_BITEXACT-flag of the AVFormatContext. Therefore this commit removes the custom option. Given that the description of said option contained "private option - users should never set this" and that it was not documented in muxers.texi, no deprecation period for this option seemed necessary. The commands of the FATE-tests for this muxer have been changed to no longer use this option. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/webmdashenc: Remove write_trailerAndreas Rheinhardt2020-03-15
| | | | | | | | | It doesn't do anything: All allocated blocks have already been freed in write_header. 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/webmdashenc: Check id in adaption_setsMichael Niedermayer2019-02-17
| | | | | | | Fixes: out of array access Found-by: Wenxiang Qian Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* webmdashenc: Fix memory leakDerek Buitenhuis2017-07-16
| | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/webmdashenc: Validate the 'streams' adaptation sets parameterDerek Buitenhuis2017-04-20
| | | | | | | It should not be a value larger than the number of streams we have, or it will cause invalid reads and/or SIGSEGV. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/webmdashenc: Require the 'adaptation_sets' option to be setDerek Buitenhuis2017-04-20
| | | | | | | This seems to be non-optional, and if the muxer is run without it, strlen() is run on NULL, causing a segfault. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* webm_dash_manifest: Add option to specify bandwidthVignesh Venkatasubramanian2017-04-17
| | | | | | | | | Add an option to webm_dash_manifest demuxer to specify a value for "bandwidth" field in the DASH manifest. The value is then used by the muxer. Fixes an existing FIXME in the code. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: James Zern <jzern@google.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>
* avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
|
* fix: assigning instead of comparingAppChecker2015-10-27
| | | | | Signed-off-by: AppChecker <support.appc@cnpo.ru> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/webmdashenc: fix uninitialized variableGanesh Ajjanagadde2015-08-20
| | | | | | | | | Fixes -Wsometimes-uninitialized from http://fate.ffmpeg.org/report.cgi?time=20150820031140&slot=arm64-darwin-clang-apple-5.1 Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/webmdashenc: fix unchecked strftimeVignesh Venkatasubramanian2015-05-15
| | | | | | | | Fix unchecked strftime return value. This patch fixes Coverity CID 1295086. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Fix UTCTiming ElementVignesh Venkatasubramanian2015-04-28
| | | | | | | | | | | | | Remove the direct profile from UTCTiming element. Per DASH spec, direct profile value should be the time at which the request was made to the server and not the time at which the manifest was written. So ffmpeg cannot write this value. This patch removes the direct profile and write the UTCTiming element with the http profile only if a URL is passed as a parameter. Update the fate test to reflect this change. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: parameter'ize minimumUpdatePeriodVignesh Venkatasubramanian2015-04-22
| | | | | | | | | Some players do not support setting minimumUpdatePeriod to zero. This patch adds a new parameter that will let the users set any value to this field. Also updates the test and the documentation. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Add minimumUpdatePeriodVignesh Venkatasubramanian2015-04-22
| | | | | | | | | | | DASH spec requires the presence of either duration of the period or the minimumUpdatePeriod element. This patch adds the minimumUpdatePeriod element hardcoded with the value 0 as the manifest will never be updated for WebM DASH Live streams. Also updating the fate test reference file. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Fix potential memory leakVignesh Venkatasubramanian2015-04-21
| | | | | | | | Fix potential memory leak in WebM DASH Muxer. This fixes coverity scan CID 1295088. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Add better error handlingVignesh Venkatasubramanian2015-04-17
| | | | | | | | | Return appropriate error codes and propagate the error codes from helper functions to the outer calls. Also fix a potential leak in call to av_realloc. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webdashenc: replace unchecked av_malloc with stack allocationVignesh Venkatasubramanian2015-04-14
| | | | | | | | Replace an unchecked av_malloc call with stack allocation as the size is always a constant. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Fix fate in MSVCVignesh Venkatasubramanian2015-04-07
| | | | | | | | | MSVC does not support the %F and %T format specifiers in strftime. Replace that with the expanded version. This fixes the broken fate tests in MSVC (webm-dash-manifest-*). Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* webmdashenc: Support for live stream manifestsVignesh Venkatasubramanian2015-04-05
| | | | | | | | | This patch adds support for creating DASH manifests for WebM Live Streams. It also updates the documentation and adds a fate test to verify the behavior of the new muxer flag. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avformat/webmdashenc: use AVERROR(ENOMEM) for memory allocation failuresMichael Niedermayer2015-04-01
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/webmdashenc: Representation IDs should be unique.Vignesh Venkatasubramanian2014-11-12
| | | | | | | | | According to the DASH spec, Representation IDs should be unique across all adaptation sets. Fixing that and updating the fate reference file to reflect this change. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavf/webm_dash: some fields should go into RepresentationVignesh Venkatasubramanian2014-10-02
| | | | | | | | | | | Width, Height and Sample Rate should be in the AdaptationSet tag only if all the contained representations have the same width, height and sampling rate. Otherwise they should go into the Representation tag. This patch adds this functionality and a fate test for the same. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Add a closing LF to Webm-manifest files.Carl Eugen Hoyos2014-09-16
| | | | | | Fixes fate-webm-dash-manifest on AIX. Reviewed-by: Nicolas George
* avformat/webmdashenc: use av_strlcpy() and allocate enough spaceMichael Niedermayer2014-08-29
| | | | | | Fixes out of array read Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Drop remaining unneeded != NULLMichael Niedermayer2014-08-15
| | | | | Reviewed-by: Clément Bœsch <u@pkh.me> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'Michael Niedermayer2014-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39': cosmetics: Write NULL pointer equality checks more compactly Conflicts: cmdutils.c ffmpeg_opt.c ffplay.c libavcodec/dvbsub.c libavcodec/dvdsubdec.c libavcodec/dvdsubenc.c libavcodec/dxa.c libavcodec/libxvid_rc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/rv10.c libavcodec/tiffenc.c libavcodec/utils.c libavcodec/vc1dec.c libavcodec/zmbv.c libavdevice/v4l2.c libavformat/matroskadec.c libavformat/movenc.c libavformat/sdp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavf: Add WebM DASH Manifest MuxerVignesh Venkatasubramanian2014-07-15
This patch adds the ability to generate WebM DASH manifest XML using ffmpeg. A sample command line would be as follows: ffmpeg \ -f webm_dash_manifest -i video1.webm \ -f webm_dash_manifest -i video2.webm \ -f webm_dash_manifest -i audio1.webm \ -f webm_dash_manifest -i audio2.webm \ -map 0 -map 1 -map 2 -map 3 \ -c copy \ -f webm_dash_manifest \ -adaptation_sets “id=0,streams=0,1 id=1,streams=2,3” \ manifest.xml It works by exporting necessary fields as metadata tags in matroskadec and use those values to write the appropriate XML fields as per the WebM DASH Specification [1]. Some ideas are adopted from webm-tools project [2]. [1] https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification [2] https://chromium.googlesource.com/webm/webm-tools/+/master/webm_dash_manifest/ Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>