~ci-train-bot/miral/miral-ubuntu-zesty-2299

« back to all changes in this revision

Viewing changes to miral-shell/miral-screencast.sh

  • Committer: Bileto Bot
  • Date: 2016-11-30 08:40:00 UTC
  • mfrom: (340.1.2 miral-release)
  • Revision ID: ci-train-bot@canonical.com-20161130084000-q9mfvwqsbdr078ec
* New upstream release 0.5.0 (https://launchpad.net/miral/+milestone/0.5)
  - ABI summary:
    . miral ABI unchanged at 1
  - Enhancements:
    . Add miral::DebugExtension allowing shells to enable & disable support
      for debug extension API(s) dynamically
    . Improve handling of fullscreen surfaces when switching outputs, or
      specified output doesn't exist (any more)
    . Initial tests and some fixes for tracking of active window.
    . Document the order of windows passed to
      WindowManagementPolicy::advise_raise() so clients can rely on it.
    . [examples] Add miral-desktop script for launching a pseudo-desktop
    . [examples] Add miral-screencast - a utility script to assist with
      creating a screencast
    . [examples: miral-shell --window-manager tiling] implement the layout
      suggested in "Tasks for the interested reader"
    . [examples: miral-shell --window-manager tiling] Don't place a tile
      until the first window is ready
    . [examples: miral-kiosk] Provide configuration options for kiosk:
      --keymap --kiosk-maximize-root-windows & --kiosk-startup-apps-only
  - Bugs fixed:
    . Display configuration changes may cause "fatal errors" when there are
      fullscreen windows (LP: #1640557)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
width=1920
 
3
height=1080
 
4
output=screencast.mp4
 
5
socket=${XDG_RUNTIME_DIR}/mir_socket
 
6
if [ -v MIR_SERVER ]; then socket=${MIR_SERVER}; fi
 
7
 
 
8
while [ $# -gt 0 ]
 
9
do
 
10
  if [ "$1" == "--help" -o "$1" == "-h" ]
 
11
  then
 
12
    echo "$(basename $0) - screencast capture script for use with Mir servers"
 
13
    echo "Usage: $0 [options]"
 
14
    echo "Options are:"
 
15
    echo "    --width   set the capture width   [${width}]"
 
16
    echo "    --height  set the capture height  [${height}]"
 
17
    echo "    --output  set the output filename [${output}]"
 
18
    echo "    --socket  set the mir socket      [${socket}]"
 
19
    exit 0
 
20
  elif [ "$1" == "--socket" ]; then shift; socket=$1
 
21
  elif [ "$1" == "--output" ]; then shift; output=$1
 
22
  elif [ "$1" == "--width"  ]; then shift; width=$1
 
23
  elif [ "$1" == "--height" ]; then shift; height=$1
 
24
  fi
 
25
  shift
 
26
done
 
27
 
 
28
echo width = ${width}
 
29
echo height = ${height}
 
30
echo output = ${output}
 
31
echo socket = ${socket}
 
32
 
 
33
if ! which mirscreencast >> /dev/null ; then echo "Need mirscreencast - run \"sudo apt install mir-utils\""; exit 1 ;fi
 
34
if ! which mencoder >> /dev/null ;      then echo "Need mencoder - run \"sudo apt install mencoder\""; exit 1 ;fi
 
35
 
 
36
if [ -e ${output} ]; then echo "Output exists, moving to ${output}~"; mv ${output} ${output}~ ;fi
 
37
while [ ! -e "${socket}" ]; do echo "waiting for ${socket}"; sleep 1 ;done
 
38
 
 
39
tempfile=$(mktemp)
 
40
mirscreencast --size ${width} ${height} -m ${socket} -f ${tempfile}& mirscreencast_pid=$!
 
41
trap 'kill ${mirscreencast_pid}; rm -f -- "${tempfile}"; exit 0' INT TERM HUP EXIT
 
42
 
 
43
sleep 1; # don't lose the next message in the spew from mirscreencast
 
44
read -rsp $'\n\nPress enter when recording complete...'
 
45
 
 
46
mencoder -demuxer rawvideo -rawvideo fps=60:w=${width}:h=${height}:format=bgra -ovc x264 -o ${output} ${tempfile}