File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import typing
3
+ from pygrabber .dshow_graph import FilterGraph
3
4
4
5
is_nt = True if os .name == "nt" else False
5
6
7
+
8
+ def list_camera_names ():
9
+ graph = FilterGraph ()
10
+ cam_list = graph .get_input_devices ()
11
+ cam_names = []
12
+ for index , name in enumerate (cam_list ):
13
+ cam_names .append (name )
14
+ return cam_names
15
+
16
+
17
+ def get_camera_index_by_name (name ):
18
+ graph = FilterGraph ()
19
+ cam_list = graph .get_input_devices ()
20
+
21
+ for i , device_name in enumerate (cam_list ):
22
+ if device_name == name :
23
+ return i
24
+
25
+ return None
26
+
27
+
6
28
def PlaySound (* args , ** kwargs ): pass
29
+
30
+
7
31
SND_FILENAME = SND_ASYNC = 1
8
32
9
33
if is_nt :
10
34
import winsound
35
+
11
36
PlaySound = winsound .PlaySound
12
37
SND_FILENAME = winsound .SND_FILENAME
13
- SND_ASYNC = winsound .SND_ASYNC
38
+ SND_ASYNC = winsound .SND_ASYNC
You can’t perform that action at this time.
0 commit comments