diff --git a/dts-patch.tar.gz b/dts-patch.tar.gz deleted file mode 100755 index e0a7569..0000000 Binary files a/dts-patch.tar.gz and /dev/null differ diff --git a/gstreamer-patch.tar.gz b/gstreamer-patch.tar.gz new file mode 100755 index 0000000..fb3c97c Binary files /dev/null and b/gstreamer-patch.tar.gz differ diff --git a/gstreamer-wrapper.sh b/gstreamer-wrapper.sh new file mode 100644 index 0000000..a145587 --- /dev/null +++ b/gstreamer-wrapper.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +######################### +# VARS +######################### + +pid=$$ +stderrfile="/tmp/gstreamer.stderr" +logfile="/tmp/gstreamer.log" + +######################### +# UTILS +######################### + +function log() { + echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $logfile +} +function newline() { + echo "" >> $logfile +} +function info() { + log "INFO" "$1" +} + +function handle_error() { + log "ERROR" "Error on line $(caller)" + endprocess +} + +function endprocess() { + info "========================================[end gst-launch $pid]" + newline + # rm -f "$stderrfile" + exit 1 +} + +######################### +# ENTRYPOINT +######################### + +trap endprocess SIGTERM +trap handle_error ERR + +newline +info "========================================[start gst-launch $pid]" +info "DEFAULT_ARGS: $*" + +export LD_LIBRARY_PATH=/var/packages/VideoStation/target/lib/patch/lib/ +export GST_PLUGIN_PATH=/var/packages/VideoStation/target/lib/patch/plugins/ + +/var/packages/VideoStation/target/bin/gst-launch-1.0.orig "$@" 2>> $stderrfile + diff --git a/patcher.sh b/patcher.sh index 1738dc2..50a41b4 100755 --- a/patcher.sh +++ b/patcher.sh @@ -10,21 +10,24 @@ version="2.0" action="patch" branch="master" dependencies=("VideoStation" "ffmpeg") -wrappers=("ffmpeg") +wrappers=("ffmpeg" "gstreamer") vs_path=/var/packages/VideoStation/target -vs_lib_path="$vs_path/lib/gstreamer" +vs_lib_path="$vs_path/lib" libsynovte_path="$vs_path/lib/libsynovte.so" # CodecPack path cp_path=/var/packages/CodecPack/target cp_bin_path="$cp_path/bin" -cp_lib_path="$cp_path/lib/gstreamer" +cp_lib_path="$cp_path/lib" + +patch_package="gstreamer-patch.tar.gz" cp_to_patch=( "ffmpeg41:ffmpeg" "ffmpeg27:ffmpeg" "ffmpeg33:ffmpeg" + "gst-launch-1.0:gst-launch-1.0" ) ############################### @@ -129,22 +132,21 @@ function patch() { info "Enabling eac3, dts and truehd" sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' "$libsynovte_path" + info "Downloading gstreamer patch" + wget -q -O - "$repo_base_url/raw/branch/$branch/$patch_package" > "/tmp/$patch_package" - info "Downloading gstreamer dts patch" - wget -q -O - "$repo_base_url/raw/branch/$branch/dts-patch.tar.gz" > /tmp/dts-patch.tar.gz - - # patch CodecPack & VideoStation gstreamer plugin - info "Patching gstreamer plugin" - tar -xzvf /tmp/dts-patch.tar.gz -C $vs_lib_path; - tar -xzvf /tmp/dts-patch.tar.gz -C $cp_lib_path; - info "Patching dts patch done" + # patch VideoStation gstreamer plugin + info "Patching gstreamer" + tar -xzvf "/tmp/$patch_package" -C $vs_lib_path; + # tar -xzvf "/tmp/$patch_package" -C $cp_lib_path; + info "Patching gstreamer done" # force refresh gstreamer plugin cache rm -rf /var/packages/VideoStation/etc/gstreamer-1.0/registry.aarch64.bin - rm -rf /var/packages/CodecPack/etc/gstreamer-1.0/registry.aarch64.bin + # rm -rf /var/packages/CodecPack/etc/gstreamer-1.0/registry.aarch64.bin info "Refresh gstreamer plugin cache done" - rm /tmp/dts-patch.tar.gz + rm "/tmp/$patch_package" restart_packages