Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix livestream demo #565

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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