Skip to content

Commit

Permalink
Add the codec option in list command to show only info about related
Browse files Browse the repository at this point in the history
```
./fluster.py list --codec H.266

List of available test suites:

JVET-VVC_draft6
    Codec: H.266
    Description: JVET VVC draft6
    Test vectors: 282

List of available decoders:

H.266
    FFmpeg-H.266: FFmpeg H.266 SW decoder
    Fluendo-H.266-SW-Gst1.0: Fluendo H.266 SW decoder for GStreamer 1.0
    GStreamer-H.266-Libav-Gst1.0: GStreamer H.266 Libav decoder for GStreamer 1.0
    GStreamer-H.266-VVdeC-Gst1.0: GStreamer H.266 VVdeC decoder for GStreamer 1.0
    VVCSoftware_VTM-H266: VVCSoftware_VTM H.266/VVC reference decoder
    VVdeC-H266: VVdeC H.266/VVC decoder
```
  • Loading branch information
rgonzalezfluendo committed Nov 23, 2024
1 parent 0a2a41c commit b2e70c2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
3 changes: 3 additions & 0 deletions fluster/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class Codec(Enum):
AAC = "AAC"
AV1 = "AV1"

def __str__(self) -> str:
return self.value


class OutputFormat(Enum):
"""Output format"""
Expand Down
19 changes: 13 additions & 6 deletions fluster/fluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ def _load_test_suites(self) -> None:
if len(self.test_suites) == 0:
raise Exception(f'No test suites found in "{self.test_suites_dir}"')

def list_decoders(self, check: bool, verbose: bool) -> None:
def list_decoders(
self, check: bool, verbose: bool, codec: Optional[Codec] = None
) -> None:
"""List all the available decoders"""
print("\nList of available decoders:")
decoders_dict: Dict[Codec, List[Decoder]] = {}
Expand All @@ -194,8 +196,10 @@ def list_decoders(self, check: bool, verbose: bool) -> None:
decoders_dict[dec.codec] = []
decoders_dict[dec.codec].append(dec)

for codec, decoder_list in decoders_dict.items():
print(f'\n{str(codec).split(".")[1]}')
for current_codec, decoder_list in decoders_dict.items():
if codec and codec != current_codec:
continue
print(f"\n{current_codec}")
for decoder in decoder_list:
string = f"{decoder}"
if check:
Expand All @@ -210,16 +214,19 @@ def list_test_suites(
self,
show_test_vectors: bool = False,
test_suites: Optional[List[str]] = None,
codec: Optional[Codec] = None,
) -> None:
"""List all test suites"""
self._load_test_suites()
print("\nList of available test suites:")
if test_suites:
test_suites = [x.lower() for x in test_suites]

for test_suite in self.test_suites:
if test_suites:
if test_suite.name.lower() not in test_suites:
continue
if test_suites and test_suite.name.lower() not in test_suites:
continue
if codec and test_suite.codec != codec:
continue
print(test_suite)
if show_test_vectors:
for test_vector in test_suite.test_vectors.values():
Expand Down
18 changes: 16 additions & 2 deletions fluster/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from tempfile import gettempdir

from fluster.fluster import Fluster, Context, SummaryFormat
from fluster.codec import Codec
from fluster import utils

APPNAME = "fluster"
Expand Down Expand Up @@ -190,6 +191,13 @@ def _add_list_cmd(self, subparsers: Any) -> None:
help="show stdout and stderr of commands executed",
action="store_true",
)
subparser.add_argument(
"-d",
"--codec",
help="show decoders and test suites of a codec",
type=Codec,
choices=list(Codec),
)
subparser.set_defaults(func=self._list_cmd)

def _add_run_cmd(self, subparsers: Any) -> None:
Expand Down Expand Up @@ -366,9 +374,15 @@ def _add_download_cmd(self, subparsers: Any) -> None:
@staticmethod
def _list_cmd(args: Any, fluster: Fluster) -> None:
fluster.list_test_suites(
show_test_vectors=args.testvectors, test_suites=args.testsuites
show_test_vectors=args.testvectors,
test_suites=args.testsuites,
codec=args.codec,
)
fluster.list_decoders(
check=args.check,
verbose=args.verbose,
codec=args.codec,
)
fluster.list_decoders(check=args.check, verbose=args.verbose)

@staticmethod
def _run_cmd(args: Any, fluster: Fluster) -> None:
Expand Down

0 comments on commit b2e70c2

Please sign in to comment.