Skip to content

Commit 52da564

Browse files
authored
File component framerate (#28)
* Add support for framerate option in FileComponent * Fix linter issue
1 parent be2f8d8 commit 52da564

File tree

4 files changed

+44
-28
lines changed

4 files changed

+44
-28
lines changed

jellyfish/_openapi_client/models/component_options_file.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from typing import Any, Dict, List, Type, TypeVar
1+
from typing import Any, Dict, List, Type, TypeVar, Union
22

33
from attrs import define as _attrs_define
44
from attrs import field as _attrs_field
55

6+
from ..types import UNSET, Unset
7+
68
T = TypeVar("T", bound="ComponentOptionsFile")
79

810

@@ -12,12 +14,15 @@ class ComponentOptionsFile:
1214

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

1822
def to_dict(self) -> Dict[str, Any]:
1923
"""@private"""
2024
file_path = self.file_path
25+
framerate = self.framerate
2126

2227
field_dict: Dict[str, Any] = {}
2328
field_dict.update(self.additional_properties)
@@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
2631
"filePath": file_path,
2732
}
2833
)
34+
if framerate is not UNSET:
35+
field_dict["framerate"] = framerate
2936

3037
return field_dict
3138

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

45+
framerate = d.pop("framerate", UNSET)
46+
3847
component_options_file = cls(
3948
file_path=file_path,
49+
framerate=framerate,
4050
)
4151

4252
component_options_file.additional_properties = d

jellyfish/_openapi_client/models/component_properties_file.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
from typing import Any, Dict, List, Type, TypeVar
1+
from typing import Any, Dict, List, Type, TypeVar, Union
22

33
from attrs import define as _attrs_define
44
from attrs import field as _attrs_field
55

6+
from ..types import UNSET, Unset
7+
68
T = TypeVar("T", bound="ComponentPropertiesFile")
79

810

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

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

1822
def to_dict(self) -> Dict[str, Any]:
1923
"""@private"""
2024
file_path = self.file_path
25+
framerate = self.framerate
2126

2227
field_dict: Dict[str, Any] = {}
2328
field_dict.update(self.additional_properties)
@@ -26,6 +31,8 @@ def to_dict(self) -> Dict[str, Any]:
2631
"filePath": file_path,
2732
}
2833
)
34+
if framerate is not UNSET:
35+
field_dict["framerate"] = framerate
2936

3037
return field_dict
3138

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

45+
framerate = d.pop("framerate", UNSET)
46+
3847
component_properties_file = cls(
3948
file_path=file_path,
49+
framerate=framerate,
4050
)
4151

4252
component_properties_file.additional_properties = d

jellyfish/_openapi_client/models/component_properties_rtsp.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,70 @@
1-
from typing import Any, Dict, List, Type, TypeVar, Union
1+
from typing import Any, Dict, List, Type, TypeVar
22

33
from attrs import define as _attrs_define
44
from attrs import field as _attrs_field
55

6-
from ..types import UNSET, Unset
7-
86
T = TypeVar("T", bound="ComponentPropertiesRTSP")
97

108

119
@_attrs_define
1210
class ComponentPropertiesRTSP:
1311
"""Properties specific to the RTSP component"""
1412

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

2826
def to_dict(self) -> Dict[str, Any]:
2927
"""@private"""
30-
source_uri = self.source_uri
3128
keep_alive_interval = self.keep_alive_interval
3229
pierce_nat = self.pierce_nat
3330
reconnect_delay = self.reconnect_delay
3431
rtp_port = self.rtp_port
32+
source_uri = self.source_uri
3533

3634
field_dict: Dict[str, Any] = {}
3735
field_dict.update(self.additional_properties)
3836
field_dict.update(
3937
{
38+
"keepAliveInterval": keep_alive_interval,
39+
"pierceNat": pierce_nat,
40+
"reconnectDelay": reconnect_delay,
41+
"rtpPort": rtp_port,
4042
"sourceUri": source_uri,
4143
}
4244
)
43-
if keep_alive_interval is not UNSET:
44-
field_dict["keepAliveInterval"] = keep_alive_interval
45-
if pierce_nat is not UNSET:
46-
field_dict["pierceNat"] = pierce_nat
47-
if reconnect_delay is not UNSET:
48-
field_dict["reconnectDelay"] = reconnect_delay
49-
if rtp_port is not UNSET:
50-
field_dict["rtpPort"] = rtp_port
5145

5246
return field_dict
5347

5448
@classmethod
5549
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
5650
"""@private"""
5751
d = src_dict.copy()
58-
source_uri = d.pop("sourceUri")
52+
keep_alive_interval = d.pop("keepAliveInterval")
5953

60-
keep_alive_interval = d.pop("keepAliveInterval", UNSET)
54+
pierce_nat = d.pop("pierceNat")
6155

62-
pierce_nat = d.pop("pierceNat", UNSET)
56+
reconnect_delay = d.pop("reconnectDelay")
6357

64-
reconnect_delay = d.pop("reconnectDelay", UNSET)
58+
rtp_port = d.pop("rtpPort")
6559

66-
rtp_port = d.pop("rtpPort", UNSET)
60+
source_uri = d.pop("sourceUri")
6761

6862
component_properties_rtsp = cls(
69-
source_uri=source_uri,
7063
keep_alive_interval=keep_alive_interval,
7164
pierce_nat=pierce_nat,
7265
reconnect_delay=reconnect_delay,
7366
rtp_port=rtp_port,
67+
source_uri=source_uri,
7468
)
7569

7670
component_properties_rtsp.additional_properties = d

tests/test_room_api.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@
6363
)
6464

6565
FILE_OPTIONS = ComponentOptionsFile(file_path="video.h264")
66-
FILE_PROPERTIES = ComponentPropertiesFile(file_path=FILE_OPTIONS.file_path)
66+
FILE_PROPERTIES = ComponentPropertiesFile(
67+
file_path=FILE_OPTIONS.file_path, framerate=30
68+
)
6769

6870

6971
class TestAuthentication:

0 commit comments

Comments
 (0)