Skip to content

Commit

Permalink
Don't default to hardcoded parameters for livestream set mode (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw authored Jul 8, 2024
1 parent e88082f commit 8d09c73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Unreleased
----------

* Add Setting 125
* Don't default to hardcoded parameters for set livestream mode

0.16.1 (April-23-2024)
----------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,22 +660,22 @@ async def set_livestream_mode(
self,
*,
url: str,
window_size: proto.EnumWindowSize.ValueType,
minimum_bitrate: int,
maximum_bitrate: int,
starting_bitrate: int,
lens: proto.EnumLens.ValueType,
window_size: proto.EnumWindowSize.ValueType | None = None,
lens: proto.EnumLens.ValueType | None = None,
certs: list[Path] | None = None,
) -> GoProResp[None]:
"""Initiate livestream to any site that accepts an RTMP URL and simultaneously encode to camera.
Args:
url (str): url used to stream. Set to empty string to invalidate/cancel stream
window_size (open_gopro.api.proto.EnumWindowSize): Streaming video resolution
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)
lens (open_gopro.api.proto.EnumLens): Streaming Field of View
window_size (open_gopro.api.proto.EnumWindowSize | None): Streaming video resolution. Defaults to None (use camera default).
lens (open_gopro.api.proto.EnumLens): Streaming Field of View. Defaults to None (use camera default).
certs (list[Path] | None): list of certificates to use. Defaults to None.
Returns:
Expand All @@ -684,11 +684,9 @@ async def set_livestream_mode(
d = {
"url": url,
"encode": True,
"window_size": window_size,
"minimum_bitrate": minimum_bitrate,
"maximum_bitrate": maximum_bitrate,
"starting_bitrate": starting_bitrate,
"lens": lens,
}
if certs:
cert_buf = bytearray()
Expand All @@ -698,6 +696,10 @@ async def set_livestream_mode(

cert_buf.pop()
d["cert"] = bytes(cert_buf)
if lens:
d["lens"] = lens
if window_size:
d["window_size"] = window_size
return d # type: ignore

@ble_proto_command(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,8 @@ def parse_arguments() -> argparse.Namespace:
parser.add_argument("--min_bit", type=int, help="Minimum bitrate.", default=1000)
parser.add_argument("--max_bit", type=int, help="Maximum bitrate.", default=1000)
parser.add_argument("--start_bit", type=int, help="Starting bitrate.", default=1000)
parser.add_argument(
"--resolution",
help="Resolution.",
choices=list(proto.EnumWindowSize.values()),
default=proto.EnumWindowSize.WINDOW_SIZE_720,
)
parser.add_argument(
"--fov", help="Field of View.", choices=list(proto.EnumLens.values()), default=proto.EnumLens.LENS_LINEAR
)
parser.add_argument("--resolution", help="Resolution.", choices=list(proto.EnumWindowSize.values()), default=None)
parser.add_argument("--fov", help="Field of View.", choices=list(proto.EnumLens.values()), default=None)
return add_cli_args_and_parse(parser, wifi=False)


Expand Down

0 comments on commit 8d09c73

Please sign in to comment.