From d7eae4e9127c4117f4b1705ed2f05f46911e3b7a Mon Sep 17 00:00:00 2001 From: Zhongning Li <60045212+tomli380576@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:37:40 +0800 Subject: [PATCH] fix: do not check file path for viewfinder, comments --- .../checkbox_support/camera_pipelines.py | 14 +++++++++----- providers/base/bin/camera_test_auto_gst_source.py | 11 ++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/checkbox-support/checkbox_support/camera_pipelines.py b/checkbox-support/checkbox_support/camera_pipelines.py index 0147bf39ec..cccf95bc45 100644 --- a/checkbox-support/checkbox_support/camera_pipelines.py +++ b/checkbox-support/checkbox_support/camera_pipelines.py @@ -153,7 +153,7 @@ def get_all_fixated_caps( for elem in self.select_known_values_from_range( prop, low, high ): - finite_list.append(elem) # type: ignore + finite_list.append(elem) elif struct.has_field_typed(prop, Gst.FractionRange): low, high = self.extract_fraction_range(struct, prop) @@ -330,15 +330,19 @@ def send_eos(): pipeline.set_state(Gst.State.PLAYING) # get_state returns (state_change_result, curr_state, target_state) + # the 1st element isn't named, so we must access by index source_state_change_result = pipeline.get_child_by_index(0).get_state( 500 * Gst.MSECOND - )[0] - if source_state_change_result != Gst.StateChangeReturn.SUCCESS: + ) + if source_state_change_result[0] != Gst.StateChangeReturn.SUCCESS: pipeline.set_state(Gst.State.NULL) raise RuntimeError( "Failed to transition to playing state. " - "Source is still in {} state after 500ms.".format( - source_state_change_result + + "Source is still in {} state after 500ms, ".format( + source_state_change_result.state + ) + + "was trying to transition to {}".format( + source_state_change_result.pending ) ) diff --git a/providers/base/bin/camera_test_auto_gst_source.py b/providers/base/bin/camera_test_auto_gst_source.py index 6ebd3d46c7..7315beedd1 100755 --- a/providers/base/bin/camera_test_auto_gst_source.py +++ b/providers/base/bin/camera_test_auto_gst_source.py @@ -289,18 +289,16 @@ def parse_args(): def main(): args = parse_args() - print(args) if os.getuid() == 0: logger.warning( "Running this script as root. " "This may lead to different results than running as regular user." ) - abs_path = os.path.abspath( - os.path.expanduser(os.path.expandvars(args.path)) - ) - if args.subcommand == "play-video": + abs_path = os.path.abspath( + os.path.expanduser(os.path.expandvars(args.path)) + ) cam.play_video(abs_path) return @@ -329,6 +327,9 @@ def main(): cam.show_viewfinder(dev_element, show_n_seconds=args.seconds) continue + abs_path = os.path.abspath( + os.path.expanduser(os.path.expandvars(args.path)) + ) if not os.path.isdir(abs_path): # must validate early # multifilesink does not check if the path exists