aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/channel_layout.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/channel_layout: add a 5.1.2 layout using side channelsJames Almer2025-01-031-1/+2
| | | | | | And rename the existing 5.1.2 to explicitly state it contains back channels. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 9.1.6 layoutJames Almer2024-12-131-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add Binaural channels and layoutJames Almer2024-11-131-0/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* channel_layout: add new channel positions supported by xHE-AACLynne2024-06-021-0/+4
| | | | apichanges will be updated upon merging, as well as a version bump.
* avutil/channel_layout: add a helper function to get the ambisonic order of a ↵James Almer2024-05-231-9/+8
| | | | | | layout Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/channel_layout: don't clear the opaque pointer on type conversionJames Almer2024-03-251-0/+8
| | | | | | Otherwise it would not be lossless. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add specific text versions for unknown and unused ↵Marton Balint2024-03-161-0/+13
| | | | | | channels Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: fix some (un)initialization issues in ↵Marton Balint2024-03-161-0/+5
| | | | | | | | | av_channel_layout_from_string() Also make initialization/uninitialization behaviour more explicit in the docs, and make sure we do not leak a channel map on error. Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: factorize parsing list of channel namesMarton Balint2024-03-161-114/+58
| | | | | | | Also make use of the av_channel_from_string() function to determine the channel id. This fixes some parse issues in av_channel_layout_from_string(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICALMarton Balint2024-03-161-0/+30
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUTJames Almer2024-03-071-192/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: print known layout names in custom layoutJames Almer2024-02-181-26/+42
| | | | | | | If a custom layout is equivalent to a native one, check if it matches one of the known layout names and print that instead. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add av_channel_layout_retype()Marton Balint2024-02-121-0/+106
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: add av_channel_layout_custom_init()Marton Balint2024-02-121-0/+20
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: add a 9.1.4 channel layoutJames Almer2023-11-081-0/+1
| | | | | | | Mapping to ITU-R BS.2051-3 "Sound System G" and ITU-R BS.1196-8 "Channel Configuration 20". Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 7.2.3 channel layoutJames Almer2023-11-081-0/+1
| | | | | | | Mapping to ITU-R BS.2051-3 "Sound System F" and ITU-R BS.1196-8 "Channel Configuration 15". Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 3.1.2 channel layoutJames Almer2023-10-271-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 7.1.4 channel layoutWill Wolcott2023-10-271-0/+1
| | | | | | | | Mapping to ITU-R BS.2051-3 "Sound System J" and ITU-R BS.1196-8 "Channel Configuration 19". Signed-off-by: Will Wolcott <wwolcott@netflix.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 7.1.2 channel layoutJames Almer2023-10-271-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a 5.1.4 channel layoutJames Almer2023-10-271-0/+1
| | | | | | | Mapping to ITU-R BS.2051-3 "Sound System D" and ITU-R BS.1196-8 "Channel Configuration 16". Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: rename 7.1(top) channel layout to 5.1.2James Almer2023-10-271-1/+1
| | | | | | | | | | This layout maps to ITU-R BS.2051-3 "Sound System C" and ITU-R BS.1196-8 "Channel Configuration 14", and it being the first layout with top layer channels, it's best to use a different scheme to properly convey the presence and amount of said channels. The new name will also be a better fit for the additions in the following commits. Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: Account for \0 in sizesAndreas Rheinhardt2023-08-101-3/+9
| | | | | | | | | | | | | | | | | | | av_channel_name(), av_channel_description() and av_channel_layout_describe() are supposed to return the size of the needed buffer to allow the user to check for truncation; the documentation ("If the returned value is bigger than buf_size, then the string was truncated.") confirms that size does not mean strlen. Yet the AVBPrint API, i.e. AVBPrint.len, does not account for the terminating '\0'. Therefore the returned length is off by one. Furthermore, also check for whether the returned value actually fits in an int (which is the return value of these functions). Reviewed-by: Nicolas George <george@nsup.org> Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/channel_layout: add a 7.1(top) channel layoutJames Almer2022-11-031-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: add a cube channel layoutJames Almer2022-10-301-0/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "avutil/channel_layout: av_channel_layout_describe_bprint: Check for ↵James Almer2022-07-041-4/+0
| | | | | | | | | | | | 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-021-0/+4
| | | | | | | | 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-251-5/+9
| | | | | | | | | 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-251-0/+2
| | | | | | | | 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-251-2/+4
| | | | | | | | 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-151-1/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: do not copy alloc new map for extra channel layoutMarton Balint2022-03-151-13/+4
| | | | | | | 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-151-4/+4
| | | | | | | | | | | | | 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-151-10/+29
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avutil/channel_layout: print channels using av_channel_name_bprint in ↵Marton Balint2022-03-151-5/+1
| | | | | | | | | 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-151-0/+1
| | | | | | | 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-151-4/+178
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/channel_layout: Add a new channel layout APIAnton Khirnov2022-03-151-71/+592
| | | | | | | | | | | | | 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-241-2/+4
| | | | | | | | | | 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-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-241-0/+22
| | | | | | | | | | | | | | 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-101-1/+1
| | | | | | | | | | | 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-051-2/+5
| | | | | | | | 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-051-38/+0
| | | | | 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-241-0/+1
|\ | | | | | | | | | | | | * 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-231-0/+2
| | | | | | | | Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | libavutil/channel_layout: Correctly return layout when channel specification ↵Simon Thelen2015-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | 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-241-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-231-0/+2
| |
* | lavu/channel_layout: change av_get_channel_layout() behavior at the next bumpStefano Sabatini2013-10-171-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.