Skip to content

Commit

Permalink
specify Linux & Mac display in .ini file instead of hardcode
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed May 12, 2019
1 parent 6f5c139 commit beb850a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pylivestream/stream.py
Expand Up @@ -233,10 +233,7 @@ def screengrab(self, quick: bool = False) -> List[str]:
"""
grab video from desktop.
May not work for Wayland desktop.
NOTE: Linux assumes DISPLAY :0.0
"""
DISPLAY = ":0.0"

v: List[str] = ['-f', self.vcap]

Expand All @@ -249,9 +246,9 @@ def screengrab(self, quick: bool = False) -> List[str]:

if sys.platform == 'linux':
if quick:
v += ['-i', DISPLAY]
v += ['-i', self.screenchan]
else:
v += ['-i', f'{DISPLAY}+{self.origin[0]},{self.origin[1]}']
v += ['-i', f'{self.screenchan}+{self.origin[0]},{self.origin[1]}']
elif sys.platform == 'win32':
if not quick:
v += ['-offset_x', str(self.origin[0]), '-offset_y', str(self.origin[1])]
Expand Down
1 change: 1 addition & 0 deletions stream.ini
Expand Up @@ -30,6 +30,7 @@ vcap: avfoundation
hcam: avfoundation
[linux]
webcamchan: /dev/video0
screenchan: :0.0
audiochan: default
vcap: x11grab
acap: pulse
Expand Down
1 change: 1 addition & 0 deletions tests/test.ini
Expand Up @@ -29,6 +29,7 @@ audiochan: default
vcap: avfoundation
hcam: avfoundation
[linux]
screenchan: :0.0
webcamchan: /dev/video0
audiochan: default
vcap: x11grab
Expand Down

0 comments on commit beb850a

Please sign in to comment.