11#! /bin/bash
22set -e
33
4+ # Set variables based on OS
5+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
6+ LIB_EXT=" so"
7+ VIDEO_SINK=" xvimagesink"
8+ elif [[ " $OSTYPE " == " darwin" * ]]; then
9+ LIB_EXT=" dylib"
10+ VIDEO_SINK=" osxvideosink"
11+ else
12+ echo " Unsupported OS!"
13+ exit 1
14+ fi
15+
416# ------------
517# FUNCTIONS
618
@@ -52,10 +64,8 @@ build() {
5264 cmake --build " $1 " --config " Release" --parallel
5365
5466 # Move to dist
55- if [ -f " $1 /libgstprojectm.so" ] ; then
56- mv " $1 /libgstprojectm.so" " $2 "
57- elif [ -f " $1 /libgstprojectm.dylib" ] ; then
58- mv " $1 /libgstprojectm.dylib" " $2 "
67+ if [ -f " $1 /libgstprojectm.$LIB_EXT " ] ; then
68+ mv " $1 /libgstprojectm.$LIB_EXT " " $2 "
5969 else
6070 echo " Build failed!"
6171 exit 1
@@ -65,7 +75,7 @@ build() {
6575# Prompt user to install build
6676prompt_install () {
6777 # Install to gstreamer plugin, if found
68- if [ -f " $2 /libgstprojectm.so " ] || [ -f " $2 /libgstprojectm.dylib " ]; then
78+ if [ -f " $2 /libgstprojectm.$LIB_EXT " ]; then
6979 if [ " $1 " = false ] ; then
7080 echo
7181 echo -n " Install to gstreamer plugins? (Y/n): "
@@ -79,10 +89,8 @@ prompt_install() {
7989 mkdir -p " $HOME /.local/share/gstreamer-1.0/plugins/"
8090
8191 # Move the file to the destination, overwriting if it exists
82- if [ -f " $2 /libgstprojectm.so" ] ; then
83- mv " $2 /libgstprojectm.so" " $HOME /.local/share/gstreamer-1.0/plugins/"
84- elif [ -f " $2 /libgstprojectm.dylib" ] ; then
85- mv " $2 /libgstprojectm.dylib" " $HOME /.local/share/gstreamer-1.0/plugins/"
92+ if [ -f " $2 /libgstprojectm.$LIB_EXT " ] ; then
93+ mv " $2 /libgstprojectm.$LIB_EXT " " $HOME /.local/share/gstreamer-1.0/plugins/"
8694 else
8795 echo " Install failed!"
8896 exit 1
@@ -91,11 +99,11 @@ prompt_install() {
9199 # Print example command
92100 echo
93101 echo " Done! Here's an example command:"
94- echo ' gst-launch-1.0 audiotestsrc ! queue ! audioconvert ! projectm ! "video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! xvimagesink sync=false'
102+ echo " gst-launch-1.0 audiotestsrc ! queue ! audioconvert ! projectm ! " video/x-raw,width=512,height=512,framerate=60/1" ! videoconvert ! $VIDEO_SINK sync=false"
95103 else
96104 echo
97105 echo " Done!"
98- echo ' You can install the plugin manually by moving <dist/libgstprojectm.so > to <$HOME/.local/share/gstreamer-1.0/plugins/libgstprojectm.so> '
106+ echo " You can install the plugin manually by moving <dist/libgstprojectm.$LIB_EXT > to <$HOME /.local/share/gstreamer-1.0/plugins/libgstprojectm.$LIB_EXT > "
99107 fi
100108 else
101109 echo " Install failed!"
0 commit comments