From 4b6704e270d873ee3179a921d01c86720d044777 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Tue, 17 Sep 2024 09:59:13 -0400 Subject: [PATCH] support passing encode argument for RequestSetLiveStreamMode --- .../open_gopro/api/ble_commands.py | 4 +++- .../open_gopro/demos/gui/livestream.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py b/demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py index b696b08f..20d1fa8c 100644 --- a/demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py +++ b/demos/python/sdk_wireless_camera_control/open_gopro/api/ble_commands.py @@ -663,6 +663,7 @@ async def set_livestream_mode( minimum_bitrate: int, maximum_bitrate: int, starting_bitrate: int, + encode: bool, window_size: proto.EnumWindowSize.ValueType | None = None, lens: proto.EnumLens.ValueType | None = None, certs: list[Path] | None = None, @@ -674,6 +675,7 @@ async def set_livestream_mode( minimum_bitrate (int): Desired minimum streaming bitrate (>= 800) maximum_bitrate (int): Desired maximum streaming bitrate (<= 8000) starting_bitrate (int): Initial streaming bitrate (honored if 800 <= value <= 8000) + encode (bool): Whether to save media to sdcard while streaming. window_size (proto.EnumWindowSize.ValueType | None): Streaming video resolution. Defaults to None (use camera default). lens (proto.EnumLens.ValueType | None): Streaming Field of View. Defaults to None (use camera default). certs (list[Path] | None): list of certificates to use. Defaults to None. @@ -683,7 +685,7 @@ async def set_livestream_mode( """ d = { "url": url, - "encode": True, + "encode": encode, "minimum_bitrate": minimum_bitrate, "maximum_bitrate": maximum_bitrate, "starting_bitrate": starting_bitrate, diff --git a/demos/python/sdk_wireless_camera_control/open_gopro/demos/gui/livestream.py b/demos/python/sdk_wireless_camera_control/open_gopro/demos/gui/livestream.py index 74daca4b..27c9b312 100644 --- a/demos/python/sdk_wireless_camera_control/open_gopro/demos/gui/livestream.py +++ b/demos/python/sdk_wireless_camera_control/open_gopro/demos/gui/livestream.py @@ -43,6 +43,7 @@ async def wait_for_livestream_start(_: Any, update: proto.NotifyLiveStreamStatus minimum_bitrate=args.min_bit, maximum_bitrate=args.max_bit, starting_bitrate=args.start_bit, + encode=args.encode, lens=args.fov, ) @@ -79,6 +80,8 @@ def parse_arguments() -> argparse.Namespace: parser.add_argument( "--fov", help="Field of View.", choices=list(proto.EnumLens.values()), default=None, type=int # type: ignore ) + parser.add_argument('--encode', help="Save video to sdcard.", action=argparse.BooleanOptionalAction) + parser.set_defaults(encode=True) return add_cli_args_and_parse(parser, wifi=False)