aboutgitcodebugslistschat
path: root/test/lib/video
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-29 16:45:26 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-29 16:45:26 +0200
commit4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f (patch)
treeb6ca61dc46e087e04f9d1f8390fcf4186aa0a670 /test/lib/video
parenta8b767b06dbb431b82f894c601beb1290e84ee2f (diff)
downloadpasst-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar.gz
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar.bz2
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar.lz
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar.xz
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.tar.zst
passt-4e5129719d77ad6950989fc8b5c2a36ae4c2ec2f.zip
test: Record CI and demo videos in Xvfb by default, fix demo setup sequence
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib/video')
-rwxr-xr-xtest/lib/video16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/lib/video b/test/lib/video
index fd5849b..d4c0680 100755
--- a/test/lib/video
+++ b/test/lib/video
@@ -73,17 +73,23 @@ video_grab() {
echo "${VIDEO_LINKS_TEMPLATE}" > "${BASEPATH}/${VIDEO_NAME}.js"
- __x=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left X:[ ]*\([0-9]*\)$/\1/p')
- __y=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left Y:[ ]*\([0-9]*\)$/\1/p')
- __width=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Width:[ ]*\([0-9]*\)$/\1/p')
- __height=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Height:[ ]*\([0-9]*\)$/\1/p')
+ if [ ${XVFB} -eq 1 ]; then
+ # Grab the geometry of the first window that's at least 100px wide
+ eval $(xwininfo -d :99.0 -root -tree | sed -n 's/^[ ]*0x[0-f]*[^0-9]*\([0-9]\{3,\}\)x\([0-9]*\)+\([0-9]*\)+\([0-9]*\).*/__width=\1; __height=\2; __x=\3; __y=\4;/p')
+ else
+ __x=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left X:[ ]*\([0-9]*\)$/\1/p')
+ __y=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Absolute upper-left Y:[ ]*\([0-9]*\)$/\1/p')
+ __width=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Width:[ ]*\([0-9]*\)$/\1/p')
+ __height=$(xwininfo -id $(xdotool getactivewindow) | sed -n 's/[ ]*Height:[ ]*\([0-9]*\)$/\1/p')
+ fi
[ $((__width % 2)) ] && __width=$((__width - 1))
[ $((__height % 2)) ] && __height=$((__height - 1))
sleep 3
VIDEO_START_SECONDS=$(sed -n 's/\([0-9]*\).[0-9]* [0-9]*.[0-9]*/\1/p' /proc/uptime)
- ffmpeg -f x11grab -framerate 15 -video_size "${__width}x${__height}" -i "+${__x},${__y}" -vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p -draw_mouse 0 "${BASEPATH}/${VIDEO_NAME}.mp4" & echo $! > "${FFMPEG_PID_FILE}"
+ [ ${XVFB} -eq 1 ] && __disp=":99.0" || __disp=
+ ffmpeg -f x11grab -framerate 15 -video_size "${__width}x${__height}" -i "${__disp}+${__x},${__y}" -vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv444p -draw_mouse 0 "${BASEPATH}/${VIDEO_NAME}.mp4" & echo $! > "${FFMPEG_PID_FILE}"
}
# video_time_now() - Print current video timestamp, in seconds