macss 0.1.0__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.
@@ -0,0 +1 @@
1
+ include macss/libScreenCapture.dylib
macss-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: macss
3
+ Version: 0.1.0
4
+ Summary: A zero-copy, 60fps macOS ScreenCaptureKit wrapper optimized for Apple Silicon.
5
+ Author: HummingNerd
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: MacOS :: MacOS X
9
+ Classifier: Environment :: MacOS X
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: numpy>=1.20.0
macss-0.1.0/README.md ADDED
File without changes
@@ -0,0 +1,3 @@
1
+ from .macss import macss
2
+
3
+ __all__ = ["macss"]
Binary file
@@ -0,0 +1,69 @@
1
+ import ctypes
2
+ import time
3
+ import numpy as np
4
+ import os
5
+
6
+ class macss:
7
+ def __init__(self, monitor=None, exclude_self=True, exclude_window_name=""):
8
+ current_dir = os.path.dirname(os.path.abspath(__file__))
9
+ lib_path = os.path.join(current_dir, 'libScreenCapture.dylib')
10
+
11
+ self.lib = ctypes.CDLL(lib_path)
12
+ self.lib.init_capture.argtypes = [ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32)]
13
+
14
+ self.lib.start_stream.argtypes = [
15
+ ctypes.POINTER(ctypes.c_uint8),
16
+ ctypes.POINTER(ctypes.c_uint64),
17
+ ctypes.POINTER(ctypes.c_int32),
18
+ ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.c_int32,
19
+ ctypes.c_int32,
20
+ ctypes.c_char_p
21
+ ]
22
+
23
+ full_w = ctypes.c_int32()
24
+ full_h = ctypes.c_int32()
25
+ self.lib.init_capture(ctypes.byref(full_w), ctypes.byref(full_h))
26
+
27
+ if monitor:
28
+ self.crop_y = monitor.get("top", 0)
29
+ self.crop_x = monitor.get("left", 0)
30
+ self.w = monitor.get("width", full_w.value)
31
+ self.h = monitor.get("height", full_h.value)
32
+ else:
33
+ self.crop_x, self.crop_y = 0, 0
34
+ self.w, self.h = full_w.value, full_h.value
35
+
36
+ self.exclude_pid = os.getpid() if exclude_self else 0
37
+ self.exclude_window_name_c = exclude_window_name.encode('utf-8') if exclude_window_name else None
38
+
39
+ max_size = self.w * self.h * 8
40
+ self.buffer = np.empty(max_size, dtype=np.uint8)
41
+ self.ptr = self.buffer.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8))
42
+
43
+ self.frame_counter = ctypes.c_uint64(0)
44
+ self.bpr = ctypes.c_int32(0)
45
+ self.raw_image_view = None
46
+
47
+ def __enter__(self):
48
+ self.lib.start_stream(
49
+ self.ptr,
50
+ ctypes.byref(self.frame_counter),
51
+ ctypes.byref(self.bpr),
52
+ self.crop_x, self.crop_y, self.w, self.h,
53
+ self.exclude_pid,
54
+ self.exclude_window_name_c
55
+ )
56
+
57
+ while self.frame_counter.value == 0:
58
+ time.sleep(0.01)
59
+
60
+ frame_size = self.h * self.bpr.value
61
+ self.raw_image_view = self.buffer[:frame_size].reshape((self.h, self.bpr.value // 4, 4))
62
+
63
+ return self
64
+
65
+ def __exit__(self, exc_type, exc_val, exc_tb):
66
+ self.lib.stop_stream()
67
+
68
+ def grab(self):
69
+ return self.raw_image_view[:, :self.w, :]
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: macss
3
+ Version: 0.1.0
4
+ Summary: A zero-copy, 60fps macOS ScreenCaptureKit wrapper optimized for Apple Silicon.
5
+ Author: HummingNerd
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: MacOS :: MacOS X
9
+ Classifier: Environment :: MacOS X
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: numpy>=1.20.0
@@ -0,0 +1,11 @@
1
+ MANIFEST.in
2
+ README.md
3
+ pyproject.toml
4
+ macss/__init__.py
5
+ macss/libScreenCapture.dylib
6
+ macss/macss.py
7
+ macss.egg-info/PKG-INFO
8
+ macss.egg-info/SOURCES.txt
9
+ macss.egg-info/dependency_links.txt
10
+ macss.egg-info/requires.txt
11
+ macss.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ numpy>=1.20.0
@@ -0,0 +1 @@
1
+ macss
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "macss"
7
+ version = "0.1.0"
8
+ description = "A zero-copy, 60fps macOS ScreenCaptureKit wrapper optimized for Apple Silicon."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ authors = [
13
+ {name = "HummingNerd"}
14
+ ]
15
+ dependencies = [
16
+ "numpy>=1.20.0",
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Operating System :: MacOS :: MacOS X",
21
+ "Environment :: MacOS X"
22
+ ]
23
+
24
+ [tool.setuptools]
25
+ # This line is the critical fix! It tells the builder exactly which folder to pack.
26
+ packages = ["macss"]
27
+ include-package-data = true
macss-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+