ponkan-python 0.1.0__tar.gz → 0.1.1__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.
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/PKG-INFO +8 -8
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/README.md +7 -7
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/docs/api.md +12 -12
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/docs/publishing.md +6 -6
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/pyproject.toml +8 -8
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/__init__.py +2 -2
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/capture.py +12 -12
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/devices/n3dsxl_ftd3.py +3 -3
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/errors.py +1 -1
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/hardware_gate.py +1 -1
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/image/frame.py +2 -2
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/protocol/layout_3ds.py +3 -3
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/protocol/n3dsxl.py +5 -5
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/engine.py +8 -8
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/policies.py +2 -2
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/capture_raw.py +5 -5
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/list_devices.py +2 -2
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/raw_to_png.py +3 -3
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/stream_n3dsxl.py +5 -5
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_backend.py +4 -4
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_native.py +2 -2
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_native_streaming.py +7 -7
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_streaming.py +5 -5
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/ftd3_backend.py +4 -4
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/ftd3_pipe.py +3 -3
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/libusb_async.py +1 -1
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/libusb_backend.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/conftest.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_connect.py +6 -6
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_d3xx_backend.py +9 -9
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_d3xx_native_streaming.py +8 -8
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_ftd3_pipe.py +5 -5
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_high_level_capture_read_api.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_open_close.py +4 -4
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_raw_capture.py +7 -7
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/test_n3dsxl_streaming.py +7 -7
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/manual/test_n3dsxl_decoder_visual.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/performance/test_n3dsxl_d3xx_native_streaming_smoke.py +8 -8
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/performance/test_n3dsxl_streaming_smoke.py +8 -8
- ponkan_python-0.1.1/tests/unit/test_codex_pre_tool_use_policy.py +53 -0
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_d3xx_backend.py +4 -4
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_d3xx_native_api.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_d3xx_native_streaming_backend.py +4 -4
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_d3xx_streaming_backend.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_ftd3_backend_selector.py +4 -4
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_ftd3_pipe_payloads.py +5 -5
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_hardware_gate.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_high_level_capture_read_api.py +5 -5
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_layout_3ds_decoder.py +7 -7
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_libusb_backend.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_artifacts.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_connect_sequence.py +7 -7
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_device_filter.py +2 -2
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_list_devices_cli.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_session.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_n3dsxl_sizes.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_package.py +9 -9
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_raw_capture_metadata.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_stream_n3dsxl_cli.py +2 -2
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_streaming_buffers.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_streaming_engine_fake_async.py +5 -5
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_streaming_performance_stats.py +1 -1
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/unit/test_streaming_policies.py +3 -3
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/.gitignore +0 -0
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/LICENSE +0 -0
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/NOTICE.md +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/artifacts.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/devices/__init__.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/image/__init__.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/protocol/__init__.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/protocol/sizes.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/py.typed +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/__init__.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/buffers.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/stats.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/__init__.py +0 -0
- {ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/__init__.py +0 -0
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/e2e/README.md +0 -0
- {ponkan_python-0.1.0 → ponkan_python-0.1.1}/tests/performance/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ponkan-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: A Python capture library focused on new 3DS XL capture board frame acquisition.
|
|
5
5
|
Project-URL: Documentation, https://github.com/niart120/ponkan-python/blob/master/docs/api.md
|
|
6
6
|
Project-URL: Homepage, https://github.com/niart120/ponkan-python
|
|
@@ -72,7 +72,7 @@ pip install "ponkan-python[d3xx]"
|
|
|
72
72
|
高レベル API では、new 3DS XL capture board を開いて `read()` で RGB8 `numpy.ndarray` を取得できます。
|
|
73
73
|
|
|
74
74
|
```python
|
|
75
|
-
from
|
|
75
|
+
from ponkan import CaptureOutput, open_capture
|
|
76
76
|
|
|
77
77
|
with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
|
|
78
78
|
image = cap.read()
|
|
@@ -83,7 +83,7 @@ with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
|
|
|
83
83
|
上画面だけを読む場合は `CaptureOutput.TOP` を指定します。OpenCV へ渡す場合は `colorspace="BGR"` を指定できます。
|
|
84
84
|
|
|
85
85
|
```python
|
|
86
|
-
from
|
|
86
|
+
from ponkan import CaptureOutput, open_capture
|
|
87
87
|
|
|
88
88
|
with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
|
|
89
89
|
top_bgr = cap.read()
|
|
@@ -92,7 +92,7 @@ with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
|
|
|
92
92
|
3DS 固有の上画面・下画面・sequence などが必要な場合は `read_frame()` を使います。
|
|
93
93
|
|
|
94
94
|
```python
|
|
95
|
-
from
|
|
95
|
+
from ponkan import open_capture
|
|
96
96
|
|
|
97
97
|
with open_capture() as cap:
|
|
98
98
|
frame = cap.read_frame()
|
|
@@ -108,10 +108,10 @@ API の詳細は [API Reference](https://github.com/niart120/ponkan-python/blob/
|
|
|
108
108
|
インストール後は次の console scripts を利用できます。
|
|
109
109
|
|
|
110
110
|
```console
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
ponkan-list-devices
|
|
112
|
+
ponkan-capture-raw --out captures/n3dsxl/raw_2d_001.bin
|
|
113
|
+
ponkan-raw-to-png captures/n3dsxl/raw_2d_001.bin --metadata captures/n3dsxl/raw_2d_001.json --out captures/n3dsxl/png
|
|
114
|
+
ponkan-stream-n3dsxl --duration 10 --stats
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
実機へ N3DSXL command を送る操作は、事前に device identity と安全境界を確認してから実行してください。
|
|
@@ -38,7 +38,7 @@ pip install "ponkan-python[d3xx]"
|
|
|
38
38
|
高レベル API では、new 3DS XL capture board を開いて `read()` で RGB8 `numpy.ndarray` を取得できます。
|
|
39
39
|
|
|
40
40
|
```python
|
|
41
|
-
from
|
|
41
|
+
from ponkan import CaptureOutput, open_capture
|
|
42
42
|
|
|
43
43
|
with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
|
|
44
44
|
image = cap.read()
|
|
@@ -49,7 +49,7 @@ with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
|
|
|
49
49
|
上画面だけを読む場合は `CaptureOutput.TOP` を指定します。OpenCV へ渡す場合は `colorspace="BGR"` を指定できます。
|
|
50
50
|
|
|
51
51
|
```python
|
|
52
|
-
from
|
|
52
|
+
from ponkan import CaptureOutput, open_capture
|
|
53
53
|
|
|
54
54
|
with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
|
|
55
55
|
top_bgr = cap.read()
|
|
@@ -58,7 +58,7 @@ with open_capture(output=CaptureOutput.TOP, colorspace="BGR") as cap:
|
|
|
58
58
|
3DS 固有の上画面・下画面・sequence などが必要な場合は `read_frame()` を使います。
|
|
59
59
|
|
|
60
60
|
```python
|
|
61
|
-
from
|
|
61
|
+
from ponkan import open_capture
|
|
62
62
|
|
|
63
63
|
with open_capture() as cap:
|
|
64
64
|
frame = cap.read_frame()
|
|
@@ -74,10 +74,10 @@ API の詳細は [API Reference](https://github.com/niart120/ponkan-python/blob/
|
|
|
74
74
|
インストール後は次の console scripts を利用できます。
|
|
75
75
|
|
|
76
76
|
```console
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
ponkan-list-devices
|
|
78
|
+
ponkan-capture-raw --out captures/n3dsxl/raw_2d_001.bin
|
|
79
|
+
ponkan-raw-to-png captures/n3dsxl/raw_2d_001.bin --metadata captures/n3dsxl/raw_2d_001.json --out captures/n3dsxl/png
|
|
80
|
+
ponkan-stream-n3dsxl --duration 10 --stats
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
実機へ N3DSXL command を送る操作は、事前に device identity と安全境界を確認してから実行してください。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# API Reference
|
|
2
2
|
|
|
3
|
-
`
|
|
3
|
+
`ponkan` exposes a small public API for new 3DS XL capture board frame
|
|
4
4
|
acquisition. The current package is focused on 2D N3DSXL video capture and does
|
|
5
5
|
not provide GUI, audio playback, recording, old DS, Optimize, Nisetro, or IS
|
|
6
6
|
device support.
|
|
@@ -14,7 +14,7 @@ pip install "ponkan-python[d3xx]"
|
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Use the `image` extra when calling `CaptureFrame.to_pillow()` or the
|
|
17
|
-
`
|
|
17
|
+
`ponkan-raw-to-png` command. Use the `d3xx` extra when selecting the D3XX
|
|
18
18
|
backend.
|
|
19
19
|
|
|
20
20
|
## Top-Level Imports
|
|
@@ -22,7 +22,7 @@ backend.
|
|
|
22
22
|
The package root exports the high-level reader and size helpers:
|
|
23
23
|
|
|
24
24
|
```python
|
|
25
|
-
from
|
|
25
|
+
from ponkan import (
|
|
26
26
|
ACCEPTED_N3DSXL_PRODUCT_IDS,
|
|
27
27
|
ACCEPTED_N3DSXL_PRODUCT_STRINGS,
|
|
28
28
|
N3DSXL_VENDOR_ID,
|
|
@@ -45,7 +45,7 @@ tree without installed metadata it falls back to `"0.0.0"`.
|
|
|
45
45
|
Open a high-level streaming reader for an accepted new 3DS XL capture board.
|
|
46
46
|
|
|
47
47
|
```python
|
|
48
|
-
from
|
|
48
|
+
from ponkan import CaptureOutput, open_capture
|
|
49
49
|
|
|
50
50
|
with open_capture(output=CaptureOutput.BOTH_VERTICAL) as cap:
|
|
51
51
|
image = cap.read()
|
|
@@ -151,7 +151,7 @@ Write a raw payload and metadata sidecar using the same stem:
|
|
|
151
151
|
|
|
152
152
|
```python
|
|
153
153
|
from pathlib import Path
|
|
154
|
-
from
|
|
154
|
+
from ponkan.capture import save_raw_capture
|
|
155
155
|
|
|
156
156
|
bin_path, metadata_path = save_raw_capture(capture, Path("captures/raw_2d_001.bin"))
|
|
157
157
|
```
|
|
@@ -162,8 +162,8 @@ unless `force=True` is provided.
|
|
|
162
162
|
## Device Discovery
|
|
163
163
|
|
|
164
164
|
```python
|
|
165
|
-
from
|
|
166
|
-
from
|
|
165
|
+
from ponkan.devices.n3dsxl_ftd3 import list_n3dsxl_devices
|
|
166
|
+
from ponkan.transport.libusb_backend import Usb1Backend
|
|
167
167
|
|
|
168
168
|
listing = list_n3dsxl_devices(Usb1Backend())
|
|
169
169
|
```
|
|
@@ -183,7 +183,7 @@ Accepted device identity is constrained by `N3DSXL_VENDOR_ID`,
|
|
|
183
183
|
## Size Helpers
|
|
184
184
|
|
|
185
185
|
```python
|
|
186
|
-
from
|
|
186
|
+
from ponkan import capture_sizes
|
|
187
187
|
|
|
188
188
|
sizes = capture_sizes(mode_3d=False)
|
|
189
189
|
print(sizes.video_size, sizes.capture_size)
|
|
@@ -208,10 +208,10 @@ Installed console scripts:
|
|
|
208
208
|
|
|
209
209
|
| Command | Purpose |
|
|
210
210
|
| --- | --- |
|
|
211
|
-
| `
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
211
|
+
| `ponkan-list-devices` | Print accepted and rejected FTDI-family devices without sending N3DSXL commands. |
|
|
212
|
+
| `ponkan-capture-raw --out <path>` | Capture one raw frame and metadata sidecar. |
|
|
213
|
+
| `ponkan-raw-to-png <raw> --metadata <json> --out <dir>` | Decode raw video to top and bottom PNG files. |
|
|
214
|
+
| `ponkan-stream-n3dsxl --duration 10 --stats` | Run a bounded streaming smoke loop and print counters. |
|
|
215
215
|
|
|
216
216
|
Hardware commands should only be run after confirming the device identity and
|
|
217
217
|
the project hardware safety policy.
|
|
@@ -7,7 +7,7 @@ has a matching trusted publisher.
|
|
|
7
7
|
## Package Metadata
|
|
8
8
|
|
|
9
9
|
- Distribution name: `ponkan-python`
|
|
10
|
-
- Import package: `
|
|
10
|
+
- Import package: `ponkan`
|
|
11
11
|
- Python support: `>=3.12, <3.14`
|
|
12
12
|
- License expression: `MIT`
|
|
13
13
|
- License files: `LICENSE`, `NOTICE.md`
|
|
@@ -61,8 +61,8 @@ After the project and trusted publisher are ready, pushing a version tag starts
|
|
|
61
61
|
the PyPI publish job:
|
|
62
62
|
|
|
63
63
|
```console
|
|
64
|
-
git tag v0.1.
|
|
65
|
-
git push origin v0.1.
|
|
64
|
+
git tag v0.1.1
|
|
65
|
+
git push origin v0.1.1
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
The workflow builds the distribution once, stores it as a workflow artifact, and
|
|
@@ -73,12 +73,12 @@ publishes the same artifact to the selected package index.
|
|
|
73
73
|
After upload, verify installation in a clean environment:
|
|
74
74
|
|
|
75
75
|
```console
|
|
76
|
-
uvx --from ponkan-python
|
|
76
|
+
uvx --from ponkan-python ponkan-list-devices
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
For optional features:
|
|
80
80
|
|
|
81
81
|
```console
|
|
82
|
-
uvx --from "ponkan-python[image]"
|
|
83
|
-
uvx --from "ponkan-python[d3xx]"
|
|
82
|
+
uvx --from "ponkan-python[image]" ponkan-raw-to-png --help
|
|
83
|
+
uvx --from "ponkan-python[d3xx]" ponkan-list-devices
|
|
84
84
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ponkan-python"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
description = "A Python capture library focused on new 3DS XL capture board frame acquisition."
|
|
5
5
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
6
6
|
authors = [
|
|
@@ -54,10 +54,10 @@ Issues = "https://github.com/niart120/ponkan-python/issues"
|
|
|
54
54
|
Repository = "https://github.com/niart120/ponkan-python.git"
|
|
55
55
|
|
|
56
56
|
[project.scripts]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
ponkan-capture-raw = "ponkan.tools.capture_raw:main"
|
|
58
|
+
ponkan-list-devices = "ponkan.tools.list_devices:main"
|
|
59
|
+
ponkan-raw-to-png = "ponkan.tools.raw_to_png:main"
|
|
60
|
+
ponkan-stream-n3dsxl = "ponkan.tools.stream_n3dsxl:main"
|
|
61
61
|
|
|
62
62
|
[dependency-groups]
|
|
63
63
|
dev = [
|
|
@@ -76,7 +76,7 @@ build-backend = "hatchling.build"
|
|
|
76
76
|
cache-dir = ".uv-cache"
|
|
77
77
|
|
|
78
78
|
[tool.hatch.build.targets.wheel]
|
|
79
|
-
packages = ["src/
|
|
79
|
+
packages = ["src/ponkan"]
|
|
80
80
|
|
|
81
81
|
[tool.hatch.build.targets.sdist]
|
|
82
82
|
include = [
|
|
@@ -133,7 +133,7 @@ select = [
|
|
|
133
133
|
]
|
|
134
134
|
|
|
135
135
|
[tool.ruff.lint.per-file-ignores]
|
|
136
|
-
"src/
|
|
136
|
+
"src/ponkan/tools/**/*.py" = ["T201"]
|
|
137
137
|
"tests/**/*.py" = ["D100", "D103", "S101"]
|
|
138
138
|
|
|
139
139
|
[tool.ruff.lint.pydocstyle]
|
|
@@ -143,7 +143,7 @@ convention = "google"
|
|
|
143
143
|
strict = true
|
|
144
144
|
|
|
145
145
|
[tool.ruff.lint.isort]
|
|
146
|
-
known-first-party = ["
|
|
146
|
+
known-first-party = ["ponkan"]
|
|
147
147
|
|
|
148
148
|
[tool.ty.environment]
|
|
149
149
|
python-version = "3.12"
|
|
@@ -8,8 +8,8 @@ submodules.
|
|
|
8
8
|
|
|
9
9
|
from importlib.metadata import PackageNotFoundError, version
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
11
|
+
from ponkan.capture import CaptureConfig, CaptureOutput, CaptureReader, open_capture
|
|
12
|
+
from ponkan.protocol.sizes import (
|
|
13
13
|
ACCEPTED_N3DSXL_PRODUCT_IDS,
|
|
14
14
|
ACCEPTED_N3DSXL_PRODUCT_STRINGS,
|
|
15
15
|
N3DSXL_VENDOR_ID,
|
|
@@ -8,20 +8,20 @@ from enum import StrEnum
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import TYPE_CHECKING, Literal, Protocol, cast, overload
|
|
10
10
|
|
|
11
|
-
from
|
|
11
|
+
from ponkan.errors import (
|
|
12
12
|
DecodeError,
|
|
13
13
|
DeviceNotFound,
|
|
14
14
|
TransferOverflow,
|
|
15
15
|
UnsupportedOperation,
|
|
16
16
|
)
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
17
|
+
from ponkan.image.frame import CaptureFrame, ColorSpace, RGB8Array
|
|
18
|
+
from ponkan.streaming.policies import DropPolicy
|
|
19
|
+
from ponkan.streaming.stats import StreamStats
|
|
20
20
|
|
|
21
21
|
if TYPE_CHECKING:
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
22
|
+
from ponkan.protocol.n3dsxl import N3DSXLPipe, N3DSXLSessionIdentity
|
|
23
|
+
from ponkan.transport.d3xx_streaming import D3xxStreamHandle
|
|
24
|
+
from ponkan.transport.libusb_async import AsyncTransferBackend
|
|
25
25
|
|
|
26
26
|
CaptureSource = int | str
|
|
27
27
|
CaptureBackend = Literal["auto", "libusb", "d3xx", "d3xx-native"]
|
|
@@ -373,13 +373,13 @@ def _open_d3xx_engine(config: CaptureConfig, *, native: bool) -> CaptureReaderEn
|
|
|
373
373
|
|
|
374
374
|
|
|
375
375
|
def _new_d3xx_backend() -> _D3xxBackend:
|
|
376
|
-
from
|
|
376
|
+
from ponkan.transport.d3xx_backend import D3xxBackend # noqa: PLC0415
|
|
377
377
|
|
|
378
378
|
return D3xxBackend()
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
def _new_n3dsxl_protocol(handle: _D3xxHandle) -> _N3DSXLConnectProtocol:
|
|
382
|
-
from
|
|
382
|
+
from ponkan.protocol.n3dsxl import N3DSXLProtocol # noqa: PLC0415
|
|
383
383
|
|
|
384
384
|
return N3DSXLProtocol(
|
|
385
385
|
cast("N3DSXLSessionIdentity", handle),
|
|
@@ -388,13 +388,13 @@ def _new_n3dsxl_protocol(handle: _D3xxHandle) -> _N3DSXLConnectProtocol:
|
|
|
388
388
|
|
|
389
389
|
|
|
390
390
|
def _new_d3xx_backend_async(handle: _D3xxHandle) -> object:
|
|
391
|
-
from
|
|
391
|
+
from ponkan.transport.d3xx_streaming import D3xxAsyncBackend # noqa: PLC0415
|
|
392
392
|
|
|
393
393
|
return D3xxAsyncBackend(cast("D3xxStreamHandle", handle))
|
|
394
394
|
|
|
395
395
|
|
|
396
396
|
def _new_d3xx_native_backend(handle: _D3xxHandle, config: CaptureConfig) -> object:
|
|
397
|
-
from
|
|
397
|
+
from ponkan.transport.d3xx_native_streaming import ( # noqa: PLC0415
|
|
398
398
|
D3xxNativeFastPathBackend,
|
|
399
399
|
)
|
|
400
400
|
|
|
@@ -402,7 +402,7 @@ def _new_d3xx_native_backend(handle: _D3xxHandle, config: CaptureConfig) -> obje
|
|
|
402
402
|
|
|
403
403
|
|
|
404
404
|
def _new_streaming_engine(async_backend: object, config: CaptureConfig) -> CaptureReaderEngine:
|
|
405
|
-
from
|
|
405
|
+
from ponkan.streaming.engine import StreamingEngine # noqa: PLC0415
|
|
406
406
|
|
|
407
407
|
return StreamingEngine(
|
|
408
408
|
cast("AsyncTransferBackend", async_backend),
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/devices/n3dsxl_ftd3.py
RENAMED
|
@@ -4,8 +4,8 @@ from contextlib import suppress
|
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from typing import Literal, cast
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
7
|
+
from ponkan.errors import DeviceOpenError, UnsupportedDevice
|
|
8
|
+
from ponkan.protocol.sizes import (
|
|
9
9
|
ACCEPTED_N3DSXL_PRODUCT_IDS,
|
|
10
10
|
ACCEPTED_N3DSXL_PRODUCT_STRINGS,
|
|
11
11
|
N3DSXL_BULK_INTERFACE,
|
|
@@ -13,7 +13,7 @@ from py3dscapture.protocol.sizes import (
|
|
|
13
13
|
N3DSXL_DEFAULT_CONFIGURATION,
|
|
14
14
|
N3DSXL_VENDOR_ID,
|
|
15
15
|
)
|
|
16
|
-
from
|
|
16
|
+
from ponkan.transport.libusb_backend import LibusbBackend, UsbDeviceInfo, UsbHandle
|
|
17
17
|
|
|
18
18
|
AcceptedProductString = Literal["N3DSXL", "N3DSXL.2"]
|
|
19
19
|
ProductStringStatus = Literal["accepted", "unreadable"]
|
|
@@ -4,7 +4,7 @@ from dataclasses import dataclass
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class CaptureError(Exception):
|
|
7
|
-
"""Base exception for
|
|
7
|
+
"""Base exception for ponkan failures.
|
|
8
8
|
|
|
9
9
|
Catch this when callers want to handle package-level failures without
|
|
10
10
|
matching individual USB, decode, or optional-dependency errors.
|
|
@@ -5,7 +5,7 @@ from collections.abc import Mapping
|
|
|
5
5
|
from dataclasses import dataclass
|
|
6
6
|
from typing import Literal
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from ponkan.protocol.sizes import (
|
|
9
9
|
ACCEPTED_N3DSXL_PRODUCT_IDS,
|
|
10
10
|
ACCEPTED_N3DSXL_PRODUCT_STRINGS,
|
|
11
11
|
N3DSXL_VENDOR_ID,
|
|
@@ -7,8 +7,8 @@ from typing import TYPE_CHECKING, Literal, Protocol, cast
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
from numpy.typing import NDArray
|
|
9
9
|
|
|
10
|
-
from
|
|
11
|
-
from
|
|
10
|
+
from ponkan.errors import DecodeError, OptionalDependencyError
|
|
11
|
+
from ponkan.protocol.sizes import BOTTOM_WIDTH_3DS, HEIGHT_3DS, TOP_WIDTH_3DS
|
|
12
12
|
|
|
13
13
|
ColorSpace = Literal["RGB", "BGR"]
|
|
14
14
|
ScreenName = Literal["top", "bottom", "top_right"]
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/protocol/layout_3ds.py
RENAMED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
5
|
+
from ponkan.errors import DecodeError
|
|
6
|
+
from ponkan.image.frame import CaptureFrame
|
|
7
|
+
from ponkan.protocol.sizes import (
|
|
8
8
|
BOTTOM_WIDTH_3DS,
|
|
9
9
|
HEIGHT_3DS,
|
|
10
10
|
TOP_WIDTH_3DS,
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
from time import sleep
|
|
4
4
|
from typing import Protocol
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
6
|
+
from ponkan.capture import RawCapture
|
|
7
|
+
from ponkan.devices.n3dsxl_ftd3 import DeviceCandidate
|
|
8
|
+
from ponkan.errors import UnsupportedDevice, UnsupportedOperation
|
|
9
|
+
from ponkan.protocol.sizes import (
|
|
10
10
|
N3DSXL_BULK_IN_ENDPOINT,
|
|
11
11
|
N3DSXL_BULK_OUT_ENDPOINT,
|
|
12
12
|
capture_size,
|
|
13
13
|
video_size,
|
|
14
14
|
)
|
|
15
|
-
from
|
|
15
|
+
from ponkan.transport.ftd3_pipe import FTD3_COMMAND_TIMEOUT_MS
|
|
16
16
|
|
|
17
17
|
N3DSXL_CFG_WAIT_MS = 200
|
|
18
18
|
N3DSXL_RAW_FRAME_READ_ATTEMPTS = 8
|
|
@@ -5,14 +5,14 @@ import queue
|
|
|
5
5
|
import time
|
|
6
6
|
from collections.abc import AsyncIterator, Callable, Iterator
|
|
7
7
|
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
8
|
+
from ponkan.errors import DecodeError
|
|
9
|
+
from ponkan.image.frame import CaptureFrame
|
|
10
|
+
from ponkan.protocol.layout_3ds import decode_rgb8_2d
|
|
11
|
+
from ponkan.protocol.sizes import capture_size, video_size
|
|
12
|
+
from ponkan.streaming.buffers import BufferPool, RawFrameResult, RawFrameSlot
|
|
13
|
+
from ponkan.streaming.policies import BoundedFrameQueue, DropPolicy, put_frame_with_policy
|
|
14
|
+
from ponkan.streaming.stats import StreamStats, StreamTimingCollector, TimingSummary
|
|
15
|
+
from ponkan.transport.libusb_async import AsyncTransferBackend
|
|
16
16
|
|
|
17
17
|
Decoder = Callable[[bytes], CaptureFrame]
|
|
18
18
|
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/streaming/policies.py
RENAMED
|
@@ -4,8 +4,8 @@ from collections import deque
|
|
|
4
4
|
from collections.abc import Iterator
|
|
5
5
|
from typing import Literal
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
7
|
+
from ponkan.image.frame import CaptureFrame
|
|
8
|
+
from ponkan.streaming.stats import StreamStats
|
|
9
9
|
|
|
10
10
|
DropPolicy = Literal["drop_oldest", "drop_newest", "block"]
|
|
11
11
|
CopyPolicy = Literal["copy_decoded_frame_before_release_raw_slot", "zero_copy_experimental"]
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/capture_raw.py
RENAMED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import argparse
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
6
|
+
from ponkan.capture import save_raw_capture
|
|
7
|
+
from ponkan.devices.n3dsxl_ftd3 import N3DSXLDevice, list_n3dsxl_devices
|
|
8
|
+
from ponkan.protocol.n3dsxl import N3DSXLProtocol
|
|
9
|
+
from ponkan.transport.ftd3_pipe import Ftd3Pipe
|
|
10
|
+
from ponkan.transport.libusb_backend import Usb1Backend
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def main(argv: list[str] | None = None) -> int:
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/list_devices.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""List N3DSXL USB device candidates."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
3
|
+
from ponkan.devices.n3dsxl_ftd3 import DeviceListing, list_n3dsxl_devices
|
|
4
|
+
from ponkan.transport.libusb_backend import LibusbBackend, Usb1Backend
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def format_device_listing(listing: DeviceListing) -> str:
|
|
@@ -9,9 +9,9 @@ from typing import Literal
|
|
|
9
9
|
|
|
10
10
|
import numpy as np
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
12
|
+
from ponkan.image.frame import CaptureFrame
|
|
13
|
+
from ponkan.protocol.layout_3ds import APPROVED_N3DSXL_2D_DECODER_ID, decode_rgb8_2d
|
|
14
|
+
from ponkan.protocol.sizes import BOTTOM_WIDTH_3DS, HEIGHT_3DS, TOP_WIDTH_3DS
|
|
15
15
|
|
|
16
16
|
ProbeCandidateId = Literal[
|
|
17
17
|
"legacy_top_first_transpose",
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/tools/stream_n3dsxl.py
RENAMED
|
@@ -6,13 +6,13 @@ import time
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import TYPE_CHECKING, Literal, cast
|
|
8
8
|
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
9
|
+
from ponkan.artifacts import write_json_artifact
|
|
10
|
+
from ponkan.streaming.engine import StreamingEngine
|
|
11
|
+
from ponkan.streaming.stats import PerformanceStats, StreamingBackendKind
|
|
12
|
+
from ponkan.transport.libusb_async import LibusbAsyncBackend
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
|
-
from
|
|
15
|
+
from ponkan.streaming.policies import DropPolicy
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def run_streaming_smoke(
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_backend.py
RENAMED
|
@@ -9,10 +9,10 @@ from importlib import import_module
|
|
|
9
9
|
from types import ModuleType
|
|
10
10
|
from typing import Any, Literal, Protocol, cast
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
12
|
+
from ponkan.devices.n3dsxl_ftd3 import DeviceCandidate, classify_n3dsxl_device
|
|
13
|
+
from ponkan.errors import CaptureError, OptionalDependencyError
|
|
14
|
+
from ponkan.protocol.sizes import N3DSXL_VENDOR_ID
|
|
15
|
+
from ponkan.transport.libusb_backend import UsbDeviceInfo
|
|
16
16
|
|
|
17
17
|
FT_OK = 0
|
|
18
18
|
D3XX_OPEN_BY_SERIAL_NUMBER = 0x01
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_native.py
RENAMED
|
@@ -4,8 +4,8 @@ import ctypes
|
|
|
4
4
|
from dataclasses import dataclass
|
|
5
5
|
from typing import ClassVar, Protocol, cast
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
7
|
+
from ponkan.errors import CaptureError
|
|
8
|
+
from ponkan.transport.d3xx_backend import D3xxBackendError
|
|
9
9
|
|
|
10
10
|
FT_OK = 0
|
|
11
11
|
FT_TIMEOUT = 19
|
|
@@ -8,10 +8,10 @@ from dataclasses import dataclass
|
|
|
8
8
|
from threading import Event, Lock, Thread
|
|
9
9
|
from typing import TYPE_CHECKING, Protocol, cast
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
11
|
+
from ponkan.protocol.sizes import N3DSXL_BULK_IN_ENDPOINT, capture_size
|
|
12
|
+
from ponkan.streaming.buffers import RawFrameSlot
|
|
13
|
+
from ponkan.transport.d3xx_backend import D3XX_DEFAULT_TIMEOUT_MS, D3xxBackendError
|
|
14
|
+
from ponkan.transport.d3xx_native import (
|
|
15
15
|
FT_IO_INCOMPLETE,
|
|
16
16
|
FT_IO_PENDING,
|
|
17
17
|
FT_OK,
|
|
@@ -19,10 +19,10 @@ from py3dscapture.transport.d3xx_native import (
|
|
|
19
19
|
NativeOverlapped,
|
|
20
20
|
NativeTransferResult,
|
|
21
21
|
)
|
|
22
|
-
from
|
|
22
|
+
from ponkan.transport.libusb_async import AsyncTransferCallback
|
|
23
23
|
|
|
24
24
|
if TYPE_CHECKING:
|
|
25
|
-
from
|
|
25
|
+
from ponkan.transport.d3xx_native import D3xxNativeHandleProvider
|
|
26
26
|
|
|
27
27
|
NativeBufferFactory = Callable[[int], ctypes.Array[ctypes.c_char]]
|
|
28
28
|
|
|
@@ -167,7 +167,7 @@ class D3xxNativeFastPathBackend:
|
|
|
167
167
|
self._native_api.set_stream_pipe(self._pipe, self._read_size)
|
|
168
168
|
self._pump = Thread(
|
|
169
169
|
target=self._completion_pump,
|
|
170
|
-
name="
|
|
170
|
+
name="ponkan-d3xx-native-stream",
|
|
171
171
|
)
|
|
172
172
|
self._pump.start()
|
|
173
173
|
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/d3xx_streaming.py
RENAMED
|
@@ -5,10 +5,10 @@ from concurrent.futures import Future, ThreadPoolExecutor, wait
|
|
|
5
5
|
from threading import Event, Lock
|
|
6
6
|
from typing import Protocol
|
|
7
7
|
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
8
|
+
from ponkan.protocol.sizes import N3DSXL_BULK_IN_ENDPOINT
|
|
9
|
+
from ponkan.streaming.buffers import RawFrameSlot
|
|
10
|
+
from ponkan.transport.d3xx_backend import D3XX_DEFAULT_TIMEOUT_MS, D3xxBackendError
|
|
11
|
+
from ponkan.transport.libusb_async import AsyncTransferCallback
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class D3xxAsyncBackendConfigError(ValueError):
|
|
@@ -95,7 +95,7 @@ class D3xxAsyncBackend:
|
|
|
95
95
|
self._timeout_ms = timeout_ms
|
|
96
96
|
self._executor = ThreadPoolExecutor(
|
|
97
97
|
max_workers=max_workers,
|
|
98
|
-
thread_name_prefix="
|
|
98
|
+
thread_name_prefix="ponkan-d3xx-stream",
|
|
99
99
|
)
|
|
100
100
|
self._cancel_requested = Event()
|
|
101
101
|
self._lock = Lock()
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/ftd3_backend.py
RENAMED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Literal, Protocol, cast
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
5
|
+
from ponkan.devices.n3dsxl_ftd3 import DeviceCandidate, N3DSXLDevice
|
|
6
|
+
from ponkan.errors import DeviceOpenError
|
|
7
|
+
from ponkan.transport.ftd3_pipe import FTD3_COMMAND_TIMEOUT_MS, Ftd3Pipe
|
|
8
|
+
from ponkan.transport.libusb_backend import LibusbBackend
|
|
9
9
|
|
|
10
10
|
BackendKind = Literal["libusb", "d3xx"]
|
|
11
11
|
|
{ponkan_python-0.1.0/src/py3dscapture → ponkan_python-0.1.1/src/ponkan}/transport/ftd3_pipe.py
RENAMED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from struct import pack
|
|
4
4
|
from typing import Final
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
6
|
+
from ponkan.devices.n3dsxl_ftd3 import N3DSXLDevice
|
|
7
|
+
from ponkan.errors import Ftd3CommandContext, Ftd3CommandError, UnsupportedDevice
|
|
8
|
+
from ponkan.protocol.sizes import N3DSXL_FTD3_COMMAND_PIPE_ID
|
|
9
9
|
|
|
10
10
|
FTD3_COMMAND_CREATE_PIPE_ID: Final = 0x82
|
|
11
11
|
FTD3_COMMAND_TIMEOUT_MS: Final = 500
|