summaryrefslogtreecommitdiff
path: root/libavutil/channel_layout.c
Commit message (Collapse)AuthorAge
* Revert "avutil/channel_layout: av_channel_layout_describe_bprint: Check for ↵James Almer2022-07-04
| | | | | | | | | | | | buffer end" The doxy for av_channel_layout_describe() states that the user should look at the return value to check if the string was truncated. Returning an error code in this scenario goes against this and is an API break. A proper fix for the timeout was applied to the Matroska demuxer in 94901a9518. This reverts commit 8154cb7c2ff2afcb1a0842de8c215b7714c814d0.
* avutil/channel_layout: av_channel_layout_describe_bprint: Check for buffer endMichael Niedermayer2022-07-02
| | | | | | | | Fixes: Timeout printing a billion channels Fixes: 48099/clusterfuzz-testcase-minimized-ffmpeg_dem_MATROSKA_fuzzer-6754782204788736 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/channel_layout: return earlier on UNSPEC layouts in ↵James Almer2022-03-25
| | | | | | | | | av_channel_layout_subset() No point running all 64 iterations in the loop to never write anything to ret. Also make ambisonic layouts check its mask too while at it. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add missing check for AV_CHAN_NONE in ↵James Almer2022-03-25
| | | | | | | | av_channel_description Prevents printing "user -1" on invalid channel ids. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: don't try to print NULL string pointers in ↵James Almer2022-03-25
| | | | | | | | av_channel_{name,description} Instead fallback to print USR%d for channels id < 64 without a known name. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: remove duplicate stereo downmix entryJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: do not copy alloc new map for extra channel layoutMarton Balint2022-03-15
| | | | | | | Also use av_channel_layout_bprint directly for describing channel layout for extra channels. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: fix av_channel_layout_describe_bprint with custom and ↵Marton Balint2022-03-15
| | | | | | | | | | | | | ambisonic channels bp->len cannot be used to detect if try_describe_ambisonic was successful because the bprint buffer might contain other data as well. Also describing an invalid ambisonic layout should not return 0 but AVERROR(EINVAL) instead, so change try_describe_ambisonic to actually return error on invalid ambisonics. This also allows us to fix the first issue. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: factorize ambisonic order detectionMarton Balint2022-03-15
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: print channels using av_channel_name_bprint in ↵Marton Balint2022-03-15
| | | | | | | | | av_channel_layout_describe_bprint This reduces code duplication an allows printing AMBI%d channel names for custom layouts for non-standard or partial ambisonic layouts. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: Fix leak of stringAndreas Rheinhardt2022-03-15
| | | | | | | Fixes memleaks in the channel_layout FATE-test. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* channel_layout: add support for AmbisonicVittorio Giovara2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: Add a new channel layout APIAnton Khirnov2022-03-15
| | | | | | | | | | | | | The new API is more extensible and allows for custom layouts. More accurate information is exported, eg for decoders that do not set a channel layout, lavc will not make one up for them. Deprecate the old API working with just uint64_t bitmasks. Expanded and completed by Vittorio Giovara <vittorio.giovara@gmail.com> and James Almer <jamrial@gmail.com>. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> 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>
* avutil/channel_layout: add 22.2 layoutJan Ekström2020-08-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requires some extraneous top side and bottom front channels to be defined. According to STD-B59v2, the defined channel layout is: - FL - FR - FC - LFE1 - BL - BR - FLc - FRc - BC - LFE2 - SiL - SiR - TpFL - TpFR - TpFC - TpC - TpBL - TpBR - TpSiL - TpSiR - TpBC - BtFC - BtFL - BtFR
* avutil/channel_layout: add av_get_extended_channel_layoutMarton Balint2017-01-24
| | | | | | | | | | | | | | Return a channel layout and the number of channels based on the specified name. This function is similar to av_get_channel_layout(), but can also parse unknown channel layout specifications. Unknown channel layout specifications are a decimal number and a capital 'C' suffix, in order to not break compatibility with the lowercase 'c' suffix, which is used for a guessed channel layout with the specified number of channels. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: AV_CH_LAYOUT_6POINT1_BACK not reachable in parsingMartin Cracauer2016-03-10
| | | | | | | | | | | Trying to make heads and tails out of DTS 6.1 I can across this typo. I also noticed that this wiki page is incorrect or misleading, the channel order for 6.1 given does not match the source code. At the least it should be clarified that the layout given does not apply to DTS. https://trac.ffmpeg.org/wiki/AudioChannelManipulation Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavutil/channel_layout: Check strtol*() for failureMichael Niedermayer2015-11-05
| | | | | | | | Fixes assertion failure Fixes: 4f5814bb15d2dda6fc18ef9791b13816/signal_sigabrt_7ffff6ae7cc9_65_7209d160d168b76f311be6cd64a548eb.wv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavu: Drop FF_API_GET_CHANNEL_LAYOUT_COMPAT cruftHendrik Leppkes2015-09-05
| | | | | FATE refs changed to accomodate for the new default behavior of the function. Numbers are now interpreted as a channel layout, instead of a number of channels.
* Merge commit 'e23f84d9652474353d8bbc42787a56ec1991908f'Hendrik Leppkes2015-08-24
|\ | | | | | | | | | | | | * commit 'e23f84d9652474353d8bbc42787a56ec1991908f': channel_layout: Add a 16channel default layout Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * channel_layout: Add a 16channel default layoutLuca Barbato2015-08-23
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | libavutil/channel_layout: Correctly return layout when channel specification ↵Simon Thelen2015-06-09
| | | | | | | | | | | | | | | | | | | | ends with a trailing 'c'. Return layout when FF_API_GET_CHANNEL_LAYOUT_COMPAT is set even if the layout itself is not in the deprecated style. Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-11-24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: Add missing #includes for *INT64_MAX and *INT64_C Conflicts: ffmpeg.c ffmpeg_filter.c ffplay.c libavformat/assdec.c libavformat/avidec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Add missing #includes for *INT64_MAX and *INT64_CDiego Biurrun2013-11-23
| |
* | lavu/channel_layout: change av_get_channel_layout() behavior at the next bumpStefano Sabatini2013-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new syntax is preferred since it allows backward syntax compatibility with libswr when switching to the new option handling code with AV_OPT_TYPE_CHANNEL_LAYOUT. With the new parser the string: 1234 is interpreted as a channel layout mask, rather than as a number of channels, and thus it's compatible with the current way to set a channel layout as an integer (e.g. for the icl and ocl options) making use of integer option values. ff_get_channel_layout() with compat=0 will be used in the AV_OPT_TYPE_CHANNEL handler code. The user is encouraged to switch to the new forward compatible syntax, which requires to put a trailing "c" when specifying a layout as a number of channels.
* | Call the common 7.1 wide channel layout "7.1(wide)".Carl Eugen Hoyos2013-02-09
| | | | | | | | Rename the uncommon variant with side speakers to "7.1(wide-side)".
* | Merge commit '97bf7c03b1338a867da52c159a2afecbdedcfa88'Michael Niedermayer2012-11-12
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '97bf7c03b1338a867da52c159a2afecbdedcfa88': doc: git-howto: Leave reviewers time to react before pushing patches Include libavutil/channel_layout.h instead of libavutil/audioconvert.h lavu: rename audioconvert.* to channel_layout.* and deprecate audioconvert.h Conflicts: doc/APIchanges doc/examples/decoding_encoding.c doc/git-howto.texi ffmpeg_filter.c libavcodec/flacdec.c libavcodec/imc.c libavcodec/mpegaudiodec.c libavcodec/utils.c libavfilter/asrc_anullsrc.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/buffer.c libavutil/Makefile libavutil/audioconvert.h libavutil/channel_layout.c libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavu: rename audioconvert.* to channel_layout.* and deprecate audioconvert.hJustin Ruggles2012-11-11