+usage() {
+ cat <<EOF
+usage: $(basename $0) [OPTIONS] <output_file> [<ximagesrc_options>]
+
+Screencast script based on GStreamer.
+
+Options:
+ --audio record audio from pulsesrc
+ --frame include the window manager border, without the shadows
+ --pointer capture the mouse pointer
+ --single-shot capture a single snapshot as a PNG instead of a video
+ -h, --help display this usage message and exit
+
+EOF
+}
+
+CAPTURE_AUDIO=0
+WINDOW_FRAME=0
+SHOW_POINTER=0
+SINGLE_SHOT=0
+
+while [ $# -gt 0 ];
+do
+ case "$1" in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ --audio)
+ CAPTURE_AUDIO=1
+ ;;
+ --frame)
+ WINDOW_FRAME=1
+ ;;
+ --pointer)
+ SHOW_POINTER=1
+ ;;
+ --single-shot)
+ SINGLE_SHOT=1
+ ;;
+ -*)
+ echo "Error: Unknown option '${1}'" 1>&2
+ ;;
+ *)
+ break;
+ esac
+ shift
+done