Cleaning + best practices (#84)

pull/144/head
Alex 3 years ago committed by GitHub
parent 8d24685ecd
commit 95c214035e

@ -54,6 +54,9 @@ echo ""
echo "Gstreamer last stderr logs........................."
tail -22 /tmp/gstreamer*.stderr
echo ""
echo "FFMPEG head logs..................................."
head /tmp/ffmpeg*.stderr
echo ""
echo "FFMPEG last stderr logs............................"
tail -22 /tmp/ffmpeg*.stderr

@ -1,5 +1,6 @@
The patcher now supports every scenarios including gstreamer (credits to @nap-liu).
The patcher now supports every scenario including gstreamer (credits to @nap-liu).
A process leak was identified and fixed, performances should be better when changing video time.
A new version of the wrapper was deployed (v2.1).
You can find the changelog here: https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher/releases/tag/2.1
As always, please let me know of any issue you could have.

@ -13,30 +13,32 @@ errcode=0
# UTILS
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
log() {
local now
now=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$now] [$1] $2" >> $stderrfile
}
function newline() {
newline() {
echo "" >> $stderrfile
}
function info() {
info() {
log "INFO" "$1"
}
function handle_error() {
handle_error() {
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
}
function endprocess() {
endprocess() {
info "========================================[end ffmpeg $pid]"
newline
rm -f "$stderrfile"
if [[ "$child" != "" ]]; then
kill -9 "$child"
kill "$child"
fi
exit $errcode
@ -51,11 +53,11 @@ trap handle_error ERR
newline
info "========================================[start ffmpeg $pid]"
info "DEFAULT_ARGS: $*"
info "DEFAULT ARGS: $*"
/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" <&0 2> $stderrfile &
/var/packages/@ffmpeg_version@/target/bin/ffmpeg "$@" <&0 2>> $stderrfile &
child=$!
wait $child
wait "$child"
endprocess

@ -13,30 +13,32 @@ errcode=0
# UTILS
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
log() {
local now
now=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$now] [$1] $2" >> $stderrfile
}
function newline() {
newline() {
echo "" >> $stderrfile
}
function info() {
info() {
log "INFO" "$1"
}
function handle_error() {
handle_error() {
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
}
function endprocess() {
endprocess() {
info "========================================[end gst $pid]"
newline
rm "$stderrfile"
if [[ "$child" != "" ]]; then
kill -9 "$child"
kill "$child"
fi
exit $errcode
@ -53,9 +55,9 @@ newline
info "========================================[start gst-inspect $pid]"
info "GST_ARGS: $*"
/var/packages/VideoStation/target/bin/gst-inspect-1.0.orig "$@" 2> $stderrfile &
/var/packages/VideoStation/target/bin/gst-inspect-1.0.orig "$@" 2>> $stderrfile &
child=$!
wait $child
wait "$child"
endprocess

@ -13,30 +13,32 @@ errcode=0
# UTILS
#########################
function log() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [$1] $2" >> $stderrfile
log() {
local now
now=$(date '+%Y-%m-%d %H:%M:%S')
echo "[$now] [$1] $2" >> $stderrfile
}
function newline() {
newline() {
echo "" >> $stderrfile
}
function info() {
info() {
log "INFO" "$1"
}
function handle_error() {
handle_error() {
log "ERROR" "An error occurred"
newline
errcode=1
endprocess
}
function endprocess() {
endprocess() {
info "========================================[end gst $pid]"
newline
rm "$stderrfile"
if [[ "$child" != "" ]]; then
kill -9 "$child"
kill "$child"
fi
exit $errcode
@ -53,9 +55,9 @@ newline
info "========================================[start gst-launch $pid]"
info "GST_ARGS: $*"
/var/packages/VideoStation/target/bin/gst-launch-1.0.orig "$@" 2> $stderrfile &
/var/packages/VideoStation/target/bin/gst-launch-1.0.orig "$@" 2>> $stderrfile &
child=$!
wait $child
wait "$child"
endprocess
Loading…
Cancel
Save