mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
pic2m2v: implement as a script
The C code was only calling ffmpeg binary anyway... Additionally create a md5 sum of the input file to avoid unnecessary conversions.
This commit is contained in:
@@ -5,5 +5,11 @@ bin_PROGRAMS += spark_fp
|
|||||||
spark_fp_SOURCES = spark_fp.c
|
spark_fp_SOURCES = spark_fp.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS += pic2m2v
|
# no longer use the compiled code...
|
||||||
|
noinst_PROGRAMS = pic2m2v
|
||||||
pic2m2v_SOURCES = pic2m2v.c
|
pic2m2v_SOURCES = pic2m2v.c
|
||||||
|
|
||||||
|
# ...use the script instead.
|
||||||
|
# hack...
|
||||||
|
install-exec-hook:
|
||||||
|
install -D -m 0755 $(srcdir)/pic2m2v.sh $(DESTDIR)$(bindir)/pic2m2v
|
||||||
|
40
tools/pic2m2v.sh
Normal file
40
tools/pic2m2v.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# creates still-mpegs from pictures, to be able to display them
|
||||||
|
# using a hardware video decoder. Does about the same as pic2m2v.c
|
||||||
|
# (C) 2013 Stefan Seyfried
|
||||||
|
# License: GPLv2+
|
||||||
|
#
|
||||||
|
if grep -q TRIPLEDRAGON /proc/cpuinfo; then
|
||||||
|
RES=704x576
|
||||||
|
else
|
||||||
|
RES=1280x720
|
||||||
|
fi
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
IN=$1
|
||||||
|
test -z "$IN" && break
|
||||||
|
shift
|
||||||
|
OUT="/var/cache/`echo ${IN#/}|sed 's@/@.@g'`"
|
||||||
|
MD5=${OUT}.md5
|
||||||
|
M2V=${OUT}.m2v
|
||||||
|
# $MD5 not existing => return code != 0
|
||||||
|
if [ -s $M2V ] && md5sum -c -s $MD5 > /dev/null 2>&1; then
|
||||||
|
echo "$IN is unchanged"
|
||||||
|
touch -r $IN $M2V
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! [ -e $IN ]; then
|
||||||
|
echo "$IN does not exist!"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "converting $IN -> $M2V"
|
||||||
|
ffmpeg -v 31 -y -f mjpeg -i $IN -s $RES $M2V < /dev/null
|
||||||
|
if ! [ -s $M2V ]; then
|
||||||
|
echo "$M2V does not exist - conversion error?"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# set the time identical to input file
|
||||||
|
touch -r $IN $M2V
|
||||||
|
md5sum $IN > $MD5
|
||||||
|
done
|
Reference in New Issue
Block a user