summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--omxplayer/APKBUILD59
-rw-r--r--omxplayer/default-font.patch26
-rw-r--r--omxplayer/fix-makefile.patch32
-rw-r--r--omxplayer/issue-260.patch16
-rw-r--r--omxplayer/issue-297.patch78
-rw-r--r--omxplayer/omxplayer.confd3
-rw-r--r--omxplayer/omxplayer.initd34
7 files changed, 248 insertions, 0 deletions
diff --git a/omxplayer/APKBUILD b/omxplayer/APKBUILD
new file mode 100644
index 0000000..498df2f
--- /dev/null
+++ b/omxplayer/APKBUILD
@@ -0,0 +1,59 @@
+# Maintainer: Timo Teräs <timo.teras@iki.fi>
+pkgname=omxplayer
+pkgver=0.20190102
+_commitid=f06235cc9690a6d58187514452df8cf8fcdaacec
+pkgrel=1
+pkgdesc="Commandline OMX player for Raspberry Pi"
+url="https://github.com/popcornmix/omxplayer"
+arch="armhf armv7 aarch64"
+license="GPL-2.0"
+depends="ttf-freefont"
+makedepends="linux-headers raspberrypi-dev>=0.20181212 ffmpeg-dev pcre-dev
+ boost-dev freetype-dev dbus-dev alsa-lib-dev"
+install=""
+options="!check"
+subpackages="$pkgname-doc $pkgname-dbg $pkgname-openrc"
+source="omxplayer-$pkgver.tar.gz::https://github.com/popcornmix/omxplayer/archive/$_commitid.tar.gz
+ issue-260.patch
+ issue-297.patch
+ fix-makefile.patch
+ default-font.patch
+
+ omxplayer.initd
+ omxplayer.confd
+ "
+
+builddir="$srcdir"/$pkgname-$_commitid
+
+build() {
+ cd "$builddir"
+ cat <<EOF > Makefile.include
+INCLUDES:=-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux
+INCLUDES+=$(pkg-config --cflags freetype2 dbus-1)
+LDFLAGS:=-L/opt/vc/lib -Wl,-rpath,/opt/vc/lib
+LIBS:=$(pkg-config --libs freetype2 dbus-1)
+STRIP:=echo
+EOF
+ make omxplayer.bin
+}
+
+package() {
+ cd "$builddir"
+ mkdir -p $pkgdir/usr/bin $pkgdir/usr/share/doc/omxplayer
+ cp omxplayer.bin $pkgdir/usr/bin/omxplayer
+ cp COPYING $pkgdir/usr/share/doc/omxplayer
+ cp README.md $pkgdir/usr/share/doc/omxplayer/README
+
+ install -m755 -D "$srcdir"/$pkgname.initd \
+ "$pkgdir"/etc/init.d/$pkgname
+ install -m644 -D "$srcdir"/$pkgname.confd \
+ "$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="8ed9714c8dd7de7bdeeaefd4f37dbf2840899e9a289cb18080750c93b878ef01a04c141eaf86d2cfae0b999bcc8e080ac1aac0930d55440c6e4d02e3b0eb93b2 omxplayer-0.20190102.tar.gz
+c349eea5f7c513a07d82a6cf6467c4d21bcb29c053bc5e39d8f675b1212db9beef0abf5248d50ac5a2f14fda73055786f94f421377ffcf5f6bcf8daa2f1b56e8 issue-260.patch
+2a8a6def1e09f726cba58c0b9109fa6c4fbd4a3b4f1d27d200488f262a0e0978579d83db7fe24f1d3e03beef318c3674ed79cbd2f1994c4551a59c9fe0f63489 issue-297.patch
+3493d9600fda75a7599fada332c48e8790dcc46ada65b862bb14dafb701dd7ed89f3debf439160917b73d779f549898146b394e13c45dc7d77122a11a2ede97e fix-makefile.patch
+8aa58aaa07453186302dc68d92f28c1b50bf0f8fccd50359640a7fc8339b233b32a0c8c02284a9974599e56d69cc557acc25e76e6438c6d64d15afd9c1788a8e default-font.patch
+3ddd32235d87a46478d0237ee9b253edeb75729e377b09a33069ecdca2ee230d2851f308897ee75ff69a9f3bdd2876f490bc1667a572dce1c186f80fddcf6df3 omxplayer.initd
+4f906ada035869a0e515e7615056b18b0f6906ce4b3a2d34081c0efa79bb9455380f729e7c5270180f5ace89c53a7ac7c93f609e6761825f639f44aa22346bb2 omxplayer.confd"
diff --git a/omxplayer/default-font.patch b/omxplayer/default-font.patch
new file mode 100644
index 0000000..b140e90
--- /dev/null
+++ b/omxplayer/default-font.patch
@@ -0,0 +1,26 @@
+--- omxplayer-7af21f596378e5efeceebedff9c4a298e2d06d98.orig/omxplayer.cpp
++++ omxplayer-7af21f596378e5efeceebedff9c4a298e2d06d98/omxplayer.cpp
+@@ -88,8 +88,8 @@
+ bool m_osd = true;
+ std::string m_external_subtitles_path;
+ bool m_has_external_subtitles = false;
+-std::string m_font_path = "/usr/share/fonts/truetype/freefont/FreeSans.ttf";
+-std::string m_italic_font_path = "/usr/share/fonts/truetype/freefont/FreeSansOblique.ttf";
++std::string m_font_path = "/usr/share/fonts/TTF/FreeSans.ttf";
++std::string m_italic_font_path = "/usr/share/fonts/TTF/FreeSansOblique.ttf";
+ std::string m_dbus_name = "org.mpris.MediaPlayer2.omxplayer";
+ bool m_asked_for_font = false;
+ bool m_asked_for_italic_font = false;
+--- omxplayer-6ee9a0a5488119786990b6f91990d59d6e35427c/README.md.orig
++++ omxplayer-6ee9a0a5488119786990b6f91990d59d6e35427c/README.md
+@@ -80,8 +80,8 @@
+ --no-osd Do not display status information on screen
+ --no-keys Disable keyboard input (prevents hangs for certain TTYs)
+ --subtitles path External subtitles in UTF-8 srt format
+- --font path Default: /usr/share/fonts/truetype/freefont/FreeSans.ttf
+- --italic-font path Default: /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
++ --font path Default: /usr/share/fonts/TTF/FreeSans.ttf
++ --italic-font path Default: /usr/share/fonts/TTF/FreeSansOblique.ttf
+ --font-size size Font size in 1/1000 screen height (default: 55)
+ --align left/center Subtitle alignment (default: left)
+ --no-ghost-box No semitransparent boxes behind subtitles
diff --git a/omxplayer/fix-makefile.patch b/omxplayer/fix-makefile.patch
new file mode 100644
index 0000000..445c936
--- /dev/null
+++ b/omxplayer/fix-makefile.patch
@@ -0,0 +1,32 @@
+--- omxplayer-a447d4fd42252ff7c341ac8eb3123c77a8dbf52b.orig/Makefile
++++ omxplayer-a447d4fd42252ff7c341ac8eb3123c77a8dbf52b/Makefile
+@@ -1,11 +1,14 @@
+-CFLAGS=-pipe -mfloat-abi=hard -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -g -mstructure-size-boundary=32 -mno-sched-prolog
++CFLAGS=-pipe -fomit-frame-pointer -Wno-psabi -mno-apcs-stack-check -g -mstructure-size-boundary=32 -mno-sched-prolog
+ CFLAGS+=-std=c++0x -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DTARGET_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CMAKE_CONFIG -D__VIDEOCORE4__ -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_OPT_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H -DOMX -DOMX_SKIP64BIT -ftree-vectorize -DUSE_EXTERNAL_OMX -DTARGET_RASPBERRY_PI -DUSE_EXTERNAL_LIBBCM_HOST
+
+ LDFLAGS=-L$(SDKSTAGE)/opt/vc/lib/
+ LDFLAGS+=-L./ -Lffmpeg_compiled/usr/local/lib/ -lc -lbrcmGLESv2 -lbrcmEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
++LDFLAGS+=-L./ -Wl,-rpath,/opt/vc/lib/
++LIBS+=-lWFC -lGLESv2 -lEGL -lbcm_host -lopenmaxil -lfreetype -lz -lasound
+
+-INCLUDES+=-I./ -Ilinux -Iffmpeg_compiled/usr/local/include/ -I /usr/include/dbus-1.0 -I /usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/freetype2 -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
+
++INCLUDES+=-I./ -Ilinux $(shell pkg-config --cflags dbus-1 freetype2) -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads
++
+ DIST ?= omxplayer-dist
+ STRIP ?= strip
+
+@@ -50,10 +53,10 @@
+ omxplayer.o: help.h keys.h
+
+ version:
+- bash gen_version.sh > version.h
++ sh gen_version.sh > version.h
+
+ omxplayer.bin: version $(OBJS)
+- $(CXX) $(LDFLAGS) -o omxplayer.bin $(OBJS) -lvchiq_arm -lvchostif -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
++ $(CXX) $(LDFLAGS) -o omxplayer.bin $(OBJS) $(LIBS) -lvchiq_arm -lvcos -ldbus-1 -lrt -lpthread -lavutil -lavcodec -lavformat -lswscale -lswresample -lpcre
+ $(STRIP) omxplayer.bin
+
+ help.h: README.md Makefile
diff --git a/omxplayer/issue-260.patch b/omxplayer/issue-260.patch
new file mode 100644
index 0000000..4e8e77a
--- /dev/null
+++ b/omxplayer/issue-260.patch
@@ -0,0 +1,16 @@
+https://github.com/popcornmix/omxplayer/issues/260
+
+Not a fix, but improves the situation a little bit.
+
+--- omxplayer-6ee9a0a5488119786990b6f91990d59d6e35427c.orig/omxplayer.cpp
++++ omxplayer-6ee9a0a5488119786990b6f91990d59d6e35427c/omxplayer.cpp
+@@ -1543,6 +1543,9 @@
+ }
+ }
+
++ if (audio_pts < stamp) audio_pts = DVD_NOPTS_VALUE;
++ if (video_pts < stamp) video_pts = DVD_NOPTS_VALUE;
++
+ float audio_fifo = audio_pts == DVD_NOPTS_VALUE ? 0.0f : audio_pts / DVD_TIME_BASE - stamp * 1e-6;
+ float video_fifo = video_pts == DVD_NOPTS_VALUE ? 0.0f : video_pts / DVD_TIME_BASE - stamp * 1e-6;
+ float threshold = std::min(0.1f, (float)m_player_audio.GetCacheTotal() * 0.1f);
diff --git a/omxplayer/issue-297.patch b/omxplayer/issue-297.patch
new file mode 100644
index 0000000..4a2cf1d
--- /dev/null
+++ b/omxplayer/issue-297.patch
@@ -0,0 +1,78 @@
+diff --git a/OMXReader.cpp b/OMXReader.cpp
+index df15a01..97ed20f 100644
+--- a/OMXReader.cpp
++++ b/OMXReader.cpp
+@@ -261,9 +261,6 @@ bool OMXReader::Open(std::string filename, bool dump_format, bool live /* =false
+ if(/*m_bAVI || */m_bMatroska)
+ m_pFormatContext->max_analyze_duration = 0;
+
+- if (live)
+- m_pFormatContext->flags |= AVFMT_FLAG_NOBUFFER;
+-
+ result = m_dllAvFormat.avformat_find_stream_info(m_pFormatContext, NULL);
+ if(result < 0)
+ {
+diff --git a/OMXVideo.cpp b/OMXVideo.cpp
+index acd055e..b69f451 100644
+--- a/OMXVideo.cpp
++++ b/OMXVideo.cpp
+@@ -670,6 +670,8 @@ bool COMXVideo::Open(OMXClock *clock, const OMXVideoConfig &config)
+ float fAspect = m_config.hints.aspect ? (float)m_config.hints.aspect / (float)m_config.hints.width * (float)m_config.hints.height : 1.0f;
+ m_pixel_aspect = fAspect / m_config.display_aspect;
+
++ PortSettingsChanged();
++
+ return true;
+ }
+
+diff --git a/omxplayer.cpp b/omxplayer.cpp
+index c03760b..071fb60 100644
+--- a/omxplayer.cpp
++++ b/omxplayer.cpp
+@@ -1642,30 +1642,33 @@ int main(int argc, char *argv[])
+ latency = audio_fifo;
+ else if (!m_has_audio && m_has_video && video_pts != DVD_NOPTS_VALUE)
+ latency = video_fifo;
+- if (!m_Pause && latency != DVD_NOPTS_VALUE)
++ if (!m_Pause && (m_omx_reader.IsEof() || latency != DVD_NOPTS_VALUE))
+ {
+ if (m_av_clock->OMXIsPaused())
+ {
+- if (latency > m_threshold)
++ if (m_omx_reader.IsEof() || latency > m_threshold)
+ {
+ CLog::Log(LOGDEBUG, "Resume %.2f,%.2f (%d,%d,%d,%d) EOF:%d PKT:%p\n", audio_fifo, video_fifo, audio_fifo_low, video_fifo_low, audio_fifo_high, video_fifo_high, m_omx_reader.IsEof(), m_omx_pkt);
+ m_av_clock->OMXResume();
+- m_latency = latency;
++ if (latency > 0)
++ m_latency = latency;
+ }
+ }
+ else
+ {
+- m_latency = m_latency*0.99f + latency*0.01f;
+ float speed = 1.0f;
+- if (m_latency < 0.5f*m_threshold)
+- speed = 0.990f;
+- else if (m_latency < 0.9f*m_threshold)
+- speed = 0.999f;
+- else if (m_latency > 2.0f*m_threshold)
+- speed = 1.010f;
+- else if (m_latency > 1.1f*m_threshold)
+- speed = 1.001f;
+-
++ if (latency != DVD_NOPTS_VALUE)
++ {
++ m_latency = m_latency*0.99f + latency*0.01f;
++ if (m_latency < 0.5f*m_threshold)
++ speed = 0.990f;
++ else if (m_latency < 0.9f*m_threshold)
++ speed = 0.999f;
++ else if (m_latency > 2.0f*m_threshold)
++ speed = 1.010f;
++ else if (m_latency > 1.1f*m_threshold)
++ speed = 1.001f;
++ }
+ m_av_clock->OMXSetSpeed(S(speed));
+ m_av_clock->OMXSetSpeed(S(speed), true, true);
+ CLog::Log(LOGDEBUG, "Live: %.2f (%.2f) S:%.3f T:%.2f\n", m_latency, latency, speed, m_threshold);
diff --git a/omxplayer/omxplayer.confd b/omxplayer/omxplayer.confd
new file mode 100644
index 0000000..8baf0a6
--- /dev/null
+++ b/omxplayer/omxplayer.confd
@@ -0,0 +1,3 @@
+# OMXPLAYER_OPTS="--live"
+# OMXPLAYER_URL="http://10.0.0.1/"
+# OMXPLAYER_DELAY=5
diff --git a/omxplayer/omxplayer.initd b/omxplayer/omxplayer.initd
new file mode 100644
index 0000000..70af0e5
--- /dev/null
+++ b/omxplayer/omxplayer.initd
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+
+depend() {
+ after net firewall chrony
+}
+
+omxplayer_run_loop() {
+ while true; do
+ /usr/bin/omxplayer "$@"
+ status=$?
+ echo "exited: $status"
+ [ "$status" -eq 129 ] && exit 0
+ [ "$status" -ne 0 ] && sleep ${OMXPLAYER_DELAY:-5}
+ done
+}
+
+checkconfig() {
+ [ -z "$OMXPLAYER_URL" ] && eerror "omxplayer URL not set"
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting omxplayer"
+ omxplayer_run_loop ${OMXPLAYER_OPTS} "${OMXPLAYER_URL}" 2>&1 | logger -t omxplayer &
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping omxplayer"
+ killall -HUP omxplayer
+ eend $?
+}
+