This repository was archived by the owner on Jun 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
430 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
MIT License | ||
|
||
Copyright (C) 2021 Elliot Killick <[email protected]> | ||
Copyright (C) 2021 Demi Marie Obenour <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,12 @@ Source: https://github.com/elliotkillick/qubes-video-companion | |
|
||
Files: * | ||
Copyright: 2021 Elliot Killick <[email protected]> | ||
2021 Demi Marie Obenour <[email protected]> | ||
License: MIT | ||
MIT License | ||
. | ||
Copyright (C) 2021 Elliot Killick <[email protected]> | ||
Copyright (C) 2021 Demi Marie Obenour <[email protected]> | ||
. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,7 @@ | ||
#!/bin/bash | ||
#!/bin/sh -- | ||
|
||
# Copyright (C) 2021 Elliot Killick <[email protected]> | ||
# Copyright (C) 2021 Demi Marie Obenour <[email protected]> | ||
# Licensed under the MIT License. See LICENSE file for details. | ||
|
||
[ "$DEBUG" == 1 ] && set -x | ||
|
||
set -E # Enable function inheritance of traps | ||
trap exit ERR | ||
|
||
export DISPLAY=":0" | ||
|
||
first_connected_screen_input_dimensions="$(xrandr | grep -w "connected" | head -1 | cut -d '+' -f 1 | awk '{ print $NF }')" | ||
|
||
width="$(echo "$first_connected_screen_input_dimensions" | awk -F x '{ print $1 }')" | ||
height="$(echo "$first_connected_screen_input_dimensions" | awk -F x '{ print $2 }')" | ||
|
||
fps="30" | ||
frame_rate="$fps/1" | ||
|
||
echo "$width $height $fps" | ||
|
||
echo "Starting screen sharing at ${width}x${height} ${fps} FPS..." >&2 | ||
|
||
# shellcheck source=../../ui/ui.sh | ||
source "/usr/share/qubes-video-companion/ui/ui.sh" | ||
trap 'remove_ui $!' EXIT | ||
create_ui screenshare | ||
|
||
gst-launch-1.0 -q ximagesrc use-damage=false ! \ | ||
queue ! \ | ||
"video/x-raw,width=$width,height=$height,framerate=$frame_rate,format=BGRx" ! \ | ||
videoconvert ! \ | ||
"video/x-raw,format=I420" ! \ | ||
fdsink | ||
export DISPLAY=:0 | ||
exec python3 -- /usr/share/qubes-video-companion/sender/screenshare.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,7 @@ | ||
#!/bin/bash | ||
#!/bin/sh -- | ||
|
||
# Copyright (C) 2021 Elliot Killick <[email protected]> | ||
# Copyright (C) 2021 Demi Marie Obenour <[email protected]> | ||
# Licensed under the MIT License. See LICENSE file for details. | ||
|
||
[ "$DEBUG" == 1 ] && set -x | ||
|
||
set -E # Enable function inheritance of traps | ||
trap exit ERR | ||
|
||
webcam_device="/dev/video0" | ||
# This command exits with code 255 even though no error is reported | ||
v4l2_webcam_info="$(v4l2-ctl -d "$webcam_device" --all)" || [ $? == 255 ] | ||
|
||
dimensions="$(echo "$v4l2_webcam_info" | grep 'Width/Height' | awk '{ print $3 }')" | ||
width="$(echo "$dimensions" | awk -F / '{ print $1 }')" | ||
height="$(echo "$dimensions" | awk -F / '{ print $2 }')" | ||
|
||
frame_rate="$(v4l2-ctl -d "$webcam_device" --all | grep 'Frames per second' | awk '{ print $5 }' | tr -d '()')" | ||
fps="$(echo "$frame_rate" | awk -F / '{ print $1 }')" # Support a minimum of one frame per second | ||
|
||
echo "$width $height $fps" | ||
|
||
echo "Starting webcam stream at ${width}x${height} ${fps} FPS..." >&2 | ||
|
||
# shellcheck source=../../ui/ui.sh | ||
source "/usr/share/qubes-video-companion/ui/ui.sh" | ||
trap 'remove_ui $!' EXIT | ||
create_ui webcam | ||
|
||
gst-launch-1.0 -q v4l2src ! \ | ||
queue ! \ | ||
jpegdec ! \ | ||
"video/x-raw,width=$width,height=$height,framerate=$frame_rate" ! \ | ||
fdsink | ||
export DISPLAY=:0 | ||
exec python3 -- /usr/share/qubes-video-companion/sender/webcam.py |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/python3 -- | ||
|
||
# Copyright (C) 2021 Elliot Killick <[email protected]> | ||
# Copyright (C) 2021 Demi Marie Obenour <[email protected]> | ||
# Licensed under the MIT License. See LICENSE file for details. | ||
|
||
import sys | ||
import struct | ||
import os | ||
from typing import NoReturn | ||
|
||
def main(argv) -> NoReturn: | ||
if len(argv) != 1: | ||
raise RuntimeError('should not have any arguments') | ||
|
||
width, height, fps = read_video_parameters() | ||
|
||
print('Receiving video stream at {}x{} {} FPS...'.format(width, height, fps), | ||
file=sys.stderr) | ||
os.execv('/usr/bin/gst-launch-1.0', ( | ||
'gst-launch-1.0', | ||
'fdsrc', | ||
'!', | ||
'queue', | ||
'!', | ||
'capsfilter', | ||
'caps=video/x-raw,' | ||
'width={0},' | ||
'height={1},' | ||
'framerate={2}/1,' | ||
'format=I420,' | ||
'colorimetry=2:4:7:1,' | ||
'chroma-site=none,' | ||
'interlace-mode=progressive,' | ||
'pixel-aspect-ratio=1/1,' | ||
'max-framerate={2}/1,' | ||
'views=1'.format(width, height, fps), | ||
'!', | ||
'rawvideoparse', | ||
'use-sink-caps=true', | ||
'!', | ||
'v4l2sink', | ||
'device=/dev/video0', | ||
'sync=false', | ||
)) | ||
|
||
def read_video_parameters() -> (int, int, int): | ||
input_size = 6 | ||
|
||
s = struct.Struct('=HHH') | ||
if s.size != input_size: | ||
raise AssertionError('bug') | ||
|
||
untrusted_input = os.read(0, input_size) | ||
if len(untrusted_input) != input_size: | ||
raise RuntimeError('wrong number of bytes read') | ||
untrusted_width, untrusted_height, untrusted_fps = s.unpack(untrusted_input) | ||
del untrusted_input | ||
|
||
if untrusted_width > 4096 or untrusted_height > 4096 or untrusted_fps > 4096: | ||
raise RuntimeError('excessive width, height, and/or fps') | ||
width, height, fps = untrusted_width, untrusted_height, untrusted_fps | ||
del untrusted_width, untrusted_height, untrusted_fps | ||
|
||
return width, height, fps | ||
|
||
if __name__ == '__main__': | ||
main(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,12 +57,12 @@ make DESTDIR=%{?buildroot} install-dom0 install-license | |
%{_sysconfdir}/qubes-rpc/qvc.ScreenShare | ||
%{_sysconfdir}/qubes-rpc/policy/qvc.Webcam | ||
%{_sysconfdir}/qubes-rpc/policy/qvc.ScreenShare | ||
%{_datadir}/qubes-video-companion/ui/ui.sh | ||
%{_datadir}/qubes-video-companion/ui/main.py | ||
%{_datadir}/qubes-video-companion/ui/user_interface.py | ||
%{_datadir}/qubes-video-companion/ui/notification.py | ||
%{_datadir}/qubes-video-companion/ui/tray_icon.py | ||
%{_datadir}/qubes-video-companion/scripts/set-webcam-format.sh | ||
%{_sysconfdir}/qubes/rpc-config/qvc.Webcam | ||
%{_sysconfdir}/qubes/rpc-config/qvc.ScreenShare | ||
%{_datadir}/qubes-video-companion/sender/service.py | ||
%{_datadir}/qubes-video-companion/sender/webcam.py | ||
%{_datadir}/qubes-video-companion/sender/screenshare.py | ||
%{_datadir}/qubes-video-companion/sender/tray_icon.py | ||
|
||
%changelog | ||
* Wed Feb 17 2021 Elliot Killick <[email protected]> 1.0.0-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.