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

tplgtool2: print all supported formats of PCM and adjust alignment #1105

Merged
merged 2 commits into from
Sep 19, 2023
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
11 changes: 7 additions & 4 deletions tools/tplgtool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,22 +720,25 @@ def is_dynamic_pipeline(self, pipeline_id: str):
def print_pcm_info(self):
r"""Print pcm info, like::

pcm=Speaker;id=2;type=playback;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm_id=2;name=Speaker;type=playback;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;fmts=S16_LE S32_LE
"""
max_name_len=max(len(pcm["pcm_name"]) for pcm in self.pcm_list)

for pcm in self.pcm_list:
name = pcm["pcm_name"]
pcm_id = pcm["pcm_id"]
pcm_type = self.get_pcm_type(pcm)
fmt_list = self.get_pcm_fmt(pcm)
cap_index = int(pcm_type == "capture") # 1 for capture, 0 for playback
cap = pcm["caps"][cap_index]
fmt = fmt_list[cap_index][0] # only show first format
fmts = ' '.join(fmt_list[cap_index])
rate_min = cap["rate_min"]
rate_max = cap["rate_max"]
ch_min = cap["channels_min"]
ch_max = cap["channels_max"]
print(f"pcm={name};id={pcm_id};type={pcm_type};fmt={fmt};"
f"rate_min={rate_min};rate_max={rate_max};ch_min={ch_min};ch_max={ch_max};")
print(f"pcm_id={pcm_id:>2};name={name.ljust(max_name_len, ' ')};type={pcm_type:<8};"
f"rate_min={rate_min:>6};rate_max={rate_max:>6};ch_min={ch_min};ch_max={ch_max};"
f"fmts={fmts}")

@cached_property
def coreids(self):
Expand Down
Loading