xbmc: bump version to 13.0-Gotham
v8 cover xbmc: bump version to 13.0-Gotham
the patch series combines my latest patches to bump xbmc. It also adds uClibc support to xbmc, a mesa3d version bump and several new packages to support the new xbmc release along with libva to get the best out of Intel systems.
Regards, Bernd
v8: - squashed "[v7 29/31] ffmpeg cross-compile" into
"[v8 16/28] Gotham bump" (Thomas)
- squashed "[v7 21/31] uclibc at arm" & "[v7 31/31] ipv6" patches into "[v8 20/28] uclibc" patch (Thomas/Yann)
- xbmc-pvr-addons: updated comment (Yann)
v7: - rebased
- bump mesa3d version to 10.2-rc3
- included v2 of "xproto_dri3proto: New package"
v6: - bump mesa3d version to 10.2-rc2
- bump libva and libva-intel-driver to 1.3.1
Bernd Kuhls (28):
xproto_dri3proto: New package
mesa3d: Bump version to 10.2-rc3
mesa3d: Depend on xorg meta package instead of xserver_xorg-server
mesa3d: add dependency xproto_presentproto
mesa3d: Remove dependency for the libxml2 module of host-python
mesa3d: Add dri3 support
mesa3d: dri2 does not need udev support
libva: new package
libva-intel-driver: new package
ffmpeg: Add libva support
libglu: new package
libglew: new package
sdl: Add new dependency libglu for opengl support
xdriver_xf86-video-intel: Bump version to 2.99.911
rtmpdump: Add KSV patch
xbmc: bump version to 13.0
xbmc-pvr-addons: Version bump to xbmc Gotham-compatible addon
xbmc-addon-xvdr: Version bump to xbmc Gotham-compatible addon
xbmc: Add host-gettext dependency
xbmc: Allow compilation with uClibc
xbmc: Add X.org/OpenGL support
xbmc: Add VA-API support
xbmc: Add alsa support
xbmc: Add lame support
xbmc: Disable broken rsxs screensaver
xbmc: Add option for Goom screensaver
xbmc: add nasm/yasm dependency
xbmc: Fix TexturePacker compile
package/libdrm/Config.in | 1 - package/x11r7/xlib_libXfont/xlib_libXfont.mk | 2 +- .../xlib_libXpm/xlib_libXpm-0001-detect-fork.patch | 66 -------------------- package/x11r7/xlib_libXpm/xlib_libXpm.mk | 1 - 4 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 package/x11r7/xlib_libXpm/xlib_libXpm-0001-detect-fork.patch
Signature · 1 line
1.7.10.4
PATCH v8 1/28 xproto_dri3proto: New package
--- package/x11r7/Config.in | 1 + package/x11r7/xproto_dri3proto/Config.in | 4 ++++ package/x11r7/xproto_dri3proto/xproto_dri3proto.mk | 15 +++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 package/x11r7/xproto_dri3proto/Config.in create mode 100644 package/x11r7/xproto_dri3proto/xproto_dri3proto.mk
package/x11r7/Config.in +1 -0
@@ -227,6 +227,7 @@ if BR2_PACKAGE_XORG7 source package/x11r7/xproto_damageproto/Config.in source package/x11r7/xproto_dmxproto/Config.in source package/x11r7/xproto_dri2proto/Config.in + source package/x11r7/xproto_dri3proto/Config.in source package/x11r7/xproto_fixesproto/Config.in source package/x11r7/xproto_fontcacheproto/Config.in source package/x11r7/xproto_fontsproto/Config.in
package/x11r7/xproto_dri3proto/Config.in new file +4 -0
@@ -0,0 +1,4 @@ +config BR2_PACKAGE_XPROTO_DRI3PROTO + bool "dri3proto" + help + X.Org DRI3 protocol headers
package/x11r7/xproto_dri3proto/xproto_dri3proto.mk new file +15 -0
@@ -0,0 +1,15 @@ +################################################################################ +# +# xproto_dri3proto +# +################################################################################ + +XPROTO_DRI3PROTO_VERSION = 1.0 +XPROTO_DRI3PROTO_SOURCE = dri3proto-$(XPROTO_DRI3PROTO_VERSION).tar.bz2 +XPROTO_DRI3PROTO_SITE = http://xorg.freedesktop.org/releases/individual/proto +XPROTO_DRI3PROTO_LICENSE = MIT +XPROTO_DRI3PROTO_LICENSE_FILES = COPYING +XPROTO_DRI3PROTO_INSTALL_STAGING = YES +XPROTO_DRI3PROTO_INSTALL_TARGET = NO + +$(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH v8 2/28 mesa3d: Bump version to 10.2-rc3
In reply to Bernd Kuhls--- package/mesa3d/mesa3d.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/mesa3d/mesa3d.mk +2 -2
@@ -4,8 +4,8 @@ # ################################################################################ -MESA3D_VERSION = 10.0.4 -MESA3D_SOURCE = MesaLib-$(MESA3D_VERSION).tar.bz2 +MESA3D_VERSION = 10.2 +MESA3D_SOURCE = MesaLib-$(MESA3D_VERSION).0-rc3.tar.bz2 MESA3D_SITE = ftp://ftp.freedesktop.org/pub/mesa/$(MESA3D_VERSION) MESA3D_LICENSE = MIT, SGI, Khronos MESA3D_LICENSE_FILES = docs/license.html
Signature · 1 line
1.7.10.4
PATCH v8 3/28 mesa3d: Depend on xorg meta package instead of xserver_xorg-server
In reply to Bernd Kuhls--- package/mesa3d/Config.in | 22 +++++++++++----------- package/mesa3d/mesa3d.mk | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-)
package/mesa3d/Config.in +11 -11
@@ -3,13 +3,13 @@ menuconfig BR2_PACKAGE_MESA3D select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_EXPAT select BR2_PACKAGE_HOST_LIBXML2_PYTHON - select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_LIBXCB if BR2_PACKAGE_XSERVER_XORG_SERVER + select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_LIBXCB if BR2_PACKAGE_XORG7 depends on BR2_INSTALL_LIBSTDCPP depends on BR2_LARGEFILE depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
@@ -61,10 +61,10 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST This is a software opengl implementation using the Gallium3D infrastructure. -comment "DRI drivers needs an X.Org server and a toolchain w/ dynamic library" - depends on BR2_PREFER_STATIC_LIB || !BR2_PACKAGE_XSERVER_XORG_SERVER +comment "DRI drivers needs X.Org and a toolchain w/ dynamic library" + depends on BR2_PREFER_STATIC_LIB || !BR2_PACKAGE_XORG7 -if !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XSERVER_XORG_SERVER +if !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XORG7 comment "DRI drivers"
@@ -91,7 +91,7 @@ config BR2_PACKAGE_MESA3D_DRI_DRIVER_RADEON help Legacy Radeon driver for R100 series GPUs. -endif # !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XSERVER_XORG_SERVER +endif # !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XORG7 if BR2_PACKAGE_MESA3D_DRIVER
package/mesa3d/mesa3d.mk +2 -2
@@ -23,7 +23,7 @@ MESA3D_DEPENDENCIES = \ host-xutil_makedepend \ libdrm -ifeq ($(BR2_PACKAGE_XSERVER_XORG_SERVER),y) +ifeq ($(BR2_PACKAGE_XORG7),y) MESA3D_DEPENDENCIES += \ xproto_xf86driproto \ xproto_dri2proto \
@@ -92,7 +92,7 @@ ifeq ($(BR2_PACKAGE_WAYLAND),y) MESA3D_DEPENDENCIES += wayland MESA3D_EGL_PLATFORMS += wayland endif -ifeq ($(BR2_PACKAGE_XSERVER_XORG_SERVER),y) +ifeq ($(BR2_PACKAGE_XORG7),y) MESA3D_EGL_PLATFORMS += x11 endif MESA3D_CONF_OPT += \
Signature · 1 line
1.7.10.4
PATCH v8 3/28 mesa3d: Depend on xorg meta package instead of xserver_xorg-server
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 1 line
Signed-off-by Bernd Kuhls <[email protected]>
It would be nice if you could provide a bit more details in the commit log. I fail to see the reason for this change.
Care to expand a bit the commit log, please?
Regards,
Yann E. MORIN.
Quoted 82 lines
--- package/mesa3d/Config.in | 22 +++++++++++----------- package/mesa3d/mesa3d.mk | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-)package/mesa3d/Config.in +11
-11@@ -3,13 +3,13 @@ menuconfig BR2_PACKAGE_MESA3D select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_EXPAT select BR2_PACKAGE_HOST_LIBXML2_PYTHON - select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XSERVER_XORG_SERVER - select BR2_PACKAGE_LIBXCB if BR2_PACKAGE_XSERVER_XORG_SERVER + select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXDAMAGE if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_LIBXCB if BR2_PACKAGE_XORG7 depends on BR2_INSTALL_LIBSTDCPP depends on BR2_LARGEFILE depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL@@ -61,10 +61,10 @@ config BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST This is a software opengl implementation using the Gallium3D infrastructure. -comment "DRI drivers needs an X.Org server and a toolchain w/ dynamic library" - depends on BR2_PREFER_STATIC_LIB || !BR2_PACKAGE_XSERVER_XORG_SERVER +comment "DRI drivers needs X.Org and a toolchain w/ dynamic library" + depends on BR2_PREFER_STATIC_LIB || !BR2_PACKAGE_XORG7 -if !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XSERVER_XORG_SERVER +if !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XORG7 comment "DRI drivers"@@ -91,7 +91,7 @@ config BR2_PACKAGE_MESA3D_DRI_DRIVER_RADEON help Legacy Radeon driver for R100 series GPUs. -endif # !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XSERVER_XORG_SERVER +endif # !BR2_PREFER_STATIC_LIB && BR2_PACKAGE_XORG7 if BR2_PACKAGE_MESA3D_DRIVERpackage/mesa3d/mesa3d.mk +2
-2@@ -23,7 +23,7 @@ MESA3D_DEPENDENCIES = \ host-xutil_makedepend \ libdrm -ifeq ($(BR2_PACKAGE_XSERVER_XORG_SERVER),y) +ifeq ($(BR2_PACKAGE_XORG7),y) MESA3D_DEPENDENCIES += \ xproto_xf86driproto \ xproto_dri2proto \@@ -92,7 +92,7 @@ ifeq ($(BR2_PACKAGE_WAYLAND),y) MESA3D_DEPENDENCIES += wayland MESA3D_EGL_PLATFORMS += wayland endif -ifeq ($(BR2_PACKAGE_XSERVER_XORG_SERVER),y) +ifeq ($(BR2_PACKAGE_XORG7),y) MESA3D_EGL_PLATFORMS += x11 endif MESA3D_CONF_OPT += \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 3/28 mesa3d: Depend on xorg meta package instead of xserver_xorg-server
"Yann E. MORIN" <[email protected]> wrote in news:20140517195636.GD3459 at free.fr:
Quoted 4 lines
It would be nice if you could provide a bit more details in the commit log. I fail to see the reason for this change.
Care to expand a bit the commit log, please?
Hi,
v9 will carry this small note:
"mesa3d does not depend on the xorg server as such, only on X libraries."
Is it enough?
Regards, Bernd
PATCH v8 3/28 mesa3d: Depend on xorg meta package instead of xserver_xorg-server
Bernd, All,
On 2014-05-17 22:50 +0200, Bernd Kuhls spake thusly:
Quoted 6 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140517195636.GD3459 at free.fr:
Quoted 3 lines
It would be nice if you could provide a bit more details in the commit log. I fail to see the reason for this change.
Quoted 8 lines
Quoted 1 line
Care to expand a bit the commit log, please?
Hi,
v9 will carry this small note:
"mesa3d does not depend on the xorg server as such, only on X libraries."Is it enough?
Yes, good! Thanks! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 4/28 mesa3d: add dependency xproto_presentproto
In reply to Bernd Kuhls--- package/mesa3d/Config.in | 1 + package/mesa3d/mesa3d.mk | 1 + 2 files changed, 2 insertions(+)
package/mesa3d/Config.in +1 -0
@@ -4,6 +4,7 @@ menuconfig BR2_PACKAGE_MESA3D select BR2_PACKAGE_EXPAT select BR2_PACKAGE_HOST_LIBXML2_PYTHON select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XPROTO_PRESENTPROTO if BR2_PACKAGE_XORG7 select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XORG7 select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7 select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XORG7
package/mesa3d/mesa3d.mk +1 -0
@@ -28,6 +28,7 @@ MESA3D_DEPENDENCIES += \ xproto_xf86driproto \ xproto_dri2proto \ xproto_glproto \ + xproto_presentproto \ xlib_libX11 \ xlib_libXext \ xlib_libXdamage \
Signature · 1 line
1.7.10.4
PATCH v8 5/28 mesa3d: Remove dependency for the libxml2 module of host-python
In reply to Bernd KuhlsRemove the ugly BR2_PACKAGE_HOST_LIBXML2_PYTHON hack as well as mesa3d was the only package needing it, this is not the case anymore since:
--- package/libxml2/Config.in | 3 --- package/libxml2/libxml2-python2.patch | 27 --------------------------- package/libxml2/libxml2.mk | 14 -------------- package/mesa3d/Config.in | 1 - package/mesa3d/mesa3d.mk | 1 - 5 files changed, 46 deletions(-) delete mode 100644 package/libxml2/libxml2-python2.patch
package/libxml2/Config.in +0 -3
@@ -4,6 +4,3 @@ config BR2_PACKAGE_LIBXML2 XML C Parser http://xmlsoft.org/ - -config BR2_PACKAGE_HOST_LIBXML2_PYTHON - bool
package/libxml2/libxml2-python2.patch deleted +0 -27
@@ -1,27 +0,0 @@ -Prefer python2 binary in case python points to python3 - -Signed-off-by: Bernd Kuhls <[email protected]> - -diff -uNr libxml2-2.9.1.org/configure.in libxml2-2.9.1/configure.in ---- libxml2-2.9.1.org/configure.in 2013-04-19 09:25:20.000000000 +0200 -+++ libxml2-2.9.1/configure.in 2014-04-12 14:16:26.579361068 +0200 -@@ -748,6 +748,11 @@ - PYTHON_TESTS= - pythondir= - if test "$with_python" != "no" ; then -+ if test -x "$with_python/bin/python2" -+ then -+ echo Found python2 in $with_python/bin/python2 -+ PYTHON="$with_python/bin/python2" -+ else - if test -x "$with_python/bin/python" - then - echo Found python in $with_python/bin/python -@@ -773,6 +778,7 @@ - fi - fi - fi -+ fi - if test "$PYTHON" != "" - then - PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
package/libxml2/libxml2.mk +0 -14
@@ -22,20 +22,6 @@ HOST_LIBXML2_DEPENDENCIES = host-pkgconf HOST_LIBXML2_CONF_OPT = --without-zlib --without-lzma -# mesa3d uses functions that are only available with debug -ifeq ($(BR2_PACKAGE_MESA3D),y) -HOST_LIBXML2_CONF_OPT += --with-debug -else -HOST_LIBXML2_CONF_OPT += --without-debug -endif - -ifeq ($(BR2_PACKAGE_HOST_LIBXML2_PYTHON),y) -HOST_LIBXML2_DEPENDENCIES += host-python -HOST_LIBXML2_CONF_OPT += --with-python=$(HOST_DIR)/usr -else -HOST_LIBXML2_CONF_OPT += --without-python -endif - ifeq ($(BR2_PACKAGE_ZLIB),y) LIBXML2_DEPENDENCIES += zlib LIBXML2_CONF_OPT += --with-zlib
package/mesa3d/Config.in +0 -1
@@ -2,7 +2,6 @@ menuconfig BR2_PACKAGE_MESA3D bool "Mesa 3D Graphics Library" select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_EXPAT - select BR2_PACKAGE_HOST_LIBXML2_PYTHON select BR2_PACKAGE_XPROTO_DRI2PROTO if BR2_PACKAGE_XORG7 select BR2_PACKAGE_XPROTO_PRESENTPROTO if BR2_PACKAGE_XORG7 select BR2_PACKAGE_XPROTO_XF86DRIPROTO if BR2_PACKAGE_XORG7
package/mesa3d/mesa3d.mk +0 -1
@@ -18,7 +18,6 @@ MESA3D_DEPENDENCIES = \ host-bison \ host-flex \ host-gettext \ - host-libxml2 \ host-python \ host-xutil_makedepend \ libdrm
Signature · 1 line
1.7.10.4
PATCH v8 6/28 mesa3d: Add dri3 support
In reply to Bernd Kuhls--- package/mesa3d/mesa3d.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/mesa3d/mesa3d.mk +7 -0
@@ -22,6 +22,13 @@ MESA3D_DEPENDENCIES = \ host-xutil_makedepend \ libdrm +ifeq ($(BR2_PACKAGE_XPROTO_DRI3PROTO),y) +MESA3D_DEPENDENCIES += xproto_dri3proto +MESA3D_CONF_OPT += --enable-dri3 +else +MESA3D_CONF_OPT += --disable-dri3 +endif + ifeq ($(BR2_PACKAGE_XORG7),y) MESA3D_DEPENDENCIES += \ xproto_xf86driproto \
Signature · 1 line
1.7.10.4
PATCH v8 7/28 mesa3d: dri2 does not need udev support
In reply to Bernd Kuhlshttp://cgit.freedesktop.org/mesa/mesa/commit/configure.ac?id=b959fd9674938e127a34d42d34b903e3a9ae7ad9
"The loader infrastructure for everything but DRI2 requires that udev be present"
Check for udev only for dri3.
--- .../mesa3d-0002-dri2-does-not-need-udev.patch | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 package/mesa3d/mesa3d-0002-dri2-does-not-need-udev.patch
package/mesa3d/mesa3d-0002-dri2-does-not-need-udev.patch new file +25 -0
@@ -0,0 +1,25 @@ +http://cgit.freedesktop.org/mesa/mesa/commit/configure.ac?id=b959fd9674938e127a34d42d34b903e3a9ae7ad9 +"The loader infrastructure for everything but DRI2 requires that udev be present" + +Check for udev only for dri3. + +Patch sent upstream: https://bugs.freedesktop.org/show_bug.cgi?id=75212#c5 + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -uNr Mesa-10.2.0-rc1.org/configure.ac Mesa-10.2.0-rc1/configure.ac +--- Mesa-10.2.0-rc1.org/configure.ac 2014-05-03 02:17:23.000000000 +0200 ++++ Mesa-10.2.0-rc1/configure.ac 2014-05-07 19:51:54.187921825 +0200 +@@ -998,11 +998,11 @@ + DEFINES="$DEFINES -DHAVE_ALIAS" + if test "x$enable_dri3" = xyes; then + DEFINES="$DEFINES -DHAVE_DRI3" +- fi + + if test "x$have_libudev" != xyes; then + AC_MSG_ERROR([libudev-dev required for building DRI]) + fi ++ fi + + case "$host_cpu" in + powerpc* | sparc*)
Signature · 1 line
1.7.10.4
PATCH v8 8/28 libva: new package
In reply to Bernd Kuhls--- package/Config.in | 1 + package/libva/Config.in | 18 ++++++++ package/libva/libva-0001-no_test_decode.patch | 17 ++++++++ package/libva/libva.mk | 57 +++++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 package/libva/Config.in create mode 100644 package/libva/libva-0001-no_test_decode.patch create mode 100644 package/libva/libva.mk
package/Config.in +1 -0
@@ -599,6 +599,7 @@ source "package/libsvg/Config.in" source "package/libsvg-cairo/Config.in" source "package/libsvgtiny/Config.in" source "package/libungif/Config.in" +source "package/libva/Config.in" source "package/opencv/Config.in" source "package/opengl/Config.in" source "package/pango/Config.in"
package/libva/Config.in new file +18 -0
@@ -0,0 +1,18 @@ +config BR2_PACKAGE_LIBVA + bool "libva" + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XORG7 + depends on BR2_TOOLCHAIN_HAS_THREADS # libdrm/libpthread-stubs + depends on BR2_LARGEFILE # libdrm + help + The main motivation for VA-API (Video Acceleration API) is to enable + hardware accelerated video decode/encode at various entry-points (VLD, + IDCT, Motion Compensation etc.) for the prevailing coding standards + today (MPEG-2, MPEG-4 ASP/H.263, MPEG-4 AVC/H.264, and VC-1/VMW3). + + http://www.freedesktop.org/wiki/Software/vaapi/ + +comment "libva needs a toolchain w/ largefile, threads" + depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
package/libva/libva-0001-no_test_decode.patch new file +17 -0
@@ -0,0 +1,17 @@ +mpeg2vldemo is the only file requiring cxx support. It is not needed for +buildroot, so disable its compilation to avoid depending on cxx. + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -uNr libva-1.3.0.org/test/Makefile.am libva-1.3.0/test/Makefile.am +--- libva-1.3.0.org/test/Makefile.am 2014-03-24 05:49:46.000000000 +0100 ++++ libva-1.3.0/test/Makefile.am 2014-04-26 18:12:25.644390292 +0200 +@@ -20,7 +20,7 @@ + # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-SUBDIRS = common decode encode vainfo ++SUBDIRS = common encode vainfo + + if USE_X11 + SUBDIRS += basic putsurface
package/libva/libva.mk new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v8 9/28 libva-intel-driver: new package
In reply to Bernd Kuhls--- package/Config.in | 1 + package/libva-intel-driver/Config.in | 19 ++++++++++++++ package/libva-intel-driver/libva-intel-driver.mk | 29 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 package/libva-intel-driver/Config.in create mode 100644 package/libva-intel-driver/libva-intel-driver.mk
package/Config.in +1 -0
@@ -600,6 +600,7 @@ source "package/libsvg-cairo/Config.in" source "package/libsvgtiny/Config.in" source "package/libungif/Config.in" source "package/libva/Config.in" +source "package/libva-intel-driver/Config.in" source "package/opencv/Config.in" source "package/opengl/Config.in" source "package/pango/Config.in"
package/libva-intel-driver/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_LIBVA_INTEL_DRIVER + bool "libva-intel-driver" + select BR2_PACKAGE_LIBVA + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_LIBDRM_INTEL + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_XORG7 + select BR2_PACKAGE_XLIB_LIBXFIXES if BR2_PACKAGE_XORG7 + depends on BR2_i386 || BR2_x86_64 + depends on BR2_TOOLCHAIN_HAS_THREADS # libdrm/libpthread-stubs + depends on BR2_LARGEFILE # libdrm + help + VA-API back-end driver for Intel graphics chips + + https://01.org/linuxgraphics/community/vaapi + +comment "libva intel driver needs a toolchain w/ largefile, threads" + depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS + depends on BR2_i386 || BR2_x86_64
package/libva-intel-driver/libva-intel-driver.mk new file +29 -0
@@ -0,0 +1,29 @@ +################################################################################ +# +# libva-intel-driver +# +################################################################################ + +LIBVA_INTEL_DRIVER_VERSION = 1.3.1 +LIBVA_INTEL_DRIVER_SOURCE = libva-intel-driver-$(LIBVA_INTEL_DRIVER_VERSION).tar.bz2 +LIBVA_INTEL_DRIVER_SITE = http://www.freedesktop.org/software/vaapi/releases/libva-intel-driver +LIBVA_INTEL_DRIVER_LICENSE = MIT +LIBVA_INTEL_DRIVER_LICENSE_FILES = COPYING +LIBVA_INTEL_DRIVER_AUTORECONF = YES +LIBVA_INTEL_DRIVER_DEPENDENCIES = host-pkgconf libdrm libva + +ifeq ($(BR2_PACKAGE_XORG7),y) +LIBVA_INTEL_DRIVER_DEPENDENCIES += xlib_libX11 xlib_libXext xlib_libXfixes +LIBVA_INTEL_DRIVER_CONF_OPT += --enable-x11 +else +LIBVA_INTEL_DRIVER_CONF_OPT += --disable-x11 +endif + +ifeq ($(BR2_PACKAGE_WAYLAND),y) +LIBVA_DEPENDENCIES += wayland +LIBVA_INTEL_DRIVER_CONF_OPT += --enable-wayland +else +LIBVA_INTEL_DRIVER_CONF_OPT += --disable-wayland +endif + +$(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH v8 10/28 ffmpeg: Add libva support
In reply to Bernd Kuhls--- package/ffmpeg/ffmpeg.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
package/ffmpeg/ffmpeg.mk +7 -1
@@ -41,7 +41,6 @@ FFMPEG_CONF_OPT = \ --enable-mdct \ --enable-rdft \ --disable-crystalhd \ - --disable-vaapi \ --disable-vdpau \ --disable-dxva2 \ --enable-runtime-cpudetect \
@@ -209,6 +208,13 @@ FFMPEG_CONF_OPT += \ --enable-encoder=libvorbis endif +ifeq ($(BR2_PACKAGE_LIBVA),y) +FFMPEG_CONF_OPT += --enable-vaapi +FFMPEG_DEPENDENCIES += libva +else +FFMPEG_CONF_OPT += --disable-vaapi +endif + ifeq ($(BR2_X86_CPU_HAS_MMX),y) FFMPEG_CONF_OPT += --enable-yasm FFMPEG_DEPENDENCIES += host-yasm
Signature · 1 line
1.7.10.4
PATCH v8 11/28 libglu: new package
In reply to Bernd Kuhls--- package/Config.in | 1 + package/libglu/Config.in | 10 ++++++++++ package/libglu/libglu.mk | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 package/libglu/Config.in create mode 100644 package/libglu/libglu.mk
package/Config.in +1 -0
@@ -590,6 +590,7 @@ source "package/libexif/Config.in" source "package/libgail/Config.in" source "package/libgeotiff/Config.in" source "package/libglade/Config.in" +source "package/libglu/Config.in" source "package/libgtk2/Config.in" source "package/libpng/Config.in" source "package/libqrencode/Config.in"
package/libglu/Config.in new file +10 -0
@@ -0,0 +1,10 @@ +config BR2_PACKAGE_LIBGLU + bool "libglu" + depends on BR2_PACKAGE_HAS_LIBGL + help + Mesa OpenGL Utility library + + http://cgit.freedesktop.org/mesa/glu/ + +comment "libglu needs an OpenGL backend" + depends on !BR2_PACKAGE_HAS_LIBGL
package/libglu/libglu.mk new file +16 -0
@@ -0,0 +1,16 @@ +################################################################################ +# +# libglu +# +################################################################################ + +LIBGLU_VERSION = 9.0.0 +LIBGLU_SITE = http://cgit.freedesktop.org/mesa/glu/snapshot +LIBGLU_SOURCE = glu-$(LIBGLU_VERSION).tar.gz +LIBGLU_LICENSE = SGI-B-2.0 +LIBGLU_LICENSE_FILES = include/GL/glu.h +LIBGLU_INSTALL_STAGING = YES +LIBGLU_AUTORECONF = YES +LIBGLU_DEPENDENCIES = libgl + +$(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH v8 12/28 libglew: new package
In reply to Bernd Kuhls--- package/Config.in | 1 + package/libglew/Config.in | 19 +++++++++++++++++++ package/libglew/libglew.mk | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 package/libglew/Config.in create mode 100644 package/libglew/libglew.mk
package/Config.in +1 -0
@@ -590,6 +590,7 @@ source "package/libexif/Config.in" source "package/libgail/Config.in" source "package/libgeotiff/Config.in" source "package/libglade/Config.in" +source "package/libglew/Config.in" source "package/libglu/Config.in" source "package/libgtk2/Config.in" source "package/libpng/Config.in"
package/libglew/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_LIBGLEW + bool "libglew" + depends on BR2_PACKAGE_XORG7 + depends on BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_LIBX11 + select BR2_PACKAGE_XLIB_LIBXEXT + select BR2_PACKAGE_XLIB_LIBXI + select BR2_PACKAGE_XLIB_LIBXMU + help + The OpenGL Extension Wrangler Library (GLEW) is a cross-platform C/C++ + extension loading library. GLEW provides efficient run-time mechanisms + for determining which OpenGL extensions are supported on the target + platform. OpenGL core and extension functionality is exposed in a + single header file. + + http://glew.sourceforge.net + +comment "libglew depends on X.org and needs an OpenGL backend" + depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_HAS_LIBGL
package/libglew/libglew.mk new file +36 -0
@@ -0,0 +1,36 @@ +################################################################################ +# +# libglew +# +################################################################################ + +LIBGLEW_VERSION = 1.10.0 +LIBGLEW_SOURCE = glew-$(LIBGLEW_VERSION).tgz +LIBGLEW_SITE = http://sourceforge.net/projects/glew/files/glew/$(LIBGLEW_VERSION) +LIBGLEW_LICENSE = MIT +LIBGLEW_LICENSE_FILES = LICENSE.txt +LIBGLEW_INSTALL_STAGING = YES +LIBGLEW_DEPENDENCIES = libgl xlib_libX11 xlib_libXext xlib_libXi xlib_libXmu + +# using $TARGET_CONFIGURE_OPTS breaks compilation +define LIBGLEW_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + GLEW_DEST="/usr" LIBDIR="/usr/lib" \ + AR="$(TARGET_AR)" CC="$(TARGET_CC)" \ + LD="$(TARGET_CC)" STRIP="$(TARGET_STRIP)" \ + POPT="$(TARGET_CFLAGS)" LDFLAGS.EXTRA="$(TARGET_LDFLAGS)" +endef + +define LIBGLEW_INSTALL_STAGING_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + GLEW_DEST="$(STAGING_DIR)/usr" LIBDIR="$(STAGING_DIR)/usr/lib" \ + $(TARGET_CONFIGURE_OPTS) install +endef + +define LIBGLEW_INSTALL_TARGET_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ + GLEW_DEST="$(TARGET_DIR)/usr" LIBDIR="$(TARGET_DIR)/usr/lib" \ + $(TARGET_CONFIGURE_OPTS) install +endef + +$(eval $(generic-package))
Signature · 1 line
1.7.10.4
PATCH v8 13/28 sdl: Add new dependency libglu for opengl support
In reply to Bernd Kuhls--- package/sdl/sdl.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
package/sdl/sdl.mk +4 -1
@@ -62,9 +62,12 @@ SDL_DEPENDENCIES += alsa-lib endif ifeq ($(BR2_PACKAGE_MESA3D),y) -SDL_DEPENDENCIES += mesa3d +SDL_DEPENDENCIES += libglu mesa3d +SDL_CONF_OPT += --enable-video-opengl endif +SDL_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv) + SDL_CONF_OPT += --enable-pulseaudio=no \ --disable-arts \ --disable-esd \
Signature · 1 line
1.7.10.4
PATCH v8 13/28 sdl: Add new dependency libglu for opengl support
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 10 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/sdl/sdl.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)package/sdl/sdl.mk +0
-0
package/sdl/sdl.mk SDL_DEPENDENCIES += alsa-lib · line 69
Quoted 9 lines
package/sdl/sdl.mk +3
-1@@ -62,9 +62,12 @@ SDL_DEPENDENCIES += alsa-lib endif ifeq ($(BR2_PACKAGE_MESA3D),y) -SDL_DEPENDENCIES += mesa3d +SDL_DEPENDENCIES += libglu mesa3d +SDL_CONF_OPT += --enable-video-opengl endif +SDL_DEPENDENCIES += $(if $(BR2_PACKAGE_LIBICONV),libiconv)
It looks like this should be in a separate patch. If it is needed here, then please expand the commit log with the reason libiconv is now a dependency of sdl.
Regards,
Yann E. MORIN.
Quoted 10 lines
package/sdl/sdl.mk +0
-0SDL_CONF_OPT += --enable-pulseaudio=no \ --disable-arts \ --disable-esd \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 14/28 xdriver_xf86-video-intel: Bump version to 2.99.911
In reply to Bernd Kuhls- add necessary dependencies
- add -D_GNU_SOURCE to avoid getline compilation error
--- package/x11r7/xdriver_xf86-video-intel/Config.in | 11 ++++---- .../xdriver_xf86-video-intel.mk | 27 +++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-)
package/x11r7/xdriver_xf86-video-intel/Config.in +6 -5
@@ -2,13 +2,14 @@ config BR2_PACKAGE_XDRIVER_XF86_VIDEO_INTEL bool "xf86-video-intel" depends on (BR2_i386 || BR2_x86_64) depends on BR2_PACKAGE_MESA3D - select BR2_PACKAGE_XPROTO_FONTSPROTO - select BR2_PACKAGE_XPROTO_RANDRPROTO - select BR2_PACKAGE_XPROTO_RENDERPROTO - select BR2_PACKAGE_XPROTO_XPROTO - select BR2_PACKAGE_XLIB_LIBPCIACCESS select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_LIBDRM_INTEL + select BR2_PACKAGE_XLIB_LIBPCIACCESS + select BR2_PACKAGE_XLIB_LIBXCOMPOSITE + select BR2_PACKAGE_XLIB_LIBXRANDR + select BR2_PACKAGE_XLIB_LIBXTST + select BR2_PACKAGE_XPROTO_FONTSPROTO + select BR2_PACKAGE_XPROTO_XPROTO help Intel video driver
package/x11r7/xdriver_xf86-video-intel/xdriver_xf86-video-intel.mk +21 -6
@@ -4,18 +4,18 @@ # ################################################################################ -XDRIVER_XF86_VIDEO_INTEL_VERSION = 2.99.907 +XDRIVER_XF86_VIDEO_INTEL_VERSION = 2.99.911 XDRIVER_XF86_VIDEO_INTEL_SOURCE = xf86-video-intel-$(XDRIVER_XF86_VIDEO_INTEL_VERSION).tar.bz2 XDRIVER_XF86_VIDEO_INTEL_SITE = http://xorg.freedesktop.org/releases/individual/driver XDRIVER_XF86_VIDEO_INTEL_LICENSE = MIT XDRIVER_XF86_VIDEO_INTEL_LICENSE_FILES = COPYING -XDRIVER_XF86_VIDEO_INTEL_AUTORECONF = YES + +# this fixes a getline-related compilation in src/sna/kgem.c +XDRIVER_XF86_VIDEO_INTEL_CONF_ENV = \ + CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" XDRIVER_XF86_VIDEO_INTEL_CONF_OPT = \ - --enable-dri \ - --enable-kms-only \ --disable-xvmc \ - --disable-ums-only \ --enable-sna \ --disable-uxa \ --disable-glamor \
@@ -23,6 +23,21 @@ XDRIVER_XF86_VIDEO_INTEL_CONF_OPT = \ --disable-dga \ --disable-async-swap -XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES = xserver_xorg-server xproto_fontsproto xproto_randrproto xproto_renderproto xproto_xproto libdrm xlib_libpciaccess +XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES = \ + libdrm \ + xlib_libXcomposite \ + xlib_libXrandr \ + xlib_libXtst \ + xlib_libpciaccess \ + xproto_fontsproto \ + xproto_xproto \ + xserver_xorg-server + +ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER_I965),y) +XDRIVER_XF86_VIDEO_INTEL_CONF_OPT += --enable-dri +XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES += mesa3d xproto_xf86driproto +else +XDRIVER_XF86_VIDEO_INTEL_CONF_OPT += --disable-dri +endif $(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH v8 14/28 xdriver_xf86-video-intel: Bump version to 2.99.911
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 20 lines
- add necessary dependencies
- add -D_GNU_SOURCE to avoid getline compilation errorSigned-off-by Bernd Kuhls <[email protected]>--- package/x11r7/xdriver_xf86-video-intel/Config.in | 11 ++++---- .../xdriver_xf86-video-intel.mk | 27 +++++++++++++++----- 2 files changed, 27 insertions(+), 11 deletions(-)package/x11r7/xdriver_xf86-video-intel/Config.in +0
-3@@ -2,13 +2,14 @@ config BR2_PACKAGE_XDRIVER_XF86_VIDEO_INTEL bool "xf86-video-intel" depends on (BR2_i386 || BR2_x86_64) depends on BR2_PACKAGE_MESA3D - select BR2_PACKAGE_XPROTO_FONTSPROTO - select BR2_PACKAGE_XPROTO_RANDRPROTO - select BR2_PACKAGE_XPROTO_RENDERPROTO
package/x11r7/xdriver_xf86-video-intel/Config.in config BR2_PACKAGE_XDRIVER_XF86_VIDEO_INTEL · line 12
Quoted 10 lines
package/x11r7/xdriver_xf86-video-intel/Config.in +6
-2- select BR2_PACKAGE_XPROTO_XPROTO - select BR2_PACKAGE_XLIB_LIBPCIACCESS select BR2_PACKAGE_LIBDRM select BR2_PACKAGE_LIBDRM_INTEL + select BR2_PACKAGE_XLIB_LIBPCIACCESS + select BR2_PACKAGE_XLIB_LIBXCOMPOSITE + select BR2_PACKAGE_XLIB_LIBXRANDR + select BR2_PACKAGE_XLIB_LIBXTST + select BR2_PACKAGE_XPROTO_FONTSPROTO + select BR2_PACKAGE_XPROTO_XPROTO
Please, avoid re-ordering the dependencies.
If you really think this is necessary, then by all means do it in a separate patch, please.
Remember that the shorter the patches are, the easier they are to review.
Also, adding new dependencies and re-ordering dependencies are two semantically unrelated changes, so should be in different patches. But I fail to see why the reordering is needed, since all the XPROTO deps are already cluttered together.
Regards,
Yann E. MORIN.
Quoted 61 lines
package/x11r7/xdriver_xf86-video-intel/Config.in +0
-0help Intel video driverpackage/x11r7/xdriver_xf86-video-intel/xdriver_xf86-video-intel.mk +21
-6@@ -4,18 +4,18 @@ # ################################################################################ -XDRIVER_XF86_VIDEO_INTEL_VERSION = 2.99.907 +XDRIVER_XF86_VIDEO_INTEL_VERSION = 2.99.911 XDRIVER_XF86_VIDEO_INTEL_SOURCE = xf86-video-intel-$(XDRIVER_XF86_VIDEO_INTEL_VERSION).tar.bz2 XDRIVER_XF86_VIDEO_INTEL_SITE = http://xorg.freedesktop.org/releases/individual/driver XDRIVER_XF86_VIDEO_INTEL_LICENSE = MIT XDRIVER_XF86_VIDEO_INTEL_LICENSE_FILES = COPYING -XDRIVER_XF86_VIDEO_INTEL_AUTORECONF = YES + +# this fixes a getline-related compilation in src/sna/kgem.c +XDRIVER_XF86_VIDEO_INTEL_CONF_ENV = \ + CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" XDRIVER_XF86_VIDEO_INTEL_CONF_OPT = \ - --enable-dri \ - --enable-kms-only \ --disable-xvmc \ - --disable-ums-only \ --enable-sna \ --disable-uxa \ --disable-glamor \@@ -23,6 +23,21 @@ XDRIVER_XF86_VIDEO_INTEL_CONF_OPT = \ --disable-dga \ --disable-async-swap -XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES = xserver_xorg-server xproto_fontsproto xproto_randrproto xproto_renderproto xproto_xproto libdrm xlib_libpciaccess +XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES = \ + libdrm \ + xlib_libXcomposite \ + xlib_libXrandr \ + xlib_libXtst \ + xlib_libpciaccess \ + xproto_fontsproto \ + xproto_xproto \ + xserver_xorg-server + +ifeq ($(BR2_PACKAGE_MESA3D_DRI_DRIVER_I965),y) +XDRIVER_XF86_VIDEO_INTEL_CONF_OPT += --enable-dri +XDRIVER_XF86_VIDEO_INTEL_DEPENDENCIES += mesa3d xproto_xf86driproto +else +XDRIVER_XF86_VIDEO_INTEL_CONF_OPT += --disable-dri +endif $(eval $(autotools-package))Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 14/28 xdriver_xf86-video-intel: Bump version to 2.99.911
"Yann E. MORIN" <[email protected]> wrote in news:20140517200617.GF3459 at free.fr:
Quoted 1 line
Please, avoid re-ordering the dependencies.
Hi,
v9 has the re-ordering removed.
Regards, Bernd
PATCH v8 14/28 xdriver_xf86-video-intel: Bump version to 2.99.911
On 2014-05-17 22:51 +0200, Bernd Kuhls spake thusly:
Quoted 8 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140517200617.GF3459 at free.fr:
Quoted 1 line
Please, avoid re-ordering the dependencies.
Hi,
v9 has the re-ordering removed.
Thanks.
While I'm at it, care to wait a bit before resending the series?Others may have comments, too, so wait a bit before respins. Something like two days should be OK.
Thank you for your huge amount of work on this series! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 14/28 xdriver_xf86-video-intel: Bump version to 2.99.911
"Yann E. MORIN" <[email protected]> wrote in news:20140517210923.GR3459 at free.fr:
Quoted 1 line
While I'm at it, care to wait a bit before resending the series?
Hi,
of course, that?s the reason I am trying to comment all your comments ;)
Regards, Bernd
PATCH v8 15/28 rtmpdump: Add KSV patch
In reply to Bernd Kuhls--- package/rtmpdump/rtmpdump-0001-ksv.patch | 3397 ++++++++++++++++++++++++++++++ 1 file changed, 3397 insertions(+) create mode 100644 package/rtmpdump/rtmpdump-0001-ksv.patch
package/rtmpdump/rtmpdump-0001-ksv.patch new file +3397 -0
@@ -0,0 +1,3397 @@ +Several fixes made or collected by KSV: +http://stream-recorder.com/forum/customized-rtmpdump-binaries-patch-file-t16103.html + +This patch file is the -p1 converted version of Patch.diff, contained in +rtmpdump-2.4.zip, downloaded from https://github.com/K-S-V/Scripts/releases +It includes "Update 21/03/2014" as latest update. + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/amf.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/amf.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/amf.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/amf.c 2014-05-04 17:55:17.513338440 +0200 +@@ -618,6 +618,9 @@ + return -1; + } + ++ if (*pBuffer == AMF_NULL) ++ bDecodeName = 0; ++ + if (bDecodeName && nSize < 4) + { /* at least name (length +@least 1 byte) and 1 byte of data */ + RTMP_Log(RTMP_LOGDEBUG, +@@ -729,13 +732,13 @@ + } + case AMF_DATE: + { +- RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE"); +- + if (nSize < 10) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_UTCoffset = AMF_DecodeInt16(pBuffer + 8); ++ RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE: %f, UTC offset: %d", prop->p_vu.p_number, ++ prop->p_UTCoffset); + + nSize -= 10; + break; +@@ -807,8 +810,8 @@ + } + else + { +- name.av_val = "no-name."; +- name.av_len = sizeof("no-name.") - 1; ++ name.av_val = "no-name"; ++ name.av_len = sizeof ("no-name") - 1; + } + if (name.av_len > 18) + name.av_len = 18; +@@ -1068,17 +1071,18 @@ + + /*std::string str = className; */ + +- RTMP_Log(RTMP_LOGDEBUG, +- "Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d", +- cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, +- cd.cd_num); ++ RTMP_Log(RTMP_LOGDEBUG, "Class name: %.*s, externalizable: %d, dynamic: %d, classMembers: %d", ++ cd.cd_name.av_len, cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, cd.cd_num); + + for (i = 0; i < cd.cd_num; i++) +- { +- AVal memberName; +- len = AMF3ReadString(pBuffer, &memberName); +- RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); +- AMF3CD_AddProp(&cd, &memberName); ++ { ++ AVal memberName = {NULL, 0}; ++ len = AMF3ReadString(pBuffer, &memberName); ++ if (memberName.av_val) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); ++ AMF3CD_AddProp(&cd, &memberName); ++ } + nSize -= len; + pBuffer += len; + } +@@ -1259,7 +1263,8 @@ + { + if (!(cd->cd_num & 0x0f)) + cd->cd_props = realloc(cd->cd_props, (cd->cd_num + 16) * sizeof(AVal)); +- cd->cd_props[cd->cd_num++] = *prop; ++ if (cd->cd_props) ++ cd->cd_props[cd->cd_num++] = *prop; + } + + AVal * +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/handshake.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/handshake.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/handshake.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/handshake.h 2014-05-04 17:55:17.517338389 +0200 +@@ -707,7 +707,7 @@ + uint32_t uptime; + + uint8_t clientbuf[RTMP_SIG_SIZE + 4], *clientsig=clientbuf+4; +- uint8_t serversig[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply; ++ uint8_t serversig[RTMP_SIG_SIZE], serversig1[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply; + uint8_t type; + getoff *getdh = NULL, *getdig = NULL; + +@@ -760,7 +760,7 @@ + #else + ip = (int32_t *)(clientsig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + + /* set handshake digest */ +@@ -825,6 +825,8 @@ + + if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; ++ if (ReadN(r, (char *) serversig1, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) ++ return FALSE; + + /* decode server response */ + memcpy(&uptime, serversig, 4); +@@ -834,7 +836,7 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version : %d.%d.%d.%d", __FUNCTION__, serversig[4], + serversig[5], serversig[6], serversig[7]); + +- if (FP9HandShake && type == 3 && !serversig[4]) ++ if (FP9HandShake && type == 3 && (!serversig[4] || !serversig1[4])) + FP9HandShake = FALSE; + + #ifdef _DEBUG +@@ -914,7 +916,7 @@ + #else + ip = (int32_t *)reply; + for (i = 0; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + /* calculate response now */ + signatureResp = reply+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH; +@@ -965,16 +967,22 @@ + __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE); + #endif +- if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE)) +- return FALSE; +- +- /* 2nd part of handshake */ +- if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) +- return FALSE; ++ if (r->Link.CombineConnectPacket) ++ { ++ char *HandshakeResponse = malloc(RTMP_SIG_SIZE); ++ memcpy(HandshakeResponse, (char *) reply, RTMP_SIG_SIZE); ++ r->Link.HandshakeResponse.av_val = HandshakeResponse; ++ r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE; ++ } ++ else ++ { ++ if (!WriteN(r, (char *) reply, RTMP_SIG_SIZE)) ++ return FALSE; ++ } + + #ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__); +- RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE); ++ RTMP_LogHex(RTMP_LOGDEBUG, serversig1, RTMP_SIG_SIZE); + #endif + + if (FP9HandShake) +@@ -982,21 +990,21 @@ + uint8_t signature[SHA256_DIGEST_LENGTH]; + uint8_t digest[SHA256_DIGEST_LENGTH]; + +- if (serversig[4] == 0 && serversig[5] == 0 && serversig[6] == 0 +- && serversig[7] == 0) ++ if (serversig1[4] == 0 && serversig1[5] == 0 && serversig1[6] == 0 ++ && serversig1[7] == 0) + { + RTMP_Log(RTMP_LOGDEBUG, + "%s: Wait, did the server just refuse signed authentication?", + __FUNCTION__); + } + RTMP_Log(RTMP_LOGDEBUG, "%s: Server sent signature:", __FUNCTION__); +- RTMP_LogHex(RTMP_LOGDEBUG, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], ++ RTMP_LogHex(RTMP_LOGDEBUG, &serversig1[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH); + + /* verify server response */ + HMACsha256(&clientsig[digestPosClient], SHA256_DIGEST_LENGTH, + GenuineFMSKey, sizeof(GenuineFMSKey), digest); +- HMACsha256(serversig, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digest, ++ HMACsha256(serversig1, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digest, + SHA256_DIGEST_LENGTH, signature); + + /* show some information */ +@@ -1024,7 +1032,7 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s: Signature calculated:", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, signature, SHA256_DIGEST_LENGTH); + if (memcmp +- (signature, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], ++ (signature, &serversig1[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: Server not genuine Adobe!", __FUNCTION__); +@@ -1057,7 +1065,7 @@ + } + else + { +- if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0) ++ if (memcmp(serversig1, clientsig, RTMP_SIG_SIZE) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!", + __FUNCTION__); +@@ -1099,7 +1107,7 @@ + { + encrypted = FALSE; + } +- else if (type == 6 || type == 8) ++ else if (type == 6 || type == 8 || type == 9) + { + offalg = 1; + encrypted = TRUE; +@@ -1148,7 +1156,7 @@ + #else + ip = (int32_t *)(serversig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + + /* set handshake digest */ +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/hashswf.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/hashswf.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/hashswf.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/hashswf.c 2014-05-04 17:55:17.517338389 +0200 +@@ -70,7 +70,7 @@ + + #endif /* CRYPTO */ + +-#define AGENT "Mozilla/5.0" ++#define AGENT "Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0" + + HTTPResult + HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb) +@@ -116,6 +116,8 @@ + + host = p1 + 3; + path = strchr(host, '/'); ++ if (!path) ++ return HTTPRES_BAD_REQUEST; + hlen = path - host; + strncpy(hbuf, host, hlen); + hbuf[hlen] = '\0'; +@@ -200,7 +202,7 @@ + } + + p1 = strchr(sb.sb_buf, ' '); +- rc = atoi(p1 + 1); ++ rc = p1 ? atoi(p1 + 1) : 400; + http->status = rc; + + if (rc >= 300) +@@ -528,9 +530,11 @@ + + if (strncmp(buf, "url: ", 5)) + continue; +- if (strncmp(buf + 5, url, hlen)) ++ if (strncmp(buf + 5, url, strlen(buf + 5) - 1)) + continue; + r1 = strrchr(buf, '/'); ++ if (!r1) ++ continue; + i = strlen(r1); + r1[--i] = '\0'; + if (strncmp(r1, file, i)) +@@ -640,7 +644,7 @@ + HMAC_finish(in.ctx, hash, hlen); + *size = in.size; + +- fprintf(f, "date: %s\n", date); ++ fprintf(f, "date: %s\n", date[0] ? date : cctim); + fprintf(f, "size: %08x\n", in.size); + fprintf(f, "hash: "); + for (i = 0; i < SHA256_DIGEST_LENGTH; i++) +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/log.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/log.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/log.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/log.c 2014-05-04 17:55:17.517338389 +0200 +@@ -52,8 +52,8 @@ + vsnprintf(str, MAX_PRINT_LEN-1, format, vl); + + /* Filter out 'no-name' */ +- if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL ) +- return; ++ if (RTMP_debuglevel < RTMP_LOGDEBUG && strstr(str, "no-name") != NULL) ++ return; + + if ( !fmsg ) fmsg = stderr; + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/Makefile librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/Makefile +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/Makefile 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/Makefile 2014-05-04 17:55:17.513338440 +0200 +@@ -26,7 +26,7 @@ + REQ_OPENSSL=libssl,libcrypto + PUB_GNUTLS=-lgmp + LIBZ=-lz +-LIBS_posix= ++LIBS_posix=-lm + LIBS_darwin= + LIBS_mingw=-lws2_32 -lwinmm -lgdi32 + LIB_GNUTLS=-lgnutls -lhogweed -lnettle -lgmp $(LIBZ) +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/parseurl.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/parseurl.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/parseurl.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/parseurl.c 2014-05-04 17:55:17.517338389 +0200 +@@ -34,6 +34,7 @@ + AVal *playpath, AVal *app) + { + char *p, *end, *col, *ques, *slash; ++ int doubleSlash = FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "Parsing..."); + +@@ -140,11 +141,19 @@ + char *slash2, *slash3 = NULL, *slash4 = NULL; + int applen, appnamelen; + +- slash2 = strchr(p, '/'); +- if(slash2) +- slash3 = strchr(slash2+1, '/'); +- if(slash3) +- slash4 = strchr(slash3+1, '/'); ++ if ((slash2 = strstr(p, "//"))) ++ { ++ doubleSlash = TRUE; ++ slash2 += 1; ++ } ++ else ++ { ++ slash2 = strchr(p, '/'); ++ if (slash2) ++ slash3 = strchr(slash2 + 1, '/'); ++ if (slash3) ++ slash4 = strchr(slash3 + 1, '/'); ++ } + + applen = end-p; /* ondemand, pass all parameters as app */ + appnamelen = applen; /* ondemand length */ +@@ -168,6 +177,8 @@ + applen = appnamelen; + } + ++ if ((!ques) && doubleSlash) ++ applen -= 1; + app->av_val = p; + app->av_len = applen; + RTMP_Log(RTMP_LOGDEBUG, "Parsed app : %.*s", applen, p); +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.c 2014-05-04 17:55:17.517338389 +0200 +@@ -28,6 +28,7 @@ + #include <string.h> + #include <assert.h> + #include <time.h> ++#include <math.h> + + #include "rtmp_sys.h" + #include "log.h" +@@ -68,6 +69,7 @@ + + #define RTMP_SIG_SIZE 1536 + #define RTMP_LARGE_HEADER_SIZE 12 ++#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf)) + + static const int packetSize[] = { 12, 8, 4, 1 }; + +@@ -108,17 +110,21 @@ + RTMPT_OPEN=0, RTMPT_SEND, RTMPT_IDLE, RTMPT_CLOSE + } RTMPTCmd; + ++static int ConnectSocket(RTMP *r); + static int DumpMetaData(AMFObject *obj); + static int HandShake(RTMP *r, int FP9HandShake); + static int SocksNegotiate(RTMP *r); + ++static int SendBytesReceived(RTMP *r); ++static int SendCommand(RTMP *r, char *method, int queue); + static int SendConnectPacket(RTMP *r, RTMPPacket *cp); + static int SendCheckBW(RTMP *r); + static int SendCheckBWResult(RTMP *r, double txn); + static int SendDeleteStream(RTMP *r, double dStreamId); + static int SendFCSubscribe(RTMP *r, AVal *subscribepath); ++static int SendGetStreamLength(RTMP *r); ++static int SendInvoke(RTMP *r, AVal *command, int queue); + static int SendPlay(RTMP *r); +-static int SendBytesReceived(RTMP *r); + static int SendUsherToken(RTMP *r, AVal *usherToken); + + #if 0 /* unused */ +@@ -336,10 +342,13 @@ + r->m_nClientBW = 2500000; + r->m_nClientBW2 = 2; + r->m_nServerBW = 2500000; +- r->m_fAudioCodecs = 3191.0; ++ r->m_fAudioCodecs = 3575.0; + r->m_fVideoCodecs = 252.0; ++ r->m_fEncoding = 3.0; + r->Link.timeout = 30; + r->Link.swfAge = 30; ++ r->Link.CombineConnectPacket = TRUE; ++ r->Link.ConnectPacket = FALSE; + } + + void +@@ -357,6 +366,8 @@ + int + RTMP_IsConnected(RTMP *r) + { ++ if (r->m_sb.sb_size > 0) ++ return TRUE; + return r->m_sb.sb_socket != -1; + } + +@@ -443,6 +454,7 @@ + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, ++ AVal *WeebToken, + int dStart, + int dStop, int bLiveStream, long int timeout) + { +@@ -465,6 +477,8 @@ + RTMP_Log(RTMP_LOGDEBUG, "subscribepath : %s", subscribepath->av_val); + if (usherToken && usherToken->av_val) + RTMP_Log(RTMP_LOGDEBUG, "NetStream.Authenticate.UsherToken : %s", usherToken->av_val); ++ if (WeebToken && WeebToken->av_val) ++ RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", WeebToken->av_val); + if (flashVer && flashVer->av_val) + RTMP_Log(RTMP_LOGDEBUG, "flashVer : %s", flashVer->av_val); + if (dStart > 0) +@@ -513,6 +527,8 @@ + r->Link.subscribepath = *subscribepath; + if (usherToken && usherToken->av_len) + r->Link.usherToken = *usherToken; ++ if (WeebToken && WeebToken->av_len) ++ r->Link.WeebToken = *WeebToken; + r->Link.seekTime = dStart; + r->Link.stopTime = dStop; + if (bLiveStream) +@@ -570,14 +586,22 @@ + "Stream is live, no seeking possible" }, + { AVC("subscribe"), OFF(Link.subscribepath), OPT_STR, 0, + "Stream to subscribe to" }, +- { AVC("jtv"), OFF(Link.usherToken), OPT_STR, 0, +- "Justin.tv authentication token" }, +- { AVC("token"), OFF(Link.token), OPT_STR, 0, ++ { AVC("jtv"), OFF(Link.usherToken), OPT_STR, 0, ++ "Justin.tv authentication token"}, ++ { AVC("weeb"), OFF(Link.WeebToken), OPT_STR, 0, ++ "Weeb.tv authentication token"}, ++ { AVC("token"), OFF(Link.token), OPT_STR, 0, + "Key for SecureToken response" }, + { AVC("swfVfy"), OFF(Link.lFlags), OPT_BOOL, RTMP_LF_SWFV, + "Perform SWF Verification" }, + { AVC("swfAge"), OFF(Link.swfAge), OPT_INT, 0, + "Number of days to use cached SWF hash" }, ++#ifdef CRYPTO ++ { AVC("swfsize"), OFF(Link.swfSize), OPT_INT, 0, ++ "Size of the decompressed SWF file"}, ++ { AVC("swfhash"), OFF(Link.swfHash), OPT_STR, 0, ++ "SHA256 hash of the decompressed SWF file"}, ++#endif + { AVC("start"), OFF(Link.seekTime), OPT_INT, 0, + "Stream start position in milliseconds" }, + { AVC("stop"), OFF(Link.stopTime), OPT_INT, 0, +@@ -765,7 +789,7 @@ + if (!ret) + return ret; + r->Link.port = port; +- r->Link.playpath = r->Link.playpath0; ++ r->Link.playpath = AVcopy(r->Link.playpath0); + + while (ptr) { + *ptr++ = '\0'; +@@ -842,9 +866,16 @@ + } + + #ifdef CRYPTO +- if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len) +- RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, +- (unsigned char *)r->Link.SWFHash, r->Link.swfAge); ++ RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %d %d %s", r->Link.swfSize, r->Link.swfHash.av_len, r->Link.swfHash.av_val); ++ if (r->Link.swfSize && r->Link.swfHash.av_len) ++ { ++ int i, j = 0; ++ for (i = 0; i < r->Link.swfHash.av_len; i += 2) ++ r->Link.SWFHash[j++] = (HEX2BIN(r->Link.swfHash.av_val[i]) << 4) | HEX2BIN(r->Link.swfHash.av_val[i + 1]); ++ r->Link.SWFSize = (uint32_t) r->Link.swfSize; ++ } ++ else if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len) ++ RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, (unsigned char *) r->Link.SWFHash, r->Link.swfAge); + #endif + + SocksSetup(r, &r->Link.sockshost); +@@ -947,6 +978,8 @@ + } + + setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)); ++ if (r->Link.protocol & RTMP_FEATURE_HTTP) ++ setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on)); + + return TRUE; + } +@@ -1397,41 +1430,96 @@ + ptr = buffer; + while (n > 0) + { +- int nBytes = 0, nRead; ++ int nBytes = 0, nRead, status = 0, retries = 0; + if (r->Link.protocol & RTMP_FEATURE_HTTP) + { +- int refill = 0; +- while (!r->m_resplen) +- { +- int ret; +- if (r->m_sb.sb_size < 13 || refill) +- { +- if (!r->m_unackd) +- HTTP_Post(r, RTMPT_IDLE, "", 1); +- if (RTMPSockBuf_Fill(&r->m_sb) < 1) +- { +- if (!r->m_sb.sb_timedout) +- RTMP_Close(r); +- return 0; +- } +- } +- if ((ret = HTTP_read(r, 0)) == -1) +- { +- RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); +- RTMP_Close(r); +- return 0; +- } +- else if (ret == -2) ++ while (!r->m_resplen) ++ { ++ /* Refill if socket buffer is empty */ ++ if (!r->m_sb.sb_size) + { +- refill = 1; ++ if (retries > 30) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ ++ if (!r->m_unackd) ++ { ++ if (retries > 0) ++ { ++ HTTP_Post(r, RTMPT_IDLE, "", 1); ++ r->m_unackd = TRUE; ++ } ++ retries++; ++ ++ if (!r->m_bPlaying) ++ sleep(.25); ++ } ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Trying to fill HTTP buffer, Retries: %d", retries); ++ status = RTMPSockBuf_Fill(&r->m_sb); ++ /* Reconnect socket when closed by some moronic servers after ++ * every HTTP data packet */ ++ if (status < 1) ++ { ++ /* Close connection on connection reset */ ++ if (status == -1) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Reconnecting socket, Status: %d", status); ++ if (ConnectSocket(r)) ++ { ++ HTTP_Post(r, RTMPT_IDLE, "", 1); ++ r->m_unackd = TRUE; ++ retries++; ++ } ++ else ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ } + } +- else ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Trying to read HTTP response, Bytes Available: %d", r->m_sb.sb_size); ++ status = HTTP_read(r, 0); ++ if (status == -1) + { +- refill = 0; ++ RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); ++ RTMP_Close(r); ++ return 0; + } +- } +- if (r->m_resplen && !r->m_sb.sb_size) +- RTMPSockBuf_Fill(&r->m_sb); ++ else if (status == -2) ++ { ++ if (RTMPSockBuf_Fill(&r->m_sb) < 1) ++ if (!r->m_sb.sb_timedout) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ } ++ else if (status == -3) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ else ++ r->m_unackd = FALSE; ++ } ++ ++ /* Refill when there is still some data to be read and socket buffer ++ * is empty */ ++ if (r->m_resplen && (!r->m_sb.sb_size)) ++ { ++ if (RTMPSockBuf_Fill(&r->m_sb) < 1) ++ if (!r->m_sb.sb_timedout) ++ RTMP_Close(r); ++ } ++ + avail = r->m_sb.sb_size; + if (avail > r->m_resplen) + avail = r->m_resplen; +@@ -1458,10 +1546,9 @@ + r->m_sb.sb_size -= nRead; + nBytes = nRead; + r->m_nBytesIn += nRead; +- if (r->m_bSendCounter +- && r->m_nBytesIn > ( r->m_nBytesInSent + r->m_nClientBW / 10)) +- if (!SendBytesReceived(r)) +- return FALSE; ++ if (r->m_bSendCounter && r->m_nBytesIn > (r->m_nBytesInSent + r->m_nClientBW / 10)) ++ if (!SendBytesReceived(r)) ++ return FALSE; + } + /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */ + #ifdef _DEBUG +@@ -1472,7 +1559,8 @@ + { + RTMP_Log(RTMP_LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__); + /*goto again; */ +- RTMP_Close(r); ++ if (!r->m_sb.sb_timedout) ++ RTMP_Close(r); + break; + } + +@@ -1497,6 +1585,7 @@ + WriteN(RTMP *r, const char *buffer, int n) + { + const char *ptr = buffer; ++ char *ConnectPacket = 0; + #ifdef CRYPTO + char *encrypted = 0; + char buf[RTMP_BUFFER_CACHE_SIZE]; +@@ -1512,6 +1601,15 @@ + } + #endif + ++ if (r->Link.ConnectPacket) ++ { ++ char *ConnectPacket = malloc(r->Link.HandshakeResponse.av_len + n); ++ memcpy(ConnectPacket, r->Link.HandshakeResponse.av_val, r->Link.HandshakeResponse.av_len); ++ memcpy(ConnectPacket + r->Link.HandshakeResponse.av_len, ptr, n); ++ ptr = ConnectPacket; ++ n += r->Link.HandshakeResponse.av_len; ++ } ++ + while (n > 0) + { + int nBytes; +@@ -1548,6 +1646,14 @@ + free(encrypted); + #endif + ++ if (r->Link.ConnectPacket) ++ { ++ if (r->Link.HandshakeResponse.av_val) ++ free(r->Link.HandshakeResponse.av_val); ++ free(ConnectPacket); ++ r->Link.ConnectPacket = FALSE; ++ } ++ + return n == 0; + } + +@@ -1577,6 +1683,9 @@ + char pbuf[4096], *pend = pbuf + sizeof(pbuf); + char *enc; + ++ if (r->Link.CombineConnectPacket) ++ r->Link.ConnectPacket = TRUE; ++ + if (cp) + return RTMP_SendPacket(r, cp, TRUE); + +@@ -1625,7 +1734,7 @@ + enc = AMF_EncodeNamedBoolean(enc, pend, &av_fpad, FALSE); + if (!enc) + return FALSE; +- enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 15.0); ++ enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 239.0); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_audioCodecs, r->m_fAudioCodecs); +@@ -1789,7 +1898,7 @@ + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + +- RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %s", usherToken->av_val); ++ RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %.*s", usherToken->av_len, usherToken->av_val); + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_NetStream_Authenticate_UsherToken); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); +@@ -2095,6 +2204,7 @@ + } + + SAVC(_checkbw); ++SAVC(checkBandwidth); + + static int + SendCheckBW(RTMP *r) +@@ -2112,7 +2222,7 @@ + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; +- enc = AMF_EncodeString(enc, pend, &av__checkbw); ++ enc = AMF_EncodeString(enc, pend, &av_checkBandwidth); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + +@@ -2219,10 +2329,8 @@ + enc = AMF_EncodeNumber(enc, pend, -1000.0); + else + { +- if (r->Link.seekTime > 0.0) +- enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */ +- else +- enc = AMF_EncodeNumber(enc, pend, 0.0); /*-2000.0);*/ /* recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found */ ++ if (r->Link.seekTime > 0.0 || r->Link.stopTime) ++ enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */ + } + if (!enc) + return FALSE; +@@ -2338,7 +2446,7 @@ + int nSize; + char *buf; + +- RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType); ++ RTMP_Log(RTMP_LOGDEBUG, "sending ctrl, type: 0x%04x", (unsigned short)nType); + + packet.m_nChannel = 0x02; /* control channel (ping) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; +@@ -2370,8 +2478,8 @@ + } + else if (nType == 0x1A) + { +- *buf = nObject & 0xff; +- } ++ *buf = nObject & 0xff; ++ } + else + { + if (nSize > 2) +@@ -2885,6 +2993,7 @@ + #endif + + ++SAVC(onBWCheck); + SAVC(onBWDone); + SAVC(onFCSubscribe); + SAVC(onFCUnsubscribe); +@@ -2897,24 +3006,24 @@ + SAVC(description); + SAVC(onStatus); + SAVC(playlist_ready); ++SAVC(cps); ++SAVC(getStreamLength); ++SAVC(sendStatus); ++SAVC(verifyClient); + static const AVal av_NetStream_Failed = AVC("NetStream.Failed"); + static const AVal av_NetStream_Play_Failed = AVC("NetStream.Play.Failed"); +-static const AVal av_NetStream_Play_StreamNotFound = +-AVC("NetStream.Play.StreamNotFound"); +-static const AVal av_NetConnection_Connect_InvalidApp = +-AVC("NetConnection.Connect.InvalidApp"); ++static const AVal av_NetStream_Play_StreamNotFound = AVC("NetStream.Play.StreamNotFound"); ++static const AVal av_NetConnection_Connect_InvalidApp = AVC("NetConnection.Connect.InvalidApp"); + static const AVal av_NetStream_Play_Start = AVC("NetStream.Play.Start"); + static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete"); + static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop"); + static const AVal av_NetStream_Seek_Notify = AVC("NetStream.Seek.Notify"); + static const AVal av_NetStream_Pause_Notify = AVC("NetStream.Pause.Notify"); +-static const AVal av_NetStream_Play_PublishNotify = +-AVC("NetStream.Play.PublishNotify"); +-static const AVal av_NetStream_Play_UnpublishNotify = +-AVC("NetStream.Play.UnpublishNotify"); ++static const AVal av_NetStream_Play_PublishNotify = AVC("NetStream.Play.PublishNotify"); ++static const AVal av_NetStream_Play_UnpublishNotify = AVC("NetStream.Play.UnpublishNotify"); + static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start"); +-static const AVal av_NetConnection_Connect_Rejected = +-AVC("NetConnection.Connect.Rejected"); ++static const AVal av_NetConnection_Connect_Rejected = AVC("NetConnection.Connect.Rejected"); ++static const AVal av_NetConnection_confStream = AVC("NetConnection.confStream"); + + /* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */ + static int +@@ -2924,6 +3033,11 @@ + AVal method; + double txn; + int ret = 0, nRes; ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc, **params = NULL; ++ char *host = r->Link.hostname.av_len ? r->Link.hostname.av_val : ""; ++ char *pageUrl = r->Link.pageUrl.av_len ? r->Link.pageUrl.av_val : ""; ++ int param_count; ++ AVal av_Command, av_Response; + if (body[0] != 0x02) /* make sure it is a string method name we start with */ + { + RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", +@@ -2985,46 +3099,221 @@ + RTMP_SendServerBW(r); + RTMP_SendCtrl(r, 3, 0, 300); + } +- RTMP_SendCreateStream(r); ++ if (strstr(host, "tv-stream.to") || strstr(pageUrl, "tv-stream.to")) ++ { ++ static char auth[] = {'h', 0xC2, 0xA7, '4', 'j', 'h', 'H', '4', '3', 'd'}; ++ AVal av_auth; ++ SAVC(requestAccess); ++ av_auth.av_val = auth; ++ av_auth.av_len = sizeof (auth); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_requestAccess); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ SendCommand(r, "getConnectionCount", FALSE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "featve.com") || strstr(pageUrl, "featve.com")) ++ { ++ AVal av_auth = AVC("yes"); ++ SAVC(youCannotPlayMe); + +- if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) +- { +- /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ +- if (r->Link.usherToken.av_len) +- SendUsherToken(r, &r->Link.usherToken); +- /* Send the FCSubscribe if live stream or if subscribepath is set */ +- if (r->Link.subscribepath.av_len) +- SendFCSubscribe(r, &r->Link.subscribepath); +- else if (r->Link.lFlags & RTMP_LF_LIVE) +- SendFCSubscribe(r, &r->Link.playpath); +- } +- } ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_youCannotPlayMe); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "wfctv.com") || strstr(pageUrl, "wfctv.com")) ++ { ++ AVal av_auth1 = AVC("zoivid"); ++ AVal av_auth2 = AVC("yePi4jee"); ++ SAVC(stream_login); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_stream_login); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth1); ++ enc = AMF_EncodeString(enc, pend, &av_auth2); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "streamscene.cc") || strstr(pageUrl, "streamscene.cc") ++ || strstr(host, "tsboard.tv") || strstr(pageUrl, "teamstream.in") ++ || strstr(host, "hdstreams.tv") || strstr(pageUrl, "teamstream.to") ++ || strstr(pageUrl, "istreams.to")) ++ { ++ SendCommand(r, "r", FALSE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "pc3oot.us.to")) ++ { ++ SendCommand(r, "StreamPiraten", TRUE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "axcast.com")) ++ { ++ SendCommand(r, "requestData", FALSE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "dhmediahosting.com")) ++ { ++ SendCommand(r, "netStreamEnable", FALSE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "ezcast.tv")) ++ { ++ SendCommand(r, "jaSakamCarevataKerka", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "liveflash.tv")) ++ { ++ SendCommand(r, "kaskatija", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "mips.tv")) ++ { ++ SendCommand(r, "gaolVanus", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "ucaster.eu")) ++ { ++ SendCommand(r, "vujkoMiLazarBarakovOdMokrino", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "yukons.net")) ++ { ++ SendCommand(r, "trxuwaaLahRKnaechb", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "yycast.com")) ++ { ++ SendCommand(r, "trajkoProkopiev", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if ((strstr(host, "highwebmedia.com") || strstr(pageUrl, "chaturbate.com")) ++ && (!strstr(host, "origin"))) ++ { ++ AVal av_ModelName; ++ SAVC(CheckPublicStatus); ++ ++ if (strlen(pageUrl) > 7) ++ { ++ strsplit(pageUrl + 7, FALSE, '/', ¶ms); ++ av_ModelName.av_val = params[1]; ++ av_ModelName.av_len = strlen(params[1]); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_CheckPublicStatus); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_ModelName); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ SendInvoke(r, &av_Command, FALSE); ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "you must specify the pageUrl"); ++ RTMP_Close(r); ++ } ++ } ++ /* Weeb.tv specific authentication */ ++ else if (r->Link.WeebToken.av_len) ++ { ++ AVal av_Token, av_Username, av_Password; ++ SAVC(determineAccess); ++ ++ param_count = strsplit(r->Link.WeebToken.av_val, FALSE, ';', ¶ms); ++ if (param_count >= 1) ++ { ++ av_Token.av_val = params[0]; ++ av_Token.av_len = strlen(params[0]); ++ } ++ if (param_count >= 2) ++ { ++ av_Username.av_val = params[1]; ++ av_Username.av_len = strlen(params[1]); ++ } ++ if (param_count >= 3) ++ { ++ av_Password.av_val = params[2]; ++ av_Password.av_len = strlen(params[2]); ++ } ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_determineAccess); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_Token); ++ enc = AMF_EncodeString(enc, pend, &av_Username); ++ enc = AMF_EncodeString(enc, pend, &av_Password); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", r->Link.WeebToken.av_val); ++ SendInvoke(r, &av_Command, FALSE); ++ } ++ else ++ RTMP_SendCreateStream(r); ++ } + else if (AVMATCH(&methodInvoked, &av_createStream)) +- { +- r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); ++ { ++ r->m_stream_id = (int) AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); + +- if (r->Link.protocol & RTMP_FEATURE_WRITE) +- { +- SendPublish(r); +- } +- else +- { +- if (r->Link.lFlags & RTMP_LF_PLST) +- SendPlaylist(r); +- SendPlay(r); +- RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); +- } +- } ++ if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) ++ { ++ /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ ++ if (r->Link.usherToken.av_len) ++ SendUsherToken(r, &r->Link.usherToken); ++ /* Send the FCSubscribe if live stream or if subscribepath is set */ ++ if (r->Link.subscribepath.av_len) ++ SendFCSubscribe(r, &r->Link.subscribepath); ++ else if ((r->Link.lFlags & RTMP_LF_LIVE) && (!r->Link.WeebToken.av_len)) ++ SendFCSubscribe(r, &r->Link.playpath); ++ } ++ ++ if (r->Link.protocol & RTMP_FEATURE_WRITE) ++ { ++ SendPublish(r); ++ } ++ else ++ { ++ if (r->Link.lFlags & RTMP_LF_PLST) ++ SendPlaylist(r); ++ SendPlay(r); ++ RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); ++ } ++ } + else if (AVMATCH(&methodInvoked, &av_play) || +- AVMATCH(&methodInvoked, &av_publish)) +- { +- r->m_bPlaying = TRUE; +- } ++ AVMATCH(&methodInvoked, &av_publish)) ++ { ++ r->m_bPlaying = TRUE; ++ } + free(methodInvoked.av_val); + } + else if (AVMATCH(&method, &av_onBWDone)) + { +- if (!r->m_nBWCheckCounter) ++ if (!r->m_nBWCheckCounter) + SendCheckBW(r); + } + else if (AVMATCH(&method, &av_onFCSubscribe)) +@@ -3048,21 +3337,22 @@ + { + int i; + for (i = 0; i < r->m_numCalls; i++) +- if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) +- { +- AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); +- break; +- } ++ if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) ++ { ++ AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); ++ break; ++ } + } + else if (AVMATCH(&method, &av__error)) + { ++ int handled = FALSE; + #ifdef CRYPTO + AVal methodInvoked = {0}; + int i; + + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { +- for (i=0; i<r->m_numCalls; i++) ++ for (i = 0; i < r->m_numCalls; i++) + { + if (r->m_methodCalls[i].num == txn) + { +@@ -3074,12 +3364,12 @@ + if (!methodInvoked.av_val) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", +- __FUNCTION__, txn); ++ __FUNCTION__, txn); + goto leave; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, received error for method call <%s>", __FUNCTION__, +- methodInvoked.av_val); ++ methodInvoked.av_val); + + if (AVMATCH(&methodInvoked, &av_connect)) + { +@@ -3093,20 +3383,65 @@ + /* if PublisherAuth returns 1, then reconnect */ + PublisherAuth(r, &description); + } +- } +- else +- { +- RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); ++ handled = TRUE; + } + free(methodInvoked.av_val); +-#else +- RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + #endif ++ double code = 0.0; ++ unsigned int parsedPort = 0; ++ AMFObject obj2; ++ AMFObjectProperty p; ++ AVal redirect; ++ SAVC(ex); ++ SAVC(redirect); ++ ++ AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); ++ if (RTMP_FindFirstMatchingProperty(&obj2, &av_ex, &p)) ++ { ++ AMFProp_GetObject(&p, &obj2); ++ if (RTMP_FindFirstMatchingProperty(&obj2, &av_code, &p)) ++ code = AMFProp_GetNumber(&p); ++ if (code == 302 && RTMP_FindFirstMatchingProperty(&obj2, &av_redirect, &p)) ++ { ++ AMFProp_GetString(&p, &redirect); ++ r->Link.redirected = TRUE; ++ ++ char *playpath = "//playpath"; ++ int len = redirect.av_len + strlen(playpath); ++ char *url = malloc(len + 1); ++ memcpy(url, redirect.av_val, redirect.av_len); ++ memcpy(url + redirect.av_len, playpath, strlen(playpath)); ++ url[len] = '\0'; ++ r->Link.tcUrl.av_val = url; ++ r->Link.tcUrl.av_len = redirect.av_len; ++ RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, &parsedPort, &r->Link.playpath0, &r->Link.app); ++ if (parsedPort) ++ r->Link.port = parsedPort; ++ } ++ } ++ if (r->Link.redirected) ++ { ++ handled = TRUE; ++ RTMP_Log(RTMP_LOGINFO, "rtmp server sent redirect"); ++ } ++ ++ if (!handled) ++ RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + } + else if (AVMATCH(&method, &av_close)) + { +- RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); +- RTMP_Close(r); ++ if (r->Link.redirected) ++ { ++ r->Link.redirected = FALSE; ++ RTMP_Close(r); ++ RTMP_Log(RTMP_LOGINFO, "trying to connect with redirected url"); ++ RTMP_Connect(r, NULL); ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); ++ RTMP_Close(r); ++ } + #ifdef CRYPTO + if ((r->Link.protocol & RTMP_FEATURE_WRITE) && + !(r->Link.pFlags & RTMP_PUB_CLEAN) && +@@ -3127,16 +3462,18 @@ + else if (AVMATCH(&method, &av_onStatus)) + { + AMFObject obj2; +- AVal code, level; ++ AVal code, level, description; + AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); + AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code); + AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level); ++ AMFProp_GetString(AMF_GetProp(&obj2, &av_description, -1), &description); + + RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val); + if (AVMATCH(&code, &av_NetStream_Failed) +- || AVMATCH(&code, &av_NetStream_Play_Failed) +- || AVMATCH(&code, &av_NetStream_Play_StreamNotFound) +- || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) ++ || AVMATCH(&code, &av_NetStream_Play_Failed) ++ || AVMATCH(&code, &av_NetStream_Play_StreamNotFound) ++ || AVMATCH(&code, &av_NetConnection_Connect_Rejected) ++ || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) + { + r->m_stream_id = -1; + RTMP_Close(r); +@@ -3194,6 +3531,46 @@ + r->m_pausing = 3; + } + } ++ ++ else if (AVMATCH(&code, &av_NetConnection_confStream)) ++ { ++#ifdef CRYPTO ++ static const char hexdig[] = "0123456789abcdef"; ++ AVal auth; ++ SAVC(cf_stream); ++ int i; ++ char hash_hex[33] = {0}; ++ unsigned char hash[16]; ++ ++ param_count = strsplit(description.av_val, description.av_len, ':', ¶ms); ++ if (param_count >= 3) ++ { ++ char *buf = malloc(strlen(params[0]) + r->Link.playpath.av_len + 1); ++ strcpy(buf, params[0]); ++ strncat(buf, r->Link.playpath.av_val, r->Link.playpath.av_len); ++ md5_hash((unsigned char *) buf, strlen(buf), hash); ++ for (i = 0; i < 16; i++) ++ { ++ hash_hex[i * 2] = hexdig[0x0f & (hash[i] >> 4)]; ++ hash_hex[i * 2 + 1] = hexdig[0x0f & (hash[i])]; ++ } ++ auth.av_val = &hash_hex[atoi(params[1]) - 1]; ++ auth.av_len = atoi(params[2]); ++ RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %.*s", auth.av_len, auth.av_val); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_cf_stream); ++ enc = AMF_EncodeNumber(enc, pend, txn); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ SendInvoke(r, &av_Command, FALSE); ++ free(buf); ++ } ++#endif ++ } + } + else if (AVMATCH(&method, &av_playlist_ready)) + { +@@ -3207,6 +3584,85 @@ + } + } + } ++ else if (AVMATCH(&method, &av_verifyClient)) ++ { ++ double VerificationNumber = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); ++ RTMP_Log(RTMP_LOGDEBUG, "VerificationNumber: %.2f", VerificationNumber); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av__result); ++ enc = AMF_EncodeNumber(enc, pend, txn); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeNumber(enc, pend, exp(atan(sqrt(VerificationNumber))) + 1); ++ av_Response.av_val = pbuf; ++ av_Response.av_len = enc - pbuf; ++ ++ AMF_Decode(&obj, av_Response.av_val, av_Response.av_len, FALSE); ++ AMF_Dump(&obj); ++ SendInvoke(r, &av_Response, FALSE); ++ } ++ else if (AVMATCH(&method, &av_sendStatus)) ++ { ++ if (r->Link.WeebToken.av_len) ++ { ++ AVal av_Authorized = AVC("User.hasAccess"); ++ AVal av_TransferLimit = AVC("User.noPremium.limited"); ++ AVal av_UserLimit = AVC("User.noPremium.tooManyUsers"); ++ AVal av_TimeLeft = AVC("timeLeft"); ++ AVal av_Status, av_ReconnectionTime; ++ ++ AMFObject Status; ++ AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &Status); ++ AMFProp_GetString(AMF_GetProp(&Status, &av_code, -1), &av_Status); ++ RTMP_Log(RTMP_LOGINFO, "%.*s", av_Status.av_len, av_Status.av_val); ++ if (AVMATCH(&av_Status, &av_Authorized)) ++ { ++ RTMP_Log(RTMP_LOGINFO, "Weeb.tv authentication successful"); ++ RTMP_SendCreateStream(r); ++ } ++ else if (AVMATCH(&av_Status, &av_UserLimit)) ++ { ++ RTMP_Log(RTMP_LOGINFO, "No free slots available"); ++ RTMP_Close(r); ++ } ++ else if (AVMATCH(&av_Status, &av_TransferLimit)) ++ { ++ AMFProp_GetString(AMF_GetProp(&Status, &av_TimeLeft, -1), &av_ReconnectionTime); ++ RTMP_Log(RTMP_LOGINFO, "Viewing limit exceeded. try again in %.*s minutes.", av_ReconnectionTime.av_len, av_ReconnectionTime.av_val); ++ RTMP_Close(r); ++ } ++ } ++ } ++ else if (AVMATCH(&method, &av_cps)) ++ { ++ int Status = AMFProp_GetBoolean(AMF_GetProp(&obj, NULL, 3)); ++ if (Status == FALSE) ++ { ++ AVal Message; ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 4), &Message); ++ RTMP_Log(RTMP_LOGINFO, "Model status is %.*s", Message.av_len, Message.av_val); ++ RTMP_Close(r); ++ } ++ else ++ { ++ AVal Playpath, Server; ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 5), &Playpath); ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 6), &Server); ++ if (strncasecmp(&Playpath.av_val[Playpath.av_len - 4], ".mp4", 4) != 0) ++ { ++ char *playpath = calloc(Server.av_len + Playpath.av_len + 25, sizeof (char)); ++ strcat(playpath, "rtmp://"); ++ strncat(playpath, Server.av_val, Server.av_len); ++ strcat(playpath, "/live-origin/"); ++ strncat(playpath, Playpath.av_val, Playpath.av_len); ++ strcat(playpath, ".mp4"); ++ Playpath.av_val = playpath; ++ Playpath.av_len = strlen(playpath); ++ } ++ RTMP_ParsePlaypath(&Playpath, &r->Link.playpath); ++ RTMP_SendCreateStream(r); ++ } ++ } + else + { + +@@ -3232,7 +3688,8 @@ + return TRUE; + } + +- if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) ++ if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY ++ || prop->p_type == AMF_STRICT_ARRAY) + { + if (RTMP_FindFirstMatchingProperty(&prop->p_vu.p_object, name, p)) + return TRUE; +@@ -3258,7 +3715,8 @@ + return TRUE; + } + +- if (prop->p_type == AMF_OBJECT) ++ if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY ++ || prop->p_type == AMF_STRICT_ARRAY) + { + if (RTMP_FindPrefixProperty(&prop->p_vu.p_object, name, p)) + return TRUE; +@@ -3292,6 +3750,7 @@ + snprintf(str, 255, "%s", + prop->p_vu.p_number != 0. ? "TRUE" : "FALSE"); + break; ++ case AMF_NULL: + case AMF_STRING: + len = snprintf(str, 255, "%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); +@@ -3307,7 +3766,7 @@ + } + if (str[0] && prop->p_name.av_len) + { +- RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len, ++ RTMP_Log(RTMP_LOGINFO, " %-24.*s%s", prop->p_name.av_len, + prop->p_name.av_val, str); + } + } +@@ -3389,7 +3848,7 @@ + unsigned int tmp; + if (packet->m_body && packet->m_nBodySize >= 2) + nType = AMF_DecodeInt16(packet->m_body); +- RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType, ++ RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl, type: %d, len: %d", __FUNCTION__, nType, + packet->m_nBodySize); + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + +@@ -3498,15 +3957,15 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__); + if (packet->m_nBodySize > 2 && packet->m_body[2] > 0x01) + { +- RTMP_Log(RTMP_LOGERROR, +- "%s: SWFVerification Type %d request not supported! Patches welcome...", +- __FUNCTION__, packet->m_body[2]); ++ RTMP_Log(RTMP_LOGERROR, ++ "%s: SWFVerification Type %d request not supported, attempting to use SWFVerification Type 1! Patches welcome...", ++ __FUNCTION__, packet->m_body[2]); + } + #ifdef CRYPTO + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + /* respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied */ +- else if (r->Link.SWFSize) ++ if (r->Link.SWFSize) + { + RTMP_SendCtrl(r, 0x1B, 0, 0); + } +@@ -3811,8 +4270,18 @@ + serversig[4], serversig[5], serversig[6], serversig[7]); + + /* 2nd part of handshake */ +- if (!WriteN(r, serversig, RTMP_SIG_SIZE)) +- return FALSE; ++ if (r->Link.CombineConnectPacket) ++ { ++ char *HandshakeResponse = malloc(RTMP_SIG_SIZE); ++ memcpy(HandshakeResponse, (char *) serversig, RTMP_SIG_SIZE); ++ r->Link.HandshakeResponse.av_val = HandshakeResponse; ++ r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE; ++ } ++ else ++ { ++ if (!WriteN(r, (char *) serversig, RTMP_SIG_SIZE)) ++ return FALSE; ++ } + + if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; +@@ -4263,8 +4732,13 @@ + { + int nBytes; + +- if (!sb->sb_size) +- sb->sb_start = sb->sb_buf; ++ /* Copy unprocessed bytes to the start of buffer to make optimum use of ++ * available buffer */ ++ if (sb->sb_start != sb->sb_buf) ++ { ++ memcpy(sb->sb_buf, sb->sb_start, sb->sb_size); ++ sb->sb_start = sb->sb_buf; ++ } + + while (1) + { +@@ -4278,6 +4752,8 @@ + #endif + { + nBytes = recv(sb->sb_socket, sb->sb_start + sb->sb_size, nBytes, 0); ++ if (!nBytes) ++ RTMP_Log(RTMP_LOGDEBUG, "Socket closed by server, nBytes: %d", nBytes); + } + if (nBytes != -1) + { +@@ -4417,21 +4893,19 @@ + HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len) + { + char hbuf[512]; +- int hlen = snprintf(hbuf, sizeof(hbuf), "POST /%s%s/%d HTTP/1.1\r\n" +- "Host: %.*s:%d\r\n" +- "Accept: */*\r\n" +- "User-Agent: Shockwave Flash\r\n" +- "Connection: Keep-Alive\r\n" +- "Cache-Control: no-cache\r\n" +- "Content-type: application/x-fcs\r\n" +- "Content-length: %d\r\n\r\n", RTMPT_cmds[cmd], +- r->m_clientID.av_val ? r->m_clientID.av_val : "", +- r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val, +- r->Link.port, len); ++ int hlen = snprintf(hbuf, sizeof (hbuf), "POST /%s%s/%d HTTP/1.1\r\n" ++ "Content-Type: application/x-fcs\r\n" ++ "User-Agent: Shockwave Flash\r\n" ++ "Host: %.*s:%d\r\n" ++ "Content-Length: %d\r\n" ++ "Connection: Keep-Alive\r\n" ++ "Cache-Control: no-cache\r\n\r\n", RTMPT_cmds[cmd], ++ r->m_clientID.av_val ? r->m_clientID.av_val : "", ++ r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val, ++ r->Link.port, len); + RTMPSockBuf_Send(&r->m_sb, hbuf, hlen); + hlen = RTMPSockBuf_Send(&r->m_sb, buf, len); + r->m_msgCounter++; +- r->m_unackd++; + return hlen; + } + +@@ -4441,22 +4915,17 @@ + char *ptr; + int hlen; + +-restart: + if (fill) + RTMPSockBuf_Fill(&r->m_sb); +- if (r->m_sb.sb_size < 13) { +- if (fill) +- goto restart; ++ ++ /* Check if socket buffer is empty or HTTP header isn't completely received */ ++ memset(r->m_sb.sb_start + r->m_sb.sb_size, '\0', 1); ++ if ((!r->m_sb.sb_size) || (!strstr(r->m_sb.sb_start, "\r\n\r\n"))) + return -2; +- } ++ + if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) + return -1; + r->m_sb.sb_start[r->m_sb.sb_size] = '\0'; +- if (!strstr(r->m_sb.sb_start, "\r\n\r\n")) { +- if (fill) +- goto restart; +- return -2; +- } + + ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); + while ((ptr = strstr(ptr, "Content-"))) { +@@ -4464,21 +4933,31 @@ + ptr += 8; + } + if (!ptr) +- return -1; +- hlen = atoi(ptr+16); ++ { ++ ptr = r->m_sb.sb_start + sizeof ("HTTP/1.1 200"); ++ RTMP_Log(RTMP_LOGDEBUG, "No Content-Length header found, assuming continuous stream"); ++ hlen = 2147483648UL; // 2 GB ++ } ++ else ++ hlen = atoi(ptr + 16); + ptr = strstr(ptr+16, "\r\n\r\n"); + if (!ptr) + return -1; + ptr += 4; +- if (ptr + (r->m_clientID.av_val ? 1 : hlen) > r->m_sb.sb_start + r->m_sb.sb_size) +- { +- if (fill) +- goto restart; +- return -2; +- } + r->m_sb.sb_size -= ptr - r->m_sb.sb_start; + r->m_sb.sb_start = ptr; +- r->m_unackd--; ++ ++ /* Stop processing if content length is 0 */ ++ if (!hlen) ++ return -3; ++ ++ /* Refill buffer if no payload is received */ ++ if (hlen && (!r->m_sb.sb_size)) ++ { ++ RTMPSockBuf_Fill(&r->m_sb); ++ ptr = r->m_sb.sb_buf; ++ r->m_sb.sb_start = ptr; ++ } + + if (!r->m_clientID.av_val) + { +@@ -4498,10 +4977,17 @@ + r->m_sb.sb_start++; + r->m_sb.sb_size--; + } ++ ++ /* Following values shouldn't be negative in any case */ ++ if (r->m_resplen < 0) ++ r->m_resplen = 0; ++ if (r->m_sb.sb_size < 0) ++ r->m_sb.sb_size = 0; ++ + return 0; + } + +-#define MAX_IGNORED_FRAMES 50 ++#define MAX_IGNORED_FRAMES 100 + + /* Read from the stream until we get a media packet. + * Returns -3 if Play.Close/Stop, -2 if fatal error, -1 if no more media +@@ -4569,162 +5055,156 @@ + #endif + + if (r->m_read.flags & RTMP_READ_RESUME) +- { +- /* check the header if we get one */ +- if (packet.m_nTimeStamp == 0) +- { +- if (r->m_read.nMetaHeaderSize > 0 +- && packet.m_packetType == RTMP_PACKET_TYPE_INFO) +- { +- AMFObject metaObj; +- int nRes = +- AMF_Decode(&metaObj, packetBody, nPacketLen, FALSE); +- if (nRes >= 0) +- { +- AVal metastring; +- AMFProp_GetString(AMF_GetProp(&metaObj, NULL, 0), +- &metastring); +- +- if (AVMATCH(&metastring, &av_onMetaData)) +- { +- /* compare */ +- if ((r->m_read.nMetaHeaderSize != nPacketLen) || +- (memcmp +- (r->m_read.metaHeader, packetBody, +- r->m_read.nMetaHeaderSize) != 0)) +- { +- ret = RTMP_READ_ERROR; +- } +- } +- AMF_Reset(&metaObj); +- if (ret == RTMP_READ_ERROR) +- break; +- } +- } ++ { ++ RTMP_Log(RTMP_LOGDEBUG2, "Received timestamp: %d, type %d", ++ packet.m_nTimeStamp, packet.m_packetType); ++ if (packet.m_nTimeStamp > 0 && r->m_read.nResumeDriftTS > 0) ++ packet.m_nTimeStamp -= r->m_read.nResumeDriftTS; ++ RTMP_Log(RTMP_LOGDEBUG2, "Adjusted timestamp: %d", packet.m_nTimeStamp); ++ ++ /* check the header if we get one */ ++ if (r->m_read.nMetaHeaderSize > 0 ++ && packet.m_packetType == RTMP_PACKET_TYPE_INFO) ++ { ++ AMFObject metaObj; ++ int nRes = AMF_Decode(&metaObj, packetBody, nPacketLen, FALSE); ++ if (nRes >= 0) ++ { ++ AVal metastring; ++ AMFProp_GetString(AMF_GetProp(&metaObj, NULL, 0), &metastring); + +- /* check first keyframe to make sure we got the right position +- * in the stream! (the first non ignored frame) +- */ +- if (r->m_read.nInitialFrameSize > 0) +- { +- /* video or audio data */ +- if (packet.m_packetType == r->m_read.initialFrameType +- && r->m_read.nInitialFrameSize == nPacketLen) +- { +- /* we don't compare the sizes since the packet can +- * contain several FLV packets, just make sure the +- * first frame is our keyframe (which we are going +- * to rewrite) +- */ +- if (memcmp +- (r->m_read.initialFrame, packetBody, +- r->m_read.nInitialFrameSize) == 0) +- { +- RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!"); +- r->m_read.flags |= RTMP_READ_GOTKF; +- /* ignore it! (what about audio data after it? it is +- * handled by ignoring all 0ms frames, see below) +- */ +- ret = RTMP_READ_IGNORE; +- break; +- } +- } ++ if (AVMATCH(&metastring, &av_onMetaData)) ++ { ++ /* compare */ ++ if ((r->m_read.nMetaHeaderSize != nPacketLen) || ++ (memcmp(r->m_read.metaHeader, packetBody, r->m_read.nMetaHeaderSize) != 0)) ++ { ++ ret = RTMP_READ_ERROR; ++ } ++ } ++ AMF_Reset(&metaObj); ++ if (ret == RTMP_READ_ERROR) ++ break; ++ } ++ } + +- /* hande FLV streams, even though the server resends the +- * keyframe as an extra video packet it is also included +- * in the first FLV stream chunk and we have to compare +- * it and filter it out !! +- */ +- if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) +- { +- /* basically we have to find the keyframe with the +- * correct TS being nResumeTS +- */ +- unsigned int pos = 0; +- uint32_t ts = 0; +- +- while (pos + 11 < nPacketLen) +- { +- /* size without header (11) and prevTagSize (4) */ +- uint32_t dataSize = +- AMF_DecodeInt24(packetBody + pos + 1); +- ts = AMF_DecodeInt24(packetBody + pos + 4); +- ts |= (packetBody[pos + 7] << 24); ++ /* check first keyframe to make sure we got the right position ++ * in the stream! (the first non ignored frame) ++ */ ++ RTMP_Log(RTMP_LOGDEBUG2, "Required packet length: %d, Packet length: %d", ++ r->m_read.nInitialFrameSize, nPacketLen); ++ if (r->m_read.nInitialFrameSize > 0) ++ { ++ /* video or audio data */ ++ if (packet.m_packetType == r->m_read.initialFrameType ++ && r->m_read.nInitialFrameSize == nPacketLen) ++ { ++ /* we don't compare the sizes since the packet can ++ * contain several FLV packets, just make sure the ++ * first frame is our keyframe (which we are going ++ * to rewrite) ++ */ ++ RTMP_Log(RTMP_LOGDEBUG2, "Comparing keyframe data"); ++ if (memcmp(r->m_read.initialFrame, packetBody, ++ r->m_read.nInitialFrameSize) == 0) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!"); ++ r->m_read.flags |= RTMP_READ_GOTKF; ++ r->m_read.nResumeDriftTS = packet.m_nTimeStamp; ++ /* ignore it! (what about audio data after it? it is ++ * handled by ignoring all 0ms frames, see below) ++ */ ++ ret = RTMP_READ_IGNORE; ++ break; ++ } ++ } ++ ++ /* hande FLV streams, even though the server resends the ++ * keyframe as an extra video packet it is also included ++ * in the first FLV stream chunk and we have to compare ++ * it and filter it out !! ++ */ ++ if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) ++ { ++ /* basically we have to find the keyframe with the ++ * correct TS being nResumeTS ++ */ ++ unsigned int pos = 0; ++ uint32_t ts = 0; ++ ++ while (pos + 11 < nPacketLen) ++ { ++ /* size without header (11) and prevTagSize (4) */ ++ uint32_t dataSize = AMF_DecodeInt24(packetBody + pos + 1); ++ ts = AMF_DecodeInt24(packetBody + pos + 4); ++ ts |= (packetBody[pos + 7] << 24); + + #ifdef _DEBUG +- RTMP_Log(RTMP_LOGDEBUG, +- "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms", +- packetBody[pos], dataSize, ts); +-#endif +- /* ok, is it a keyframe?: +- * well doesn't work for audio! +- */ +- if (packetBody[pos /*6928, test 0 */ ] == +- r->m_read.initialFrameType +- /* && (packetBody[11]&0xf0) == 0x10 */ ) +- { +- if (ts == r->m_read.nResumeTS) +- { +- RTMP_Log(RTMP_LOGDEBUG, +- "Found keyframe with resume-keyframe timestamp!"); +- if (r->m_read.nInitialFrameSize != dataSize +- || memcmp(r->m_read.initialFrame, +- packetBody + pos + 11, +- r->m_read. +- nInitialFrameSize) != 0) +- { +- RTMP_Log(RTMP_LOGERROR, +- "FLV Stream: Keyframe doesn't match!"); +- ret = RTMP_READ_ERROR; +- break; +- } +- r->m_read.flags |= RTMP_READ_GOTFLVK; +- +- /* skip this packet? +- * check whether skippable: +- */ +- if (pos + 11 + dataSize + 4 > nPacketLen) +- { +- RTMP_Log(RTMP_LOGWARNING, +- "Non skipable packet since it doesn't end with chunk, stream corrupt!"); +- ret = RTMP_READ_ERROR; +- break; +- } +- packetBody += (pos + 11 + dataSize + 4); +- nPacketLen -= (pos + 11 + dataSize + 4); +- +- goto stopKeyframeSearch; +- +- } +- else if (r->m_read.nResumeTS < ts) +- { +- /* the timestamp ts will only increase with +- * further packets, wait for seek +- */ +- goto stopKeyframeSearch; +- } +- } +- pos += (11 + dataSize + 4); +- } +- if (ts < r->m_read.nResumeTS) +- { +- RTMP_Log(RTMP_LOGERROR, +- "First packet does not contain keyframe, all " +- "timestamps are smaller than the keyframe " +- "timestamp; probably the resume seek failed?"); +- } +- stopKeyframeSearch: +- ; +- if (!(r->m_read.flags & RTMP_READ_GOTFLVK)) +- { +- RTMP_Log(RTMP_LOGERROR, +- "Couldn't find the seeked keyframe in this chunk!"); +- ret = RTMP_READ_IGNORE; +- break; +- } +- } +- } +- } ++ RTMP_Log(RTMP_LOGDEBUG, ++ "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms", ++ packetBody[pos], dataSize, ts); ++#endif ++ /* ok, is it a keyframe?: ++ * well doesn't work for audio! ++ */ ++ if (packetBody[pos /*6928, test 0 */ ] == r->m_read.initialFrameType ++ /* && (packetBody[11]&0xf0) == 0x10 */) ++ { ++ if (ts == r->m_read.nResumeTS) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Found keyframe with resume-keyframe timestamp!"); ++ if (r->m_read.nInitialFrameSize != dataSize || ++ memcmp(r->m_read.initialFrame, packetBody + pos + 11, ++ r->m_read.nInitialFrameSize) != 0) ++ { ++ RTMP_Log(RTMP_LOGERROR, "FLV Stream: Keyframe doesn't match!"); ++ ret = RTMP_READ_ERROR; ++ break; ++ } ++ r->m_read.flags |= RTMP_READ_GOTFLVK; ++ ++ /* skip this packet? ++ * check whether skippable: ++ */ ++ if (pos + 11 + dataSize + 4 > nPacketLen) ++ { ++ RTMP_Log(RTMP_LOGWARNING, "Non skipable packet since it doesn't " ++ "end with chunk, stream corrupt!"); ++ ret = RTMP_READ_ERROR; ++ break; ++ } ++ packetBody += (pos + 11 + dataSize + 4); ++ nPacketLen -= (pos + 11 + dataSize + 4); ++ ++ goto stopKeyframeSearch; ++ ++ } ++ else if (r->m_read.nResumeTS < ts) ++ { ++ /* the timestamp ts will only increase with ++ * further packets, wait for seek ++ */ ++ goto stopKeyframeSearch; ++ } ++ } ++ pos += (11 + dataSize + 4); ++ } ++ if (ts < r->m_read.nResumeTS) ++ { ++ RTMP_Log(RTMP_LOGERROR, ++ "First packet does not contain keyframe, all " ++ "timestamps are smaller than the keyframe " ++ "timestamp; probably the resume seek failed?"); ++ } ++ stopKeyframeSearch: ++ if (!(r->m_read.flags & RTMP_READ_GOTFLVK)) ++ { ++ RTMP_Log(RTMP_LOGERROR, "Couldn't find the seeked keyframe in this chunk!"); ++ ret = RTMP_READ_IGNORE; ++ break; ++ } ++ } ++ } + + if (packet.m_nTimeStamp > 0 + && (r->m_read.flags & (RTMP_READ_GOTKF|RTMP_READ_GOTFLVK))) +@@ -4984,7 +5464,7 @@ + 0x00, 0x00, 0x00, 0x00 + }; + +-#define HEADERBUF (128*1024) ++#define HEADERBUF (1024*1024) + int + RTMP_Read(RTMP *r, char *buf, int size) + { +@@ -5187,3 +5667,284 @@ + } + return size+s2; + } ++ ++AVal ++AVcopy(AVal src) ++{ ++ AVal dst; ++ if (src.av_len) ++ { ++ dst.av_val = malloc(src.av_len + 1); ++ memcpy(dst.av_val, src.av_val, src.av_len); ++ dst.av_val[src.av_len] = '\0'; ++ dst.av_len = src.av_len; ++ } ++ else ++ { ++ dst.av_val = NULL; ++ dst.av_len = 0; ++ } ++ return dst; ++} ++ ++static int ++ConnectSocket(RTMP *r) ++{ ++ int on = 1; ++ struct sockaddr_in service; ++ if (!r->Link.hostname.av_len) ++ return FALSE; ++ ++ memset(&service, 0, sizeof (struct sockaddr_in)); ++ service.sin_family = AF_INET; ++ ++ if (r->Link.socksport) ++ { ++ /* Connect via SOCKS */ ++ if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport)) ++ return FALSE; ++ } ++ else ++ { ++ /* Connect directly */ ++ if (!add_addr_info(&service, &r->Link.hostname, r->Link.port)) ++ return FALSE; ++ } ++ ++ r->m_sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (r->m_sb.sb_socket != -1) ++ { ++ if (connect(r->m_sb.sb_socket, (struct sockaddr *) &service, sizeof (struct sockaddr)) < 0) ++ { ++ int err = GetSockError(); ++ RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)", ++ __FUNCTION__, err, strerror(err)); ++ RTMP_Close(r); ++ return FALSE; ++ } ++ ++ if (r->Link.socksport) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__); ++ if (!SocksNegotiate(r)) ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__); ++ RTMP_Close(r); ++ return FALSE; ++ } ++ } ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d", ++ __FUNCTION__, GetSockError()); ++ return FALSE; ++ } ++ ++ /* set timeout */ ++ SET_RCVTIMEO(tv, r->Link.timeout); ++ if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof (tv))) ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %d failed!", ++ __FUNCTION__, r->Link.timeout); ++ } ++ ++ setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof (on)); ++ if (r->Link.protocol & RTMP_FEATURE_HTTP) ++ setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on)); ++ ++ return TRUE; ++} ++ ++static int ++SendCommand(RTMP *r, char *method, int queue) ++{ ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; ++ AVal av_command, methodName; ++ ++ enc = pbuf; ++ methodName.av_val = method; ++ methodName.av_len = strlen(method); ++ enc = AMF_EncodeString(enc, pend, &methodName); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ av_command.av_val = pbuf; ++ av_command.av_len = enc - pbuf; ++ ++ return SendInvoke(r, &av_command, queue); ++} ++ ++static int ++SendGetStreamLength(RTMP *r) ++{ ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; ++ AVal av_Command; ++ SAVC(getStreamLength); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_getStreamLength); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &r->Link.playpath); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ return SendInvoke(r, &av_Command, TRUE); ++} ++ ++static int ++SendInvoke(RTMP *r, AVal *command, int queue) ++{ ++ RTMPPacket packet; ++ char pbuf[512], *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ if (command->av_len) ++ { ++ memcpy(enc, command->av_val, command->av_len); ++ enc += command->av_len; ++ } ++ else ++ return FALSE; ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, queue); ++} ++ ++AVal ++StripParams(AVal *src) ++{ ++ AVal str; ++ if (src->av_val) ++ { ++ str.av_val = calloc(src->av_len + 1, sizeof (char)); ++ strncpy(str.av_val, src->av_val, src->av_len); ++ str.av_len = src->av_len; ++ char *start = str.av_val; ++ char *end = start + str.av_len; ++ char *ptr = start; ++ ++ while (ptr < end) ++ { ++ if (*ptr == '?') ++ { ++ str.av_len = ptr - start; ++ break; ++ } ++ ptr++; ++ } ++ memset(start + str.av_len, 0, 1); ++ ++ char *dynamic = strstr(start, "[[DYNAMIC]]"); ++ if (dynamic) ++ { ++ dynamic -= 1; ++ memset(dynamic, 0, 1); ++ str.av_len = dynamic - start; ++ end = start + str.av_len; ++ } ++ ++ char *import = strstr(start, "[[IMPORT]]"); ++ if (import) ++ { ++ str.av_val = import + 11; ++ strcpy(start, "http://"); ++ str.av_val = strcat(start, str.av_val); ++ str.av_len = strlen(str.av_val); ++ } ++ return str; ++ } ++ str = *src; ++ return str; ++} ++ ++char * ++strreplace(char *srcstr, int srclen, char *orig, char *repl, int didAlloc) ++{ ++ char *ptr = NULL, *sptr = srcstr; ++ int origlen = strlen(orig); ++ int repllen = strlen(repl); ++ if (!srclen) ++ srclen = strlen(srcstr); ++ char *srcend = srcstr + srclen; ++ int dstbuffer = srclen / origlen * repllen; ++ if (dstbuffer < srclen) ++ dstbuffer = srclen; ++ char *dststr = calloc(dstbuffer + 1, sizeof (char)); ++ char *dptr = dststr; ++ ++ if ((ptr = strstr(srcstr, orig))) ++ { ++ while (ptr < srcend && (ptr = strstr(sptr, orig))) ++ { ++ int len = ptr - sptr; ++ memcpy(dptr, sptr, len); ++ sptr += len + origlen; ++ dptr += len; ++ memcpy(dptr, repl, repllen); ++ dptr += repllen; ++ } ++ memcpy(dptr, sptr, srcend - sptr); ++ if (didAlloc) ++ free(srcstr); ++ return dststr; ++ } ++ ++ memcpy(dststr, srcstr, srclen); ++ if (didAlloc) ++ free(srcstr); ++ return dststr; ++} ++ ++int ++strsplit(char *src, int srclen, char delim, char ***params) ++{ ++ char *sptr, *srcbeg, *srcend, *dstr; ++ int count = 1, i = 0, len = 0; ++ ++ if (src == NULL) ++ return 0; ++ if (!srclen) ++ srclen = strlen(src); ++ srcbeg = src; ++ srcend = srcbeg + srclen; ++ sptr = srcbeg; ++ ++ /* count the delimiters */ ++ while (sptr < srcend) ++ { ++ if (*sptr++ == delim) ++ count++; ++ } ++ sptr = srcbeg; ++ *params = malloc(count * sizeof (size_t)); ++ char **param = *params; ++ ++ for (i = 0; i < (count - 1); i++) ++ { ++ dstr = strchr(sptr, delim); ++ len = dstr - sptr; ++ param[i] = malloc((len + 1) * sizeof (char)); ++ memcpy(param[i], sptr, len); ++ *(param[i] + len) = '\0'; ++ sptr += len + 1; ++ } ++ ++ /* copy the last string */ ++ if (sptr <= srcend) ++ { ++ len = srclen - (sptr - srcbeg); ++ param[i] = malloc((len + 1) * sizeof (char)); ++ memcpy(param[i], sptr, len); ++ *(param[i] + len) = '\0'; ++ } ++ return count; ++} +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.h 2014-05-04 17:55:17.517338389 +0200 +@@ -150,12 +150,14 @@ + AVal playpath; /* passed in explicitly */ + AVal tcUrl; + AVal swfUrl; ++ AVal swfHash; + AVal pageUrl; + AVal app; + AVal auth; + AVal flashVer; + AVal subscribepath; + AVal usherToken; ++ AVal WeebToken; + AVal token; + AVal pubUser; + AVal pubPasswd; +@@ -174,9 +176,15 @@ + int lFlags; + + int swfAge; ++ int swfSize; + + int protocol; ++ int ConnectPacket; ++ int CombineConnectPacket; ++ int redirected; + int timeout; /* connection timeout in seconds */ ++ AVal Extras; ++ AVal HandshakeResponse; + + #define RTMP_PUB_NAME 0x0001 /* send login to server */ + #define RTMP_PUB_RESP 0x0002 /* send salted password hash */ +@@ -224,6 +232,7 @@ + /* if bResume == TRUE */ + uint8_t initialFrameType; + uint32_t nResumeTS; ++ uint32_t nResumeDriftTS; + char *metaHeader; + char *initialFrame; + uint32_t nMetaHeaderSize; +@@ -310,6 +319,7 @@ + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, ++ AVal *WeebToken, + int dStart, + int dStop, int bLiveStream, long int timeout); + +@@ -375,6 +385,11 @@ + int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age); + ++ AVal AVcopy(AVal src); ++ AVal StripParams(AVal *src); ++ char *strreplace(char *srcstr, int srclen, char *orig, char *repl, int didAlloc); ++ int strsplit(char *src, int srclen, char delim, char ***params); ++ + #ifdef __cplusplus + }; + #endif +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp_sys.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp_sys.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp_sys.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp_sys.h 2014-05-04 17:55:17.517338389 +0200 +@@ -65,6 +65,7 @@ + #include <polarssl/net.h> + #include <polarssl/ssl.h> + #include <polarssl/havege.h> ++#include <polarssl/md5.h> + #if POLARSSL_VERSION_NUMBER < 0x01010000 + #define havege_random havege_rand + #endif +@@ -105,6 +106,7 @@ + #define TLS_write(s,b,l) ssl_write(s,(unsigned char *)b,l) + #define TLS_shutdown(s) ssl_close_notify(s) + #define TLS_close(s) ssl_free(s); free(s) ++#define md5_hash(i, ilen, o) md5(i, ilen, o) + + #elif defined(USE_GNUTLS) + #include <gnutls/gnutls.h> +@@ -122,6 +124,8 @@ + #define TLS_write(s,b,l) gnutls_record_send(s,b,l) + #define TLS_shutdown(s) gnutls_bye(s, GNUTLS_SHUT_RDWR) + #define TLS_close(s) gnutls_deinit(s) ++#define md5_hash(i, ilen, o) gnutls_digest_algorithm_t algorithm = GNUTLS_DIG_MD5;\ ++ gnutls_hash_fast(algorithm, i, ilen, o); + + #else /* USE_OPENSSL */ + #define TLS_CTX SSL_CTX * +@@ -134,6 +138,7 @@ + #define TLS_write(s,b,l) SSL_write(s,b,l) + #define TLS_shutdown(s) SSL_shutdown(s) + #define TLS_close(s) SSL_free(s) ++#define md5_hash(i, ilen, o) MD5(i, ilen, o) + + #endif + #endif +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/Makefile librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/Makefile +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/Makefile 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/Makefile 2014-05-04 17:55:17.513338440 +0200 +@@ -32,7 +32,7 @@ + SBINDIR=$(DESTDIR)$(sbindir) + MANDIR=$(DESTDIR)$(mandir) + +-LIBS_posix= ++LIBS_posix=-lm + LIBS_darwin= + LIBS_mingw=-lws2_32 -lwinmm -lgdi32 + LIB_RTMP=-Llibrtmp -lrtmp +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpdump.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpdump.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpdump.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpdump.c 2014-05-04 17:55:17.517338389 +0200 +@@ -283,6 +283,7 @@ + uint8_t dataType; + int bAudioOnly; + off_t size; ++ char *syncbuf, *p; + + fseek(file, 0, SEEK_END); + size = ftello(file); +@@ -293,8 +294,8 @@ + + bAudioOnly = (dataType & 0x4) && !(dataType & 0x1); + +- RTMP_Log(RTMP_LOGDEBUG, "bAudioOnly: %d, size: %llu", bAudioOnly, +- (unsigned long long) size); ++ RTMP_Log(RTMP_LOGDEBUG, "bAudioOnly: %d, size: %lu", bAudioOnly, ++ (unsigned long) size); + + // ok, we have to get the timestamp of the last keyframe (only keyframes are seekable) / last audio frame (audio only streams) + +@@ -326,6 +327,51 @@ + prevTagSize = AMF_DecodeInt32(buffer); + //RTMP_Log(RTMP_LOGDEBUG, "Last packet: prevTagSize: %d", prevTagSize); + ++ if (prevTagSize <= 0 || prevTagSize > size - 4 - 13) ++ { ++ /* Last packet was not fully received - try to sync to last tag */ ++ prevTagSize = 0; ++ tsize = size > 0x100000 ? 0x100000 : size; /* 1MB should be enough for 3500K bitrates */ ++ if (tsize > 13 + 15) ++ { ++ tsize -= 13; // do not read header ++ syncbuf = (char *) malloc(tsize); ++ if (syncbuf) ++ { ++ fseeko(file, size - tsize, SEEK_SET); ++ if (fread(syncbuf, 1, tsize, file) == tsize) ++ { ++ p = syncbuf + tsize; ++ while (p >= syncbuf + 15) ++ { ++ /* Check for StreamID */ ++ if (AMF_DecodeInt24(p - 7) == 0) ++ { ++ /* Check for Audio/Video/Script */ ++ dataType = p[-15] & 0x1F; ++ if (dataType == 8 || dataType == 9 || dataType == 18) ++ { ++ prevTagSize = AMF_DecodeInt24(p - 14); ++ if ((prevTagSize < tsize) && (p + prevTagSize + 11 <= syncbuf + tsize - 4) ++ && (AMF_DecodeInt32(p - 4 + prevTagSize) == prevTagSize + 11)) ++ { ++ prevTagSize = syncbuf + tsize - p + 15; ++ RTMP_Log(RTMP_LOGDEBUG, "Sync success - found last tag@0x%x", (uint32_t) (size - prevTagSize)); ++ prevTagSize -= 4; ++ tsize = 0; ++ break; ++ } ++ else ++ prevTagSize = 0; ++ } ++ } ++ --p; ++ } ++ } ++ free(syncbuf); ++ } ++ } ++ } + if (prevTagSize == 0) + { + RTMP_Log(RTMP_LOGERROR, "Couldn't find keyframe to resume from!"); +@@ -705,6 +751,8 @@ + RTMP_LogPrintf + ("--jtv|-j JSON Authentication token for Justin.tv legacy servers\n"); + RTMP_LogPrintf ++ ("--weeb|-J string Authentication token for weeb.tv servers\n"); ++ RTMP_LogPrintf + ("--hashes|-# Display progress with hashes, not with the byte counter\n"); + RTMP_LogPrintf + ("--buffer|-b Buffer time in milliseconds (default: %u)\n", +@@ -751,7 +799,8 @@ + AVal hostname = { 0, 0 }; + AVal playpath = { 0, 0 }; + AVal subscribepath = { 0, 0 }; +- AVal usherToken = { 0, 0 }; //Justin.tv auth token ++ AVal usherToken = { 0, 0 }; // Justin.tv auth token ++ AVal WeebToken = { 0, 0 }; // Weeb.tv auth token + int port = -1; + int protocol = RTMP_PROTOCOL_UNDEFINED; + int retries = 0; +@@ -858,12 +907,13 @@ + {"quiet", 0, NULL, 'q'}, + {"verbose", 0, NULL, 'V'}, + {"jtv", 1, NULL, 'j'}, ++ {"weeb", 1, NULL, 'J'}, + {0, 0, 0, 0} + }; + + while ((opt = + getopt_long(argc, argv, +- "hVveqzRr:s:t:i:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:", ++ "hVveqzRr:s:t:i:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:J:", + longopts, NULL)) != -1) + { + switch (opt) +@@ -995,7 +1045,7 @@ + port = parsedPort; + if (playpath.av_len == 0 && parsedPlaypath.av_len) + { +- playpath = parsedPlaypath; ++ playpath = AVcopy(parsedPlaypath); + } + if (protocol == RTMP_PROTOCOL_UNDEFINED) + protocol = parsedProtocol; +@@ -1079,6 +1129,9 @@ + case 'j': + STR2AVAL(usherToken, optarg); + break; ++ case 'J': ++ STR2AVAL(WeebToken, optarg); ++ break; + default: + RTMP_LogPrintf("unknown option: %c\n", opt); + usage(argv[0]); +@@ -1170,14 +1223,14 @@ + + if (tcUrl.av_len == 0) + { +- tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) + +- hostname.av_len + app.av_len + sizeof("://:65535/"); ++ tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) + ++ hostname.av_len + app.av_len + sizeof ("://:65535/"); + tcUrl.av_val = (char *) malloc(tcUrl.av_len); +- if (!tcUrl.av_val) +- return RD_FAILED; ++ if (!tcUrl.av_val) ++ return RD_FAILED; + tcUrl.av_len = snprintf(tcUrl.av_val, tcUrl.av_len, "%s://%.*s:%d/%.*s", +- RTMPProtocolStringsLower[protocol], hostname.av_len, +- hostname.av_val, port, app.av_len, app.av_val); ++ RTMPProtocolStringsLower[protocol], hostname.av_len, ++ hostname.av_val, port, app.av_len, app.av_val); + } + + int first = 1; +@@ -1197,8 +1250,8 @@ + if (!fullUrl.av_len) + { + RTMP_SetupStream(&rtmp, protocol, &hostname, port, &sockshost, &playpath, +- &tcUrl, &swfUrl, &pageUrl, &app, &auth, &swfHash, swfSize, +- &flashVer, &subscribepath, &usherToken, dSeek, dStopOffset, bLiveStream, timeout); ++ &tcUrl, &swfUrl, &pageUrl, &app, &auth, &swfHash, swfSize, ++ &flashVer, &subscribepath, &usherToken, &WeebToken, dSeek, dStopOffset, bLiveStream, timeout); + } + else + { +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpgw.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpgw.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpgw.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpgw.c 2014-05-04 17:55:17.525338289 +0200 +@@ -96,7 +96,8 @@ + AVal flashVer; + AVal token; + AVal subscribepath; +- AVal usherToken; //Justin.tv auth token ++ AVal usherToken; // Justin.tv auth token ++ AVal WeebToken; // Weeb.tv auth token + AVal sockshost; + AMFObject extras; + int edepth; +@@ -556,8 +557,8 @@ + if (!req.fullUrl.av_len) + { + RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost, +- &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset, +- req.bLiveStream, req.timeout); ++ &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, &req.WeebToken, dSeek, req.dStopOffset, ++ req.bLiveStream, req.timeout); + } + else + { +@@ -972,6 +973,9 @@ + case 'j': + STR2AVAL(req->usherToken, arg); + break; ++ case 'J': ++ STR2AVAL(req->WeebToken, arg); ++ break; + default: + RTMP_LogPrintf("unknown option: %c, arg: %s\n", opt, arg); + return FALSE; +@@ -1044,6 +1048,7 @@ + {"quiet", 0, NULL, 'q'}, + {"verbose", 0, NULL, 'V'}, + {"jtv", 1, NULL, 'j'}, ++ {"weeb", 1, NULL, 'J'}, + {0, 0, 0, 0} + }; + +@@ -1056,7 +1061,7 @@ + + while ((opt = + getopt_long(argc, argv, +- "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts, ++ "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:J:", longopts, + NULL)) != -1) + { + switch (opt) +@@ -1121,6 +1126,8 @@ + RTMP_LogPrintf + ("--jtv|-j JSON Authentication token for Justin.tv legacy servers\n"); + RTMP_LogPrintf ++ ("--weeb|-J string Authentication token for weeb.tv servers\n"); ++ RTMP_LogPrintf + ("--buffer|-b Buffer time in milliseconds (default: %u)\n\n", + defaultRTMPRequest.bufferTime); + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpsrv.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpsrv.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpsrv.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpsrv.c 2014-05-04 17:55:17.525338289 +0200 +@@ -25,9 +25,13 @@ + */ + + #include <stdlib.h> ++#ifdef __MINGW_H ++#include <unistd.h> ++#endif + #include <string.h> + #include <math.h> + #include <limits.h> ++#include <time.h> + + #include <signal.h> + #include <getopt.h> +@@ -94,12 +98,19 @@ + STREAMING_SERVER *rtmpServer = 0; // server structure pointer + void *sslCtx = NULL; + ++int file_exists(const char *fname); + STREAMING_SERVER *startStreaming(const char *address, int port); + void stopStreaming(STREAMING_SERVER * server); + void AVreplace(AVal *src, const AVal *orig, const AVal *repl); + + static const AVal av_dquote = AVC("\""); + static const AVal av_escdquote = AVC("\\\""); ++#ifdef WIN32 ++static const AVal av_caret = AVC("^"); ++static const AVal av_esccaret = AVC("^^"); ++static const AVal av_pipe = AVC("|"); ++static const AVal av_escpipe = AVC("^|"); ++#endif + + typedef struct + { +@@ -168,6 +179,12 @@ + SAVC(code); + SAVC(description); + SAVC(secureToken); ++SAVC(_checkbw); ++SAVC(_onbwdone); ++SAVC(checkBandwidth); ++SAVC(onBWDone); ++SAVC(FCSubscribe); ++SAVC(onFCSubscribe); + + static int + SendConnectResult(RTMP *r, double txn) +@@ -191,7 +208,7 @@ + enc = AMF_EncodeNumber(enc, pend, txn); + *enc++ = AMF_OBJECT; + +- STR2AVAL(av, "FMS/3,5,1,525"); ++ STR2AVAL(av, "FMS/3,5,7,7009"); + enc = AMF_EncodeNamedString(enc, pend, &av_fmsVer, &av); + enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 31.0); + enc = AMF_EncodeNamedNumber(enc, pend, &av_mode, 1.0); +@@ -213,7 +230,7 @@ + enc = AMF_EncodeNamedString(enc, pend, &av_secureToken, &av); + #endif + STR2AVAL(p.p_name, "version"); +- STR2AVAL(p.p_vu.p_aval, "3,5,1,525"); ++ STR2AVAL(p.p_vu.p_aval, "3,5,7,7009"); + p.p_type = AMF_STRING; + obj.o_num = 1; + obj.o_props = &p; +@@ -234,7 +251,7 @@ + SendResultNumber(RTMP *r, double txn, double ID) + { + RTMPPacket packet; +- char pbuf[256], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -264,12 +281,13 @@ + SAVC(details); + SAVC(clientid); + static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken"); ++static const AVal av_FCSubscribe_message = AVC("FCSubscribe to stream"); + + static int + SendPlayStart(RTMP *r) + { + RTMPPacket packet; +- char pbuf[512], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -301,7 +319,7 @@ + SendPlayStop(RTMP *r) + { + RTMPPacket packet; +- char pbuf[512], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -329,6 +347,83 @@ + return RTMP_SendPacket(r, &packet, FALSE); + } + ++static int ++SendCheckBWResponse(RTMP *r, int oldMethodType, int onBWDoneInit) ++{ ++ RTMPPacket packet; ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); ++ char *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ if (oldMethodType) ++ { ++ enc = AMF_EncodeString(enc, pend, &av__onbwdone); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeNumber(enc, pend, 10240); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ } ++ else ++ { ++ enc = AMF_EncodeString(enc, pend, &av_onBWDone); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ if (!onBWDoneInit) ++ { ++ enc = AMF_EncodeNumber(enc, pend, 10240); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ enc = AMF_EncodeNumber(enc, pend, 20); ++ } ++ } ++ ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, FALSE); ++} ++ ++static int ++SendOnFCSubscribe(RTMP *r) ++{ ++ RTMPPacket packet; ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); ++ char *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ enc = AMF_EncodeString(enc, pend, &av_onFCSubscribe); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ ++ *enc++ = AMF_OBJECT; ++ enc = AMF_EncodeNamedString(enc, pend, &av_level, &av_status); ++ enc = AMF_EncodeNamedString(enc, pend, &av_code, &av_NetStream_Play_Start); ++ enc = AMF_EncodeNamedString(enc, pend, &av_description, &av_FCSubscribe_message); ++ enc = AMF_EncodeNamedNumber(enc, pend, &av_clientid, 0); ++ *enc++ = 0; ++ *enc++ = 0; ++ *enc++ = AMF_OBJECT_END; ++ ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, FALSE); ++} ++ + static void + spawn_dumper(int argc, AVal *av, char *cmd) + { +@@ -389,6 +484,8 @@ + len += 40; + break; + case AMF_OBJECT: ++ case AMF_ECMA_ARRAY: ++ case AMF_STRICT_ARRAY: + len += 9; + len += countAMF(&p->p_vu.p_object, argc); + (*argc) += 2; +@@ -404,12 +501,14 @@ + static char * + dumpAMF(AMFObject *obj, char *ptr, AVal *argv, int *argc) + { +- int i, len, ac = *argc; ++ int i, ac = *argc; + const char opt[] = "NBSO Z"; + +- for (i=0, len=0; i < obj->o_num; i++) ++ for (i = 0; i < obj->o_num; i++) + { + AMFObjectProperty *p = &obj->o_props[i]; ++ if ((p->p_type == AMF_ECMA_ARRAY) || (p->p_type == AMF_STRICT_ARRAY)) ++ p->p_type = AMF_OBJECT; + argv[ac].av_val = ptr+1; + argv[ac++].av_len = 2; + ptr += sprintf(ptr, " -C "); +@@ -569,6 +668,7 @@ + server->arglen += countAMF(&r->Link.extras, &server->argc); + } + SendConnectResult(r, txn); ++ SendCheckBWResponse(r, FALSE, TRUE); + } + else if (AVMATCH(&method, &av_createStream)) + { +@@ -583,10 +683,26 @@ + AVal usherToken; + AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &usherToken); + AVreplace(&usherToken, &av_dquote, &av_escdquote); ++#ifdef WIN32 ++ AVreplace(&usherToken, &av_caret, &av_esccaret); ++ AVreplace(&usherToken, &av_pipe, &av_escpipe); ++#endif + server->arglen += 6 + usherToken.av_len; + server->argc += 2; + r->Link.usherToken = usherToken; + } ++ else if (AVMATCH(&method, &av__checkbw)) ++ { ++ SendCheckBWResponse(r, TRUE, FALSE); ++ } ++ else if (AVMATCH(&method, &av_checkBandwidth)) ++ { ++ SendCheckBWResponse(r, FALSE, FALSE); ++ } ++ else if (AVMATCH(&method, &av_FCSubscribe)) ++ { ++ SendOnFCSubscribe(r); ++ } + else if (AVMATCH(&method, &av_play)) + { + char *file, *p, *q, *cmd, *ptr; +@@ -600,6 +716,17 @@ + if (obj.o_num > 5) + r->Link.length = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 5)); + */ ++ double StartFlag = 0; ++ AMFObjectProperty *Start = AMF_GetProp(&obj, NULL, 4); ++ if (!(Start->p_type == AMF_INVALID)) ++ StartFlag = AMFProp_GetNumber(Start); ++ r->Link.app = AVcopy(r->Link.app); ++ if (StartFlag == -1000 || (r->Link.app.av_val && strstr(r->Link.app.av_val, "live"))) ++ { ++ StartFlag = -1000; ++ server->arglen += 7; ++ server->argc += 1; ++ } + if (r->Link.tcUrl.av_len) + { + len = server->arglen + r->Link.playpath.av_len + 4 + +@@ -617,6 +744,7 @@ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; ++ r->Link.tcUrl = StripParams(&r->Link.tcUrl); + ptr += sprintf(ptr," -r \"%s\"", r->Link.tcUrl.av_val); + argv[argc++].av_len = r->Link.tcUrl.av_len; + +@@ -641,6 +769,7 @@ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; ++ r->Link.swfUrl = StripParams(&r->Link.swfUrl); + ptr += sprintf(ptr, " -W \"%s\"", r->Link.swfUrl.av_val); + argv[argc++].av_len = r->Link.swfUrl.av_len; + } +@@ -663,10 +792,17 @@ + r->Link.usherToken.av_val = NULL; + r->Link.usherToken.av_len = 0; + } +- if (r->Link.extras.o_num) { +- ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc); +- AMF_Reset(&r->Link.extras); +- } ++ if (StartFlag == -1000) ++ { ++ argv[argc].av_val = ptr + 1; ++ argv[argc++].av_len = 6; ++ ptr += sprintf(ptr, " --live"); ++ } ++ if (r->Link.extras.o_num) ++ { ++ ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc); ++ AMF_Reset(&r->Link.extras); ++ } + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; +@@ -674,7 +810,13 @@ + r->Link.playpath.av_len, r->Link.playpath.av_val); + argv[argc++].av_len = r->Link.playpath.av_len; + +- av = r->Link.playpath; ++ if (r->Link.playpath.av_len) ++ av = r->Link.playpath; ++ else ++ { ++ av.av_val = "file"; ++ av.av_len = 4; ++ } + /* strip trailing URL parameters */ + q = memchr(av.av_val, '?', av.av_len); + if (q) +@@ -708,25 +850,82 @@ + + memcpy(file, av.av_val, av.av_len); + file[av.av_len] = '\0'; +- for (p=file; *p; p++) +- if (*p == ':') +- *p = '_'; + +- /* Add extension if none present */ +- if (file[av.av_len - 4] != '.') +- { +- av.av_len += 4; +- } +- /* Always use flv extension, regardless of original */ +- if (strcmp(file+av.av_len-4, ".flv")) +- { +- strcpy(file+av.av_len-4, ".flv"); +- } ++ if (strlen(file) < 128) ++ { ++ /* Add extension if none present */ ++ if (file[av.av_len - 4] != '.') ++ { ++ av.av_len += 4; ++ } ++ ++ /* Always use flv extension, regardless of original */ ++ if (strcmp(file + av.av_len - 4, ".flv")) ++ { ++ strcpy(file + av.av_len - 4, ".flv"); ++ } ++ ++ /* Remove invalid characters from filename */ ++ file = strreplace(file, 0, ":", "_", TRUE); ++ file = strreplace(file, 0, "&", "_", TRUE); ++ file = strreplace(file, 0, "^", "_", TRUE); ++ file = strreplace(file, 0, "|", "_", TRUE); ++ } ++ else ++ { ++ /* Filename too long - generate unique name */ ++ strcpy(file, "vXXXXXX"); ++ mktemp(file); ++ strcat(file, ".flv"); ++ } ++ ++ /* Add timestamp to the filename */ ++ char *filename, *pfilename, timestamp[21]; ++ int filename_len, timestamp_len; ++ time_t current_time; ++ ++ time(¤t_time); ++ timestamp_len = strftime(×tamp[0], sizeof (timestamp), "%Y-%m-%d_%I-%M-%S_", localtime(¤t_time)); ++ timestamp[timestamp_len] = '\0'; ++ filename_len = strlen(file); ++ filename = malloc(timestamp_len + filename_len + 1); ++ pfilename = filename; ++ memcpy(pfilename, timestamp, timestamp_len); ++ pfilename += timestamp_len; ++ memcpy(pfilename, file, filename_len); ++ pfilename += filename_len; ++ *pfilename++ = '\0'; ++ file = filename; ++ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = file; + argv[argc].av_len = av.av_len; +- ptr += sprintf(ptr, " -o %s", file); ++#ifdef VLC ++ char *vlc; ++ int didAlloc = FALSE; ++ ++ if (getenv("VLC")) ++ vlc = getenv("VLC"); ++ else if (getenv("ProgramFiles")) ++ { ++ vlc = malloc(512 * sizeof (char)); ++ didAlloc = TRUE; ++ char *ProgramFiles = getenv("ProgramFiles"); ++ sprintf(vlc, "\"%s%s", ProgramFiles, " (x86)\\VideoLAN\\VLC\\vlc.exe"); ++ if (!file_exists(vlc + 1)) ++ sprintf(vlc + 1, "%s%s", ProgramFiles, "\\VideoLAN\\VLC\\vlc.exe"); ++ strcpy(vlc + strlen(vlc), "\" -"); ++ } ++ else ++ vlc = "vlc -"; ++ ++ ptr += sprintf(ptr, " | %s", vlc); ++ if (didAlloc) ++ free(vlc); ++#else ++ ptr += sprintf(ptr, " -o \"%s\"", file); ++#endif + now = RTMP_GetTime(); + if (now - server->filetime < DUPTIME && AVMATCH(&argv[argc], &server->filename)) + { +@@ -740,7 +939,21 @@ + server->filetime = now; + free(server->filename.av_val); + server->filename = argv[argc++]; +- spawn_dumper(argc, argv, cmd); ++#ifdef VLC ++ FILE *vlc_cmdfile = fopen("VLC.bat", "w"); ++ char *vlc_batchcmd = strreplace(cmd, 0, "%", "%%", FALSE); ++ fprintf(vlc_cmdfile, "%s\n", vlc_batchcmd); ++ fclose(vlc_cmdfile); ++ free(vlc_batchcmd); ++ spawn_dumper(argc, argv, "VLC.bat"); ++#else ++ spawn_dumper(argc, argv, cmd); ++#endif ++ ++ /* Save command to text file */ ++ FILE *cmdfile = fopen("Command.txt", "a"); ++ fprintf(cmdfile, "%s\n", cmd); ++ fclose(cmdfile); + } + + free(cmd); +@@ -859,12 +1072,18 @@ + { + case 'q': + RTMP_LogPrintf("Exiting\n"); +- stopStreaming(rtmpServer); +- exit(0); ++ if (rtmpServer) ++ stopStreaming(rtmpServer); + break; + default: + RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich); + } ++ sleep(1); ++ if (rtmpServer && (rtmpServer->state == STREAMING_STOPPED)) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Exiting text UI thread"); ++ break; ++ } + } + TFRET(); + } +@@ -1052,7 +1271,6 @@ + } + } + +- + void + sigIntHandler(int sig) + { +@@ -1189,3 +1407,15 @@ + src->av_val = dest; + src->av_len = dptr - dest; + } ++ ++int ++file_exists(const char *fname) ++{ ++ FILE *file; ++ if ((file = fopen(fname, "r"))) ++ { ++ fclose(file); ++ return TRUE; ++ }
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.10.4
Part of the diff is not shown here. View the raw message.
PATCH v8 15/28 rtmpdump: Add KSV patch
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 3 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/rtmpdump/rtmpdump-0001-ksv.patch | 3397 ++++++++++++++++++++++++++++++
Wee... Huge patch without any explanation.
What is this 'KSV' stuff?
What does the patch do?
Why is it needed?
Regards,
Yann E. MORIN.
Quoted 3,413 lines
1 file changed, 3397 insertions(+) create mode 100644 package/rtmpdump/rtmpdump-0001-ksv.patchpackage/rtmpdump/rtmpdump-0001-ksv.patch new file +3397
-0@@ -0,0 +1,3397 @@ +Several fixes made or collected by KSV: +http://stream-recorder.com/forum/customized-rtmpdump-binaries-patch-file-t16103.html + +This patch file is the -p1 converted version of Patch.diff, contained in +rtmpdump-2.4.zip, downloaded from https://github.com/K-S-V/Scripts/releases +It includes "Update 21/03/2014" as latest update. + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/amf.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/amf.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/amf.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/amf.c 2014-05-04 17:55:17.513338440 +0200 +@@ -618,6 +618,9 @@ + return -1; + } + ++ if (*pBuffer == AMF_NULL) ++ bDecodeName = 0; ++ + if (bDecodeName && nSize < 4) + { /* at least name (length + at least 1 byte) and 1 byte of data */ + RTMP_Log(RTMP_LOGDEBUG, +@@ -729,13 +732,13 @@ + } + case AMF_DATE: + { +- RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE"); +- + if (nSize < 10) + return -1; + + prop->p_vu.p_number = AMF_DecodeNumber(pBuffer); + prop->p_UTCoffset = AMF_DecodeInt16(pBuffer + 8); ++ RTMP_Log(RTMP_LOGDEBUG, "AMF_DATE: %f, UTC offset: %d", prop->p_vu.p_number, ++ prop->p_UTCoffset); + + nSize -= 10; + break; +@@ -807,8 +810,8 @@ + } + else + { +- name.av_val = "no-name."; +- name.av_len = sizeof("no-name.") - 1; ++ name.av_val = "no-name"; ++ name.av_len = sizeof ("no-name") - 1; + } + if (name.av_len > 18) + name.av_len = 18; +@@ -1068,17 +1071,18 @@ + + /*std::string str = className; */ + +- RTMP_Log(RTMP_LOGDEBUG, +- "Class name: %s, externalizable: %d, dynamic: %d, classMembers: %d", +- cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, +- cd.cd_num); ++ RTMP_Log(RTMP_LOGDEBUG, "Class name: %.*s, externalizable: %d, dynamic: %d, classMembers: %d", ++ cd.cd_name.av_len, cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic, cd.cd_num); + + for (i = 0; i < cd.cd_num; i++) +- { +- AVal memberName; +- len = AMF3ReadString(pBuffer, &memberName); +- RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); +- AMF3CD_AddProp(&cd, &memberName); ++ { ++ AVal memberName = {NULL, 0}; ++ len = AMF3ReadString(pBuffer, &memberName); ++ if (memberName.av_val) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Member: %s", memberName.av_val); ++ AMF3CD_AddProp(&cd, &memberName); ++ } + nSize -= len; + pBuffer += len; + } +@@ -1259,7 +1263,8 @@ + { + if (!(cd->cd_num & 0x0f)) + cd->cd_props = realloc(cd->cd_props, (cd->cd_num + 16) * sizeof(AVal)); +- cd->cd_props[cd->cd_num++] = *prop; ++ if (cd->cd_props) ++ cd->cd_props[cd->cd_num++] = *prop; + } + + AVal * +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/handshake.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/handshake.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/handshake.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/handshake.h 2014-05-04 17:55:17.517338389 +0200 +@@ -707,7 +707,7 @@ + uint32_t uptime; + + uint8_t clientbuf[RTMP_SIG_SIZE + 4], *clientsig=clientbuf+4; +- uint8_t serversig[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply; ++ uint8_t serversig[RTMP_SIG_SIZE], serversig1[RTMP_SIG_SIZE], client2[RTMP_SIG_SIZE], *reply; + uint8_t type; + getoff *getdh = NULL, *getdig = NULL; + +@@ -760,7 +760,7 @@ + #else + ip = (int32_t *)(clientsig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + + /* set handshake digest */ +@@ -825,6 +825,8 @@ + + if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; ++ if (ReadN(r, (char *) serversig1, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) ++ return FALSE; + + /* decode server response */ + memcpy(&uptime, serversig, 4); +@@ -834,7 +836,7 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s: FMS Version : %d.%d.%d.%d", __FUNCTION__, serversig[4], + serversig[5], serversig[6], serversig[7]); + +- if (FP9HandShake && type == 3 && !serversig[4]) ++ if (FP9HandShake && type == 3 && (!serversig[4] || !serversig1[4])) + FP9HandShake = FALSE; + + #ifdef _DEBUG +@@ -914,7 +916,7 @@ + #else + ip = (int32_t *)reply; + for (i = 0; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + /* calculate response now */ + signatureResp = reply+RTMP_SIG_SIZE-SHA256_DIGEST_LENGTH; +@@ -965,16 +967,22 @@ + __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, reply, RTMP_SIG_SIZE); + #endif +- if (!WriteN(r, (char *)reply, RTMP_SIG_SIZE)) +- return FALSE; +- +- /* 2nd part of handshake */ +- if (ReadN(r, (char *)serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) +- return FALSE; ++ if (r->Link.CombineConnectPacket) ++ { ++ char *HandshakeResponse = malloc(RTMP_SIG_SIZE); ++ memcpy(HandshakeResponse, (char *) reply, RTMP_SIG_SIZE); ++ r->Link.HandshakeResponse.av_val = HandshakeResponse; ++ r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE; ++ } ++ else ++ { ++ if (!WriteN(r, (char *) reply, RTMP_SIG_SIZE)) ++ return FALSE; ++ } + + #ifdef _DEBUG + RTMP_Log(RTMP_LOGDEBUG, "%s: 2nd handshake: ", __FUNCTION__); +- RTMP_LogHex(RTMP_LOGDEBUG, serversig, RTMP_SIG_SIZE); ++ RTMP_LogHex(RTMP_LOGDEBUG, serversig1, RTMP_SIG_SIZE); + #endif + + if (FP9HandShake) +@@ -982,21 +990,21 @@ + uint8_t signature[SHA256_DIGEST_LENGTH]; + uint8_t digest[SHA256_DIGEST_LENGTH]; + +- if (serversig[4] == 0 && serversig[5] == 0 && serversig[6] == 0 +- && serversig[7] == 0) ++ if (serversig1[4] == 0 && serversig1[5] == 0 && serversig1[6] == 0 ++ && serversig1[7] == 0) + { + RTMP_Log(RTMP_LOGDEBUG, + "%s: Wait, did the server just refuse signed authentication?", + __FUNCTION__); + } + RTMP_Log(RTMP_LOGDEBUG, "%s: Server sent signature:", __FUNCTION__); +- RTMP_LogHex(RTMP_LOGDEBUG, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], ++ RTMP_LogHex(RTMP_LOGDEBUG, &serversig1[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH); + + /* verify server response */ + HMACsha256(&clientsig[digestPosClient], SHA256_DIGEST_LENGTH, + GenuineFMSKey, sizeof(GenuineFMSKey), digest); +- HMACsha256(serversig, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digest, ++ HMACsha256(serversig1, RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH, digest, + SHA256_DIGEST_LENGTH, signature); + + /* show some information */ +@@ -1024,7 +1032,7 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s: Signature calculated:", __FUNCTION__); + RTMP_LogHex(RTMP_LOGDEBUG, signature, SHA256_DIGEST_LENGTH); + if (memcmp +- (signature, &serversig[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], ++ (signature, &serversig1[RTMP_SIG_SIZE - SHA256_DIGEST_LENGTH], + SHA256_DIGEST_LENGTH) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: Server not genuine Adobe!", __FUNCTION__); +@@ -1057,7 +1065,7 @@ + } + else + { +- if (memcmp(serversig, clientsig, RTMP_SIG_SIZE) != 0) ++ if (memcmp(serversig1, clientsig, RTMP_SIG_SIZE) != 0) + { + RTMP_Log(RTMP_LOGWARNING, "%s: client signature does not match!", + __FUNCTION__); +@@ -1099,7 +1107,7 @@ + { + encrypted = FALSE; + } +- else if (type == 6 || type == 8) ++ else if (type == 6 || type == 8 || type == 9) + { + offalg = 1; + encrypted = TRUE; +@@ -1148,7 +1156,7 @@ + #else + ip = (int32_t *)(serversig+8); + for (i = 2; i < RTMP_SIG_SIZE/4; i++) +- *ip++ = rand(); ++ *ip++ = ((rand() & 0xFFFF) << 16) | (rand() & 0xFFFF); + #endif + + /* set handshake digest */ +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/hashswf.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/hashswf.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/hashswf.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/hashswf.c 2014-05-04 17:55:17.517338389 +0200 +@@ -70,7 +70,7 @@ + + #endif /* CRYPTO */ + +-#define AGENT "Mozilla/5.0" ++#define AGENT "Mozilla/5.0 (Windows NT 5.1; rv:21.0) Gecko/20100101 Firefox/21.0" + + HTTPResult + HTTP_get(struct HTTP_ctx *http, const char *url, HTTP_read_callback *cb) +@@ -116,6 +116,8 @@ + + host = p1 + 3; + path = strchr(host, '/'); ++ if (!path) ++ return HTTPRES_BAD_REQUEST; + hlen = path - host; + strncpy(hbuf, host, hlen); + hbuf[hlen] = '\0'; +@@ -200,7 +202,7 @@ + } + + p1 = strchr(sb.sb_buf, ' '); +- rc = atoi(p1 + 1); ++ rc = p1 ? atoi(p1 + 1) : 400; + http->status = rc; + + if (rc >= 300) +@@ -528,9 +530,11 @@ + + if (strncmp(buf, "url: ", 5)) + continue; +- if (strncmp(buf + 5, url, hlen)) ++ if (strncmp(buf + 5, url, strlen(buf + 5) - 1)) + continue; + r1 = strrchr(buf, '/'); ++ if (!r1) ++ continue; + i = strlen(r1); + r1[--i] = '\0'; + if (strncmp(r1, file, i)) +@@ -640,7 +644,7 @@ + HMAC_finish(in.ctx, hash, hlen); + *size = in.size; + +- fprintf(f, "date: %s\n", date); ++ fprintf(f, "date: %s\n", date[0] ? date : cctim); + fprintf(f, "size: %08x\n", in.size); + fprintf(f, "hash: "); + for (i = 0; i < SHA256_DIGEST_LENGTH; i++) +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/log.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/log.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/log.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/log.c 2014-05-04 17:55:17.517338389 +0200 +@@ -52,8 +52,8 @@ + vsnprintf(str, MAX_PRINT_LEN-1, format, vl); + + /* Filter out 'no-name' */ +- if ( RTMP_debuglevel<RTMP_LOGALL && strstr(str, "no-name" ) != NULL ) +- return; ++ if (RTMP_debuglevel < RTMP_LOGDEBUG && strstr(str, "no-name") != NULL) ++ return; + + if ( !fmsg ) fmsg = stderr; + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/Makefile librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/Makefile +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/Makefile 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/Makefile 2014-05-04 17:55:17.513338440 +0200 +@@ -26,7 +26,7 @@ + REQ_OPENSSL=libssl,libcrypto + PUB_GNUTLS=-lgmp + LIBZ=-lz +-LIBS_posix= ++LIBS_posix=-lm + LIBS_darwin= + LIBS_mingw=-lws2_32 -lwinmm -lgdi32 + LIB_GNUTLS=-lgnutls -lhogweed -lnettle -lgmp $(LIBZ) +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/parseurl.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/parseurl.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/parseurl.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/parseurl.c 2014-05-04 17:55:17.517338389 +0200 +@@ -34,6 +34,7 @@ + AVal *playpath, AVal *app) + { + char *p, *end, *col, *ques, *slash; ++ int doubleSlash = FALSE; + + RTMP_Log(RTMP_LOGDEBUG, "Parsing..."); + +@@ -140,11 +141,19 @@ + char *slash2, *slash3 = NULL, *slash4 = NULL; + int applen, appnamelen; + +- slash2 = strchr(p, '/'); +- if(slash2) +- slash3 = strchr(slash2+1, '/'); +- if(slash3) +- slash4 = strchr(slash3+1, '/'); ++ if ((slash2 = strstr(p, "//"))) ++ { ++ doubleSlash = TRUE; ++ slash2 += 1; ++ } ++ else ++ { ++ slash2 = strchr(p, '/'); ++ if (slash2) ++ slash3 = strchr(slash2 + 1, '/'); ++ if (slash3) ++ slash4 = strchr(slash3 + 1, '/'); ++ } + + applen = end-p; /* ondemand, pass all parameters as app */ + appnamelen = applen; /* ondemand length */ +@@ -168,6 +177,8 @@ + applen = appnamelen; + } + ++ if ((!ques) && doubleSlash) ++ applen -= 1; + app->av_val = p; + app->av_len = applen; + RTMP_Log(RTMP_LOGDEBUG, "Parsed app : %.*s", applen, p); +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.c 2014-05-04 17:55:17.517338389 +0200 +@@ -28,6 +28,7 @@ + #include <string.h> + #include <assert.h> + #include <time.h> ++#include <math.h> + + #include "rtmp_sys.h" + #include "log.h" +@@ -68,6 +69,7 @@ + + #define RTMP_SIG_SIZE 1536 + #define RTMP_LARGE_HEADER_SIZE 12 ++#define HEX2BIN(a) (((a)&0x40)?((a)&0xf)+9:((a)&0xf)) + + static const int packetSize[] = { 12, 8, 4, 1 }; + +@@ -108,17 +110,21 @@ + RTMPT_OPEN=0, RTMPT_SEND, RTMPT_IDLE, RTMPT_CLOSE + } RTMPTCmd; + ++static int ConnectSocket(RTMP *r); + static int DumpMetaData(AMFObject *obj); + static int HandShake(RTMP *r, int FP9HandShake); + static int SocksNegotiate(RTMP *r); + ++static int SendBytesReceived(RTMP *r); ++static int SendCommand(RTMP *r, char *method, int queue); + static int SendConnectPacket(RTMP *r, RTMPPacket *cp); + static int SendCheckBW(RTMP *r); + static int SendCheckBWResult(RTMP *r, double txn); + static int SendDeleteStream(RTMP *r, double dStreamId); + static int SendFCSubscribe(RTMP *r, AVal *subscribepath); ++static int SendGetStreamLength(RTMP *r); ++static int SendInvoke(RTMP *r, AVal *command, int queue); + static int SendPlay(RTMP *r); +-static int SendBytesReceived(RTMP *r); + static int SendUsherToken(RTMP *r, AVal *usherToken); + + #if 0 /* unused */ +@@ -336,10 +342,13 @@ + r->m_nClientBW = 2500000; + r->m_nClientBW2 = 2; + r->m_nServerBW = 2500000; +- r->m_fAudioCodecs = 3191.0; ++ r->m_fAudioCodecs = 3575.0; + r->m_fVideoCodecs = 252.0; ++ r->m_fEncoding = 3.0; + r->Link.timeout = 30; + r->Link.swfAge = 30; ++ r->Link.CombineConnectPacket = TRUE; ++ r->Link.ConnectPacket = FALSE; + } + + void +@@ -357,6 +366,8 @@ + int + RTMP_IsConnected(RTMP *r) + { ++ if (r->m_sb.sb_size > 0) ++ return TRUE; + return r->m_sb.sb_socket != -1; + } + +@@ -443,6 +454,7 @@ + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, ++ AVal *WeebToken, + int dStart, + int dStop, int bLiveStream, long int timeout) + { +@@ -465,6 +477,8 @@ + RTMP_Log(RTMP_LOGDEBUG, "subscribepath : %s", subscribepath->av_val); + if (usherToken && usherToken->av_val) + RTMP_Log(RTMP_LOGDEBUG, "NetStream.Authenticate.UsherToken : %s", usherToken->av_val); ++ if (WeebToken && WeebToken->av_val) ++ RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", WeebToken->av_val); + if (flashVer && flashVer->av_val) + RTMP_Log(RTMP_LOGDEBUG, "flashVer : %s", flashVer->av_val); + if (dStart > 0) +@@ -513,6 +527,8 @@ + r->Link.subscribepath = *subscribepath; + if (usherToken && usherToken->av_len) + r->Link.usherToken = *usherToken; ++ if (WeebToken && WeebToken->av_len) ++ r->Link.WeebToken = *WeebToken; + r->Link.seekTime = dStart; + r->Link.stopTime = dStop; + if (bLiveStream) +@@ -570,14 +586,22 @@ + "Stream is live, no seeking possible" }, + { AVC("subscribe"), OFF(Link.subscribepath), OPT_STR, 0, + "Stream to subscribe to" }, +- { AVC("jtv"), OFF(Link.usherToken), OPT_STR, 0, +- "Justin.tv authentication token" }, +- { AVC("token"), OFF(Link.token), OPT_STR, 0, ++ { AVC("jtv"), OFF(Link.usherToken), OPT_STR, 0, ++ "Justin.tv authentication token"}, ++ { AVC("weeb"), OFF(Link.WeebToken), OPT_STR, 0, ++ "Weeb.tv authentication token"}, ++ { AVC("token"), OFF(Link.token), OPT_STR, 0, + "Key for SecureToken response" }, + { AVC("swfVfy"), OFF(Link.lFlags), OPT_BOOL, RTMP_LF_SWFV, + "Perform SWF Verification" }, + { AVC("swfAge"), OFF(Link.swfAge), OPT_INT, 0, + "Number of days to use cached SWF hash" }, ++#ifdef CRYPTO ++ { AVC("swfsize"), OFF(Link.swfSize), OPT_INT, 0, ++ "Size of the decompressed SWF file"}, ++ { AVC("swfhash"), OFF(Link.swfHash), OPT_STR, 0, ++ "SHA256 hash of the decompressed SWF file"}, ++#endif + { AVC("start"), OFF(Link.seekTime), OPT_INT, 0, + "Stream start position in milliseconds" }, + { AVC("stop"), OFF(Link.stopTime), OPT_INT, 0, +@@ -765,7 +789,7 @@ + if (!ret) + return ret; + r->Link.port = port; +- r->Link.playpath = r->Link.playpath0; ++ r->Link.playpath = AVcopy(r->Link.playpath0); + + while (ptr) { + *ptr++ = '\0'; +@@ -842,9 +866,16 @@ + } + + #ifdef CRYPTO +- if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len) +- RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, +- (unsigned char *)r->Link.SWFHash, r->Link.swfAge); ++ RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %d %d %s", r->Link.swfSize, r->Link.swfHash.av_len, r->Link.swfHash.av_val); ++ if (r->Link.swfSize && r->Link.swfHash.av_len) ++ { ++ int i, j = 0; ++ for (i = 0; i < r->Link.swfHash.av_len; i += 2) ++ r->Link.SWFHash[j++] = (HEX2BIN(r->Link.swfHash.av_val[i]) << 4) | HEX2BIN(r->Link.swfHash.av_val[i + 1]); ++ r->Link.SWFSize = (uint32_t) r->Link.swfSize; ++ } ++ else if ((r->Link.lFlags & RTMP_LF_SWFV) && r->Link.swfUrl.av_len) ++ RTMP_HashSWF(r->Link.swfUrl.av_val, &r->Link.SWFSize, (unsigned char *) r->Link.SWFHash, r->Link.swfAge); + #endif + + SocksSetup(r, &r->Link.sockshost); +@@ -947,6 +978,8 @@ + } + + setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof(on)); ++ if (r->Link.protocol & RTMP_FEATURE_HTTP) ++ setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on)); + + return TRUE; + } +@@ -1397,41 +1430,96 @@ + ptr = buffer; + while (n > 0) + { +- int nBytes = 0, nRead; ++ int nBytes = 0, nRead, status = 0, retries = 0; + if (r->Link.protocol & RTMP_FEATURE_HTTP) + { +- int refill = 0; +- while (!r->m_resplen) +- { +- int ret; +- if (r->m_sb.sb_size < 13 || refill) +- { +- if (!r->m_unackd) +- HTTP_Post(r, RTMPT_IDLE, "", 1); +- if (RTMPSockBuf_Fill(&r->m_sb) < 1) +- { +- if (!r->m_sb.sb_timedout) +- RTMP_Close(r); +- return 0; +- } +- } +- if ((ret = HTTP_read(r, 0)) == -1) +- { +- RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); +- RTMP_Close(r); +- return 0; +- } +- else if (ret == -2) ++ while (!r->m_resplen) ++ { ++ /* Refill if socket buffer is empty */ ++ if (!r->m_sb.sb_size) + { +- refill = 1; ++ if (retries > 30) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ ++ if (!r->m_unackd) ++ { ++ if (retries > 0) ++ { ++ HTTP_Post(r, RTMPT_IDLE, "", 1); ++ r->m_unackd = TRUE; ++ } ++ retries++; ++ ++ if (!r->m_bPlaying) ++ sleep(.25); ++ } ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Trying to fill HTTP buffer, Retries: %d", retries); ++ status = RTMPSockBuf_Fill(&r->m_sb); ++ /* Reconnect socket when closed by some moronic servers after ++ * every HTTP data packet */ ++ if (status < 1) ++ { ++ /* Close connection on connection reset */ ++ if (status == -1) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Reconnecting socket, Status: %d", status); ++ if (ConnectSocket(r)) ++ { ++ HTTP_Post(r, RTMPT_IDLE, "", 1); ++ r->m_unackd = TRUE; ++ retries++; ++ } ++ else ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ } + } +- else ++ ++ RTMP_Log(RTMP_LOGDEBUG, "Trying to read HTTP response, Bytes Available: %d", r->m_sb.sb_size); ++ status = HTTP_read(r, 0); ++ if (status == -1) + { +- refill = 0; ++ RTMP_Log(RTMP_LOGDEBUG, "%s, No valid HTTP response found", __FUNCTION__); ++ RTMP_Close(r); ++ return 0; + } +- } +- if (r->m_resplen && !r->m_sb.sb_size) +- RTMPSockBuf_Fill(&r->m_sb); ++ else if (status == -2) ++ { ++ if (RTMPSockBuf_Fill(&r->m_sb) < 1) ++ if (!r->m_sb.sb_timedout) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ } ++ else if (status == -3) ++ { ++ RTMP_Close(r); ++ return 0; ++ } ++ else ++ r->m_unackd = FALSE; ++ } ++ ++ /* Refill when there is still some data to be read and socket buffer ++ * is empty */ ++ if (r->m_resplen && (!r->m_sb.sb_size)) ++ { ++ if (RTMPSockBuf_Fill(&r->m_sb) < 1) ++ if (!r->m_sb.sb_timedout) ++ RTMP_Close(r); ++ } ++ + avail = r->m_sb.sb_size; + if (avail > r->m_resplen) + avail = r->m_resplen; +@@ -1458,10 +1546,9 @@ + r->m_sb.sb_size -= nRead; + nBytes = nRead; + r->m_nBytesIn += nRead; +- if (r->m_bSendCounter +- && r->m_nBytesIn > ( r->m_nBytesInSent + r->m_nClientBW / 10)) +- if (!SendBytesReceived(r)) +- return FALSE; ++ if (r->m_bSendCounter && r->m_nBytesIn > (r->m_nBytesInSent + r->m_nClientBW / 10)) ++ if (!SendBytesReceived(r)) ++ return FALSE; + } + /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */ + #ifdef _DEBUG +@@ -1472,7 +1559,8 @@ + { + RTMP_Log(RTMP_LOGDEBUG, "%s, RTMP socket closed by peer", __FUNCTION__); + /*goto again; */ +- RTMP_Close(r); ++ if (!r->m_sb.sb_timedout) ++ RTMP_Close(r); + break; + } + +@@ -1497,6 +1585,7 @@ + WriteN(RTMP *r, const char *buffer, int n) + { + const char *ptr = buffer; ++ char *ConnectPacket = 0; + #ifdef CRYPTO + char *encrypted = 0; + char buf[RTMP_BUFFER_CACHE_SIZE]; +@@ -1512,6 +1601,15 @@ + } + #endif + ++ if (r->Link.ConnectPacket) ++ { ++ char *ConnectPacket = malloc(r->Link.HandshakeResponse.av_len + n); ++ memcpy(ConnectPacket, r->Link.HandshakeResponse.av_val, r->Link.HandshakeResponse.av_len); ++ memcpy(ConnectPacket + r->Link.HandshakeResponse.av_len, ptr, n); ++ ptr = ConnectPacket; ++ n += r->Link.HandshakeResponse.av_len; ++ } ++ + while (n > 0) + { + int nBytes; +@@ -1548,6 +1646,14 @@ + free(encrypted); + #endif + ++ if (r->Link.ConnectPacket) ++ { ++ if (r->Link.HandshakeResponse.av_val) ++ free(r->Link.HandshakeResponse.av_val); ++ free(ConnectPacket); ++ r->Link.ConnectPacket = FALSE; ++ } ++ + return n == 0; + } + +@@ -1577,6 +1683,9 @@ + char pbuf[4096], *pend = pbuf + sizeof(pbuf); + char *enc; + ++ if (r->Link.CombineConnectPacket) ++ r->Link.ConnectPacket = TRUE; ++ + if (cp) + return RTMP_SendPacket(r, cp, TRUE); + +@@ -1625,7 +1734,7 @@ + enc = AMF_EncodeNamedBoolean(enc, pend, &av_fpad, FALSE); + if (!enc) + return FALSE; +- enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 15.0); ++ enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 239.0); + if (!enc) + return FALSE; + enc = AMF_EncodeNamedNumber(enc, pend, &av_audioCodecs, r->m_fAudioCodecs); +@@ -1789,7 +1898,7 @@ + packet.m_hasAbsTimestamp = 0; + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + +- RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %s", usherToken->av_val); ++ RTMP_Log(RTMP_LOGDEBUG, "UsherToken: %.*s", usherToken->av_len, usherToken->av_val); + enc = packet.m_body; + enc = AMF_EncodeString(enc, pend, &av_NetStream_Authenticate_UsherToken); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); +@@ -2095,6 +2204,7 @@ + } + + SAVC(_checkbw); ++SAVC(checkBandwidth); + + static int + SendCheckBW(RTMP *r) +@@ -2112,7 +2222,7 @@ + packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; + + enc = packet.m_body; +- enc = AMF_EncodeString(enc, pend, &av__checkbw); ++ enc = AMF_EncodeString(enc, pend, &av_checkBandwidth); + enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); + *enc++ = AMF_NULL; + +@@ -2219,10 +2329,8 @@ + enc = AMF_EncodeNumber(enc, pend, -1000.0); + else + { +- if (r->Link.seekTime > 0.0) +- enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */ +- else +- enc = AMF_EncodeNumber(enc, pend, 0.0); /*-2000.0);*/ /* recorded as default, -2000.0 is not reliable since that freezes the player if the stream is not found */ ++ if (r->Link.seekTime > 0.0 || r->Link.stopTime) ++ enc = AMF_EncodeNumber(enc, pend, r->Link.seekTime); /* resume from here */ + } + if (!enc) + return FALSE; +@@ -2338,7 +2446,7 @@ + int nSize; + char *buf; + +- RTMP_Log(RTMP_LOGDEBUG, "sending ctrl. type: 0x%04x", (unsigned short)nType); ++ RTMP_Log(RTMP_LOGDEBUG, "sending ctrl, type: 0x%04x", (unsigned short)nType); + + packet.m_nChannel = 0x02; /* control channel (ping) */ + packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; +@@ -2370,8 +2478,8 @@ + } + else if (nType == 0x1A) + { +- *buf = nObject & 0xff; +- } ++ *buf = nObject & 0xff; ++ } + else + { + if (nSize > 2) +@@ -2885,6 +2993,7 @@ + #endif + + ++SAVC(onBWCheck); + SAVC(onBWDone); + SAVC(onFCSubscribe); + SAVC(onFCUnsubscribe); +@@ -2897,24 +3006,24 @@ + SAVC(description); + SAVC(onStatus); + SAVC(playlist_ready); ++SAVC(cps); ++SAVC(getStreamLength); ++SAVC(sendStatus); ++SAVC(verifyClient); + static const AVal av_NetStream_Failed = AVC("NetStream.Failed"); + static const AVal av_NetStream_Play_Failed = AVC("NetStream.Play.Failed"); +-static const AVal av_NetStream_Play_StreamNotFound = +-AVC("NetStream.Play.StreamNotFound"); +-static const AVal av_NetConnection_Connect_InvalidApp = +-AVC("NetConnection.Connect.InvalidApp"); ++static const AVal av_NetStream_Play_StreamNotFound = AVC("NetStream.Play.StreamNotFound"); ++static const AVal av_NetConnection_Connect_InvalidApp = AVC("NetConnection.Connect.InvalidApp"); + static const AVal av_NetStream_Play_Start = AVC("NetStream.Play.Start"); + static const AVal av_NetStream_Play_Complete = AVC("NetStream.Play.Complete"); + static const AVal av_NetStream_Play_Stop = AVC("NetStream.Play.Stop"); + static const AVal av_NetStream_Seek_Notify = AVC("NetStream.Seek.Notify"); + static const AVal av_NetStream_Pause_Notify = AVC("NetStream.Pause.Notify"); +-static const AVal av_NetStream_Play_PublishNotify = +-AVC("NetStream.Play.PublishNotify"); +-static const AVal av_NetStream_Play_UnpublishNotify = +-AVC("NetStream.Play.UnpublishNotify"); ++static const AVal av_NetStream_Play_PublishNotify = AVC("NetStream.Play.PublishNotify"); ++static const AVal av_NetStream_Play_UnpublishNotify = AVC("NetStream.Play.UnpublishNotify"); + static const AVal av_NetStream_Publish_Start = AVC("NetStream.Publish.Start"); +-static const AVal av_NetConnection_Connect_Rejected = +-AVC("NetConnection.Connect.Rejected"); ++static const AVal av_NetConnection_Connect_Rejected = AVC("NetConnection.Connect.Rejected"); ++static const AVal av_NetConnection_confStream = AVC("NetConnection.confStream"); + + /* Returns 0 for OK/Failed/error, 1 for 'Stop or Complete' */ + static int +@@ -2924,6 +3033,11 @@ + AVal method; + double txn; + int ret = 0, nRes; ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc, **params = NULL; ++ char *host = r->Link.hostname.av_len ? r->Link.hostname.av_val : ""; ++ char *pageUrl = r->Link.pageUrl.av_len ? r->Link.pageUrl.av_val : ""; ++ int param_count; ++ AVal av_Command, av_Response; + if (body[0] != 0x02) /* make sure it is a string method name we start with */ + { + RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", +@@ -2985,46 +3099,221 @@ + RTMP_SendServerBW(r); + RTMP_SendCtrl(r, 3, 0, 300); + } +- RTMP_SendCreateStream(r); ++ if (strstr(host, "tv-stream.to") || strstr(pageUrl, "tv-stream.to")) ++ { ++ static char auth[] = {'h', 0xC2, 0xA7, '4', 'j', 'h', 'H', '4', '3', 'd'}; ++ AVal av_auth; ++ SAVC(requestAccess); ++ av_auth.av_val = auth; ++ av_auth.av_len = sizeof (auth); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_requestAccess); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ SendCommand(r, "getConnectionCount", FALSE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "featve.com") || strstr(pageUrl, "featve.com")) ++ { ++ AVal av_auth = AVC("yes"); ++ SAVC(youCannotPlayMe); + +- if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) +- { +- /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ +- if (r->Link.usherToken.av_len) +- SendUsherToken(r, &r->Link.usherToken); +- /* Send the FCSubscribe if live stream or if subscribepath is set */ +- if (r->Link.subscribepath.av_len) +- SendFCSubscribe(r, &r->Link.subscribepath); +- else if (r->Link.lFlags & RTMP_LF_LIVE) +- SendFCSubscribe(r, &r->Link.playpath); +- } +- } ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_youCannotPlayMe); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "wfctv.com") || strstr(pageUrl, "wfctv.com")) ++ { ++ AVal av_auth1 = AVC("zoivid"); ++ AVal av_auth2 = AVC("yePi4jee"); ++ SAVC(stream_login); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_stream_login); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_auth1); ++ enc = AMF_EncodeString(enc, pend, &av_auth2); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ SendInvoke(r, &av_Command, FALSE); ++ ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "streamscene.cc") || strstr(pageUrl, "streamscene.cc") ++ || strstr(host, "tsboard.tv") || strstr(pageUrl, "teamstream.in") ++ || strstr(host, "hdstreams.tv") || strstr(pageUrl, "teamstream.to") ++ || strstr(pageUrl, "istreams.to")) ++ { ++ SendCommand(r, "r", FALSE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(host, "pc3oot.us.to")) ++ { ++ SendCommand(r, "StreamPiraten", TRUE); ++ SendGetStreamLength(r); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "axcast.com")) ++ { ++ SendCommand(r, "requestData", FALSE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "dhmediahosting.com")) ++ { ++ SendCommand(r, "netStreamEnable", FALSE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "ezcast.tv")) ++ { ++ SendCommand(r, "jaSakamCarevataKerka", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "liveflash.tv")) ++ { ++ SendCommand(r, "kaskatija", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "mips.tv")) ++ { ++ SendCommand(r, "gaolVanus", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "ucaster.eu")) ++ { ++ SendCommand(r, "vujkoMiLazarBarakovOdMokrino", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "yukons.net")) ++ { ++ SendCommand(r, "trxuwaaLahRKnaechb", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if (strstr(pageUrl, "yycast.com")) ++ { ++ SendCommand(r, "trajkoProkopiev", TRUE); ++ RTMP_SendCreateStream(r); ++ } ++ else if ((strstr(host, "highwebmedia.com") || strstr(pageUrl, "chaturbate.com")) ++ && (!strstr(host, "origin"))) ++ { ++ AVal av_ModelName; ++ SAVC(CheckPublicStatus); ++ ++ if (strlen(pageUrl) > 7) ++ { ++ strsplit(pageUrl + 7, FALSE, '/', ¶ms); ++ av_ModelName.av_val = params[1]; ++ av_ModelName.av_len = strlen(params[1]); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_CheckPublicStatus); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_ModelName); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ SendInvoke(r, &av_Command, FALSE); ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "you must specify the pageUrl"); ++ RTMP_Close(r); ++ } ++ } ++ /* Weeb.tv specific authentication */ ++ else if (r->Link.WeebToken.av_len) ++ { ++ AVal av_Token, av_Username, av_Password; ++ SAVC(determineAccess); ++ ++ param_count = strsplit(r->Link.WeebToken.av_val, FALSE, ';', ¶ms); ++ if (param_count >= 1) ++ { ++ av_Token.av_val = params[0]; ++ av_Token.av_len = strlen(params[0]); ++ } ++ if (param_count >= 2) ++ { ++ av_Username.av_val = params[1]; ++ av_Username.av_len = strlen(params[1]); ++ } ++ if (param_count >= 3) ++ { ++ av_Password.av_val = params[2]; ++ av_Password.av_len = strlen(params[2]); ++ } ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_determineAccess); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &av_Token); ++ enc = AMF_EncodeString(enc, pend, &av_Username); ++ enc = AMF_EncodeString(enc, pend, &av_Password); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ RTMP_Log(RTMP_LOGDEBUG, "WeebToken: %s", r->Link.WeebToken.av_val); ++ SendInvoke(r, &av_Command, FALSE); ++ } ++ else ++ RTMP_SendCreateStream(r); ++ } + else if (AVMATCH(&methodInvoked, &av_createStream)) +- { +- r->m_stream_id = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); ++ { ++ r->m_stream_id = (int) AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); + +- if (r->Link.protocol & RTMP_FEATURE_WRITE) +- { +- SendPublish(r); +- } +- else +- { +- if (r->Link.lFlags & RTMP_LF_PLST) +- SendPlaylist(r); +- SendPlay(r); +- RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); +- } +- } ++ if (!(r->Link.protocol & RTMP_FEATURE_WRITE)) ++ { ++ /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ ++ if (r->Link.usherToken.av_len) ++ SendUsherToken(r, &r->Link.usherToken); ++ /* Send the FCSubscribe if live stream or if subscribepath is set */ ++ if (r->Link.subscribepath.av_len) ++ SendFCSubscribe(r, &r->Link.subscribepath); ++ else if ((r->Link.lFlags & RTMP_LF_LIVE) && (!r->Link.WeebToken.av_len)) ++ SendFCSubscribe(r, &r->Link.playpath); ++ } ++ ++ if (r->Link.protocol & RTMP_FEATURE_WRITE) ++ { ++ SendPublish(r); ++ } ++ else ++ { ++ if (r->Link.lFlags & RTMP_LF_PLST) ++ SendPlaylist(r); ++ SendPlay(r); ++ RTMP_SendCtrl(r, 3, r->m_stream_id, r->m_nBufferMS); ++ } ++ } + else if (AVMATCH(&methodInvoked, &av_play) || +- AVMATCH(&methodInvoked, &av_publish)) +- { +- r->m_bPlaying = TRUE; +- } ++ AVMATCH(&methodInvoked, &av_publish)) ++ { ++ r->m_bPlaying = TRUE; ++ } + free(methodInvoked.av_val); + } + else if (AVMATCH(&method, &av_onBWDone)) + { +- if (!r->m_nBWCheckCounter) ++ if (!r->m_nBWCheckCounter) + SendCheckBW(r); + } + else if (AVMATCH(&method, &av_onFCSubscribe)) +@@ -3048,21 +3337,22 @@ + { + int i; + for (i = 0; i < r->m_numCalls; i++) +- if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) +- { +- AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); +- break; +- } ++ if (AVMATCH(&r->m_methodCalls[i].name, &av__checkbw)) ++ { ++ AV_erase(r->m_methodCalls, &r->m_numCalls, i, TRUE); ++ break; ++ } + } + else if (AVMATCH(&method, &av__error)) + { ++ int handled = FALSE; + #ifdef CRYPTO + AVal methodInvoked = {0}; + int i; + + if (r->Link.protocol & RTMP_FEATURE_WRITE) + { +- for (i=0; i<r->m_numCalls; i++) ++ for (i = 0; i < r->m_numCalls; i++) + { + if (r->m_methodCalls[i].num == txn) + { +@@ -3074,12 +3364,12 @@ + if (!methodInvoked.av_val) + { + RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", +- __FUNCTION__, txn); ++ __FUNCTION__, txn); + goto leave; + } + + RTMP_Log(RTMP_LOGDEBUG, "%s, received error for method call <%s>", __FUNCTION__, +- methodInvoked.av_val); ++ methodInvoked.av_val); + + if (AVMATCH(&methodInvoked, &av_connect)) + { +@@ -3093,20 +3383,65 @@ + /* if PublisherAuth returns 1, then reconnect */ + PublisherAuth(r, &description); + } +- } +- else +- { +- RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); ++ handled = TRUE; + } + free(methodInvoked.av_val); +-#else +- RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + #endif ++ double code = 0.0; ++ unsigned int parsedPort = 0; ++ AMFObject obj2; ++ AMFObjectProperty p; ++ AVal redirect; ++ SAVC(ex); ++ SAVC(redirect); ++ ++ AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); ++ if (RTMP_FindFirstMatchingProperty(&obj2, &av_ex, &p)) ++ { ++ AMFProp_GetObject(&p, &obj2); ++ if (RTMP_FindFirstMatchingProperty(&obj2, &av_code, &p)) ++ code = AMFProp_GetNumber(&p); ++ if (code == 302 && RTMP_FindFirstMatchingProperty(&obj2, &av_redirect, &p)) ++ { ++ AMFProp_GetString(&p, &redirect); ++ r->Link.redirected = TRUE; ++ ++ char *playpath = "//playpath"; ++ int len = redirect.av_len + strlen(playpath); ++ char *url = malloc(len + 1); ++ memcpy(url, redirect.av_val, redirect.av_len); ++ memcpy(url + redirect.av_len, playpath, strlen(playpath)); ++ url[len] = '\0'; ++ r->Link.tcUrl.av_val = url; ++ r->Link.tcUrl.av_len = redirect.av_len; ++ RTMP_ParseURL(url, &r->Link.protocol, &r->Link.hostname, &parsedPort, &r->Link.playpath0, &r->Link.app); ++ if (parsedPort) ++ r->Link.port = parsedPort; ++ } ++ } ++ if (r->Link.redirected) ++ { ++ handled = TRUE; ++ RTMP_Log(RTMP_LOGINFO, "rtmp server sent redirect"); ++ } ++ ++ if (!handled) ++ RTMP_Log(RTMP_LOGERROR, "rtmp server sent error"); + } + else if (AVMATCH(&method, &av_close)) + { +- RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); +- RTMP_Close(r); ++ if (r->Link.redirected) ++ { ++ r->Link.redirected = FALSE; ++ RTMP_Close(r); ++ RTMP_Log(RTMP_LOGINFO, "trying to connect with redirected url"); ++ RTMP_Connect(r, NULL); ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "rtmp server requested close"); ++ RTMP_Close(r); ++ } + #ifdef CRYPTO + if ((r->Link.protocol & RTMP_FEATURE_WRITE) && + !(r->Link.pFlags & RTMP_PUB_CLEAN) && +@@ -3127,16 +3462,18 @@ + else if (AVMATCH(&method, &av_onStatus)) + { + AMFObject obj2; +- AVal code, level; ++ AVal code, level, description; + AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &obj2); + AMFProp_GetString(AMF_GetProp(&obj2, &av_code, -1), &code); + AMFProp_GetString(AMF_GetProp(&obj2, &av_level, -1), &level); ++ AMFProp_GetString(AMF_GetProp(&obj2, &av_description, -1), &description); + + RTMP_Log(RTMP_LOGDEBUG, "%s, onStatus: %s", __FUNCTION__, code.av_val); + if (AVMATCH(&code, &av_NetStream_Failed) +- || AVMATCH(&code, &av_NetStream_Play_Failed) +- || AVMATCH(&code, &av_NetStream_Play_StreamNotFound) +- || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) ++ || AVMATCH(&code, &av_NetStream_Play_Failed) ++ || AVMATCH(&code, &av_NetStream_Play_StreamNotFound) ++ || AVMATCH(&code, &av_NetConnection_Connect_Rejected) ++ || AVMATCH(&code, &av_NetConnection_Connect_InvalidApp)) + { + r->m_stream_id = -1; + RTMP_Close(r); +@@ -3194,6 +3531,46 @@ + r->m_pausing = 3; + } + } ++ ++ else if (AVMATCH(&code, &av_NetConnection_confStream)) ++ { ++#ifdef CRYPTO ++ static const char hexdig[] = "0123456789abcdef"; ++ AVal auth; ++ SAVC(cf_stream); ++ int i; ++ char hash_hex[33] = {0}; ++ unsigned char hash[16]; ++ ++ param_count = strsplit(description.av_val, description.av_len, ':', ¶ms); ++ if (param_count >= 3) ++ { ++ char *buf = malloc(strlen(params[0]) + r->Link.playpath.av_len + 1); ++ strcpy(buf, params[0]); ++ strncat(buf, r->Link.playpath.av_val, r->Link.playpath.av_len); ++ md5_hash((unsigned char *) buf, strlen(buf), hash); ++ for (i = 0; i < 16; i++) ++ { ++ hash_hex[i * 2] = hexdig[0x0f & (hash[i] >> 4)]; ++ hash_hex[i * 2 + 1] = hexdig[0x0f & (hash[i])]; ++ } ++ auth.av_val = &hash_hex[atoi(params[1]) - 1]; ++ auth.av_len = atoi(params[2]); ++ RTMP_Log(RTMP_LOGDEBUG, "Khalsa: %.*s", auth.av_len, auth.av_val); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_cf_stream); ++ enc = AMF_EncodeNumber(enc, pend, txn); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &auth); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ SendInvoke(r, &av_Command, FALSE); ++ free(buf); ++ } ++#endif ++ } + } + else if (AVMATCH(&method, &av_playlist_ready)) + { +@@ -3207,6 +3584,85 @@ + } + } + } ++ else if (AVMATCH(&method, &av_verifyClient)) ++ { ++ double VerificationNumber = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 3)); ++ RTMP_Log(RTMP_LOGDEBUG, "VerificationNumber: %.2f", VerificationNumber); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av__result); ++ enc = AMF_EncodeNumber(enc, pend, txn); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeNumber(enc, pend, exp(atan(sqrt(VerificationNumber))) + 1); ++ av_Response.av_val = pbuf; ++ av_Response.av_len = enc - pbuf; ++ ++ AMF_Decode(&obj, av_Response.av_val, av_Response.av_len, FALSE); ++ AMF_Dump(&obj); ++ SendInvoke(r, &av_Response, FALSE); ++ } ++ else if (AVMATCH(&method, &av_sendStatus)) ++ { ++ if (r->Link.WeebToken.av_len) ++ { ++ AVal av_Authorized = AVC("User.hasAccess"); ++ AVal av_TransferLimit = AVC("User.noPremium.limited"); ++ AVal av_UserLimit = AVC("User.noPremium.tooManyUsers"); ++ AVal av_TimeLeft = AVC("timeLeft"); ++ AVal av_Status, av_ReconnectionTime; ++ ++ AMFObject Status; ++ AMFProp_GetObject(AMF_GetProp(&obj, NULL, 3), &Status); ++ AMFProp_GetString(AMF_GetProp(&Status, &av_code, -1), &av_Status); ++ RTMP_Log(RTMP_LOGINFO, "%.*s", av_Status.av_len, av_Status.av_val); ++ if (AVMATCH(&av_Status, &av_Authorized)) ++ { ++ RTMP_Log(RTMP_LOGINFO, "Weeb.tv authentication successful"); ++ RTMP_SendCreateStream(r); ++ } ++ else if (AVMATCH(&av_Status, &av_UserLimit)) ++ { ++ RTMP_Log(RTMP_LOGINFO, "No free slots available"); ++ RTMP_Close(r); ++ } ++ else if (AVMATCH(&av_Status, &av_TransferLimit)) ++ { ++ AMFProp_GetString(AMF_GetProp(&Status, &av_TimeLeft, -1), &av_ReconnectionTime); ++ RTMP_Log(RTMP_LOGINFO, "Viewing limit exceeded. try again in %.*s minutes.", av_ReconnectionTime.av_len, av_ReconnectionTime.av_val); ++ RTMP_Close(r); ++ } ++ } ++ } ++ else if (AVMATCH(&method, &av_cps)) ++ { ++ int Status = AMFProp_GetBoolean(AMF_GetProp(&obj, NULL, 3)); ++ if (Status == FALSE) ++ { ++ AVal Message; ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 4), &Message); ++ RTMP_Log(RTMP_LOGINFO, "Model status is %.*s", Message.av_len, Message.av_val); ++ RTMP_Close(r); ++ } ++ else ++ { ++ AVal Playpath, Server; ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 5), &Playpath); ++ AMFProp_GetString(AMF_GetProp(&obj, NULL, 6), &Server); ++ if (strncasecmp(&Playpath.av_val[Playpath.av_len - 4], ".mp4", 4) != 0) ++ { ++ char *playpath = calloc(Server.av_len + Playpath.av_len + 25, sizeof (char)); ++ strcat(playpath, "rtmp://"); ++ strncat(playpath, Server.av_val, Server.av_len); ++ strcat(playpath, "/live-origin/"); ++ strncat(playpath, Playpath.av_val, Playpath.av_len); ++ strcat(playpath, ".mp4"); ++ Playpath.av_val = playpath; ++ Playpath.av_len = strlen(playpath); ++ } ++ RTMP_ParsePlaypath(&Playpath, &r->Link.playpath); ++ RTMP_SendCreateStream(r); ++ } ++ } + else + { + +@@ -3232,7 +3688,8 @@ + return TRUE; + } + +- if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY) ++ if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY ++ || prop->p_type == AMF_STRICT_ARRAY) + { + if (RTMP_FindFirstMatchingProperty(&prop->p_vu.p_object, name, p)) + return TRUE; +@@ -3258,7 +3715,8 @@ + return TRUE; + } + +- if (prop->p_type == AMF_OBJECT) ++ if (prop->p_type == AMF_OBJECT || prop->p_type == AMF_ECMA_ARRAY ++ || prop->p_type == AMF_STRICT_ARRAY) + { + if (RTMP_FindPrefixProperty(&prop->p_vu.p_object, name, p)) + return TRUE; +@@ -3292,6 +3750,7 @@ + snprintf(str, 255, "%s", + prop->p_vu.p_number != 0. ? "TRUE" : "FALSE"); + break; ++ case AMF_NULL: + case AMF_STRING: + len = snprintf(str, 255, "%.*s", prop->p_vu.p_aval.av_len, + prop->p_vu.p_aval.av_val); +@@ -3307,7 +3766,7 @@ + } + if (str[0] && prop->p_name.av_len) + { +- RTMP_Log(RTMP_LOGINFO, " %-22.*s%s", prop->p_name.av_len, ++ RTMP_Log(RTMP_LOGINFO, " %-24.*s%s", prop->p_name.av_len, + prop->p_name.av_val, str); + } + } +@@ -3389,7 +3848,7 @@ + unsigned int tmp; + if (packet->m_body && packet->m_nBodySize >= 2) + nType = AMF_DecodeInt16(packet->m_body); +- RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl. type: %d, len: %d", __FUNCTION__, nType, ++ RTMP_Log(RTMP_LOGDEBUG, "%s, received ctrl, type: %d, len: %d", __FUNCTION__, nType, + packet->m_nBodySize); + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + +@@ -3498,15 +3957,15 @@ + RTMP_Log(RTMP_LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__); + if (packet->m_nBodySize > 2 && packet->m_body[2] > 0x01) + { +- RTMP_Log(RTMP_LOGERROR, +- "%s: SWFVerification Type %d request not supported! Patches welcome...", +- __FUNCTION__, packet->m_body[2]); ++ RTMP_Log(RTMP_LOGERROR, ++ "%s: SWFVerification Type %d request not supported, attempting to use SWFVerification Type 1! Patches welcome...", ++ __FUNCTION__, packet->m_body[2]); + } + #ifdef CRYPTO + /*RTMP_LogHex(packet.m_body, packet.m_nBodySize); */ + + /* respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied */ +- else if (r->Link.SWFSize) ++ if (r->Link.SWFSize) + { + RTMP_SendCtrl(r, 0x1B, 0, 0); + } +@@ -3811,8 +4270,18 @@ + serversig[4], serversig[5], serversig[6], serversig[7]); + + /* 2nd part of handshake */ +- if (!WriteN(r, serversig, RTMP_SIG_SIZE)) +- return FALSE; ++ if (r->Link.CombineConnectPacket) ++ { ++ char *HandshakeResponse = malloc(RTMP_SIG_SIZE); ++ memcpy(HandshakeResponse, (char *) serversig, RTMP_SIG_SIZE); ++ r->Link.HandshakeResponse.av_val = HandshakeResponse; ++ r->Link.HandshakeResponse.av_len = RTMP_SIG_SIZE; ++ } ++ else ++ { ++ if (!WriteN(r, (char *) serversig, RTMP_SIG_SIZE)) ++ return FALSE; ++ } + + if (ReadN(r, serversig, RTMP_SIG_SIZE) != RTMP_SIG_SIZE) + return FALSE; +@@ -4263,8 +4732,13 @@ + { + int nBytes; + +- if (!sb->sb_size) +- sb->sb_start = sb->sb_buf; ++ /* Copy unprocessed bytes to the start of buffer to make optimum use of ++ * available buffer */ ++ if (sb->sb_start != sb->sb_buf) ++ { ++ memcpy(sb->sb_buf, sb->sb_start, sb->sb_size); ++ sb->sb_start = sb->sb_buf; ++ } + + while (1) + { +@@ -4278,6 +4752,8 @@ + #endif + { + nBytes = recv(sb->sb_socket, sb->sb_start + sb->sb_size, nBytes, 0); ++ if (!nBytes) ++ RTMP_Log(RTMP_LOGDEBUG, "Socket closed by server, nBytes: %d", nBytes); + } + if (nBytes != -1) + { +@@ -4417,21 +4893,19 @@ + HTTP_Post(RTMP *r, RTMPTCmd cmd, const char *buf, int len) + { + char hbuf[512]; +- int hlen = snprintf(hbuf, sizeof(hbuf), "POST /%s%s/%d HTTP/1.1\r\n" +- "Host: %.*s:%d\r\n" +- "Accept: */*\r\n" +- "User-Agent: Shockwave Flash\r\n" +- "Connection: Keep-Alive\r\n" +- "Cache-Control: no-cache\r\n" +- "Content-type: application/x-fcs\r\n" +- "Content-length: %d\r\n\r\n", RTMPT_cmds[cmd], +- r->m_clientID.av_val ? r->m_clientID.av_val : "", +- r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val, +- r->Link.port, len); ++ int hlen = snprintf(hbuf, sizeof (hbuf), "POST /%s%s/%d HTTP/1.1\r\n" ++ "Content-Type: application/x-fcs\r\n" ++ "User-Agent: Shockwave Flash\r\n" ++ "Host: %.*s:%d\r\n" ++ "Content-Length: %d\r\n" ++ "Connection: Keep-Alive\r\n" ++ "Cache-Control: no-cache\r\n\r\n", RTMPT_cmds[cmd], ++ r->m_clientID.av_val ? r->m_clientID.av_val : "", ++ r->m_msgCounter, r->Link.hostname.av_len, r->Link.hostname.av_val, ++ r->Link.port, len); + RTMPSockBuf_Send(&r->m_sb, hbuf, hlen); + hlen = RTMPSockBuf_Send(&r->m_sb, buf, len); + r->m_msgCounter++; +- r->m_unackd++; + return hlen; + } + +@@ -4441,22 +4915,17 @@ + char *ptr; + int hlen; + +-restart: + if (fill) + RTMPSockBuf_Fill(&r->m_sb); +- if (r->m_sb.sb_size < 13) { +- if (fill) +- goto restart; ++ ++ /* Check if socket buffer is empty or HTTP header isn't completely received */ ++ memset(r->m_sb.sb_start + r->m_sb.sb_size, '\0', 1); ++ if ((!r->m_sb.sb_size) || (!strstr(r->m_sb.sb_start, "\r\n\r\n"))) + return -2; +- } ++ + if (strncmp(r->m_sb.sb_start, "HTTP/1.1 200 ", 13)) + return -1; + r->m_sb.sb_start[r->m_sb.sb_size] = '\0'; +- if (!strstr(r->m_sb.sb_start, "\r\n\r\n")) { +- if (fill) +- goto restart; +- return -2; +- } + + ptr = r->m_sb.sb_start + sizeof("HTTP/1.1 200"); + while ((ptr = strstr(ptr, "Content-"))) { +@@ -4464,21 +4933,31 @@ + ptr += 8; + } + if (!ptr) +- return -1; +- hlen = atoi(ptr+16); ++ { ++ ptr = r->m_sb.sb_start + sizeof ("HTTP/1.1 200"); ++ RTMP_Log(RTMP_LOGDEBUG, "No Content-Length header found, assuming continuous stream"); ++ hlen = 2147483648UL; // 2 GB ++ } ++ else ++ hlen = atoi(ptr + 16); + ptr = strstr(ptr+16, "\r\n\r\n"); + if (!ptr) + return -1; + ptr += 4; +- if (ptr + (r->m_clientID.av_val ? 1 : hlen) > r->m_sb.sb_start + r->m_sb.sb_size) +- { +- if (fill) +- goto restart; +- return -2; +- } + r->m_sb.sb_size -= ptr - r->m_sb.sb_start; + r->m_sb.sb_start = ptr; +- r->m_unackd--; ++ ++ /* Stop processing if content length is 0 */ ++ if (!hlen) ++ return -3; ++ ++ /* Refill buffer if no payload is received */ ++ if (hlen && (!r->m_sb.sb_size)) ++ { ++ RTMPSockBuf_Fill(&r->m_sb); ++ ptr = r->m_sb.sb_buf; ++ r->m_sb.sb_start = ptr; ++ } + + if (!r->m_clientID.av_val) + { +@@ -4498,10 +4977,17 @@ + r->m_sb.sb_start++; + r->m_sb.sb_size--; + } ++ ++ /* Following values shouldn't be negative in any case */ ++ if (r->m_resplen < 0) ++ r->m_resplen = 0; ++ if (r->m_sb.sb_size < 0) ++ r->m_sb.sb_size = 0; ++ + return 0; + } + +-#define MAX_IGNORED_FRAMES 50 ++#define MAX_IGNORED_FRAMES 100 + + /* Read from the stream until we get a media packet. + * Returns -3 if Play.Close/Stop, -2 if fatal error, -1 if no more media +@@ -4569,162 +5055,156 @@ + #endif + + if (r->m_read.flags & RTMP_READ_RESUME) +- { +- /* check the header if we get one */ +- if (packet.m_nTimeStamp == 0) +- { +- if (r->m_read.nMetaHeaderSize > 0 +- && packet.m_packetType == RTMP_PACKET_TYPE_INFO) +- { +- AMFObject metaObj; +- int nRes = +- AMF_Decode(&metaObj, packetBody, nPacketLen, FALSE); +- if (nRes >= 0) +- { +- AVal metastring; +- AMFProp_GetString(AMF_GetProp(&metaObj, NULL, 0), +- &metastring); +- +- if (AVMATCH(&metastring, &av_onMetaData)) +- { +- /* compare */ +- if ((r->m_read.nMetaHeaderSize != nPacketLen) || +- (memcmp +- (r->m_read.metaHeader, packetBody, +- r->m_read.nMetaHeaderSize) != 0)) +- { +- ret = RTMP_READ_ERROR; +- } +- } +- AMF_Reset(&metaObj); +- if (ret == RTMP_READ_ERROR) +- break; +- } +- } ++ { ++ RTMP_Log(RTMP_LOGDEBUG2, "Received timestamp: %d, type %d", ++ packet.m_nTimeStamp, packet.m_packetType); ++ if (packet.m_nTimeStamp > 0 && r->m_read.nResumeDriftTS > 0) ++ packet.m_nTimeStamp -= r->m_read.nResumeDriftTS; ++ RTMP_Log(RTMP_LOGDEBUG2, "Adjusted timestamp: %d", packet.m_nTimeStamp); ++ ++ /* check the header if we get one */ ++ if (r->m_read.nMetaHeaderSize > 0 ++ && packet.m_packetType == RTMP_PACKET_TYPE_INFO) ++ { ++ AMFObject metaObj; ++ int nRes = AMF_Decode(&metaObj, packetBody, nPacketLen, FALSE); ++ if (nRes >= 0) ++ { ++ AVal metastring; ++ AMFProp_GetString(AMF_GetProp(&metaObj, NULL, 0), &metastring); + +- /* check first keyframe to make sure we got the right position +- * in the stream! (the first non ignored frame) +- */ +- if (r->m_read.nInitialFrameSize > 0) +- { +- /* video or audio data */ +- if (packet.m_packetType == r->m_read.initialFrameType +- && r->m_read.nInitialFrameSize == nPacketLen) +- { +- /* we don't compare the sizes since the packet can +- * contain several FLV packets, just make sure the +- * first frame is our keyframe (which we are going +- * to rewrite) +- */ +- if (memcmp +- (r->m_read.initialFrame, packetBody, +- r->m_read.nInitialFrameSize) == 0) +- { +- RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!"); +- r->m_read.flags |= RTMP_READ_GOTKF; +- /* ignore it! (what about audio data after it? it is +- * handled by ignoring all 0ms frames, see below) +- */ +- ret = RTMP_READ_IGNORE; +- break; +- } +- } ++ if (AVMATCH(&metastring, &av_onMetaData)) ++ { ++ /* compare */ ++ if ((r->m_read.nMetaHeaderSize != nPacketLen) || ++ (memcmp(r->m_read.metaHeader, packetBody, r->m_read.nMetaHeaderSize) != 0)) ++ { ++ ret = RTMP_READ_ERROR; ++ } ++ } ++ AMF_Reset(&metaObj); ++ if (ret == RTMP_READ_ERROR) ++ break; ++ } ++ } + +- /* hande FLV streams, even though the server resends the +- * keyframe as an extra video packet it is also included +- * in the first FLV stream chunk and we have to compare +- * it and filter it out !! +- */ +- if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) +- { +- /* basically we have to find the keyframe with the +- * correct TS being nResumeTS +- */ +- unsigned int pos = 0; +- uint32_t ts = 0; +- +- while (pos + 11 < nPacketLen) +- { +- /* size without header (11) and prevTagSize (4) */ +- uint32_t dataSize = +- AMF_DecodeInt24(packetBody + pos + 1); +- ts = AMF_DecodeInt24(packetBody + pos + 4); +- ts |= (packetBody[pos + 7] << 24); ++ /* check first keyframe to make sure we got the right position ++ * in the stream! (the first non ignored frame) ++ */ ++ RTMP_Log(RTMP_LOGDEBUG2, "Required packet length: %d, Packet length: %d", ++ r->m_read.nInitialFrameSize, nPacketLen); ++ if (r->m_read.nInitialFrameSize > 0) ++ { ++ /* video or audio data */ ++ if (packet.m_packetType == r->m_read.initialFrameType ++ && r->m_read.nInitialFrameSize == nPacketLen) ++ { ++ /* we don't compare the sizes since the packet can ++ * contain several FLV packets, just make sure the ++ * first frame is our keyframe (which we are going ++ * to rewrite) ++ */ ++ RTMP_Log(RTMP_LOGDEBUG2, "Comparing keyframe data"); ++ if (memcmp(r->m_read.initialFrame, packetBody, ++ r->m_read.nInitialFrameSize) == 0) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Checked keyframe successfully!"); ++ r->m_read.flags |= RTMP_READ_GOTKF; ++ r->m_read.nResumeDriftTS = packet.m_nTimeStamp; ++ /* ignore it! (what about audio data after it? it is ++ * handled by ignoring all 0ms frames, see below) ++ */ ++ ret = RTMP_READ_IGNORE; ++ break; ++ } ++ } ++ ++ /* hande FLV streams, even though the server resends the ++ * keyframe as an extra video packet it is also included ++ * in the first FLV stream chunk and we have to compare ++ * it and filter it out !! ++ */ ++ if (packet.m_packetType == RTMP_PACKET_TYPE_FLASH_VIDEO) ++ { ++ /* basically we have to find the keyframe with the ++ * correct TS being nResumeTS ++ */ ++ unsigned int pos = 0; ++ uint32_t ts = 0; ++ ++ while (pos + 11 < nPacketLen) ++ { ++ /* size without header (11) and prevTagSize (4) */ ++ uint32_t dataSize = AMF_DecodeInt24(packetBody + pos + 1); ++ ts = AMF_DecodeInt24(packetBody + pos + 4); ++ ts |= (packetBody[pos + 7] << 24); + + #ifdef _DEBUG +- RTMP_Log(RTMP_LOGDEBUG, +- "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms", +- packetBody[pos], dataSize, ts); +-#endif +- /* ok, is it a keyframe?: +- * well doesn't work for audio! +- */ +- if (packetBody[pos /*6928, test 0 */ ] == +- r->m_read.initialFrameType +- /* && (packetBody[11]&0xf0) == 0x10 */ ) +- { +- if (ts == r->m_read.nResumeTS) +- { +- RTMP_Log(RTMP_LOGDEBUG, +- "Found keyframe with resume-keyframe timestamp!"); +- if (r->m_read.nInitialFrameSize != dataSize +- || memcmp(r->m_read.initialFrame, +- packetBody + pos + 11, +- r->m_read. +- nInitialFrameSize) != 0) +- { +- RTMP_Log(RTMP_LOGERROR, +- "FLV Stream: Keyframe doesn't match!"); +- ret = RTMP_READ_ERROR; +- break; +- } +- r->m_read.flags |= RTMP_READ_GOTFLVK; +- +- /* skip this packet? +- * check whether skippable: +- */ +- if (pos + 11 + dataSize + 4 > nPacketLen) +- { +- RTMP_Log(RTMP_LOGWARNING, +- "Non skipable packet since it doesn't end with chunk, stream corrupt!"); +- ret = RTMP_READ_ERROR; +- break; +- } +- packetBody += (pos + 11 + dataSize + 4); +- nPacketLen -= (pos + 11 + dataSize + 4); +- +- goto stopKeyframeSearch; +- +- } +- else if (r->m_read.nResumeTS < ts) +- { +- /* the timestamp ts will only increase with +- * further packets, wait for seek +- */ +- goto stopKeyframeSearch; +- } +- } +- pos += (11 + dataSize + 4); +- } +- if (ts < r->m_read.nResumeTS) +- { +- RTMP_Log(RTMP_LOGERROR, +- "First packet does not contain keyframe, all " +- "timestamps are smaller than the keyframe " +- "timestamp; probably the resume seek failed?"); +- } +- stopKeyframeSearch: +- ; +- if (!(r->m_read.flags & RTMP_READ_GOTFLVK)) +- { +- RTMP_Log(RTMP_LOGERROR, +- "Couldn't find the seeked keyframe in this chunk!"); +- ret = RTMP_READ_IGNORE; +- break; +- } +- } +- } +- } ++ RTMP_Log(RTMP_LOGDEBUG, ++ "keyframe search: FLV Packet: type %02X, dataSize: %d, timeStamp: %d ms", ++ packetBody[pos], dataSize, ts); ++#endif ++ /* ok, is it a keyframe?: ++ * well doesn't work for audio! ++ */ ++ if (packetBody[pos /*6928, test 0 */ ] == r->m_read.initialFrameType ++ /* && (packetBody[11]&0xf0) == 0x10 */) ++ { ++ if (ts == r->m_read.nResumeTS) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Found keyframe with resume-keyframe timestamp!"); ++ if (r->m_read.nInitialFrameSize != dataSize || ++ memcmp(r->m_read.initialFrame, packetBody + pos + 11, ++ r->m_read.nInitialFrameSize) != 0) ++ { ++ RTMP_Log(RTMP_LOGERROR, "FLV Stream: Keyframe doesn't match!"); ++ ret = RTMP_READ_ERROR; ++ break; ++ } ++ r->m_read.flags |= RTMP_READ_GOTFLVK; ++ ++ /* skip this packet? ++ * check whether skippable: ++ */ ++ if (pos + 11 + dataSize + 4 > nPacketLen) ++ { ++ RTMP_Log(RTMP_LOGWARNING, "Non skipable packet since it doesn't " ++ "end with chunk, stream corrupt!"); ++ ret = RTMP_READ_ERROR; ++ break; ++ } ++ packetBody += (pos + 11 + dataSize + 4); ++ nPacketLen -= (pos + 11 + dataSize + 4); ++ ++ goto stopKeyframeSearch; ++ ++ } ++ else if (r->m_read.nResumeTS < ts) ++ { ++ /* the timestamp ts will only increase with ++ * further packets, wait for seek ++ */ ++ goto stopKeyframeSearch; ++ } ++ } ++ pos += (11 + dataSize + 4); ++ } ++ if (ts < r->m_read.nResumeTS) ++ { ++ RTMP_Log(RTMP_LOGERROR, ++ "First packet does not contain keyframe, all " ++ "timestamps are smaller than the keyframe " ++ "timestamp; probably the resume seek failed?"); ++ } ++ stopKeyframeSearch: ++ if (!(r->m_read.flags & RTMP_READ_GOTFLVK)) ++ { ++ RTMP_Log(RTMP_LOGERROR, "Couldn't find the seeked keyframe in this chunk!"); ++ ret = RTMP_READ_IGNORE; ++ break; ++ } ++ } ++ } + + if (packet.m_nTimeStamp > 0 + && (r->m_read.flags & (RTMP_READ_GOTKF|RTMP_READ_GOTFLVK))) +@@ -4984,7 +5464,7 @@ + 0x00, 0x00, 0x00, 0x00 + }; + +-#define HEADERBUF (128*1024) ++#define HEADERBUF (1024*1024) + int + RTMP_Read(RTMP *r, char *buf, int size) + { +@@ -5187,3 +5667,284 @@ + } + return size+s2; + } ++ ++AVal ++AVcopy(AVal src) ++{ ++ AVal dst; ++ if (src.av_len) ++ { ++ dst.av_val = malloc(src.av_len + 1); ++ memcpy(dst.av_val, src.av_val, src.av_len); ++ dst.av_val[src.av_len] = '\0'; ++ dst.av_len = src.av_len; ++ } ++ else ++ { ++ dst.av_val = NULL; ++ dst.av_len = 0; ++ } ++ return dst; ++} ++ ++static int ++ConnectSocket(RTMP *r) ++{ ++ int on = 1; ++ struct sockaddr_in service; ++ if (!r->Link.hostname.av_len) ++ return FALSE; ++ ++ memset(&service, 0, sizeof (struct sockaddr_in)); ++ service.sin_family = AF_INET; ++ ++ if (r->Link.socksport) ++ { ++ /* Connect via SOCKS */ ++ if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport)) ++ return FALSE; ++ } ++ else ++ { ++ /* Connect directly */ ++ if (!add_addr_info(&service, &r->Link.hostname, r->Link.port)) ++ return FALSE; ++ } ++ ++ r->m_sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); ++ if (r->m_sb.sb_socket != -1) ++ { ++ if (connect(r->m_sb.sb_socket, (struct sockaddr *) &service, sizeof (struct sockaddr)) < 0) ++ { ++ int err = GetSockError(); ++ RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)", ++ __FUNCTION__, err, strerror(err)); ++ RTMP_Close(r); ++ return FALSE; ++ } ++ ++ if (r->Link.socksport) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__); ++ if (!SocksNegotiate(r)) ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__); ++ RTMP_Close(r); ++ return FALSE; ++ } ++ } ++ } ++ else ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d", ++ __FUNCTION__, GetSockError()); ++ return FALSE; ++ } ++ ++ /* set timeout */ ++ SET_RCVTIMEO(tv, r->Link.timeout); ++ if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof (tv))) ++ { ++ RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %d failed!", ++ __FUNCTION__, r->Link.timeout); ++ } ++ ++ setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof (on)); ++ if (r->Link.protocol & RTMP_FEATURE_HTTP) ++ setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on)); ++ ++ return TRUE; ++} ++ ++static int ++SendCommand(RTMP *r, char *method, int queue) ++{ ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; ++ AVal av_command, methodName; ++ ++ enc = pbuf; ++ methodName.av_val = method; ++ methodName.av_len = strlen(method); ++ enc = AMF_EncodeString(enc, pend, &methodName); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ av_command.av_val = pbuf; ++ av_command.av_len = enc - pbuf; ++ ++ return SendInvoke(r, &av_command, queue); ++} ++ ++static int ++SendGetStreamLength(RTMP *r) ++{ ++ char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc; ++ AVal av_Command; ++ SAVC(getStreamLength); ++ ++ enc = pbuf; ++ enc = AMF_EncodeString(enc, pend, &av_getStreamLength); ++ enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeString(enc, pend, &r->Link.playpath); ++ av_Command.av_val = pbuf; ++ av_Command.av_len = enc - pbuf; ++ ++ return SendInvoke(r, &av_Command, TRUE); ++} ++ ++static int ++SendInvoke(RTMP *r, AVal *command, int queue) ++{ ++ RTMPPacket packet; ++ char pbuf[512], *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ if (command->av_len) ++ { ++ memcpy(enc, command->av_val, command->av_len); ++ enc += command->av_len; ++ } ++ else ++ return FALSE; ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, queue); ++} ++ ++AVal ++StripParams(AVal *src) ++{ ++ AVal str; ++ if (src->av_val) ++ { ++ str.av_val = calloc(src->av_len + 1, sizeof (char)); ++ strncpy(str.av_val, src->av_val, src->av_len); ++ str.av_len = src->av_len; ++ char *start = str.av_val; ++ char *end = start + str.av_len; ++ char *ptr = start; ++ ++ while (ptr < end) ++ { ++ if (*ptr == '?') ++ { ++ str.av_len = ptr - start; ++ break; ++ } ++ ptr++; ++ } ++ memset(start + str.av_len, 0, 1); ++ ++ char *dynamic = strstr(start, "[[DYNAMIC]]"); ++ if (dynamic) ++ { ++ dynamic -= 1; ++ memset(dynamic, 0, 1); ++ str.av_len = dynamic - start; ++ end = start + str.av_len; ++ } ++ ++ char *import = strstr(start, "[[IMPORT]]"); ++ if (import) ++ { ++ str.av_val = import + 11; ++ strcpy(start, "http://"); ++ str.av_val = strcat(start, str.av_val); ++ str.av_len = strlen(str.av_val); ++ } ++ return str; ++ } ++ str = *src; ++ return str; ++} ++ ++char * ++strreplace(char *srcstr, int srclen, char *orig, char *repl, int didAlloc) ++{ ++ char *ptr = NULL, *sptr = srcstr; ++ int origlen = strlen(orig); ++ int repllen = strlen(repl); ++ if (!srclen) ++ srclen = strlen(srcstr); ++ char *srcend = srcstr + srclen; ++ int dstbuffer = srclen / origlen * repllen; ++ if (dstbuffer < srclen) ++ dstbuffer = srclen; ++ char *dststr = calloc(dstbuffer + 1, sizeof (char)); ++ char *dptr = dststr; ++ ++ if ((ptr = strstr(srcstr, orig))) ++ { ++ while (ptr < srcend && (ptr = strstr(sptr, orig))) ++ { ++ int len = ptr - sptr; ++ memcpy(dptr, sptr, len); ++ sptr += len + origlen; ++ dptr += len; ++ memcpy(dptr, repl, repllen); ++ dptr += repllen; ++ } ++ memcpy(dptr, sptr, srcend - sptr); ++ if (didAlloc) ++ free(srcstr); ++ return dststr; ++ } ++ ++ memcpy(dststr, srcstr, srclen); ++ if (didAlloc) ++ free(srcstr); ++ return dststr; ++} ++ ++int ++strsplit(char *src, int srclen, char delim, char ***params) ++{ ++ char *sptr, *srcbeg, *srcend, *dstr; ++ int count = 1, i = 0, len = 0; ++ ++ if (src == NULL) ++ return 0; ++ if (!srclen) ++ srclen = strlen(src); ++ srcbeg = src; ++ srcend = srcbeg + srclen; ++ sptr = srcbeg; ++ ++ /* count the delimiters */ ++ while (sptr < srcend) ++ { ++ if (*sptr++ == delim) ++ count++; ++ } ++ sptr = srcbeg; ++ *params = malloc(count * sizeof (size_t)); ++ char **param = *params; ++ ++ for (i = 0; i < (count - 1); i++) ++ { ++ dstr = strchr(sptr, delim); ++ len = dstr - sptr; ++ param[i] = malloc((len + 1) * sizeof (char)); ++ memcpy(param[i], sptr, len); ++ *(param[i] + len) = '\0'; ++ sptr += len + 1; ++ } ++ ++ /* copy the last string */ ++ if (sptr <= srcend) ++ { ++ len = srclen - (sptr - srcbeg); ++ param[i] = malloc((len + 1) * sizeof (char)); ++ memcpy(param[i], sptr, len); ++ *(param[i] + len) = '\0'; ++ } ++ return count; ++} +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp.h 2014-05-04 17:55:17.517338389 +0200 +@@ -150,12 +150,14 @@ + AVal playpath; /* passed in explicitly */ + AVal tcUrl; + AVal swfUrl; ++ AVal swfHash; + AVal pageUrl; + AVal app; + AVal auth; + AVal flashVer; + AVal subscribepath; + AVal usherToken; ++ AVal WeebToken; + AVal token; + AVal pubUser; + AVal pubPasswd; +@@ -174,9 +176,15 @@ + int lFlags; + + int swfAge; ++ int swfSize; + + int protocol; ++ int ConnectPacket; ++ int CombineConnectPacket; ++ int redirected; + int timeout; /* connection timeout in seconds */ ++ AVal Extras; ++ AVal HandshakeResponse; + + #define RTMP_PUB_NAME 0x0001 /* send login to server */ + #define RTMP_PUB_RESP 0x0002 /* send salted password hash */ +@@ -224,6 +232,7 @@ + /* if bResume == TRUE */ + uint8_t initialFrameType; + uint32_t nResumeTS; ++ uint32_t nResumeDriftTS; + char *metaHeader; + char *initialFrame; + uint32_t nMetaHeaderSize; +@@ -310,6 +319,7 @@ + AVal *flashVer, + AVal *subscribepath, + AVal *usherToken, ++ AVal *WeebToken, + int dStart, + int dStop, int bLiveStream, long int timeout); + +@@ -375,6 +385,11 @@ + int RTMP_HashSWF(const char *url, unsigned int *size, unsigned char *hash, + int age); + ++ AVal AVcopy(AVal src); ++ AVal StripParams(AVal *src); ++ char *strreplace(char *srcstr, int srclen, char *orig, char *repl, int didAlloc); ++ int strsplit(char *src, int srclen, char delim, char ***params); ++ + #ifdef __cplusplus + }; + #endif +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp_sys.h librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp_sys.h +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/librtmp/rtmp_sys.h 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/librtmp/rtmp_sys.h 2014-05-04 17:55:17.517338389 +0200 +@@ -65,6 +65,7 @@ + #include <polarssl/net.h> + #include <polarssl/ssl.h> + #include <polarssl/havege.h> ++#include <polarssl/md5.h> + #if POLARSSL_VERSION_NUMBER < 0x01010000 + #define havege_random havege_rand + #endif +@@ -105,6 +106,7 @@ + #define TLS_write(s,b,l) ssl_write(s,(unsigned char *)b,l) + #define TLS_shutdown(s) ssl_close_notify(s) + #define TLS_close(s) ssl_free(s); free(s) ++#define md5_hash(i, ilen, o) md5(i, ilen, o) + + #elif defined(USE_GNUTLS) + #include <gnutls/gnutls.h> +@@ -122,6 +124,8 @@ + #define TLS_write(s,b,l) gnutls_record_send(s,b,l) + #define TLS_shutdown(s) gnutls_bye(s, GNUTLS_SHUT_RDWR) + #define TLS_close(s) gnutls_deinit(s) ++#define md5_hash(i, ilen, o) gnutls_digest_algorithm_t algorithm = GNUTLS_DIG_MD5;\ ++ gnutls_hash_fast(algorithm, i, ilen, o); + + #else /* USE_OPENSSL */ + #define TLS_CTX SSL_CTX * +@@ -134,6 +138,7 @@ + #define TLS_write(s,b,l) SSL_write(s,b,l) + #define TLS_shutdown(s) SSL_shutdown(s) + #define TLS_close(s) SSL_free(s) ++#define md5_hash(i, ilen, o) MD5(i, ilen, o) + + #endif + #endif +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/Makefile librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/Makefile +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/Makefile 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/Makefile 2014-05-04 17:55:17.513338440 +0200 +@@ -32,7 +32,7 @@ + SBINDIR=$(DESTDIR)$(sbindir) + MANDIR=$(DESTDIR)$(mandir) + +-LIBS_posix= ++LIBS_posix=-lm + LIBS_darwin= + LIBS_mingw=-lws2_32 -lwinmm -lgdi32 + LIB_RTMP=-Llibrtmp -lrtmp +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpdump.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpdump.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpdump.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpdump.c 2014-05-04 17:55:17.517338389 +0200 +@@ -283,6 +283,7 @@ + uint8_t dataType; + int bAudioOnly; + off_t size; ++ char *syncbuf, *p; + + fseek(file, 0, SEEK_END); + size = ftello(file); +@@ -293,8 +294,8 @@ + + bAudioOnly = (dataType & 0x4) && !(dataType & 0x1); + +- RTMP_Log(RTMP_LOGDEBUG, "bAudioOnly: %d, size: %llu", bAudioOnly, +- (unsigned long long) size); ++ RTMP_Log(RTMP_LOGDEBUG, "bAudioOnly: %d, size: %lu", bAudioOnly, ++ (unsigned long) size); + + // ok, we have to get the timestamp of the last keyframe (only keyframes are seekable) / last audio frame (audio only streams) + +@@ -326,6 +327,51 @@ + prevTagSize = AMF_DecodeInt32(buffer); + //RTMP_Log(RTMP_LOGDEBUG, "Last packet: prevTagSize: %d", prevTagSize); + ++ if (prevTagSize <= 0 || prevTagSize > size - 4 - 13) ++ { ++ /* Last packet was not fully received - try to sync to last tag */ ++ prevTagSize = 0; ++ tsize = size > 0x100000 ? 0x100000 : size; /* 1MB should be enough for 3500K bitrates */ ++ if (tsize > 13 + 15) ++ { ++ tsize -= 13; // do not read header ++ syncbuf = (char *) malloc(tsize); ++ if (syncbuf) ++ { ++ fseeko(file, size - tsize, SEEK_SET); ++ if (fread(syncbuf, 1, tsize, file) == tsize) ++ { ++ p = syncbuf + tsize; ++ while (p >= syncbuf + 15) ++ { ++ /* Check for StreamID */ ++ if (AMF_DecodeInt24(p - 7) == 0) ++ { ++ /* Check for Audio/Video/Script */ ++ dataType = p[-15] & 0x1F; ++ if (dataType == 8 || dataType == 9 || dataType == 18) ++ { ++ prevTagSize = AMF_DecodeInt24(p - 14); ++ if ((prevTagSize < tsize) && (p + prevTagSize + 11 <= syncbuf + tsize - 4) ++ && (AMF_DecodeInt32(p - 4 + prevTagSize) == prevTagSize + 11)) ++ { ++ prevTagSize = syncbuf + tsize - p + 15; ++ RTMP_Log(RTMP_LOGDEBUG, "Sync success - found last tag at 0x%x", (uint32_t) (size - prevTagSize)); ++ prevTagSize -= 4; ++ tsize = 0; ++ break; ++ } ++ else ++ prevTagSize = 0; ++ } ++ } ++ --p; ++ } ++ } ++ free(syncbuf); ++ } ++ } ++ } + if (prevTagSize == 0) + { + RTMP_Log(RTMP_LOGERROR, "Couldn't find keyframe to resume from!"); +@@ -705,6 +751,8 @@ + RTMP_LogPrintf + ("--jtv|-j JSON Authentication token for Justin.tv legacy servers\n"); + RTMP_LogPrintf ++ ("--weeb|-J string Authentication token for weeb.tv servers\n"); ++ RTMP_LogPrintf + ("--hashes|-# Display progress with hashes, not with the byte counter\n"); + RTMP_LogPrintf + ("--buffer|-b Buffer time in milliseconds (default: %u)\n", +@@ -751,7 +799,8 @@ + AVal hostname = { 0, 0 }; + AVal playpath = { 0, 0 }; + AVal subscribepath = { 0, 0 }; +- AVal usherToken = { 0, 0 }; //Justin.tv auth token ++ AVal usherToken = { 0, 0 }; // Justin.tv auth token ++ AVal WeebToken = { 0, 0 }; // Weeb.tv auth token + int port = -1; + int protocol = RTMP_PROTOCOL_UNDEFINED; + int retries = 0; +@@ -858,12 +907,13 @@ + {"quiet", 0, NULL, 'q'}, + {"verbose", 0, NULL, 'V'}, + {"jtv", 1, NULL, 'j'}, ++ {"weeb", 1, NULL, 'J'}, + {0, 0, 0, 0} + }; + + while ((opt = + getopt_long(argc, argv, +- "hVveqzRr:s:t:i:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:", ++ "hVveqzRr:s:t:i:p:a:b:f:o:u:C:n:c:l:y:Ym:k:d:A:B:T:w:x:W:X:S:#j:J:", + longopts, NULL)) != -1) + { + switch (opt) +@@ -995,7 +1045,7 @@ + port = parsedPort; + if (playpath.av_len == 0 && parsedPlaypath.av_len) + { +- playpath = parsedPlaypath; ++ playpath = AVcopy(parsedPlaypath); + } + if (protocol == RTMP_PROTOCOL_UNDEFINED) + protocol = parsedProtocol; +@@ -1079,6 +1129,9 @@ + case 'j': + STR2AVAL(usherToken, optarg); + break; ++ case 'J': ++ STR2AVAL(WeebToken, optarg); ++ break; + default: + RTMP_LogPrintf("unknown option: %c\n", opt); + usage(argv[0]); +@@ -1170,14 +1223,14 @@ + + if (tcUrl.av_len == 0) + { +- tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) + +- hostname.av_len + app.av_len + sizeof("://:65535/"); ++ tcUrl.av_len = strlen(RTMPProtocolStringsLower[protocol]) + ++ hostname.av_len + app.av_len + sizeof ("://:65535/"); + tcUrl.av_val = (char *) malloc(tcUrl.av_len); +- if (!tcUrl.av_val) +- return RD_FAILED; ++ if (!tcUrl.av_val) ++ return RD_FAILED; + tcUrl.av_len = snprintf(tcUrl.av_val, tcUrl.av_len, "%s://%.*s:%d/%.*s", +- RTMPProtocolStringsLower[protocol], hostname.av_len, +- hostname.av_val, port, app.av_len, app.av_val); ++ RTMPProtocolStringsLower[protocol], hostname.av_len, ++ hostname.av_val, port, app.av_len, app.av_val); + } + + int first = 1; +@@ -1197,8 +1250,8 @@ + if (!fullUrl.av_len) + { + RTMP_SetupStream(&rtmp, protocol, &hostname, port, &sockshost, &playpath, +- &tcUrl, &swfUrl, &pageUrl, &app, &auth, &swfHash, swfSize, +- &flashVer, &subscribepath, &usherToken, dSeek, dStopOffset, bLiveStream, timeout); ++ &tcUrl, &swfUrl, &pageUrl, &app, &auth, &swfHash, swfSize, ++ &flashVer, &subscribepath, &usherToken, &WeebToken, dSeek, dStopOffset, bLiveStream, timeout); + } + else + { +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpgw.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpgw.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpgw.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpgw.c 2014-05-04 17:55:17.525338289 +0200 +@@ -96,7 +96,8 @@ + AVal flashVer; + AVal token; + AVal subscribepath; +- AVal usherToken; //Justin.tv auth token ++ AVal usherToken; // Justin.tv auth token ++ AVal WeebToken; // Weeb.tv auth token + AVal sockshost; + AMFObject extras; + int edepth; +@@ -556,8 +557,8 @@ + if (!req.fullUrl.av_len) + { + RTMP_SetupStream(&rtmp, req.protocol, &req.hostname, req.rtmpport, &req.sockshost, +- &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, dSeek, req.dStopOffset, +- req.bLiveStream, req.timeout); ++ &req.playpath, &req.tcUrl, &req.swfUrl, &req.pageUrl, &req.app, &req.auth, &req.swfHash, req.swfSize, &req.flashVer, &req.subscribepath, &req.usherToken, &req.WeebToken, dSeek, req.dStopOffset, ++ req.bLiveStream, req.timeout); + } + else + { +@@ -972,6 +973,9 @@ + case 'j': + STR2AVAL(req->usherToken, arg); + break; ++ case 'J': ++ STR2AVAL(req->WeebToken, arg); ++ break; + default: + RTMP_LogPrintf("unknown option: %c, arg: %s\n", opt, arg); + return FALSE; +@@ -1044,6 +1048,7 @@ + {"quiet", 0, NULL, 'q'}, + {"verbose", 0, NULL, 'V'}, + {"jtv", 1, NULL, 'j'}, ++ {"weeb", 1, NULL, 'J'}, + {0, 0, 0, 0} + }; + +@@ -1056,7 +1061,7 @@ + + while ((opt = + getopt_long(argc, argv, +- "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:", longopts, ++ "hvqVzr:s:t:i:p:a:f:u:n:c:l:y:m:d:D:A:B:T:g:w:x:W:X:S:j:J:", longopts, + NULL)) != -1) + { + switch (opt) +@@ -1121,6 +1126,8 @@ + RTMP_LogPrintf + ("--jtv|-j JSON Authentication token for Justin.tv legacy servers\n"); + RTMP_LogPrintf ++ ("--weeb|-J string Authentication token for weeb.tv servers\n"); ++ RTMP_LogPrintf + ("--buffer|-b Buffer time in milliseconds (default: %u)\n\n", + defaultRTMPRequest.bufferTime); + +diff -uNr librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpsrv.c librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpsrv.c +--- librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497.org/rtmpsrv.c 2014-03-02 19:20:23.000000000 +0100 ++++ librtmp-79459a2b43f41ac44a2ec001139bcb7b1b8f7497/rtmpsrv.c 2014-05-04 17:55:17.525338289 +0200 +@@ -25,9 +25,13 @@ + */ + + #include <stdlib.h> ++#ifdef __MINGW_H ++#include <unistd.h> ++#endif + #include <string.h> + #include <math.h> + #include <limits.h> ++#include <time.h> + + #include <signal.h> + #include <getopt.h> +@@ -94,12 +98,19 @@ + STREAMING_SERVER *rtmpServer = 0; // server structure pointer + void *sslCtx = NULL; + ++int file_exists(const char *fname); + STREAMING_SERVER *startStreaming(const char *address, int port); + void stopStreaming(STREAMING_SERVER * server); + void AVreplace(AVal *src, const AVal *orig, const AVal *repl); + + static const AVal av_dquote = AVC("\""); + static const AVal av_escdquote = AVC("\\\""); ++#ifdef WIN32 ++static const AVal av_caret = AVC("^"); ++static const AVal av_esccaret = AVC("^^"); ++static const AVal av_pipe = AVC("|"); ++static const AVal av_escpipe = AVC("^|"); ++#endif + + typedef struct + { +@@ -168,6 +179,12 @@ + SAVC(code); + SAVC(description); + SAVC(secureToken); ++SAVC(_checkbw); ++SAVC(_onbwdone); ++SAVC(checkBandwidth); ++SAVC(onBWDone); ++SAVC(FCSubscribe); ++SAVC(onFCSubscribe); + + static int + SendConnectResult(RTMP *r, double txn) +@@ -191,7 +208,7 @@ + enc = AMF_EncodeNumber(enc, pend, txn); + *enc++ = AMF_OBJECT; + +- STR2AVAL(av, "FMS/3,5,1,525"); ++ STR2AVAL(av, "FMS/3,5,7,7009"); + enc = AMF_EncodeNamedString(enc, pend, &av_fmsVer, &av); + enc = AMF_EncodeNamedNumber(enc, pend, &av_capabilities, 31.0); + enc = AMF_EncodeNamedNumber(enc, pend, &av_mode, 1.0); +@@ -213,7 +230,7 @@ + enc = AMF_EncodeNamedString(enc, pend, &av_secureToken, &av); + #endif + STR2AVAL(p.p_name, "version"); +- STR2AVAL(p.p_vu.p_aval, "3,5,1,525"); ++ STR2AVAL(p.p_vu.p_aval, "3,5,7,7009"); + p.p_type = AMF_STRING; + obj.o_num = 1; + obj.o_props = &p; +@@ -234,7 +251,7 @@ + SendResultNumber(RTMP *r, double txn, double ID) + { + RTMPPacket packet; +- char pbuf[256], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -264,12 +281,13 @@ + SAVC(details); + SAVC(clientid); + static const AVal av_NetStream_Authenticate_UsherToken = AVC("NetStream.Authenticate.UsherToken"); ++static const AVal av_FCSubscribe_message = AVC("FCSubscribe to stream"); + + static int + SendPlayStart(RTMP *r) + { + RTMPPacket packet; +- char pbuf[512], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -301,7 +319,7 @@ + SendPlayStop(RTMP *r) + { + RTMPPacket packet; +- char pbuf[512], *pend = pbuf+sizeof(pbuf); ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); + + packet.m_nChannel = 0x03; // control channel (invoke) + packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */ +@@ -329,6 +347,83 @@ + return RTMP_SendPacket(r, &packet, FALSE); + } + ++static int ++SendCheckBWResponse(RTMP *r, int oldMethodType, int onBWDoneInit) ++{ ++ RTMPPacket packet; ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); ++ char *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ if (oldMethodType) ++ { ++ enc = AMF_EncodeString(enc, pend, &av__onbwdone); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ enc = AMF_EncodeNumber(enc, pend, 10240); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ } ++ else ++ { ++ enc = AMF_EncodeString(enc, pend, &av_onBWDone); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ if (!onBWDoneInit) ++ { ++ enc = AMF_EncodeNumber(enc, pend, 10240); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ enc = AMF_EncodeNumber(enc, pend, 20); ++ } ++ } ++ ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, FALSE); ++} ++ ++static int ++SendOnFCSubscribe(RTMP *r) ++{ ++ RTMPPacket packet; ++ char pbuf[1024], *pend = pbuf + sizeof (pbuf); ++ char *enc; ++ ++ packet.m_nChannel = 0x03; /* control channel (invoke) */ ++ packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM; ++ packet.m_packetType = RTMP_PACKET_TYPE_INVOKE; ++ packet.m_nTimeStamp = 0; ++ packet.m_nInfoField2 = 0; ++ packet.m_hasAbsTimestamp = 0; ++ packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE; ++ ++ enc = packet.m_body; ++ enc = AMF_EncodeString(enc, pend, &av_onFCSubscribe); ++ enc = AMF_EncodeNumber(enc, pend, 0); ++ *enc++ = AMF_NULL; ++ ++ *enc++ = AMF_OBJECT; ++ enc = AMF_EncodeNamedString(enc, pend, &av_level, &av_status); ++ enc = AMF_EncodeNamedString(enc, pend, &av_code, &av_NetStream_Play_Start); ++ enc = AMF_EncodeNamedString(enc, pend, &av_description, &av_FCSubscribe_message); ++ enc = AMF_EncodeNamedNumber(enc, pend, &av_clientid, 0); ++ *enc++ = 0; ++ *enc++ = 0; ++ *enc++ = AMF_OBJECT_END; ++ ++ packet.m_nBodySize = enc - packet.m_body; ++ ++ return RTMP_SendPacket(r, &packet, FALSE); ++} ++ + static void + spawn_dumper(int argc, AVal *av, char *cmd) + { +@@ -389,6 +484,8 @@ + len += 40; + break; + case AMF_OBJECT: ++ case AMF_ECMA_ARRAY: ++ case AMF_STRICT_ARRAY: + len += 9; + len += countAMF(&p->p_vu.p_object, argc); + (*argc) += 2; +@@ -404,12 +501,14 @@ + static char * + dumpAMF(AMFObject *obj, char *ptr, AVal *argv, int *argc) + { +- int i, len, ac = *argc; ++ int i, ac = *argc; + const char opt[] = "NBSO Z"; + +- for (i=0, len=0; i < obj->o_num; i++) ++ for (i = 0; i < obj->o_num; i++) + { + AMFObjectProperty *p = &obj->o_props[i]; ++ if ((p->p_type == AMF_ECMA_ARRAY) || (p->p_type == AMF_STRICT_ARRAY)) ++ p->p_type = AMF_OBJECT; + argv[ac].av_val = ptr+1; + argv[ac++].av_len = 2; + ptr += sprintf(ptr, " -C "); +@@ -569,6 +668,7 @@ + server->arglen += countAMF(&r->Link.extras, &server->argc); + } + SendConnectResult(r, txn); ++ SendCheckBWResponse(r, FALSE, TRUE); + } + else if (AVMATCH(&method, &av_createStream)) + { +@@ -583,10 +683,26 @@ + AVal usherToken; + AMFProp_GetString(AMF_GetProp(&obj, NULL, 3), &usherToken); + AVreplace(&usherToken, &av_dquote, &av_escdquote); ++#ifdef WIN32 ++ AVreplace(&usherToken, &av_caret, &av_esccaret); ++ AVreplace(&usherToken, &av_pipe, &av_escpipe); ++#endif + server->arglen += 6 + usherToken.av_len; + server->argc += 2; + r->Link.usherToken = usherToken; + } ++ else if (AVMATCH(&method, &av__checkbw)) ++ { ++ SendCheckBWResponse(r, TRUE, FALSE); ++ } ++ else if (AVMATCH(&method, &av_checkBandwidth)) ++ { ++ SendCheckBWResponse(r, FALSE, FALSE); ++ } ++ else if (AVMATCH(&method, &av_FCSubscribe)) ++ { ++ SendOnFCSubscribe(r); ++ } + else if (AVMATCH(&method, &av_play)) + { + char *file, *p, *q, *cmd, *ptr; +@@ -600,6 +716,17 @@ + if (obj.o_num > 5) + r->Link.length = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 5)); + */ ++ double StartFlag = 0; ++ AMFObjectProperty *Start = AMF_GetProp(&obj, NULL, 4); ++ if (!(Start->p_type == AMF_INVALID)) ++ StartFlag = AMFProp_GetNumber(Start); ++ r->Link.app = AVcopy(r->Link.app); ++ if (StartFlag == -1000 || (r->Link.app.av_val && strstr(r->Link.app.av_val, "live"))) ++ { ++ StartFlag = -1000; ++ server->arglen += 7; ++ server->argc += 1; ++ } + if (r->Link.tcUrl.av_len) + { + len = server->arglen + r->Link.playpath.av_len + 4 + +@@ -617,6 +744,7 @@ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; ++ r->Link.tcUrl = StripParams(&r->Link.tcUrl); + ptr += sprintf(ptr," -r \"%s\"", r->Link.tcUrl.av_val); + argv[argc++].av_len = r->Link.tcUrl.av_len; + +@@ -641,6 +769,7 @@ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; ++ r->Link.swfUrl = StripParams(&r->Link.swfUrl); + ptr += sprintf(ptr, " -W \"%s\"", r->Link.swfUrl.av_val); + argv[argc++].av_len = r->Link.swfUrl.av_len; + } +@@ -663,10 +792,17 @@ + r->Link.usherToken.av_val = NULL; + r->Link.usherToken.av_len = 0; + } +- if (r->Link.extras.o_num) { +- ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc); +- AMF_Reset(&r->Link.extras); +- } ++ if (StartFlag == -1000) ++ { ++ argv[argc].av_val = ptr + 1; ++ argv[argc++].av_len = 6; ++ ptr += sprintf(ptr, " --live"); ++ } ++ if (r->Link.extras.o_num) ++ { ++ ptr = dumpAMF(&r->Link.extras, ptr, argv, &argc); ++ AMF_Reset(&r->Link.extras); ++ } + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = ptr + 5; +@@ -674,7 +810,13 @@ + r->Link.playpath.av_len, r->Link.playpath.av_val); + argv[argc++].av_len = r->Link.playpath.av_len; + +- av = r->Link.playpath; ++ if (r->Link.playpath.av_len) ++ av = r->Link.playpath; ++ else ++ { ++ av.av_val = "file"; ++ av.av_len = 4; ++ } + /* strip trailing URL parameters */ + q = memchr(av.av_val, '?', av.av_len); + if (q) +@@ -708,25 +850,82 @@ + + memcpy(file, av.av_val, av.av_len); + file[av.av_len] = '\0'; +- for (p=file; *p; p++) +- if (*p == ':') +- *p = '_'; + +- /* Add extension if none present */ +- if (file[av.av_len - 4] != '.') +- { +- av.av_len += 4; +- } +- /* Always use flv extension, regardless of original */ +- if (strcmp(file+av.av_len-4, ".flv")) +- { +- strcpy(file+av.av_len-4, ".flv"); +- } ++ if (strlen(file) < 128) ++ { ++ /* Add extension if none present */ ++ if (file[av.av_len - 4] != '.') ++ { ++ av.av_len += 4; ++ } ++ ++ /* Always use flv extension, regardless of original */ ++ if (strcmp(file + av.av_len - 4, ".flv")) ++ { ++ strcpy(file + av.av_len - 4, ".flv"); ++ } ++ ++ /* Remove invalid characters from filename */ ++ file = strreplace(file, 0, ":", "_", TRUE); ++ file = strreplace(file, 0, "&", "_", TRUE); ++ file = strreplace(file, 0, "^", "_", TRUE); ++ file = strreplace(file, 0, "|", "_", TRUE); ++ } ++ else ++ { ++ /* Filename too long - generate unique name */ ++ strcpy(file, "vXXXXXX"); ++ mktemp(file); ++ strcat(file, ".flv"); ++ } ++ ++ /* Add timestamp to the filename */ ++ char *filename, *pfilename, timestamp[21]; ++ int filename_len, timestamp_len; ++ time_t current_time; ++ ++ time(¤t_time); ++ timestamp_len = strftime(×tamp[0], sizeof (timestamp), "%Y-%m-%d_%I-%M-%S_", localtime(¤t_time)); ++ timestamp[timestamp_len] = '\0'; ++ filename_len = strlen(file); ++ filename = malloc(timestamp_len + filename_len + 1); ++ pfilename = filename; ++ memcpy(pfilename, timestamp, timestamp_len); ++ pfilename += timestamp_len; ++ memcpy(pfilename, file, filename_len); ++ pfilename += filename_len; ++ *pfilename++ = '\0'; ++ file = filename; ++ + argv[argc].av_val = ptr + 1; + argv[argc++].av_len = 2; + argv[argc].av_val = file; + argv[argc].av_len = av.av_len; +- ptr += sprintf(ptr, " -o %s", file); ++#ifdef VLC ++ char *vlc; ++ int didAlloc = FALSE; ++ ++ if (getenv("VLC")) ++ vlc = getenv("VLC"); ++ else if (getenv("ProgramFiles")) ++ { ++ vlc = malloc(512 * sizeof (char)); ++ didAlloc = TRUE; ++ char *ProgramFiles = getenv("ProgramFiles"); ++ sprintf(vlc, "\"%s%s", ProgramFiles, " (x86)\\VideoLAN\\VLC\\vlc.exe"); ++ if (!file_exists(vlc + 1)) ++ sprintf(vlc + 1, "%s%s", ProgramFiles, "\\VideoLAN\\VLC\\vlc.exe"); ++ strcpy(vlc + strlen(vlc), "\" -"); ++ } ++ else ++ vlc = "vlc -"; ++ ++ ptr += sprintf(ptr, " | %s", vlc); ++ if (didAlloc) ++ free(vlc); ++#else ++ ptr += sprintf(ptr, " -o \"%s\"", file); ++#endif + now = RTMP_GetTime(); + if (now - server->filetime < DUPTIME && AVMATCH(&argv[argc], &server->filename)) + { +@@ -740,7 +939,21 @@ + server->filetime = now; + free(server->filename.av_val); + server->filename = argv[argc++]; +- spawn_dumper(argc, argv, cmd); ++#ifdef VLC ++ FILE *vlc_cmdfile = fopen("VLC.bat", "w"); ++ char *vlc_batchcmd = strreplace(cmd, 0, "%", "%%", FALSE); ++ fprintf(vlc_cmdfile, "%s\n", vlc_batchcmd); ++ fclose(vlc_cmdfile); ++ free(vlc_batchcmd); ++ spawn_dumper(argc, argv, "VLC.bat"); ++#else ++ spawn_dumper(argc, argv, cmd); ++#endif ++ ++ /* Save command to text file */ ++ FILE *cmdfile = fopen("Command.txt", "a"); ++ fprintf(cmdfile, "%s\n", cmd); ++ fclose(cmdfile); + } + + free(cmd); +@@ -859,12 +1072,18 @@ + { + case 'q': + RTMP_LogPrintf("Exiting\n"); +- stopStreaming(rtmpServer); +- exit(0); ++ if (rtmpServer) ++ stopStreaming(rtmpServer); + break; + default: + RTMP_LogPrintf("Unknown command \'%c\', ignoring\n", ich); + } ++ sleep(1); ++ if (rtmpServer && (rtmpServer->state == STREAMING_STOPPED)) ++ { ++ RTMP_Log(RTMP_LOGDEBUG, "Exiting text UI thread"); ++ break; ++ } + } + TFRET(); + } +@@ -1052,7 +1271,6 @@ + } + } + +- + void + sigIntHandler(int sig) + { +@@ -1189,3 +1407,15 @@ + src->av_val = dest; + src->av_len = dptr - dest; + } ++ ++int ++file_exists(const char *fname) ++{ ++ FILE *file; ++ if ((file = fopen(fname, "r"))) ++ { ++ fclose(file); ++ return TRUE; ++ }Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Part of the diff is not shown here. View the raw message.
PATCH v8 15/28 rtmpdump: Add KSV patch
"Yann E. MORIN" <[email protected]> wrote in news:20140517201125.GG3459 at free.fr:
Quoted 5 lines
Wee... Huge patch without any explanation.
What is this 'KSV' stuff?
What does the patch do?
Why is it needed?
Hi,
KSV is a member of the stream-recorder board, he collects patches to rtmpdump and releases them as a combined patch.
My patch contains a link to the forum thread[1] where the patch development takes place. That forum post contains a long list of explanations and a changelog. Shall I quote that webpage in my patch file?
The patch improves rtmpdump by adding website-specific fixes, for example. An older version of the patch is used in OpenELEC, btw:
https://github.com/OpenELEC/OpenELEC.tv/tree/master/packages/multimedia/rtmpd
ump/patches
Regards, Bernd
[1] http://stream-recorder.com/forum/customized-rtmpdump-binaries-patch-file-
t16103.html
PATCH v8 16/28 xbmc: bump version to 13.0
In reply to Bernd Kuhls--- package/xbmc/Config.in | 1 + package/xbmc/xbmc.mk | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-)
package/xbmc/Config.in +1 -0
@@ -35,6 +35,7 @@ menuconfig BR2_PACKAGE_XBMC select BR2_PACKAGE_LIBUNGIF select BR2_PACKAGE_LIBVORBIS select BR2_PACKAGE_LIBXML2 + select BR2_PACKAGE_LIBXSLT select BR2_PACKAGE_LZO select BR2_PACKAGE_NCURSES select BR2_PACKAGE_OPENSSL
package/xbmc/xbmc.mk +3 -2
@@ -4,7 +4,7 @@ # ################################################################################ -XBMC_VERSION = 12.3-Frodo +XBMC_VERSION = 13.0-Gotham XBMC_SITE = $(call github,xbmc,xbmc,$(XBMC_VERSION)) XBMC_LICENSE = GPLv2 XBMC_LICENSE_FILES = LICENSE.GPL
@@ -15,7 +15,7 @@ XBMC_LICENSE_FILES = LICENSE.GPL XBMC_DEPENDENCIES = host-gawk host-gperf host-infozip host-lzo host-sdl_image host-swig XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ libass libcdio libcurl libegl libfribidi libgcrypt libgles libmad libmodplug libmpeg2 \ - libogg libplist libpng libsamplerate libungif libvorbis libxml2 lzo ncurses \ + libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \ openssl pcre python readline sqlite taglib tiff tinyxml yajl zlib XBMC_CONF_ENV = \
@@ -27,6 +27,7 @@ XBMC_CONF_ENV = \ TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr" XBMC_CONF_OPT += \ + --with-arch=$(BR2_ARCH) \ --disable-alsa \ --disable-crystalhd \ --disable-debug \
Signature · 1 line
1.7.10.4
PATCH v8 16/28 xbmc: bump version to 13.0
Bernd Kuhls <[email protected]> wrote in news:1400342276-10303-17-git-send-email-bernd.kuhls at t-online.de:
package/xbmc/xbmc.mk line 7
Quoted 2 lines
package/xbmc/xbmc.mk +1
-1-XBMC_VERSION = 12.3-Frodo +XBMC_VERSION = 13.0-Gotham
Hi,
btw, v9 of my patch series will contain 13.1b1-Gotham :)
Regards, Bernd
PATCH v8 17/28 xbmc-pvr-addons: Version bump to xbmc Gotham-compatible addon
In reply to Bernd Kuhls--- .../xbmc-pvr-addons-0001-buildfix.patch | 229 ++++++++++++++++++++ package/xbmc-pvr-addons/xbmc-pvr-addons.mk | 7 +- 2 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch
package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch new file +229 -0
@@ -0,0 +1,229 @@ +Add support to build in a seperate builddir + +source: https://github.com/opdenkamp/xbmc-pvr-addons/pull/224 + +patch taken from OpenElec +https://github.com/OpenELEC/OpenELEC.tv/blob/5d7777390abcb59cdc8f99c4253f89da94a8055c/packages/mediacenter/xbmc-pvr-addons/patches/xbmc-pvr-addons-buildfix.patch + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/Makefile.include.am xbmc-pvr-addons-f38b2eb.patch/addons/Makefile.include.am +--- xbmc-pvr-addons-f38b2eb/addons/Makefile.include.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/Makefile.include.am 2014-05-04 14:35:47.618601552 +0200 +@@ -36,7 +36,9 @@ + mkdir -m 755 -p $(DESTDIR)@LIBDIR@/$(ADDONNAME) + mkdir -m 755 -p $(DESTDIR)@DATADIR@/$(ADDONNAME) + cp -f @BINPREFIX@$(ADDONBINNAME)@BIN_EXT@ $(DESTDIR)@LIBDIR@/$(ADDONNAME) ; chmod 655 $(DESTDIR)@LIBDIR@/$(ADDONNAME)/@BINPREFIX@$(ADDONBINNAME)@BIN_EXT@ +- cp -r -f @abs_top_srcdir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ; chmod -R o+rx $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ cp -r -f @abs_top_srcdir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ cp -r -f @abs_top_builddir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ chmod -R o+rx $(DESTDIR)@DATADIR@/$(ADDONNAME) + endif + + all: @BUILD_TYPE@ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.argustv/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.argustv/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.argustv/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.argustv/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libargustv-addon + lib_LTLIBRARIES = libargustv-addon.la + +-LIBS = @abs_top_srcdir@/lib/jsoncpp/libjsoncpp.la ++LIBS = @abs_top_builddir@/lib/jsoncpp/libjsoncpp.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc -Isrc/lib/filesystem -I at abs_top_srcdir@/lib/jsoncpp/include ++INCLUDES+=-I$(srcdir)/src -I$(srcdir)/src/lib/filesystem -I at abs_top_srcdir@/lib/jsoncpp/include + + libargustv_addon_la_SOURCES = src/activerecording.cpp \ + src/channel.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.demo/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.demo/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.demo/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.demo/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrdemo-addon + lib_LTLIBRARIES = libpvrdemo-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.dvblink/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvblink/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.dvblink/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvblink/Makefile.am 2014-05-04 14:38:41.761644652 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libdvblink-addon + lib_LTLIBRARIES = libdvblink-addon.la + +-LIBS = @abs_top_srcdir@/lib/libdvblinkremote/libdvblinkremote.la ++LIBS = @abs_top_builddir@/lib/libdvblinkremote/libdvblinkremote.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libdvblink_addon_la_SOURCES = src/client.cpp \ + src/base64.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.dvbviewer/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvbviewer/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.dvbviewer/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvbviewer/Makefile.am 2014-05-04 14:36:53.759689719 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libdvbviewer-addon + lib_LTLIBRARIES = libdvbviewer-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.hts/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.hts/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.hts/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.hts/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libtvheadend-addon + lib_LTLIBRARIES = libtvheadend-addon.la + +-LIBS = @abs_top_srcdir@/lib/libhts/libhts.la -ldl ++LIBS = @abs_top_builddir@/lib/libhts/libhts.la -ldl + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.mediaportal.tvserver/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mediaportal.tvserver/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.mediaportal.tvserver/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mediaportal.tvserver/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libmediaportal-addon + lib_LTLIBRARIES = libmediaportal-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libmediaportal_addon_la_SOURCES = src/Cards.cpp \ + src/channels.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.mythtv.cmyth/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mythtv.cmyth/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.mythtv.cmyth/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mythtv.cmyth/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libmythtvcmyth-addon + lib_LTLIBRARIES = libmythtvcmyth-addon.la + +-LIBS = @abs_top_srcdir@/lib/cmyth/libcmyth.la ++LIBS = @abs_top_builddir@/lib/cmyth/libcmyth.la + + AM_CPPFLAGS = -I$(abs_top_srcdir)/lib/cmyth/include + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.nextpvr/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.nextpvr/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.nextpvr/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.nextpvr/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libnextpvr-addon + lib_LTLIBRARIES = libnextpvr-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libnextpvr_addon_la_SOURCES = src/client.cpp \ + src/pvrclient-nextpvr.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.njoy/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.njoy/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.njoy/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.njoy/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrnjoy-addon + lib_LTLIBRARIES = libpvrnjoy-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.vuplus/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.vuplus/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.vuplus/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.vuplus/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libvuplus-addon + lib_LTLIBRARIES = libvuplus-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.wmc/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.wmc/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.wmc/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.wmc/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrwmc-addon + lib_LTLIBRARIES = libpvrwmc-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/lib/cmyth/libcmyth/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/libcmyth/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/cmyth/libcmyth/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/libcmyth/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -26,7 +26,7 @@ + storagegroup.c \ + epginfo.c + +-INCLUDES=-I../include/ $(MYSQL_INCLUDES) ++INCLUDES=-I$(srcdir)/../include/ $(MYSQL_INCLUDES) + + $(LIB): libcmyth.la + cp -f .libs/libcmyth.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/cmyth/librefmem/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/librefmem/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/cmyth/librefmem/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/librefmem/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -3,7 +3,7 @@ + librefmem_la_SOURCES = alloc.c \ + debug_refmem.c + +-INCLUDES=-I../include/ -I../libcmyth/ ++INCLUDES=-I$(srcdir)/../include/ -I$(srcdir)/../libcmyth/ + + $(LIB): librefmem.la + cp -f .libs/librefmem.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/jsoncpp/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/jsoncpp/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/jsoncpp/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/jsoncpp/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -4,7 +4,7 @@ + src/lib_json/json_value.cpp \ + src/lib_json/json_writer.cpp + +-INCLUDES=-Iinclude/ ++INCLUDES=-I$(srcdir)/include/ + + $(LIB): libjsoncpp.la + cp -f .libs/libjsoncpp.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/libdvblinkremote/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/libdvblinkremote/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/libdvblinkremote/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/libdvblinkremote/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -26,10 +26,10 @@ + util.cpp \ + xml_object_serializer_factory.cpp + +-LIBS= @abs_top_srcdir@/lib/tinyxml2/libtinyxml2.la ++LIBS= @abs_top_builddir@/lib/tinyxml2/libtinyxml2.la + +-INCLUDES=-I.. ++INCLUDES=-I$(srcdir)/.. + + $(LIB): libdvblinkremote.la + cp -f .libs/libdvblinkremote.a . +- cp -f .libs/libdvblinkremote.la $(LIB) +\ Kein Zeilenumbruch am Dateiende. ++ cp -f .libs/libdvblinkremote.la $(LIB)
package/xbmc-pvr-addons/xbmc-pvr-addons.mk +4 -3
@@ -4,9 +4,10 @@ # ################################################################################ -# This cset is on the branch 'frodo' -# When XBMC is updated, then this should be updated to the corresponding branch -XBMC_PVR_ADDONS_VERSION = 319351af7f3b546a5a56cdf6492f6ba1aec1cd2f +# This cset in on master. When a Gotham branch is made, we should +# follow it, as incompatible changes in the plugins API can happen +# on the master branch. +XBMC_PVR_ADDONS_VERSION = f38b2ebdc6f96244d5e4bc584315f4a2c24bc787 XBMC_PVR_ADDONS_SITE = $(call github,opdenkamp,xbmc-pvr-addons,$(XBMC_PVR_ADDONS_VERSION)) XBMC_PVR_ADDONS_LICENSE = GPLv3+ XBMC_PVR_ADDONS_LICENSE_FILES = COPYING
Signature · 1 line
1.7.10.4
PATCH v8 17/28 xbmc-pvr-addons: Version bump to xbmc Gotham-compatible addon
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 13 lines
Signed-off-by Bernd Kuhls <[email protected]>--- .../xbmc-pvr-addons-0001-buildfix.patch | 229 ++++++++++++++++++++ package/xbmc-pvr-addons/xbmc-pvr-addons.mk | 7 +- 2 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patchpackage/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch new file +0
-0
package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch line 1
Quoted 1 line
package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch new file +1
-0@@ -0,0 +1,229 @@ +Add support to build in a seperate builddir
We do not need that patch, sicne we are not building the packages out-of-tree.
If it does not build without this patch, then the explanations in this patch are incorrect.
Regards,
Yann E. MORIN.
Quoted 252 lines
package/xbmc-pvr-addons/xbmc-pvr-addons-0001-buildfix.patch new file +227
-0+source: https://github.com/opdenkamp/xbmc-pvr-addons/pull/224 + +patch taken from OpenElec +https://github.com/OpenELEC/OpenELEC.tv/blob/5d7777390abcb59cdc8f99c4253f89da94a8055c/packages/mediacenter/xbmc-pvr-addons/patches/xbmc-pvr-addons-buildfix.patch + +Signed-off-by: Bernd Kuhls <[email protected]> + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/Makefile.include.am xbmc-pvr-addons-f38b2eb.patch/addons/Makefile.include.am +--- xbmc-pvr-addons-f38b2eb/addons/Makefile.include.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/Makefile.include.am 2014-05-04 14:35:47.618601552 +0200 +@@ -36,7 +36,9 @@ + mkdir -m 755 -p $(DESTDIR)@LIBDIR@/$(ADDONNAME) + mkdir -m 755 -p $(DESTDIR)@DATADIR@/$(ADDONNAME) + cp -f @BINPREFIX@$(ADDONBINNAME)@BIN_EXT@ $(DESTDIR)@LIBDIR@/$(ADDONNAME) ; chmod 655 $(DESTDIR)@LIBDIR@/$(ADDONNAME)/@BINPREFIX@$(ADDONBINNAME)@BIN_EXT@ +- cp -r -f @abs_top_srcdir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ; chmod -R o+rx $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ cp -r -f @abs_top_srcdir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ cp -r -f @abs_top_builddir@/addons/$(ADDONNAME)/addon/* $(DESTDIR)@DATADIR@/$(ADDONNAME) ++ chmod -R o+rx $(DESTDIR)@DATADIR@/$(ADDONNAME) + endif + + all: @BUILD_TYPE@ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.argustv/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.argustv/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.argustv/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.argustv/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libargustv-addon + lib_LTLIBRARIES = libargustv-addon.la + +-LIBS = @abs_top_srcdir@/lib/jsoncpp/libjsoncpp.la ++LIBS = @abs_top_builddir@/lib/jsoncpp/libjsoncpp.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc -Isrc/lib/filesystem -I at abs_top_srcdir@/lib/jsoncpp/include ++INCLUDES+=-I$(srcdir)/src -I$(srcdir)/src/lib/filesystem -I at abs_top_srcdir@/lib/jsoncpp/include + + libargustv_addon_la_SOURCES = src/activerecording.cpp \ + src/channel.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.demo/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.demo/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.demo/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.demo/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrdemo-addon + lib_LTLIBRARIES = libpvrdemo-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.dvblink/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvblink/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.dvblink/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvblink/Makefile.am 2014-05-04 14:38:41.761644652 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libdvblink-addon + lib_LTLIBRARIES = libdvblink-addon.la + +-LIBS = @abs_top_srcdir@/lib/libdvblinkremote/libdvblinkremote.la ++LIBS = @abs_top_builddir@/lib/libdvblinkremote/libdvblinkremote.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libdvblink_addon_la_SOURCES = src/client.cpp \ + src/base64.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.dvbviewer/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvbviewer/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.dvbviewer/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.dvbviewer/Makefile.am 2014-05-04 14:36:53.759689719 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libdvbviewer-addon + lib_LTLIBRARIES = libdvbviewer-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.hts/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.hts/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.hts/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.hts/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libtvheadend-addon + lib_LTLIBRARIES = libtvheadend-addon.la + +-LIBS = @abs_top_srcdir@/lib/libhts/libhts.la -ldl ++LIBS = @abs_top_builddir@/lib/libhts/libhts.la -ldl + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.mediaportal.tvserver/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mediaportal.tvserver/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.mediaportal.tvserver/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mediaportal.tvserver/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libmediaportal-addon + lib_LTLIBRARIES = libmediaportal-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libmediaportal_addon_la_SOURCES = src/Cards.cpp \ + src/channels.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.mythtv.cmyth/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mythtv.cmyth/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.mythtv.cmyth/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.mythtv.cmyth/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libmythtvcmyth-addon + lib_LTLIBRARIES = libmythtvcmyth-addon.la + +-LIBS = @abs_top_srcdir@/lib/cmyth/libcmyth.la ++LIBS = @abs_top_builddir@/lib/cmyth/libcmyth.la + + AM_CPPFLAGS = -I$(abs_top_srcdir)/lib/cmyth/include + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.nextpvr/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.nextpvr/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.nextpvr/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.nextpvr/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,11 +10,11 @@ + LIBNAME = libnextpvr-addon + lib_LTLIBRARIES = libnextpvr-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +-INCLUDES+=-Isrc ++INCLUDES+=-I$(srcdir)/src + + libnextpvr_addon_la_SOURCES = src/client.cpp \ + src/pvrclient-nextpvr.cpp \ +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.njoy/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.njoy/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.njoy/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.njoy/Makefile.am 2014-05-04 14:35:47.618601552 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrnjoy-addon + lib_LTLIBRARIES = libpvrnjoy-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.vuplus/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.vuplus/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.vuplus/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.vuplus/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libvuplus-addon + lib_LTLIBRARIES = libvuplus-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/addons/pvr.wmc/Makefile.am xbmc-pvr-addons-f38b2eb.patch/addons/pvr.wmc/Makefile.am +--- xbmc-pvr-addons-f38b2eb/addons/pvr.wmc/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/addons/pvr.wmc/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -10,7 +10,7 @@ + LIBNAME = libpvrwmc-addon + lib_LTLIBRARIES = libpvrwmc-addon.la + +-LIBS = @abs_top_srcdir@/lib/tinyxml/libtinyxml.la ++LIBS = @abs_top_builddir@/lib/tinyxml/libtinyxml.la + + include ../Makefile.include.am + +diff -Naur xbmc-pvr-addons-f38b2eb/lib/cmyth/libcmyth/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/libcmyth/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/cmyth/libcmyth/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/libcmyth/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -26,7 +26,7 @@ + storagegroup.c \ + epginfo.c + +-INCLUDES=-I../include/ $(MYSQL_INCLUDES) ++INCLUDES=-I$(srcdir)/../include/ $(MYSQL_INCLUDES) + + $(LIB): libcmyth.la + cp -f .libs/libcmyth.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/cmyth/librefmem/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/librefmem/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/cmyth/librefmem/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/cmyth/librefmem/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -3,7 +3,7 @@ + librefmem_la_SOURCES = alloc.c \ + debug_refmem.c + +-INCLUDES=-I../include/ -I../libcmyth/ ++INCLUDES=-I$(srcdir)/../include/ -I$(srcdir)/../libcmyth/ + + $(LIB): librefmem.la + cp -f .libs/librefmem.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/jsoncpp/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/jsoncpp/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/jsoncpp/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/jsoncpp/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -4,7 +4,7 @@ + src/lib_json/json_value.cpp \ + src/lib_json/json_writer.cpp + +-INCLUDES=-Iinclude/ ++INCLUDES=-I$(srcdir)/include/ + + $(LIB): libjsoncpp.la + cp -f .libs/libjsoncpp.a . +diff -Naur xbmc-pvr-addons-f38b2eb/lib/libdvblinkremote/Makefile.am xbmc-pvr-addons-f38b2eb.patch/lib/libdvblinkremote/Makefile.am +--- xbmc-pvr-addons-f38b2eb/lib/libdvblinkremote/Makefile.am 2014-05-04 14:27:57.000000000 +0200 ++++ xbmc-pvr-addons-f38b2eb.patch/lib/libdvblinkremote/Makefile.am 2014-05-04 14:35:47.619601641 +0200 +@@ -26,10 +26,10 @@ + util.cpp \ + xml_object_serializer_factory.cpp + +-LIBS= @abs_top_srcdir@/lib/tinyxml2/libtinyxml2.la ++LIBS= @abs_top_builddir@/lib/tinyxml2/libtinyxml2.la + +-INCLUDES=-I.. ++INCLUDES=-I$(srcdir)/.. + + $(LIB): libdvblinkremote.la + cp -f .libs/libdvblinkremote.a . +- cp -f .libs/libdvblinkremote.la $(LIB) +\ Kein Zeilenumbruch am Dateiende. ++ cp -f .libs/libdvblinkremote.la $(LIB)package/xbmc-pvr-addons/xbmc-pvr-addons.mk +4
-3@@ -4,9 +4,10 @@ # ################################################################################ -# This cset is on the branch 'frodo' -# When XBMC is updated, then this should be updated to the corresponding branch -XBMC_PVR_ADDONS_VERSION = 319351af7f3b546a5a56cdf6492f6ba1aec1cd2f +# This cset in on master. When a Gotham branch is made, we should +# follow it, as incompatible changes in the plugins API can happen +# on the master branch. +XBMC_PVR_ADDONS_VERSION = f38b2ebdc6f96244d5e4bc584315f4a2c24bc787 XBMC_PVR_ADDONS_SITE = $(call github,opdenkamp,xbmc-pvr-addons,$(XBMC_PVR_ADDONS_VERSION)) XBMC_PVR_ADDONS_LICENSE = GPLv3+ XBMC_PVR_ADDONS_LICENSE_FILES = COPYINGSignature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 17/28 xbmc-pvr-addons: Version bump to xbmc Gotham-compatible addon
"Yann E. MORIN" <[email protected]> wrote in news:20140517201513.GH3459 at free.fr:
Quoted 2 lines
We do not need that patch, sicne we are not building the packages out-of-tree.
Hi,
removed in v9.
Regards, Bernd
PATCH v8 18/28 xbmc-addon-xvdr: Version bump to xbmc Gotham-compatible addon
In reply to Bernd Kuhls- remove upstream applied patch xbmc-addon-xvdr-0001-foreign-automake.patch
--- .../xbmc-addon-xvdr-0001-foreign-automake.patch | 28 -------------------- package/xbmc-addon-xvdr/xbmc-addon-xvdr.mk | 4 +-- 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 package/xbmc-addon-xvdr/xbmc-addon-xvdr-0001-foreign-automake.patch
package/xbmc-addon-xvdr/xbmc-addon-xvdr-0001-foreign-automake.patch deleted +0 -28
@@ -1,28 +0,0 @@ -commit 846b0b5a8b559f94dffadf5b2f95ca845b6ba9f1 -Author: Yann E. MORIN <[email protected]> -Date: Wed Mar 26 07:45:58 2014 +0100 - - configure: set the foreign flag - - This is required since we do not bundle the necessary files (NEWS, - INSTALL et al.) Setting it in configure.in is needed to be able - to run autoreconf (in lieu of the weird autogen.sh) - - Signed-off-by: "Yann E. MORIN" <[email protected]> - -Patch accepted upstream in master: - https://github.com/pipelka/xbmc-addon-xvdr/commit/84e5860f488e67a3a3386c779f9a56adeb3dc220 - -diff --git a/configure.in b/configure.in -index 6e692e1..7be0d18 100755 ---- a/configure.in -+++ b/configure.in -@@ -12,7 +12,7 @@ AC_CANONICAL_HOST - AC_CANONICAL_TARGET - - dnl Setup for automake --AM_INIT_AUTOMAKE -+AM_INIT_AUTOMAKE([foreign]) - - dnl Check for tools -
package/xbmc-addon-xvdr/xbmc-addon-xvdr.mk +1 -3
@@ -4,9 +4,7 @@ # ################################################################################ -# This cset is on the branch 'xbmc-frodo' -# When XBMC is updated, then this should be updated to the corresponding branch -XBMC_ADDON_XVDR_VERSION = acd4e145fc3220cf708aaf40d895904732dce2c7 +XBMC_ADDON_XVDR_VERSION = 82b5093ad33847f97a978cb620c9a87d2dbcf7eb XBMC_ADDON_XVDR_SITE = $(call github,pipelka,xbmc-addon-xvdr,$(XBMC_ADDON_XVDR_VERSION)) XBMC_ADDON_XVDR_LICENSE = GPLv2+ XBMC_ADDON_XVDR_LICENSE_FILES = COPYING
Signature · 1 line
1.7.10.4
PATCH v8 18/28 xbmc-addon-xvdr: Version bump to xbmc Gotham-compatible addon
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 1 line
- remove upstream applied patch xbmc-addon-xvdr-0001-foreign-automake.patch
Wee-hee! :-)
package/xbmc-addon-xvdr/xbmc-addon-xvdr.mk line 8
Quoted 10 lines
package/xbmc-addon-xvdr/xbmc-addon-xvdr.mk +0
-2@@ -4,9 +4,7 @@ # ################################################################################ -# This cset is on the branch 'xbmc-frodo' -# When XBMC is updated, then this should be updated to the corresponding branch
Ditto as for xbmc-pvr-addons: just duplicate the comment here.
Regards,
Yann E. MORIN.
Quoted 12 lines
package/xbmc-addon-xvdr/xbmc-addon-xvdr.mk +1
-1-XBMC_ADDON_XVDR_VERSION = acd4e145fc3220cf708aaf40d895904732dce2c7 +XBMC_ADDON_XVDR_VERSION = 82b5093ad33847f97a978cb620c9a87d2dbcf7eb XBMC_ADDON_XVDR_SITE = $(call github,pipelka,xbmc-addon-xvdr,$(XBMC_ADDON_XVDR_VERSION)) XBMC_ADDON_XVDR_LICENSE = GPLv2+ XBMC_ADDON_XVDR_LICENSE_FILES = COPYINGSignature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 18/28 xbmc-addon-xvdr: Version bump to xbmc Gotham-compatible addon
"Yann E. MORIN" <[email protected]> wrote in news:20140517201648.GI3459 at free.fr:
Quoted 3 lines
Quoted 3 lines
(quoted diff) +0
-2-# This cset is on the branch 'xbmc-frodo' -# When XBMC is updated, then this should be updated to thecorresponding branch
Hi,
added in v9.
Regards, Bernd
PATCH v8 19/28 xbmc: Add host-gettext dependency
In reply to Bernd KuhlsAUTOPOINT=/bin/true does not work anymore since
https://github.com/xbmc/xbmc/commit/42017cba7a62a0cf16896b061a25a25d392e1e46
config.status: error: cannot find input file: `Makefile.in'
configure: error: Submodule lib/cpluff failed to configure
--- package/xbmc/xbmc.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/xbmc/xbmc.mk +2 -2
@@ -12,7 +12,7 @@ XBMC_LICENSE_FILES = LICENSE.GPL # called TexturePacker. It is responsible to take all the images used in the # GUI and pack them in a blob. # http://wiki.xbmc.org/index.php?title=TexturePacker -XBMC_DEPENDENCIES = host-gawk host-gperf host-infozip host-lzo host-sdl_image host-swig +XBMC_DEPENDENCIES = host-gawk host-gettext host-gperf host-infozip host-lzo host-sdl_image host-swig XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ libass libcdio libcurl libegl libfribidi libgcrypt libgles libmad libmodplug libmpeg2 \ libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \
@@ -134,7 +134,7 @@ endif # Add HOST_DIR to PATH for codegenerator.mk to find swig define XBMC_BOOTSTRAP - cd $(@D) && PATH=$(BR_PATH) AUTOPOINT=/bin/true ./bootstrap + cd $(@D) && PATH=$(BR_PATH) ./bootstrap endef XBMC_PRE_CONFIGURE_HOOKS += XBMC_BOOTSTRAP
Signature · 1 line
1.7.10.4
PATCH v8 19/28 xbmc: Add host-gettext dependency
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 5 lines
AUTOPOINT=/bin/true does not work anymore since
https://github.com/xbmc/xbmc/commit/42017cba7a62a0cf16896b061a25a25d392e1e46config.status: error: cannot find input file: `Makefile.in'
configure: error: Submodule lib/cpluff failed to configure
Does that mean that XBMC is no longer buildable between the patch that bumps it, and this patch?
If so, then you have two options:
- fold this patch into the bump patch, or
- move this patch before the bump aptch (stating it is in preparation of the bump.)
I would prefer the second option.
Regards,
Yann E. MORIN.
Quoted 34 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/xbmc/xbmc.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)package/xbmc/xbmc.mk +2
-2@@ -12,7 +12,7 @@ XBMC_LICENSE_FILES = LICENSE.GPL # called TexturePacker. It is responsible to take all the images used in the # GUI and pack them in a blob. # http://wiki.xbmc.org/index.php?title=TexturePacker -XBMC_DEPENDENCIES = host-gawk host-gperf host-infozip host-lzo host-sdl_image host-swig +XBMC_DEPENDENCIES = host-gawk host-gettext host-gperf host-infozip host-lzo host-sdl_image host-swig XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ libass libcdio libcurl libegl libfribidi libgcrypt libgles libmad libmodplug libmpeg2 \ libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \@@ -134,7 +134,7 @@ endif # Add HOST_DIR to PATH for codegenerator.mk to find swig define XBMC_BOOTSTRAP - cd $(@D) && PATH=$(BR_PATH) AUTOPOINT=/bin/true ./bootstrap + cd $(@D) && PATH=$(BR_PATH) ./bootstrap endef XBMC_PRE_CONFIGURE_HOOKS += XBMC_BOOTSTRAPSignature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 19/28 xbmc: Add host-gettext dependency
"Yann E. MORIN" <[email protected]> wrote in news:20140517202918.GJ3459 at free.fr:
Quoted 1 line
I would prefer the second option.
Hi,
patch order is changed in v9.
Regards, Bernd
PATCH v8 20/28 xbmc: Allow compilation with uClibc
In reply to Bernd Kuhls- Add dependencies needed by xbmc on BR2_LARGEFILE, BR2_INET_IPV6 & BR2_USE_WCHAR after the removal of BR2_TOOLCHAIN_USES_GLIBC
- Add xbmc-0002-mathutil.patch to fix ARM compilation
--- package/xbmc/Config.in | 15 ++- package/xbmc/xbmc-0002-mathutil.patch | 213 +++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 6 deletions(-) create mode 100644 package/xbmc/xbmc-0002-mathutil.patch
package/xbmc/Config.in +9 -6
@@ -1,11 +1,10 @@ -comment "xbmc needs an (e)glibc toolchain w/ C++, threads" - depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS +comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" + depends on BR2_arm || BR2_i386 || BR2_x86_64 + depends on !BR2_INET_IPV6 || !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR comment "xbmc requires an OpenGL ES and EGL backend" + depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES - depends on BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_INSTALL_LIBSTDCPP - depends on BR2_TOOLCHAIN_HAS_THREADS menuconfig BR2_PACKAGE_XBMC bool "xbmc"
@@ -57,10 +56,14 @@ menuconfig BR2_PACKAGE_XBMC select BR2_PACKAGE_TINYXML select BR2_PACKAGE_YAJL select BR2_PACKAGE_ZLIB - depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_INET_IPV6 depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_LARGEFILE depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES + depends on BR2_USE_MMU # python + depends on BR2_USE_WCHAR + depends on BR2_arm || BR2_i386 || BR2_x86_64 help XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media.
package/xbmc/xbmc-0002-mathutil.patch new file +213 -0
213 lines not on this page · raw message
Signature · 1 line
1.7.10.4
PATCH v8 20/28 xbmc: Allow compilation with uClibc
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 3 lines
- Add dependencies needed by xbmc on
BR2_LARGEFILE,BR2_INET_IPV6&BR2_USE_WCHARafter the removal ofBR2_TOOLCHAIN_USES_GLIBC
- Add xbmc-0002-mathutil.patch to fix ARM compilation
I was just wondering how important building on uClibc would be.
XBMC is already a large chunk of a beast, so the benefit of switching to uClibc would be minimal size-wise, no?
Remember that uClibc was initially made for systems with storage size constrains, which is surely not the case for a device where XBMC is expected to run in the first place.
That being said, I don't much care about XBMC+uClibc, but the small runtime speed benefits alone might be worth the patch anyway.
Regards,
Yann E. MORIN.
Quoted 269 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/xbmc/Config.in | 15 ++- package/xbmc/xbmc-0002-mathutil.patch | 213 +++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+), 6 deletions(-) create mode 100644 package/xbmc/xbmc-0002-mathutil.patchpackage/xbmc/Config.in +9
-6@@ -1,11 +1,10 @@ -comment "xbmc needs an (e)glibc toolchain w/ C++, threads" - depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS +comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" + depends on BR2_arm || BR2_i386 || BR2_x86_64 + depends on !BR2_INET_IPV6 || !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR comment "xbmc requires an OpenGL ES and EGL backend" + depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES - depends on BR2_TOOLCHAIN_USES_GLIBC - depends on BR2_INSTALL_LIBSTDCPP - depends on BR2_TOOLCHAIN_HAS_THREADS menuconfig BR2_PACKAGE_XBMC bool "xbmc"@@ -57,10 +56,14 @@ menuconfig BR2_PACKAGE_XBMC select BR2_PACKAGE_TINYXML select BR2_PACKAGE_YAJL select BR2_PACKAGE_ZLIB - depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_INET_IPV6 depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_LARGEFILE depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES + depends on BR2_USE_MMU # python + depends on BR2_USE_WCHAR + depends on BR2_arm || BR2_i386 || BR2_x86_64 help XBMC is an award-winning free and open source (GPL) software media player and entertainment hub for digital media.package/xbmc/xbmc-0002-mathutil.patch new file +213
-0@@ -0,0 +1,213 @@ +Taken from upstream PR: https://github.com/xbmc/xbmc/pull/3760 + +Signed-off-by: Bernd Kuhls <[email protected]> + + +From 7388e8be7cd5e78100532ebf0dba15dccb7b03f8 Mon Sep 17 00:00:00 2001 +From: Ben Avison <[email protected]> +Date: Tue, 3 Dec 2013 15:51:39 +0000 +Subject: [PATCH] Faster and simpler portable implementation of + MathUtils::round_int(). + +Much as I like a bit of inline assembler, I have also removed the ARM versions +of MathUtils::truncate_int() and MathUtils::round_int(). The former was just +how any sane compiler should have assembled a cast from double to signed int +anyway. The latter was a much too complicated way to achieve the desired +effect, and was switched out in most ARM builds anyway in favour of the old +portable implementation that used floor(). + +Verified that MathUtils::test() still passes, and that GCC is now able to +inline MathUtils::round_int(), where it didn't previously. + +I tested on a Raspberry Pi with the default theme, displaying the front page +with the RSS ticker enabled. This saturates the CPU, so I'm measuring the +improvement using the debug window's FPS figure. This patch improves this from +~50.8 FPS to ~52.6 FPS. +--- + xbmc/utils/MathUtils.h | 129 +++++++++++++++++++++++-------------------------- + 1 file changed, 61 insertions(+), 68 deletions(-) + +diff --git a/xbmc/utils/MathUtils.h b/xbmc/utils/MathUtils.h +index 96af9f4..0dae77d 100644 +--- a/xbmc/utils/MathUtils.h ++++ b/xbmc/utils/MathUtils.h +@@ -34,17 +34,13 @@ + + #if defined(__ppc__) || \ + defined(__powerpc__) || \ +- (defined(TARGET_DARWIN_IOS) && defined(__llvm__)) || \ +- (defined(TARGET_ANDROID) && defined(__arm__)) || \ +- defined(TARGET_RASPBERRY_PI) ++ defined(__arm__) + #define DISABLE_MATHUTILS_ASM_ROUND_INT + #endif + + #if defined(__ppc__) || \ + defined(__powerpc__) || \ +- (defined(TARGET_DARWIN) && defined(__llvm__)) || \ +- (defined(TARGET_ANDROID) && defined(__arm__)) || \ +- defined(TARGET_RASPBERRY_PI) ++ defined(__arm__) + #define DISABLE_MATHUTILS_ASM_TRUNCATE_INT + #endif + +@@ -73,60 +69,63 @@ + { + assert(x > static_cast<double>(INT_MIN / 2) - 1.0); + assert(x < static_cast<double>(INT_MAX / 2) + 1.0); +- const float round_to_nearest = 0.5f; +- int i; + + #if defined(DISABLE_MATHUTILS_ASM_ROUND_INT) +- i = floor(x + round_to_nearest); +- +-#elif defined(__arm__) +- // From 'ARM-v7-M Architecture Reference Manual' page A7-569: +- // "The floating-point to integer operation (vcvt) [normally] uses the Round towards Zero rounding mode" +- // Because of this...we must use some less-than-straightforward logic to perform this operation without +- // changing the rounding mode flags +- +- /* The assembly below implements the following logic: +- if (x < 0) +- inc = -0.5f +- else +- inc = 0.5f +- int_val = trunc(x+inc); +- err = x - int_val; +- if (err == 0.5f) +- int_val++; +- return int_val; +- */ ++ /* This implementation warrants some further explanation. ++ * ++ * First, a couple of notes on rounding: ++ * 1) C casts from float/double to integer round towards zero. ++ * 2) Float/double additions are rounded according to the normal rules, ++ * in other words: on some architectures, it's fixed at compile-time, ++ * and on others it can be set using fesetround()). The following ++ * analysis assumes round-to-nearest with ties rounding to even. This ++ * is a fairly sensible choice, and is the default with ARM VFP. ++ * ++ * What this function wants is round-to-nearest with ties rounding to ++ * +infinity. This isn't an IEEE rounding mode, even if we could guarantee ++ * that all architectures supported fesetround(), which they don't. Instead, ++ * this adds an offset of 2147483648.5 (= 0x80000000.8p0), then casts to ++ * an unsigned int (crucially, all possible inputs are now in a range where ++ * round to zero acts the same as round to -infinity) and then subtracts ++ * 0x80000000 in the integer domain. The 0.5 component of the offset ++ * converts what is effectively a round down into a round to nearest, with ++ * ties rounding up, as desired. ++ * ++ * There is a catch, that because there is a double rounding, there is a ++ * small region where the input falls just *below* a tie, where the addition ++ * of the offset causes a round *up* to an exact integer, due to the finite ++ * level of precision available in floating point. You need to be aware of ++ * this when calling this function, although at present it is not believed ++ * that XBMC ever attempts to round numbers in this window. ++ * ++ * It is worth proving the size of the affected window. Recall that double ++ * precision employs a mantissa of 52 bits. ++ * 1) For all inputs -0.5 <= x <= INT_MAX ++ * Once the offset is applied, the most significant binary digit in the ++ * floating-point representation is +2^31. ++ * At this magnitude, the smallest step representable in double precision ++ * is 2^31 / 2^52 = 0.000000476837158203125 ++ * So the size of the range which is rounded up due to the addition is ++ * half the size of this step, or 0.0000002384185791015625 ++ * ++ * 2) For all inputs INT_MIN/2 < x < -0.5 ++ * Once the offset is applied, the most significant binary digit in the ++ * floating-point representation is +2^30. ++ * At this magnitude, the smallest step representable in double precision ++ * is 2^30 / 2^52 = 0.0000002384185791015625 ++ * So the size of the range which is rounded up due to the addition is ++ * half the size of this step, or 0.00000011920928955078125 ++ * ++ * 3) For all inputs INT_MIN <= x <= INT_MIN/2 ++ * The representation once the offset is applied has equal or greater ++ * precision than the input, so the addition does not cause rounding. ++ */ ++ return ((unsigned int) (x + 0x80000000.8p0)) - 0x80000000; + +- __asm__ __volatile__ ( +-#if defined(__ARM_PCS_VFP) +- "fconstd d1,#%G[rnd_val] \n\t" // Copy round_to_nearest into a working register (d1 = 0.5) + #else +- "vmov.F64 d1,%[rnd_val] \n\t" +-#endif +- "fcmpezd %P[value] \n\t" // Check value against zero (value == 0?) +- "fmstat \n\t" // Copy the floating-point status flags into the general-purpose status flags +- "it mi \n\t" +- "vnegmi.F64 d1, d1 \n\t" // if N-flag is set, negate round_to_nearest (if (value < 0) d1 = -1 * d1) +- "vadd.F64 d1,%P[value],d1 \n\t" // Add round_to_nearest to value, store result in working register (d1 += value) +- "vcvt.S32.F64 s3,d1 \n\t" // Truncate(round towards zero) (s3 = (int)d1) +- "vmov %[result],s3 \n\t" // Store the integer result in a general-purpose register (result = s3) +- "vcvt.F64.S32 d1,s3 \n\t" // Convert back to floating-point (d1 = (double)s3) +- "vsub.F64 d1,%P[value],d1 \n\t" // Calculate the error (d1 = value - d1) +-#if defined(__ARM_PCS_VFP) +- "fconstd d2,#%G[rnd_val] \n\t" // d2 = 0.5; +-#else +- "vmov.F64 d2,%[rnd_val] \n\t" +-#endif +- "fcmped d1, d2 \n\t" // (d1 == 0.5?) +- "fmstat \n\t" // Copy the floating-point status flags into the general-purpose status flags +- "it eq \n\t" +- "addeq %[result],#1 \n\t" // (if (d1 == d2) result++;) +- : [result] "=r"(i) // Outputs +- : [rnd_val] "Dv" (round_to_nearest), [value] "w"(x) // Inputs +- : "d1", "d2", "s3" // Clobbers +- ); +- +-#elif defined(__SSE2__) ++ const float round_to_nearest = 0.5f; ++ int i; ++#if defined(__SSE2__) + const float round_dn_to_nearest = 0.4999999f; + i = (x > 0) ? _mm_cvttsd_si32(_mm_set_sd(x + round_to_nearest)) : _mm_cvttsd_si32(_mm_set_sd(x - round_dn_to_nearest)); + +@@ -150,8 +149,8 @@ + ); + + #endif +- + return i; ++#endif + } + + /*! \brief Truncate to nearest integer. +@@ -165,20 +164,13 @@ + { + assert(x > static_cast<double>(INT_MIN / 2) - 1.0); + assert(x < static_cast<double>(INT_MAX / 2) + 1.0); +- int i; + + #if defined(DISABLE_MATHUTILS_ASM_TRUNCATE_INT) +- return i = (int)x; +- +-#elif defined(__arm__) +- __asm__ __volatile__ ( +- "vcvt.S32.F64 %[result],%P[value] \n\t" // Truncate(round towards zero) and store the result +- : [result] "=w"(i) // Outputs +- : [value] "w"(x) // Inputs +- ); +- return i; ++ return x; + +-#elif defined(TARGET_WINDOWS) ++#else ++ int i; ++#if defined(TARGET_WINDOWS) + const float round_towards_m_i = -0.5f; + __asm + { +@@ -204,6 +196,7 @@ + if (x < 0) + i = -i; + return (i); ++#endif + } + + inline int64_t abs(int64_t a) +-- +1.9.1 +Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 20/28 xbmc: Allow compilation with uClibc
"Yann E. MORIN" <[email protected]> wrote in news:20140517204050.GK3459 at free.fr:
Quoted 1 line
I was just wondering how important building on uClibc would be.
Hi,
from my POV this is the most important patch of the whole series because I am using xbmc on an uclibc-based distro for over six months now without problems.
Regards, Bernd
PATCH v8 20/28 xbmc: Allow compilation with uClibc
Bernd, All,
On 2014-05-17 22:47 +0200, Bernd Kuhls spake thusly:
Quoted 6 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140517204050.GK3459 at free.fr:
Quoted 1 line
I was just wondering how important building on uClibc would be.
from my POV this is the most important patch of the whole series because I am using xbmc on an uclibc-based distro for over six months now without problems.
He! I never said 'no'. ;-)
I even said 'the small runtime speed benefits alone might be worth the patch'.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
In reply to Bernd Kuhls--- package/xbmc/Config.in | 24 ++++++++++++++++++++---- package/xbmc/xbmc.mk | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 10 deletions(-)
package/xbmc/Config.in +20 -4
@@ -2,9 +2,12 @@ comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on !BR2_INET_IPV6 || !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR -comment "xbmc requires an OpenGL ES and EGL backend" - depends on BR2_arm || BR2_i386 || BR2_x86_64 - depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES +comment "xbmc needs an OpenGL backend" + depends on (!BR2_arm && (BR2_i386 || BR2_x86_64)) && \ + !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES) + +comment "xbmc needs EGL & GLES support" + depends on BR2_arm && !BR2_PACKAGE_HAS_LIBEGL && !BR2_PACKAGE_HAS_LIBGLES menuconfig BR2_PACKAGE_XBMC bool "xbmc"
@@ -22,6 +25,8 @@ menuconfig BR2_PACKAGE_XBMC select BR2_PACKAGE_LIBCDIO select BR2_PACKAGE_LIBCURL select BR2_PACKAGE_LIBFRIBIDI + select BR2_PACKAGE_LIBGLEW if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_LIBGLU if BR2_PACKAGE_HAS_LIBGL select BR2_PACKAGE_LIBGCRYPT select BR2_PACKAGE_LIBID3TAG select BR2_PACKAGE_LIBMAD
@@ -50,17 +55,28 @@ menuconfig BR2_PACKAGE_XBMC select BR2_PACKAGE_PYTHON_UNICODEDATA select BR2_PACKAGE_PYTHON_ZLIB select BR2_PACKAGE_READLINE + select BR2_PACKAGE_SDL if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_SDL_X11 if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_SDL_IMAGE if BR2_PACKAGE_HAS_LIBGL select BR2_PACKAGE_SQLITE select BR2_PACKAGE_TAGLIB select BR2_PACKAGE_TIFF select BR2_PACKAGE_TINYXML + + # mesa3d provides libgl only with dri drivers which depend on xorg + select BR2_PACKAGE_XLIB_LIBX11 if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_LIBXEXT if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_XMU if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_XRANDR if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_XLIB_XT if BR2_PACKAGE_HAS_LIBGL + select BR2_PACKAGE_YAJL select BR2_PACKAGE_ZLIB depends on BR2_INET_IPV6 depends on BR2_INSTALL_LIBSTDCPP depends on BR2_LARGEFILE depends on BR2_TOOLCHAIN_HAS_THREADS - depends on BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES + depends on BR2_PACKAGE_HAS_LIBGL || (BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES) depends on BR2_USE_MMU # python depends on BR2_USE_WCHAR depends on BR2_arm || BR2_i386 || BR2_x86_64
package/xbmc/xbmc.mk +34 -6
@@ -14,7 +14,7 @@ XBMC_LICENSE_FILES = LICENSE.GPL # http://wiki.xbmc.org/index.php?title=TexturePacker XBMC_DEPENDENCIES = host-gawk host-gettext host-gperf host-infozip host-lzo host-sdl_image host-swig XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ - libass libcdio libcurl libegl libfribidi libgcrypt libgles libmad libmodplug libmpeg2 \ + libass libcdio libcurl libfribidi libgcrypt libmad libmodplug libmpeg2 \ libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \ openssl pcre python readline sqlite taglib tiff tinyxml yajl zlib
@@ -32,7 +32,6 @@ XBMC_CONF_OPT += \ --disable-crystalhd \ --disable-debug \ --disable-dvdcss \ - --disable-gl \ --disable-hal \ --disable-joystick \ --disable-mysql \
@@ -40,14 +39,10 @@ XBMC_CONF_OPT += \ --disable-optical-drive \ --disable-projectm \ --disable-pulse \ - --disable-sdl \ --disable-ssh \ --disable-vaapi \ --disable-vdpau \ --disable-vtbdecoder \ - --disable-x11 \ - --disable-xrandr \ - --enable-gles \ --enable-optimizations ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
@@ -61,6 +56,39 @@ ifeq ($(BR2_PACKAGE_DBUS),y) XBMC_DEPENDENCIES += dbus endif +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +XBMC_DEPENDENCIES += \ + libglew \ + libglu \ + libgl \ + sdl_image \ + xlib_libX11 \ + xlib_libXext \ + xlib_libXmu \ + xlib_libXrandr \ + xlib_libXt +XBMC_CONF_OPT += \ + --enable-x11 \ + --enable-xrandr \ + --enable-gl \ + --enable-sdl +else +XBMC_CONF_OPT += \ + --disable-x11 \ + --disable-xrandr \ + --disable-gl \ + --disable-sdl +endif + +ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGLES),yy) +XBMC_DEPENDENCIES += libegl libgles +XBMC_CONF_OPT += --enable-gles +XBMC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)" +else +XBMC_CONF_OPT += --disable-gles +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusb
Signature · 1 line
1.7.10.4
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 1 line
Signed-off-by Bernd Kuhls <[email protected]>
There are quite a few changes in that patch. A ciommit log explaining what is being done would be good. ;-)
Quoted 11 lines
--- package/xbmc/Config.in | 24 ++++++++++++++++++++---- package/xbmc/xbmc.mk | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 10 deletions(-)package/xbmc/Config.in +0
-0@@ -2,9 +2,12 @@ comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" depends on BR2_arm || BR2_i386 || BR2_x86_64
package/xbmc/Config.in comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" · line 9
Quoted 10 lines
package/xbmc/Config.in +5
-3depends on !BR2_INET_IPV6 || !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR -comment "xbmc requires an OpenGL ES and EGL backend" - depends on BR2_arm || BR2_i386 || BR2_x86_64 - depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES +comment "xbmc needs an OpenGL backend" + depends on (!BR2_arm && (BR2_i386 || BR2_x86_64)) && \ + !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES) + +comment "xbmc needs EGL & GLES support"
Please keep the original comment. Besides, this change makes the two comments incoherent:
comment "xbmc needs an OpenGL backend"
comment "xbmc needs EGL & GLES support"
Also, I doubt the GL dependency is tied to x86, or the EGL/GLES dependency is tied to ARM. What if an ARM platform has a full openGL implementation? Probably XBMC would be able to use that, no?
So, I'd suggest something along those lines:
comment "XBMC needs an openGL backend, or an OpenGL ES and EGL backend"
depends on BR2_arm || BR2_i386 || BR2_x86_64
depends on !BR2_PACKAGE_HAS_LIBGL || !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLESpackage/xbmc/Config.in comment "xbmc needs a toolchain w/ C++, IPv6, largefile, threads, wchar" · line 10
Quoted 1 line
package/xbmc/Config.in +1
-0+ depends on BR2_arm && !BR2_PACKAGE_HAS_LIBEGL && !BR2_PACKAGE_HAS_LIBGLES
In anycase, this dependency line is incorrect, it would show only when both of libgles and libegl are not selected, while we would want it to show when either or both are not selected.
package/xbmc/Config.in menuconfig BR2_PACKAGE_XBMC · line 79
Quoted 2 lines
package/xbmc/Config.in +1
-1- depends on BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES + depends on BR2_PACKAGE_HAS_LIBGL || (BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES)
Parenthesis are unneeded: '&&' has precedence over '||' anyway.
Quoted 21 lines
package/xbmc/xbmc.mk +13
-0@@ -61,6 +56,39 @@ ifeq ($(BR2_PACKAGE_DBUS),y) XBMC_DEPENDENCIES += dbus endif +ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) +XBMC_DEPENDENCIES += \ + libglew \ + libglu \ + libgl \ + sdl_image \ + xlib_libX11 \ + xlib_libXext \ + xlib_libXmu \ + xlib_libXrandr \ + xlib_libXt +XBMC_CONF_OPT += \ + --enable-x11 \
package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_DBUS),y) · line 81
Quoted 10 lines
package/xbmc/xbmc.mk +10
-0+ --enable-xrandr \ + --enable-gl \ + --enable-sdl +else +XBMC_CONF_OPT += \ + --disable-x11 \ + --disable-xrandr \ + --disable-gl \ + --disable-sdl +endif
Could you join dependencies so they fit on one or two lines, instead of one pre line?
Ditto the configure options.
package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_DBUS),y) · line 87
Quoted 5 lines
package/xbmc/xbmc.mk +5
-0+ifeq ($(BR2_PACKAGE_HAS_LIBEGL)$(BR2_PACKAGE_HAS_LIBGLES),yy) +XBMC_DEPENDENCIES += libegl libgles +XBMC_CONF_OPT += --enable-gles +XBMC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)"
He! This XBMC_CONF_ENV did not pre-exist, and did not seem to be needed.
Since this change is part of the EGL/GLES if-block, it has no impact on the GL case, so is not due to adding GL support.
Why do you need to add it?
If it really is needed, then:
- either it's due to the bump to Gotham, and should go in the bump patch, or
- it should be a separate patch.
Regards,
Yann E. MORIN.
Quoted 14 lines
package/xbmc/xbmc.mk +4
-0+else +XBMC_CONF_OPT += --disable-gles +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusbSignature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
"Yann E. MORIN" <[email protected]> wrote in news:20140517205500.GL3459 at free.fr:
Quoted 3 lines
Also, I doubt the GL dependency is tied to x86, or the EGL/GLES dependency is tied to ARM. What if an ARM platform has a full openGL implementation? Probably XBMC would be able to use that, no?
Hi,
xbmc depends on GLES on ARM:
https://github.com/xbmc/xbmc/blob/Gotham/configure.in#L695
I consider this patch as one of the most complicated ones regarding Kconfig, for which I am really not an expert ;) I will have a look at the rest of your comment tomorrow.
Regards, Bernd
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Bernd, All,
On 2014-05-17 23:01 +0200, Bernd Kuhls spake thusly:
Quoted 11 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140517205500.GL3459 at free.fr:
Quoted 3 lines
Also, I doubt the GL dependency is tied to x86, or the EGL/GLES dependency is tied to ARM. What if an ARM platform has a full openGL implementation? Probably XBMC would be able to use that, no?
Hi,
xbmc depends on GLES on ARM:
https://github.com/xbmc/xbmc/blob/Gotham/configure.in#L695
Ah, it's XBMC ./configure that has this constraint. OK.
Quoted 2 lines
I consider this patch as one of the most complicated ones regarding
Kconfig, for which I am really not an expert ;)
OK, we can work on this together. ;-)
Quoted 2 lines
I will have a look at the rest of your
comment tomorrow.
Good night, see ya!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
In reply to Yann E. MORINHi,
"Yann E. MORIN" <[email protected]> wrote in news:20140517205500.GL3459 at free.fr:
Quoted 12 lines
Quoted 8 lines
package/xbmc/Config.in +3
-3-comment "xbmc requires an OpenGL ES and EGL backend" - depends on BR2_arm || BR2_i386 || BR2_x86_64 - depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES +comment "xbmc needs an OpenGL backend" + depends on (!BR2_arm && (BR2_i386 || BR2_x86_64)) && \ + !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL &&
BR2_PACKAGE_HAS_LIBGLES) +
+comment "xbmc needs EGL & GLES support"Please keep the original comment. Besides, this change makes the two comments incoherent:
Quoted 2 lines
comment "xbmc needs an OpenGL backend"
comment "xbmc needs EGL & GLES support"
as I already stated ARM depends on EGL/GLES so my plan was to display
comment "xbmc needs EGL & GLES support"
on ARM, so users know what to enable, and
comment "xbmc needs an OpenGL backend"
on BR2_i386 || BR2_x86_64 only, here EGL/GLES or GL are accepted by xbmc.
Quoted 4 lines
Could you join dependencies so they fit on one or two lines, instead of one pre line?
Ditto the configure options.
Done.
Quoted 6 lines
Quoted 4 lines
+XBMC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)"
He! This
XBMC_CONF_ENVdid not pre-exist, and did not seem to be needed.
For Gotham it fixes a build error, this section will be a preparatory patch in v9.
Regards, Bernd
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Bernd,
On 2014-05-18 13:58 +0200, Bernd Kuhls spake thusly:
Quoted 15 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140517205500.GL3459 at free.fr:
Quoted 12 lines
Quoted 8 lines
package/xbmc/Config.in +3
-3-comment "xbmc requires an OpenGL ES and EGL backend" - depends on BR2_arm || BR2_i386 || BR2_x86_64 - depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES +comment "xbmc needs an OpenGL backend" + depends on (!BR2_arm && (BR2_i386 || BR2_x86_64)) && \ + !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL &&
BR2_PACKAGE_HAS_LIBGLES) +
+comment "xbmc needs EGL & GLES support"Please keep the original comment. Besides, this change makes the two comments incoherent:
Quoted 4 lines
Quoted 2 lines
comment "xbmc needs an OpenGL backend"
comment "xbmc needs EGL & GLES support"as I already stated ARM depends on EGL/GLES
Yep, now I saw the light.
Quoted 9 lines
so my plan was to display
comment "xbmc needs EGL & GLES support"
on ARM, so users know what to enable, and
comment "xbmc needs an OpenGL backend"
on
BR2_i386||BR2_x86_64only, here EGL/GLES or GL are accepted by xbmc.
Something like:
comment "xbmc needs an OpenGL ES and EGL backend"
depends on BR2_arm
depends on !BR2_PACKAGE_HAS_LIBEGL || !BR2_PACKAGE_HAS_LIBGLES
comment "xbmc needs an OpenGL backend"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_PACKAGE_HAS_LIBGL
should do the trick.
There's no need to play tricks with mutiple archs on the same depends:
(i386 || x86_64) && !arm
is exactly the same of
i386 || x86_64
since arm can't be set when either i386 or x86_64 are set: it's the architecture, only one can be set at any one time. ;-)
[--SNIP--]
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
+XBMC_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)" \ + CXXFLAGS="$(TARGET_CXXFLAGS) $(shell $(PKG_CONFIG_HOST_BINARY) --cflags egl)"
He! This
XBMC_CONF_ENVdid not pre-exist, and did not seem to be needed.For Gotham it fixes a build error, this section will be a preparatory patch in v9.
OK, good.
Thank you! :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 3 lines
comment "xbmc needs an OpenGL backend"
depends onBR2_i386||BR2_x86_64
depends on !BR2_PACKAGE_HAS_LIBGL
Hi,
BR2_i386 || BR2_x86_64 both support libgl and egl/gles, so I typed this:
comment "xbmc needs an OpenGL backend"
depends on BR2_i386 || BR2_x86_64
depends on !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL && BR2_PACKAGE_HAS_LIBGLES)
which seems to do the trick.
Regards, Bernd
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Bernd, All,
On 2014-05-18 18:52 +0200, Bernd Kuhls spake thusly:
Quoted 7 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 3 lines
comment "xbmc needs an OpenGL backend"
depends onBR2_i386||BR2_x86_64
depends on !BR2_PACKAGE_HAS_LIBGL
Quoted 5 lines
Hi,
BR2_i386||BR2_x86_64both support libgl and egl/gles, so I typed this:comment "xbmc needs an OpenGL backend"
comment "xbmc needs an OpenGL backend, or an openGL ES and EGL backend"
Quoted 5 lines
depends on BR2_i386 || BR2_x86_64 depends on !BR2_PACKAGE_HAS_LIBGL && !(BR2_PACKAGE_HAS_LIBEGL && BR2
_PACKAGE_HAS_LIBGLES)which seems to do the trick.
Yep, good. :-)
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
In reply to Yann E. MORIN"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 1 line
Something like:
[...]
Quoted 1 line
should do the trick.
Hi,
for further comments I posted my current patch here:
http://pastebin.com/zv7jueLB (expires in one week).
Especially the last "depends on" block looks crude, but seems to work.
Regards, Bernd
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Bernd, All,
On 2014-05-18 18:58 +0200, Bernd Kuhls spake thusly:
Quoted 5 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 1 line
Something like:
[...]
Quoted 8 lines
Quoted 1 line
should do the trick.
Hi,
for further comments I posted my current patch here:
http://pastebin.com/zv7jueLB (expires in one week).Especially the last "depends on" block looks crude, but seems to work.
Yep, it looks too dense. I think we can factor it into:
depends on BR2_arm || BR2_i386 || BR2_x86_64
depends on HAS_LIBEGL && HAS_LIBGLES \
|| (BR2_i386 || BR2_x86_64) && HAS_LIBGLSo, it first ensures that it is only visible for ARM or x86 (the only archs we currently support SBMC on.)
Then, it is available only for EGL+GLES or x86+GL, since EGL+GLES is posible on ARM and x86 alike, but full GL is only possible on x86.
I think it is much cleaner to separate the architectures dependencies from the GL dependencies.
Of course, this would probably not scale if we were to support it on other archs (eg. PPC), but it will be time to revisit this if/when we happen to add that support.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
"Yann E. MORIN" <[email protected]> wrote in news:20140518172928.GD3631 at free.fr:
Quoted 3 lines
Of course, this would probably not scale if we were to support it on other archs (eg. PPC), but it will be time to revisit this if/when we happen to add that support.
Hi,
compiling for ppc and mips was already successful here, it takes only some extensions for the xbmc build system and one patch for ldt_keeper.c.
I do not plan to extend my patch series with these archs now, but we should have them in mind, it may happen earlier then you might have thaught ;)
Regards, Bernd
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
In reply to Yann E. MORINQuoted 15 lines · Yann E. MORIN
Bernd, All,
On 2014-05-18 18:58 +0200, Bernd Kuhls spake thusly:
Quoted 12 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 1 line
Something like:
[...]
Quoted 1 line
should do the trick.
Hi,
for further comments I posted my current patch here:
http://pastebin.com/zv7jueLB (expires in one week).
Quoted 7 lines
Quoted 1 line
Especially the last "depends on" block looks crude, but seems to work.
Yep, it looks too dense. I think we can factor it into:
depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on HAS_LIBEGL && HAS_LIBGLES \ || (BR2_i386 || BR2_x86_64) && HAS_LIBGL
I don't agree with you Yann that the () should be left out here. Not many
people know enough about the Kconfig logic to be able to be sure about the precedence here.
Quoted 6 lines
So, it first ensures that it is only visible for ARM or x86 (the only archs we currently support SBMC on.)
Then, it is available only for EGL+GLES or x86+GL, since EGL+GLES is posible on ARM and x86 alike, but full GL is only possible on x86.
I think there's something more fundamentally inappropriate about the approach
taken here. I think the way out could be to add auxiliary symbols to identify which provider is used. Something like:
config BR2_PACKAGE_XBMC_EGL_GLES
bool
default y
depends on BR2_PACKAGE_HAS_LIBEGL
depends on BR2_PACKAGE_HAS_LIBGLES
depends on !BR2_PACKAGE_XBMC_GL # prefer GL if available
config BR2_PACKAGE_XBMC_GL
bool
depends on BR2_PACKAGE_XORG7
depends on BR2_PACKAGE_HAS_LIBGL
comment "xbmc requires an OpenGL-capable backend"
depends on BR2_USE_MMU
depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on !BR2_PACKAGE_XBMC_EGL_GLES depends on !BR2_PACKAGE_XBMC_GL
config BR2_PACKAGE_XBMC
... depends on BR2_PACKAGE_XBMC_EGL_GLES || BR2_PACKAGE_XBMC_GL
That also allows you to use these new symbols in the .mk file instead of the_HAS_LIBGL which IMHO is not sufficiently accurate and future-safe.
BTW, I don't understand this comment:
# mesa3d provides libgl only with dri drivers which depend on xorg
If that is the case, then it's up to mesa3d to add the required dependencies, no?
Regards,
Arnout
Quoted 11 lines
I think it is much cleaner to separate the architectures dependencies from the GL dependencies.
Of course, this would probably not scale if we were to support it on other archs (eg. PPC), but it will be time to revisit this if/when we happen to add that support.
Regards,
Yann E. MORIN.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Arnout, All,
On 2014-05-20 18:33 +0200, Arnout Vandecappelle spake thusly:
Quoted 20 lines · Yann E. MORIN
Quoted 19 lines
Bernd, All,
On 2014-05-18 18:58 +0200, Bernd Kuhls spake thusly:
Quoted 5 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 1 line
Something like:
[...]
Quoted 8 lines
Quoted 1 line
should do the trick.
Hi,
for further comments I posted my current patch here:
http://pastebin.com/zv7jueLB (expires in one week).Especially the last "depends on" block looks crude, but seems to work.
Yep, it looks too dense. I think we can factor it into:
Quoted 7 lines
Quoted 3 lines
depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on HAS_LIBEGL && HAS_LIBGLES \ || (BR2_i386 || BR2_x86_64) && HAS_LIBGLI don't agree with you Yann that the () should be left out here. Not many
people know enough about theKconfiglogic to be able to be sure about the precedence here.
Well, the precedence of the || and && operators is always the same in virtually all languages: C, shell, java, you-name-it. kconfig does just abide by the usual standards, here, and it's clearly stated in the kconfig grammar.
Furthermore, leaving the () would falsely imply that || would have precedence over &&, which is not the case.
Quoted 17 lines
Quoted 5 lines
So, it first ensures that it is only visible for ARM or x86 (the only archs we currently support SBMC on.)
Then, it is available only for EGL+GLES or x86+GL, since EGL+GLES is posible on ARM and x86 alike, but full GL is only possible on x86.
I think there's something more fundamentally inappropriate about the approach
taken here. I think the way out could be to add auxiliary symbols to identify which provider is used. Something like:config
BR2_PACKAGE_XBMC_EGL_GLES
bool
default y
depends onBR2_PACKAGE_HAS_LIBEGL
depends onBR2_PACKAGE_HAS_LIBGLES
depends on !BR2_PACKAGE_XBMC_GL # prefer GL if available
Quoted 2 lines
config
BR2_PACKAGE_XBMC_GL
bool
Missing 'default y' here too, I guess. ;-)
Quoted 2 lines
depends on
BR2_PACKAGE_XORG7
depends onBR2_PACKAGE_HAS_LIBGL
And as Bernd said, full openGL support in XBMC is not possible on ARM, so it is missing a dependency on !BR2_arm. But the basis are here, granted.
Quoted 1 line
comment "xbmc requires an OpenGL-capable backend"
I think we want to differentiate the full-openGL vs. openGL EGL/GLES cases, here, since ARM can only work with EGL/GLES, while x86 can use either. So we'd need a comment for ARM (or any arch that requires GL/GLES), and another comment for x86 (or any arch that supports both.)
Quoted 8 lines
depends on
BR2_USE_MMU
depends onBR2_arm||BR2_i386||BR2_x86_64depends on !BR2_PACKAGE_XBMC_EGL_GLES depends on !BR2_PACKAGE_XBMC_GLconfig
BR2_PACKAGE_XBMC... depends on BR2_PACKAGE_XBMC_EGL_GLES || BR2_PACKAGE_XBMC_GL
Yes, this seems more sound, indeed. I tried to come up with something like that, but I failed to properly abstract the situation. Your solution is pretty good, I like it. ;-)
Quoted 2 lines
That also allows you to use these new symbols in the .mk file instead of the
_HAS_LIBGLwhich IMHO is not sufficiently accurate and future-safe.
I disagree. _HAS_LIBGL is just that: we do have a libGL implementation available.
Now, I never managed to grasp all those lib*GL* stuff. What about libGLX?
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Hi,
Quoted 11 lines
Quoted 11 lines
I think there's something more fundamentally inappropriate about the approach taken here. I think the way out could be to add auxiliary symbols to identify which provider is used. Something like:
config
BR2_PACKAGE_XBMC_EGL_GLES
bool
default y
depends onBR2_PACKAGE_HAS_LIBEGL
depends onBR2_PACKAGE_HAS_LIBGLES
depends on !BR2_PACKAGE_XBMC_GL # prefer GL if available
I like these.
Quoted 11 lines
Quoted 2 lines
config
BR2_PACKAGE_XBMC_GL
boolMissing 'default y' here too, I guess. ;-)
Quoted 2 lines
depends on
BR2_PACKAGE_XORG7
depends onBR2_PACKAGE_HAS_LIBGLAnd as Bernd said, full openGL support in XBMC is not possible on ARM, so it is missing a dependency on !BR2_arm. But the basis are here, granted.
But _HAS_LIBGL only gets selected by the (currently x86 only) mesa dri drivers, so you don't need to specify it here (and update it if there's ever a non-x86 mesa dri driver).
Quoted 6 lines
Quoted 1 line
comment "xbmc requires an OpenGL-capable backend"
I think we want to differentiate the full-openGL vs. openGL EGL/GLES cases, here, since ARM can only work with EGL/GLES, while x86 can use either. So we'd need a comment for ARM (or any arch that requires GL/GLES), and another comment for x86 (or any arch that supports both.)
How about just saying:
"xbmc requires an OpenGL(-ES) capable backend"
Signature · 1 line
Bye, Peter Korsgaard
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
In reply to Yann E. MORINQuoted 27 lines · Yann E. MORIN
Arnout, All,
On 2014-05-20 18:33 +0200, Arnout Vandecappelle spake thusly:
Quoted 24 lines · Yann E. MORIN
Quoted 22 lines
Bernd, All,
On 2014-05-18 18:58 +0200, Bernd Kuhls spake thusly:
Quoted 5 lines
"Yann E. MORIN" <[email protected]> wrote in news:20140518162900.GA3631 at free.fr:
Quoted 1 line
Something like:
[...]
Quoted 8 lines
Quoted 1 line
should do the trick.
Hi,
for further comments I posted my current patch here:
http://pastebin.com/zv7jueLB (expires in one week).Especially the last "depends on" block looks crude, but seems to work.
Yep, it looks too dense. I think we can factor it into:
depends on BR2_arm || BR2_i386 || BR2_x86_64 depends on HAS_LIBEGL && HAS_LIBGLES \ || (BR2_i386 || BR2_x86_64) && HAS_LIBGL
Quoted 8 lines
Quoted 3 lines
I don't agree with you Yann that the () should be left out here. Not many
people know enough about theKconfiglogic to be able to be sure about the precedence here.Well, the precedence of the || and && operators is always the same in virtually all languages: C, shell, java, you-name-it. kconfig does just abide by the usual standards, here, and it's clearly stated in the kconfig grammar.
In shell, || and && have equal precedence. So I disagree here.
Quoted 24 lines
Furthermore, leaving the () would falsely imply that || would have precedence over &&, which is not the case.
Quoted 17 lines
Quoted 5 lines
So, it first ensures that it is only visible for ARM or x86 (the only archs we currently support SBMC on.)
Then, it is available only for EGL+GLES or x86+GL, since EGL+GLES is posible on ARM and x86 alike, but full GL is only possible on x86.
I think there's something more fundamentally inappropriate about the approach
taken here. I think the way out could be to add auxiliary symbols to identify which provider is used. Something like:config
BR2_PACKAGE_XBMC_EGL_GLES
bool
default y
depends onBR2_PACKAGE_HAS_LIBEGL
depends onBR2_PACKAGE_HAS_LIBGLES
depends on !BR2_PACKAGE_XBMC_GL # prefer GL if availableQuoted 2 lines
config
BR2_PACKAGE_XBMC_GL
bool
Quoted 8 lines
Missing 'default y' here too, I guess. ;-)
Quoted 2 lines
depends on
BR2_PACKAGE_XORG7
depends onBR2_PACKAGE_HAS_LIBGLAnd as Bernd said, full openGL support in XBMC is not possible on ARM, so it is missing a dependency on !BR2_arm. But the basis are here, granted.
Agreed if there is a specific ARM dependency in XBMC itself. I don't agree if
this is just because only mesa3d on x86 implements libgl.
Quoted 6 lines
Quoted 1 line
comment "xbmc requires an OpenGL-capable backend"
I think we want to differentiate the full-openGL vs. openGL EGL/GLES cases, here, since ARM can only work with EGL/GLES, while x86 can use either. So we'd need a comment for ARM (or any arch that requires GL/GLES), and another comment for x86 (or any arch that supports both.)
Other packages use "requires an OpenGL-capable backend" even if they need
EGL/GLES. But admittedly these others are all qt5.
Quoted 14 lines
Quoted 9 lines
depends on
BR2_USE_MMU
depends onBR2_arm||BR2_i386||BR2_x86_64depends on !BR2_PACKAGE_XBMC_EGL_GLES depends on !BR2_PACKAGE_XBMC_GLconfig
BR2_PACKAGE_XBMC... depends on BR2_PACKAGE_XBMC_EGL_GLES || BR2_PACKAGE_XBMC_GLYes, this seems more sound, indeed. I tried to come up with something like that, but I failed to properly abstract the situation. Your solution is pretty good, I like it. ;-)
Quoted 5 lines
Quoted 2 lines
That also allows you to use these new symbols in the .mk file instead of the
_HAS_LIBGLwhich IMHO is not sufficiently accurate and future-safe.I disagree.
_HAS_LIBGLis just that: we do have a libGL implementation available.
Well, if we get another libgl provider that doesn't require X, then the_HAS_LIBGL condition will be incorrect...
Regards,
Arnout
Quoted 5 lines
Now, I never managed to grasp all those lib*GL* stuff. What about libGLX?
Regards,
Yann E. MORIN.
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
PATCH v8 21/28 xbmc: Add X.org/OpenGL support
Hi,
Arnout Vandecappelle <[email protected]> wrote in
news:537BE23F.602 at mind.be:
Quoted 9 lines · Yann E. MORIN
Quoted 5 lines
Arnout, All,
And as Bernd said, full openGL support in XBMC is not possible on ARM, so it is missing a dependency on !BR2_arm. But the basis are here, granted.
Agreed if there is a specific ARM dependency in XBMC itself. I don't agree if this is just because only mesa3d on x86 implements libgl.
xbmc needs GLES on ARM:
https://github.com/xbmc/xbmc/blob/Gotham/configure.in#L695
http://article.gmane.org/gmane.comp.lib.uclibc.buildroot/84408
Quoted 2 lines
Well, if we get another libgl provider that doesn't require X, then the
_HAS_LIBGLcondition will be incorrect...
I think it is safe to remove
depends on BR2_PACKAGE_XORG7
from BR2_PACKAGE_XBMC_GL because BR2_PACKAGE_HAS_LIBGL is currently only provided, when a DRI drivers was activated in mesa3d, which is only possible with activated xorg, v10 will contain the updated patch.
Regards, Bernd
PATCH v8 22/28 xbmc: Add VA-API support
In reply to Bernd Kuhls--- package/xbmc/xbmc.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
package/xbmc/xbmc.mk +8 -1
@@ -40,7 +40,6 @@ XBMC_CONF_OPT += \ --disable-projectm \ --disable-pulse \ --disable-ssh \ - --disable-vaapi \ --disable-vdpau \ --disable-vtbdecoder \ --enable-optimizations
@@ -56,6 +55,14 @@ ifeq ($(BR2_PACKAGE_DBUS),y) XBMC_DEPENDENCIES += dbus endif +# xbmc needs libva & libva-glx +ifeq ($(BR2_PACKAGE_LIBVA)$(BR2_PACKAGE_MESA3D_DRI_DRIVER),yy) +XBMC_DEPENDENCIES += libva +XBMC_CONF_OPT += --enable-vaapi +else +XBMC_CONF_OPT += --disable-vaapi +endif + ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) XBMC_DEPENDENCIES += \ libglew \
Signature · 1 line
1.7.10.4
PATCH v8 22/28 xbmc: Add VA-API support
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 18 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/xbmc/xbmc.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)package/xbmc/xbmc.mk +0
-1@@ -40,7 +40,6 @@ XBMC_CONF_OPT += \ --disable-projectm \ --disable-pulse \ --disable-ssh \ - --disable-vaapi \ --disable-vdpau \ --disable-vtbdecoder \ --enable-optimizations
package/xbmc/xbmc.mk ifeq ($(BR2_PACKAGE_DBUS),y) · line 60
Quoted 6 lines
package/xbmc/xbmc.mk +3
-0@@ -56,6 +55,14 @@ ifeq ($(BR2_PACKAGE_DBUS),y) XBMC_DEPENDENCIES += dbus endif +# xbmc needs libva & libva-glx +ifeq ($(BR2_PACKAGE_LIBVA)$(BR2_PACKAGE_MESA3D_DRI_DRIVER),yy) +XBMC_DEPENDENCIES += libva
Shouldn't it also depend on mesa3d, too?
Regards,
Yann E. MORIN.
Quoted 15 lines
package/xbmc/xbmc.mk +5
-0+XBMC_CONF_OPT += --enable-vaapi +else +XBMC_CONF_OPT += --disable-vaapi +endif + ifeq ($(BR2_PACKAGE_HAS_LIBGL),y) XBMC_DEPENDENCIES += \ libglew \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 23/28 xbmc: Add alsa support
In reply to Bernd Kuhls--- package/xbmc/xbmc.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
package/xbmc/xbmc.mk +7 -1
@@ -28,7 +28,6 @@ XBMC_CONF_ENV = \ XBMC_CONF_OPT += \ --with-arch=$(BR2_ARCH) \ - --disable-alsa \ --disable-crystalhd \ --disable-debug \ --disable-dvdcss \
@@ -96,6 +95,13 @@ else XBMC_CONF_OPT += --disable-gles endif +ifeq ($(BR2_PACKAGE_ALSA_LIB),y) +XBMC_DEPENDENCIES += alsa-lib +XBMC_CONF_OPT += --enable-alsa +else +XBMC_CONF_OPT += --disable-alsa +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusb
Signature · 1 line
1.7.10.4
PATCH v8 24/28 xbmc: Add lame support
In reply to Bernd Kuhls--- package/xbmc/xbmc.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/xbmc/xbmc.mk +7 -0
@@ -102,6 +102,13 @@ else XBMC_CONF_OPT += --disable-alsa endif +ifeq ($(BR2_PACKAGE_LAME),y) +XBMC_DEPENDENCIES += lame +XBMC_CONF_OPT += --enable-libmp3lame +else +XBMC_CONF_OPT += --disable-libmp3lame +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusb
Signature · 1 line
1.7.10.4
PATCH v8 25/28 xbmc: Disable broken rsxs screensaver
In reply to Bernd Kuhls--- package/xbmc/xbmc.mk | 1 + 1 file changed, 1 insertion(+)
package/xbmc/xbmc.mk +1 -0
@@ -41,6 +41,7 @@ XBMC_CONF_OPT += \ --disable-ssh \ --disable-vdpau \ --disable-vtbdecoder \ + --disable-rsxs \ --enable-optimizations ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
Signature · 1 line
1.7.10.4
PATCH v8 26/28 xbmc: Add option for Goom screensaver
In reply to Bernd Kuhls--- package/xbmc/Config.in | 11 +++++++++++ package/xbmc/xbmc.mk | 6 ++++++ 2 files changed, 17 insertions(+)
package/xbmc/Config.in +11 -0
@@ -131,6 +131,17 @@ config BR2_PACKAGE_XBMC_LIBMICROHTTPD help Enable webserver feature +config BR2_PACKAGE_XBMC_GOOM + bool "goom screensaver" + depends on BR2_i386 || BR2_x86_64 # it does not make sense to use goom on embedded archs + depends on BR2_PACKAGE_HAS_LIBGL + help + Enable goom screensaver + +comment "goom needs an OpenGL backend" + depends on BR2_i386 || BR2_x86_64 + depends on !BR2_PACKAGE_HAS_LIBGL + config BR2_PACKAGE_XBMC_LIBNFS bool "nfs" depends on BR2_TOOLCHAIN_HAS_NATIVE_RPC
package/xbmc/xbmc.mk +6 -0
@@ -110,6 +110,12 @@ else XBMC_CONF_OPT += --disable-libmp3lame endif +ifeq ($(BR2_PACKAGE_XBMC_GOOM),y) +XBMC_CONF_OPT += --enable-goom +else +XBMC_CONF_OPT += --disable-goom +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusb
Signature · 1 line
1.7.10.4
PATCH v8 26/28 xbmc: Add option for Goom screensaver
Bernd, All,
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 11 lines
Signed-off-by Bernd Kuhls <[email protected]>--- package/xbmc/Config.in | 11 +++++++++++ package/xbmc/xbmc.mk | 6 ++++++ 2 files changed, 17 insertions(+)package/xbmc/Config.in +0
-0
package/xbmc/Config.in config BR2_PACKAGE_XBMC_LIBMICROHTTPD · line 136
Quoted 6 lines
package/xbmc/Config.in +3
-0@@ -131,6 +131,17 @@ config BR2_PACKAGE_XBMC_LIBMICROHTTPD help Enable webserver feature +config BR2_PACKAGE_XBMC_GOOM + bool "goom screensaver" + depends on BR2_i386 || BR2_x86_64 # it does not make sense to use goom on embedded archs
Why does it not make sense?
Surely, if an ARM platform has a full openGL implementation, what would prevent the user to run the Goom screen saver at all?
Remove the depedns on x86.
package/xbmc/Config.in config BR2_PACKAGE_XBMC_LIBMICROHTTPD · line 142
Quoted 6 lines
package/xbmc/Config.in +6
-0+ depends on BR2_PACKAGE_HAS_LIBGL + help + Enable goom screensaver + +comment "goom needs an OpenGL backend" + depends on BR2_i386 || BR2_x86_64
Ditto, dependency on HAS_LIBGL should be enough.
Regards,
Yann E. MORIN.
Quoted 29 lines
package/xbmc/Config.in +2
-0+ depends on !BR2_PACKAGE_HAS_LIBGL + config BR2_PACKAGE_XBMC_LIBNFS bool "nfs" depends on BR2_TOOLCHAIN_HAS_NATIVE_RPCpackage/xbmc/xbmc.mk +6
-0@@ -110,6 +110,12 @@ else XBMC_CONF_OPT += --disable-libmp3lame endif +ifeq ($(BR2_PACKAGE_XBMC_GOOM),y) +XBMC_CONF_OPT += --enable-goom +else +XBMC_CONF_OPT += --disable-goom +endif + ifeq ($(BR2_PACKAGE_XBMC_LIBUSB),y) XBMC_DEPENDENCIES += libusb-compat XBMC_CONF_OPT += --enable-libusbSignature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 27/28 xbmc: add nasm/yasm dependency
In reply to Bernd Kuhls--- package/xbmc/xbmc.mk | 2 ++ 1 file changed, 2 insertions(+)
package/xbmc/xbmc.mk +2 -0
@@ -18,6 +18,8 @@ XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \ openssl pcre python readline sqlite taglib tiff tinyxml yajl zlib +XBMC_DEPENDENCIES += $(if $(BR2_i386),host-nasm) $(if $(BR2_x86_64),host-yasm) + XBMC_CONF_ENV = \ PYTHON_VERSION="$(PYTHON_VERSION_MAJOR)" \ PYTHON_LDFLAGS="-lpython$(PYTHON_VERSION_MAJOR) -lpthread -ldl -lutil -lm" \
Signature · 1 line
1.7.10.4
PATCH v8 27/28 xbmc: add nasm/yasm dependency
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 1 line
Signed-off-by Bernd Kuhls <[email protected]>
Could you please add a bit more description in your commit logs?
This change comes out of the blue, and we can't see why it is needed.
If it breaks without it, then it should probably be part of the Gotham bump, no?
If you are afraid the bump patch gets too big, then add it before the bump, and state it is a preparatory patch.
Regards,
Yann E. MORIN.
Quoted 24 lines
--- package/xbmc/xbmc.mk | 2 ++ 1 file changed, 2 insertions(+)package/xbmc/xbmc.mk +2
-0@@ -18,6 +18,8 @@ XBMC_DEPENDENCIES += boost bzip2 expat flac fontconfig freetype jasper jpeg \ libogg libplist libpng libsamplerate libungif libvorbis libxml2 libxslt lzo ncurses \ openssl pcre python readline sqlite taglib tiff tinyxml yajl zlib +XBMC_DEPENDENCIES += $(if $(BR2_i386),host-nasm) $(if $(BR2_x86_64),host-yasm) + XBMC_CONF_ENV = \ PYTHON_VERSION="$(PYTHON_VERSION_MAJOR)" \ PYTHON_LDFLAGS="-lpython$(PYTHON_VERSION_MAJOR) -lpthread -ldl -lutil -lm" \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 28/28 xbmc: Fix TexturePacker compile
In reply to Bernd KuhlsPatch description:
use_texturepacker_native=yes
is needed because we obviously need a native-compiled binary, but the xbmc build system does enable this variable only for darwin, android and raspberry-pi targets.
USE_TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr"
is also needed because USE_TEXTUREPACKER_NATIVE_ROOT="$TEXTUREPACKER_NATIVE_ROOT"
is only executed for raspberry-pi by xbmc/configure and only USE_TEXTUREPACKER_NATIVE_ROOT is used by tools/TexturePacker/Makefile.in.
To sum up, building for raspberry-pi and other archs works out-of-the-box, compiling for an Intel target, for example, fails:
In file included from SDL_anigif.cpp:23:0:
SDL_anigif.h:24:21: fatal error: SDL/SDL.h: No such file or directory compilation terminated.
XBMCTex.cpp:34:21: fatal error: SDL/SDL.h: No such file or directory
--- package/xbmc/xbmc.mk | 2 ++ 1 file changed, 2 insertions(+)
package/xbmc/xbmc.mk +2 -0
@@ -26,6 +26,8 @@ XBMC_CONF_ENV = \ PYTHON_CPPFLAGS="-I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)" \ PYTHON_SITE_PKG="$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \ PYTHON_NOVERSIONCHECK="no-check" \ + use_texturepacker_native=yes \ + USE_TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr" \ TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr" XBMC_CONF_OPT += \
Signature · 1 line
1.7.10.4
PATCH v8 28/28 xbmc: Fix TexturePacker compile
Bernd, All,
(_Not_ a review of the patch, to come later...)
On 2014-05-17 17:57 +0200, Bernd Kuhls spake thusly:
Quoted 8 lines
Patch description:
use_texturepacker_native=yes
is needed because we obviously need a native-compiled binary, but the xbmc build system does enable this variable only for darwin, android and raspberry-pi targets.
Quoted 8 lines
USE_TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr"
is also needed because USE_TEXTUREPACKER_NATIVE_ROOT="$TEXTUREPACKER_NATIVE_ROOT"
is only executed for raspberry-pi by xbmc/configure and onlyUSE_TEXTUREPACKER_NATIVE_ROOTis used bytools/TexturePacker/Makefile.in.To sum up, building for raspberry-pi and other archs works out-of-the-box,
It seems I have a bug here where it does *not* work out-of-the box on my system, for a RPi target. I'll have to re-run a build to dig up the exact error, though; I'll give your series a spin later tonight...
Maxime, did you have time to look at it on your side?
Regards,
Yann E. MORIN.
Quoted 32 lines
compiling for an Intel target, for example, fails:
In file included from SDL_anigif.cpp:23:0:
SDL_anigif.h:24:21: fatal error:SDL/SDL.h: No such file or directory compilation terminated.
XBMCTex.cpp:34:21: fatal error:SDL/SDL.h: No such file or directorySigned-off-by Bernd Kuhls <[email protected]>--- package/xbmc/xbmc.mk | 2 ++ 1 file changed, 2 insertions(+)package/xbmc/xbmc.mk +2
-0@@ -26,6 +26,8 @@ XBMC_CONF_ENV = \ PYTHON_CPPFLAGS="-I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)" \ PYTHON_SITE_PKG="$(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \ PYTHON_NOVERSIONCHECK="no-check" \ + use_texturepacker_native=yes \ + USE_TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr" \ TEXTUREPACKER_NATIVE_ROOT="$(HOST_DIR)/usr" XBMC_CONF_OPT += \Signature · 6 lines
1.7.10.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'