Skip to content

Commit

Permalink
fix: do not check file path for viewfinder, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tomli380576 committed Jan 6, 2025
1 parent 180454a commit d7eae4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
14 changes: 9 additions & 5 deletions checkbox-support/checkbox_support/camera_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
)
)

Expand Down
11 changes: 6 additions & 5 deletions providers/base/bin/camera_test_auto_gst_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,16 @@ def parse_args():

def main():
args = parse_args()

Check warning on line 291 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L290-L291

Added lines #L290 - L291 were not covered by tests
print(args)
if os.getuid() == 0:
logger.warning(

Check warning on line 293 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L293

Added line #L293 was not covered by tests
"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(

Check warning on line 299 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L299

Added line #L299 was not covered by tests
os.path.expanduser(os.path.expandvars(args.path))
)
cam.play_video(abs_path)
return

Check warning on line 303 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L302-L303

Added lines #L302 - L303 were not covered by tests

Expand Down Expand Up @@ -329,6 +327,9 @@ def main():
cam.show_viewfinder(dev_element, show_n_seconds=args.seconds)
continue

Check warning on line 328 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L327-L328

Added lines #L327 - L328 were not covered by tests

abs_path = os.path.abspath(

Check warning on line 330 in providers/base/bin/camera_test_auto_gst_source.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/camera_test_auto_gst_source.py#L330

Added line #L330 was not covered by tests
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
Expand Down

0 comments on commit d7eae4e

Please sign in to comment.