Skip to content

Commit

Permalink
tplgtool2: show all supported formats of pcm
Browse files Browse the repository at this point in the history
Make print_pcm_info() show all supported formats of a PCM, not only
the first format.

And show the formats after other attributes, thus other attributes may
have better alignment.

Signed-off-by: Mengdong Lin <[email protected]>
  • Loading branch information
mengdonglin authored and Chao Song committed Sep 19, 2023
1 parent 10ace84 commit 70558b1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/tplgtool2.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ 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=Speaker;id=2;type=playback;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;fmts=S16_LE S32_LE
"""
for pcm in self.pcm_list:
name = pcm["pcm_name"]
Expand All @@ -729,13 +729,14 @@ def print_pcm_info(self):
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={name};id={pcm_id};type={pcm_type};"
f"rate_min={rate_min};rate_max={rate_max};ch_min={ch_min};ch_max={ch_max};"
f"fmts={fmts}")

@cached_property
def coreids(self):
Expand Down

0 comments on commit 70558b1

Please sign in to comment.