Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unstable audio channel order #358

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion vocto/audio_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def configure_source(self, cfg, source, use_source_as_name=False):
# search for entrys like 'audio.*'
r = re.match(r'^audio\.([\w\-_]+)$', t_name)
if r:
for i, channel in enumerate(set(t.split("+"))):
for i, channel in enumerate(self.channels(t)):
name = source if use_source_as_name else r.group(1)
if self.has_stream(name):
log.error("input audio stream name '%s' can't be addressed a second time within source '%s'",
Expand All @@ -34,6 +34,14 @@ def configure_source(self, cfg, source, use_source_as_name=False):
audiostreams.append(AudioStream(source, i, name, channel))
self.extend(audiostreams)

@staticmethod
def channels(channel_positions: str) -> list[str]:
channels = []
for entry in channel_positions.split("+"):
if entry not in channels:
channels.append(entry)
return channels

def has_stream(self, name, channel=None):
for s in self:
if s.name == name:
Expand Down