swresample: pass input layout in mpv's order via custom channel order#18034
Open
kasper93 wants to merge 2 commits into
Open
swresample: pass input layout in mpv's order via custom channel order#18034kasper93 wants to merge 2 commits into
kasper93 wants to merge 2 commits into
Conversation
Since 9ef614d this helper has been a no-op. fudge_layout_conversion() returned the modified uint64_t channel-layout bitmask, but the new AVChannelLayout path builds out_layout from the unfudged out_lavc and feeds that to swr. Even when it was wired up, libswresample handles the BL/BR <-> SL/SR mapping if needed. SDL/SDR is not currently handled, but I would rather patch the swr/rematrix.c for those too, instead of having custom glue here. Note that SDL/SDR are not that common in-practice.
Dudemanguy
reviewed
May 28, 2026
Drop the swr_set_channel_mapping() + transpose_order() + reorder_in[] plumbing. Instead, build the swr input channel layout directly from the mpv chmap as AV_CHANNEL_ORDER_CUSTOM, so the labels in the layout already match the positions of the channels in the input data. For all unknown map, we return all UNSPEC, so the swr expands to default layout for this channel number.
jeeb
approved these changes
May 29, 2026
Member
jeeb
left a comment
There was a problem hiding this comment.
LGTM
Cleans up things nicely. Doing custom layouts specifically even when they possibly match an FFmpeg standard layout is a bit specific, but I don't really see it as a too big negative. We will anyways have to handle custom channel layouts in chmap_avchannel at some point.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.