Skip to content

Commit

Permalink
File component framerate (#28)
Browse files Browse the repository at this point in the history
* Add support for framerate option in FileComponent

* Fix linter issue
  • Loading branch information
Rados13 authored Feb 6, 2024
1 parent be2f8d8 commit 52da564
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 28 deletions.
12 changes: 11 additions & 1 deletion jellyfish/_openapi_client/models/component_options_file.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Any, Dict, List, Type, TypeVar
from typing import Any, Dict, List, Type, TypeVar, Union

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

T = TypeVar("T", bound="ComponentOptionsFile")


Expand All @@ -12,12 +14,15 @@ class ComponentOptionsFile:

file_path: str
"""Path to track file. Must be either OPUS encapsulated in Ogg or raw h264"""
framerate: Union[Unset, None, int] = UNSET
"""Framerate of video in a file. It is only valid for video track"""
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
"""@private"""

def to_dict(self) -> Dict[str, Any]:
"""@private"""
file_path = self.file_path
framerate = self.framerate

field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
Expand All @@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
"filePath": file_path,
}
)
if framerate is not UNSET:
field_dict["framerate"] = framerate

return field_dict

Expand All @@ -35,8 +42,11 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
file_path = d.pop("filePath")

framerate = d.pop("framerate", UNSET)

component_options_file = cls(
file_path=file_path,
framerate=framerate,
)

component_options_file.additional_properties = d
Expand Down
14 changes: 12 additions & 2 deletions jellyfish/_openapi_client/models/component_properties_file.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Any, Dict, List, Type, TypeVar
from typing import Any, Dict, List, Type, TypeVar, Union

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

T = TypeVar("T", bound="ComponentPropertiesFile")


Expand All @@ -11,13 +13,16 @@ class ComponentPropertiesFile:
"""Properties specific to the File component"""

file_path: str
"""Path to track file. Must be either OPUS encapsulated in Ogg or raw h264"""
"""Relative path to track file. Must be either OPUS encapsulated in Ogg or raw h264"""
framerate: Union[Unset, None, int] = UNSET
"""Framerate of video in a file. It is only valid for video track"""
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
"""@private"""

def to_dict(self) -> Dict[str, Any]:
"""@private"""
file_path = self.file_path
framerate = self.framerate

field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
Expand All @@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
"filePath": file_path,
}
)
if framerate is not UNSET:
field_dict["framerate"] = framerate

return field_dict

Expand All @@ -35,8 +42,11 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
file_path = d.pop("filePath")

framerate = d.pop("framerate", UNSET)

component_properties_file = cls(
file_path=file_path,
framerate=framerate,
)

component_properties_file.additional_properties = d
Expand Down
42 changes: 18 additions & 24 deletions jellyfish/_openapi_client/models/component_properties_rtsp.py
Original file line number Diff line number Diff line change
@@ -1,76 +1,70 @@
from typing import Any, Dict, List, Type, TypeVar, Union
from typing import Any, Dict, List, Type, TypeVar

from attrs import define as _attrs_define
from attrs import field as _attrs_field

from ..types import UNSET, Unset

T = TypeVar("T", bound="ComponentPropertiesRTSP")


@_attrs_define
class ComponentPropertiesRTSP:
"""Properties specific to the RTSP component"""

source_uri: str
"""URI of RTSP source stream"""
keep_alive_interval: Union[Unset, int] = UNSET
keep_alive_interval: int
"""Interval (in ms) in which keep-alive RTSP messages will be sent to the remote stream source"""
pierce_nat: Union[Unset, bool] = UNSET
pierce_nat: bool
"""Whether to attempt to create client-side NAT binding by sending an empty datagram from client to source, after the completion of RTSP setup"""
reconnect_delay: Union[Unset, int] = UNSET
reconnect_delay: int
"""Delay (in ms) between successive reconnect attempts"""
rtp_port: Union[Unset, int] = UNSET
rtp_port: int
"""Local port RTP stream will be received at"""
source_uri: str
"""URI of RTSP source stream"""
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)
"""@private"""

def to_dict(self) -> Dict[str, Any]:
"""@private"""
source_uri = self.source_uri
keep_alive_interval = self.keep_alive_interval
pierce_nat = self.pierce_nat
reconnect_delay = self.reconnect_delay
rtp_port = self.rtp_port
source_uri = self.source_uri

field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"keepAliveInterval": keep_alive_interval,
"pierceNat": pierce_nat,
"reconnectDelay": reconnect_delay,
"rtpPort": rtp_port,
"sourceUri": source_uri,
}
)
if keep_alive_interval is not UNSET:
field_dict["keepAliveInterval"] = keep_alive_interval
if pierce_nat is not UNSET:
field_dict["pierceNat"] = pierce_nat
if reconnect_delay is not UNSET:
field_dict["reconnectDelay"] = reconnect_delay
if rtp_port is not UNSET:
field_dict["rtpPort"] = rtp_port

return field_dict

@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
"""@private"""
d = src_dict.copy()
source_uri = d.pop("sourceUri")
keep_alive_interval = d.pop("keepAliveInterval")

keep_alive_interval = d.pop("keepAliveInterval", UNSET)
pierce_nat = d.pop("pierceNat")

pierce_nat = d.pop("pierceNat", UNSET)
reconnect_delay = d.pop("reconnectDelay")

reconnect_delay = d.pop("reconnectDelay", UNSET)
rtp_port = d.pop("rtpPort")

rtp_port = d.pop("rtpPort", UNSET)
source_uri = d.pop("sourceUri")

component_properties_rtsp = cls(
source_uri=source_uri,
keep_alive_interval=keep_alive_interval,
pierce_nat=pierce_nat,
reconnect_delay=reconnect_delay,
rtp_port=rtp_port,
source_uri=source_uri,
)

component_properties_rtsp.additional_properties = d
Expand Down
4 changes: 3 additions & 1 deletion tests/test_room_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@
)

FILE_OPTIONS = ComponentOptionsFile(file_path="video.h264")
FILE_PROPERTIES = ComponentPropertiesFile(file_path=FILE_OPTIONS.file_path)
FILE_PROPERTIES = ComponentPropertiesFile(
file_path=FILE_OPTIONS.file_path, framerate=30
)


class TestAuthentication:
Expand Down

0 comments on commit 52da564

Please sign in to comment.