9e2ff950b4be65c6e079df81e1454f5a6f57ad6f
[gst-am7xxxsink.git] / src / gst-am7xxx-play.sh
1 #!/bin/sh
2
3 set -e
4
5 SRC="$1"
6 URI="${2:-http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v}"
7
8 usage() {
9   echo "usage: $(basename $0) [test|ximage|uri [URI]|v4l2|help]"
10 }
11
12 case "$SRC" in
13   test)
14     INPUT="videotestsrc ! video/x-raw,width=1920,height=1080"
15     ;;
16
17   ximage)
18     # without use-damage=0 ximagesrc is very slow, see:
19     # https://bugzilla.gnome.org/show_bug.cgi?id=693037
20     INPUT="ximagesrc use-damage=0 show-pointer=1 ! video/x-raw,framerate=30/1"
21     ;;
22
23   uri)
24     DECODER="dec"
25     INPUT="uridecodebin uri=$URI name=$DECODER ${DECODER}."
26     ;;
27
28   v4l2)
29     INPUT="v4l2src always-copy=FALSE ! video/x-raw,width=640,height=480"
30     ;;
31
32   help|-h|--help)
33     usage
34     exit 0
35     ;;
36
37   *)
38     usage 1>&2
39     exit 1
40     ;;
41 esac
42
43 JPEG_FORMAT=1
44
45 if [ $JPEG_FORMAT -eq 1 ];
46 then
47   # am7xxx devices doesn't like jpegs with subsampling other than 420
48   ENCODER="! video/x-raw,format=I420 ! jpegenc"
49 fi
50
51 VIDEOCONVERT="videorate ! videoscale add-borders=1 ! videoconvert $ENCODER"
52
53 VIDEOSINK="am7xxxsink"
54 #VIDEOSINK="autovideosink"
55 #VIDEOSINK="fpsdisplaysink text-overlay=false video-sink=$VIDEOSINK"
56
57 VIDEO_OUT="$VIDEOCONVERT ! $VIDEOSINK"
58
59 if [ "x$DECODER" != "x" ];
60 then
61   AUDIO_OUT="${DECODER}. ! audioconvert ! autoaudiosink"
62 fi
63
64 LANG=C \
65 GST_DEBUG=am7xxxsink:6 \
66 GST_PLUGIN_PATH=$(pwd) \
67 gst-launch-1.0 $INPUT ! $VIDEO_OUT $AUDIO_OUT