Skip to content

Commit

Permalink
cast specific display, faster screen grab backend, disable stacking s…
Browse files Browse the repository at this point in the history
…ame key in one ips
  • Loading branch information
bitrate16 committed May 5, 2023
1 parent 45fbcae commit b438345
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 32 deletions.
51 changes: 42 additions & 9 deletions httprd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

VERSION = '3.2'
VERSION = '3.3'

import json
import aiohttp
import aiohttp.web
import argparse
import mss
import base64
import gzip
import PIL
Expand All @@ -36,7 +37,7 @@
from io import BytesIO

# Const config
DOWNSAMPLE = PIL.Image.BILINEAR
DOWNSAMPLE = PIL.Image.NEAREST
# Minimal amount of partial frames to be sent before sending full repaint frame to avoid fallback to full repaint on long delay channels
MIN_PARTIAL_FRAMES_BEFORE_FULL_REPAINT = 60
# Minimal amount of empty frames to be sent before sending full repaint frame to avoid fallback to full repaint on long delay channels
Expand Down Expand Up @@ -146,7 +147,7 @@ async def async_worker():
viewport_height = 0

try:

# Write frames at desired framerate
async for msg in ws:

Expand All @@ -169,10 +170,34 @@ async def async_worker():
quality = decode_int8(payload[4:5])

# Grab frame
if args.fullscreen:
image = PIL.ImageGrab.grab(bbox=None, include_layered_windows=False, all_screens=True)
else:
image = PIL.ImageGrab.grab()
with mss.mss() as sct:
# Can not screenshot
if len(sct.monitors) == 0:
buffer.write(encode_int8(0x00))

buflen = buffer.tell()
buffer.seek(0)
mbytes = buffer.read(buflen)

await ws.send_bytes(mbytes)

# Can screenshot
if args.fullscreen:
l, t = sct.monitors[0][:2]
r, b = sct.monitors[0][2:]

for m in sct.monitors:
l = m[0] if l is None or l > m[0] else l
t = m[1] if t is None or t > m[1] else t
r = m[2] if r is None or r > m[2] else r
b = m[3] if b is None or b > m[3] else b

dims = [ l, t, r, b ]
else:
dims = sct.monitors[args.display % len(sct.monitors)]

sct_img = sct.grab(dims)
image = PIL.Image.frombytes("RGB", sct_img.size, sct_img.bgra, "raw", "BGRX")

# Real dimensions
real_width, real_height = image.width, image.height
Expand Down Expand Up @@ -233,7 +258,7 @@ async def async_worker():

# Input request
if packet_type == 0x03:

# Skip non-control access
if not has_control_access:
continue
Expand Down Expand Up @@ -302,7 +327,7 @@ async def async_worker():


# Encoded page hoes here
INDEX_CONTENT = gzip.decompress(base64.b85decode('ABzY8-ziaK0{`ti>w4QpuK)EEQ)f>_HL@(pv7K0!`=!2Yyp0oYWViLn`m-r=XfdWph8N3f>Id0<ynT`b3}(pTMY7X0e@^>-iAi8E7z_pjU@p|oB$;}<jhzWMZFnSZ;_=;Ar>7_H_IK6@YV1sTVlr!DMlnx@D`%&NtIt;e9Vc@vwoL!ljM=Bg%(aurHtTh}|1)SzxO+WG6m;MC4hWpUPgWgs>U#5SHVynB4o!;>2tSh*#(`&J1r)3ekUd|{Iy7zD^{=;CchH!c(Y5P~*Zam3+cmx58fu3@>?Upi1?D&oyflF}mvH=b)%9(Dx6NL3fl(5Kf}zKqM7-E;9C{}7!14GU2oHZ(Z8zc;HDN&mQ-9F-kj9DY%vUYw9QUEB1%G)oXqcXR?XS8CpT;>d7k8IEi6^EV%)UhMUY+1$)4I8ig4DM`C@+Y%*^_R!yH#pj$_uUM?D}0z&%KCGYneHYvw#=83R_Y(5WBx}VAR<VtZ39$$3c<=Q;<}m7jbfeXj(Rjdl;45j_Zdh7?{gF8weg4rzn_7<Sa5lQ+|NYnsF0Gx;o~`jB`KJzh!!sfsM0Op^+A-B#3Mdiby7|&tSM*n>{g2M>o-jdR*?sF7wPW_s|q_9{t7CfcgDBzeZr0EXaMA2^_RiV*#A=C2AN4cR2E*7eoXaxEp*%*JR_{li-#|C<1a6lLZ>z+HzPoyvzT0$Wj9sKR1~p`>l<Kd7Gf6TP~Pa`vGk{$l-l55BYFqoWkJxD;FBWs=~ImxG;1uHphL)Rf*nYGoEIlv><{ay$Dt0c&M3)YujkK`qUF7RvN`9Mi{u{h0++tB<3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bJn!DbFn|pi48c`tz~!!Z}^!H<z#OS9MMw=0aTv$@FzJb#5hPZ?m&<JP+K+Dhz31$f%UX0ch%`;#Vxda^k=WJles+y`E^N!T!z~vnXo72*VS6<<9#0l3&1Ji*?z?^(?w+R(`k#e)1PSBG~xmLi}Bs5&pObtzFLF9b*m}`1tX0Hea&6*Cu{4Td|%PxxN|B&nUNQn3x>WVxUn$9QYF+Mc}J}R?A8&Dbd9MneJ&S>4cR7VQ%WFtr+>cJ1f5JmS2N6s$z>=aLSk<(sY408a<nS&LTS=sQi+>$?&nePCspfpGeE!16miqCHKF&7J&^?P5=M'.encode())).decode('utf-8')


# handler for /
Expand All @@ -318,12 +343,20 @@ async def get__root(request: aiohttp.web.Request):


if __name__ == '__main__':
# Validator
def check_positive(value):
ivalue = int(value)
if ivalue < 0:
raise argparse.ArgumentTypeError(f'{ ivalue } should be positive int')
return ivalue

# Args
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--port', type=int, default=7417, metavar='{1..65535}', choices=range(1, 65535), help='server port')
parser.add_argument('--password', type=str, default=None, help='password for remote control session')
parser.add_argument('--view_password', type=str, default=None, help='password for view only session (can only be set if --password is set)')
parser.add_argument('--fullscreen', action='store_true', default=False, help='enable multi-display screen capture')
parser.add_argument('--display', type=check_positive, default=0, help='display id for streaming')
args = parser.parse_args()

# Post-process args
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
aiohttp
pyautogui
Pillow
mss
Loading

0 comments on commit b438345

Please sign in to comment.