cast-sender 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cast_sender-1.0.3/LICENSE +27 -0
- cast_sender-1.0.3/MANIFEST.in +3 -0
- cast_sender-1.0.3/PKG-INFO +89 -0
- cast_sender-1.0.3/README.md +75 -0
- cast_sender-1.0.3/THIRD_PARTY_NOTICES.txt +78408 -0
- cast_sender-1.0.3/cast_sender.egg-info/PKG-INFO +89 -0
- cast_sender-1.0.3/cast_sender.egg-info/SOURCES.txt +12 -0
- cast_sender-1.0.3/cast_sender.egg-info/dependency_links.txt +1 -0
- cast_sender-1.0.3/cast_sender.egg-info/not-zip-safe +1 -0
- cast_sender-1.0.3/cast_sender.egg-info/top_level.txt +1 -0
- cast_sender-1.0.3/gn_builder.py +261 -0
- cast_sender-1.0.3/pyproject.toml +22 -0
- cast_sender-1.0.3/setup.cfg +4 -0
- cast_sender-1.0.3/setup.py +24 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2018 The Chromium Authors
|
|
2
|
+
//
|
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
|
4
|
+
// modification, are permitted provided that the following conditions are
|
|
5
|
+
// met:
|
|
6
|
+
//
|
|
7
|
+
// * Redistributions of source code must retain the above copyright
|
|
8
|
+
// notice, this list of conditions and the following disclaimer.
|
|
9
|
+
// * Redistributions in binary form must reproduce the above
|
|
10
|
+
// copyright notice, this list of conditions and the following disclaimer
|
|
11
|
+
// in the documentation and/or other materials provided with the
|
|
12
|
+
// distribution.
|
|
13
|
+
// * Neither the name of Google LLC nor the names of its
|
|
14
|
+
// contributors may be used to endorse or promote products derived from
|
|
15
|
+
// this software without specific prior written permission.
|
|
16
|
+
//
|
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
18
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
19
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
20
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
21
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
22
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
23
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
24
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
25
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cast_sender
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: Python bindings for the Open Screen Cast Sender library
|
|
5
|
+
Author-email: Google LLC <opensource@google.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
8
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: THIRD_PARTY_NOTICES.txt
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# Open Screen Cast Sender
|
|
16
|
+
|
|
17
|
+
This package provides Python bindings for the Google Open Screen Sender library.
|
|
18
|
+
It allows you to cast media files to a Chromecast device natively from Python.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install cast_sender
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage and Settings
|
|
27
|
+
|
|
28
|
+
### 1. Initialize the Environment
|
|
29
|
+
|
|
30
|
+
The `CastRuntime` handles the underlying C++ TaskRunner and event loop.
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import cast_sender
|
|
34
|
+
env = cast_sender.CastRuntime()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Initialize the Sender
|
|
38
|
+
|
|
39
|
+
Create a `CastSender` instance by providing the target receiver's IP address and
|
|
40
|
+
port.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
# ip_address: Target Cast Receiver's IP (e.g., "192.168.1.50")
|
|
44
|
+
# port: Cast V2 connection port (typically 8009)
|
|
45
|
+
# cert_path: (Optional) Path to a PEM developer root CA certificate.
|
|
46
|
+
sender = cast_sender.CastSender(env=env, ip_address="192.168.1.50", port=8009, cert_path="")
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Configure the Stream Settings
|
|
50
|
+
|
|
51
|
+
The `StreamConfig` object allows you to customize the streaming session:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
config = cast_sender.StreamConfig()
|
|
55
|
+
|
|
56
|
+
# (Required)
|
|
57
|
+
# file_path: Absolute local path to the video container.
|
|
58
|
+
config.file_path = "/path/to/video.mp4"
|
|
59
|
+
|
|
60
|
+
# (Optional)
|
|
61
|
+
# remote_transport_id: Destination receiver transport ID. Bypasses receiver app LAUNCH if provided.
|
|
62
|
+
# session_id: Pre-launched receiver app session ID. Used for a clean STOP.
|
|
63
|
+
# codec_name: Supported video encoder codec string (e.g., "vp8", "vp9", "av1"). Default is "vp8".
|
|
64
|
+
# max_bitrate: Peak aggregate bitrate (audio + video) in bps. Default is 5242880 (5 Mbps).
|
|
65
|
+
# should_include_audio: If False, negotiates a video-only mirroring session. Default is True.
|
|
66
|
+
config.remote_transport_id = ""
|
|
67
|
+
config.session_id = ""
|
|
68
|
+
config.codec_name = "vp8"
|
|
69
|
+
config.max_bitrate = 5242880
|
|
70
|
+
config.should_include_audio = True
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 4. Start Streaming
|
|
74
|
+
|
|
75
|
+
Initiates the Cast session connection, media negotiation, and streaming over
|
|
76
|
+
UDP.
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
# is_debug: (Optional) If True, sets the internal log level to INFO. Default is False.
|
|
80
|
+
sender.stream_video(config=config, is_debug=True)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 5. Teardown
|
|
84
|
+
|
|
85
|
+
Gracefully stop active streaming and shut down network sockets:
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
sender.teardown()
|
|
89
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Open Screen Cast Sender
|
|
2
|
+
|
|
3
|
+
This package provides Python bindings for the Google Open Screen Sender library.
|
|
4
|
+
It allows you to cast media files to a Chromecast device natively from Python.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install cast_sender
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage and Settings
|
|
13
|
+
|
|
14
|
+
### 1. Initialize the Environment
|
|
15
|
+
|
|
16
|
+
The `CastRuntime` handles the underlying C++ TaskRunner and event loop.
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import cast_sender
|
|
20
|
+
env = cast_sender.CastRuntime()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 2. Initialize the Sender
|
|
24
|
+
|
|
25
|
+
Create a `CastSender` instance by providing the target receiver's IP address and
|
|
26
|
+
port.
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
# ip_address: Target Cast Receiver's IP (e.g., "192.168.1.50")
|
|
30
|
+
# port: Cast V2 connection port (typically 8009)
|
|
31
|
+
# cert_path: (Optional) Path to a PEM developer root CA certificate.
|
|
32
|
+
sender = cast_sender.CastSender(env=env, ip_address="192.168.1.50", port=8009, cert_path="")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. Configure the Stream Settings
|
|
36
|
+
|
|
37
|
+
The `StreamConfig` object allows you to customize the streaming session:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
config = cast_sender.StreamConfig()
|
|
41
|
+
|
|
42
|
+
# (Required)
|
|
43
|
+
# file_path: Absolute local path to the video container.
|
|
44
|
+
config.file_path = "/path/to/video.mp4"
|
|
45
|
+
|
|
46
|
+
# (Optional)
|
|
47
|
+
# remote_transport_id: Destination receiver transport ID. Bypasses receiver app LAUNCH if provided.
|
|
48
|
+
# session_id: Pre-launched receiver app session ID. Used for a clean STOP.
|
|
49
|
+
# codec_name: Supported video encoder codec string (e.g., "vp8", "vp9", "av1"). Default is "vp8".
|
|
50
|
+
# max_bitrate: Peak aggregate bitrate (audio + video) in bps. Default is 5242880 (5 Mbps).
|
|
51
|
+
# should_include_audio: If False, negotiates a video-only mirroring session. Default is True.
|
|
52
|
+
config.remote_transport_id = ""
|
|
53
|
+
config.session_id = ""
|
|
54
|
+
config.codec_name = "vp8"
|
|
55
|
+
config.max_bitrate = 5242880
|
|
56
|
+
config.should_include_audio = True
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 4. Start Streaming
|
|
60
|
+
|
|
61
|
+
Initiates the Cast session connection, media negotiation, and streaming over
|
|
62
|
+
UDP.
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
# is_debug: (Optional) If True, sets the internal log level to INFO. Default is False.
|
|
66
|
+
sender.stream_video(config=config, is_debug=True)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 5. Teardown
|
|
70
|
+
|
|
71
|
+
Gracefully stop active streaming and shut down network sockets:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
sender.teardown()
|
|
75
|
+
```
|