diff --git a/media-video/vlc/additional-files/haikuicons.zip b/media-video/vlc/additional-files/haikuicons.zip new file mode 100644 index 000000000..219c14493 Binary files /dev/null and b/media-video/vlc/additional-files/haikuicons.zip differ diff --git a/media-video/vlc/additional-files/vlc.rdef.in b/media-video/vlc/additional-files/vlc.rdef.in index 7a176cc8f..65646e217 100644 --- a/media-video/vlc/additional-files/vlc.rdef.in +++ b/media-video/vlc/additional-files/vlc.rdef.in @@ -1,5 +1,5 @@ -resource app_flags B_SINGLE_LAUNCH | B_ARGV_ONLY; +resource app_flags B_MULTIPLE_LAUNCH; resource app_version { major = @MAJOR@, @@ -15,12 +15,6 @@ resource app_version { resource app_signature "@APP_SIGNATURE@"; -resource file_types message { - "types" = "application/x-asf", - "types" = "audio", - "types" = "video" -}; - resource vector_icon { $"6E6369660A0500020006023B69C90000000000003B23A04AC3EF4AE6A9007C45" $"03FFD3893303F2A541020006033D79BF0000000000003D324D49E2A74A24F500" diff --git a/media-video/vlc/additional-files/vlc_launcher.rdef.in b/media-video/vlc/additional-files/vlc_launcher.rdef.in new file mode 100644 index 000000000..903fddfd2 --- /dev/null +++ b/media-video/vlc/additional-files/vlc_launcher.rdef.in @@ -0,0 +1,47 @@ + +resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP; + +resource app_version { + major = @MAJOR@, + middle = @MIDDLE@, + minor = @MINOR@, + + variety = B_APPV_FINAL, + internal = 0, + + short_info = "VideoLAN Client", + long_info = "@LONG_INFO@" +}; + +resource app_signature "@APP_SIGNATURE@"; + +resource file_types message { + "types" = "application/x-asf", + "types" = "audio", + "types" = "video" +}; + +resource vector_icon { + $"6E6369660A0500020006023B69C90000000000003B23A04AC3EF4AE6A9007C45" + $"03FFD3893303F2A541020006033D79BF0000000000003D324D49E2A74A24F500" + $"FFE8CF7FD18021FFF49119020006023AB37E0000000000003D324D4B3D534961" + $"EB00A94604FFDC7D0B020016033B480D0000000000003AC58F49C2784A87EA00" + $"FF7FCCFFE4020006033BDD210000000000003B67CD49C2A749821E00FFE8CF7F" + $"B96205FFD47505020006033AA07A0000000000003A50B649C2784A547F00FFE8" + $"CF7FC36E0AFFEA87130200060338E8A800000000000038905449C28F47E0EE00" + $"FFE8CF7FC57210FFF491190401780C0605E202426045574E6048604A60465746" + $"0605F2032E484C42B54E42B54EC06FB49E3D22BFB322BD632238B54EBCA8B49B" + $"38B54E0A063A3C224C224E425E584858460A073F523F42C738C1713A3C224C42" + $"5BC60BC5400A055846C738C1713F423F52C60BC5400A04425E425B584658480A" + $"04224E224C425B425E02062EC3102EC3102EC4993D52345246524CC3104CC499" + $"4CC310C3A2BFF9C3A2BFF949C18B3D4744473647B978BFFE31C18BB978BFFE02" + $"063D4736474447C3A2BFF94AC128C3A2BFF9C2C4BD00C2C4BD0047BE1B3D3E43" + $"3E373EBA5939BA85BE1BBA5939B978BFFEB978BFFE30C1280206C2C4BD0047BE" + $"1BC2C4BD00C1E3B9F8C1E3B9F845BB0D3D3542353835BB36B9FB35BB0DBB36B9" + $"FBBA5939BA593933BE1B3D3E373E433E0206C1E3B9F845BB0DC1E3B9F8C13CB7" + $"B4C13CB7B443B8613D2E412E392EBBE2B7A337B861BBE2B7A3BB36B9FBBB36B9" + $"FB35BB0D3D35383542350206C13CB7B443B861C13CB7B442B55342B553C06FB4" + $"A03D22BFB322BD632238B553BCA8B49E38B553BBE2B7A3BBE2B7A337B8613D2E" + $"392E412E0A0A090100000A000201021001178400040A010105000A020106000A" + $"030103000A040104000A060107000A070109000A0502080A000A08010B00" +}; diff --git a/media-video/vlc/patches/vlc-2.2.8.patchset b/media-video/vlc/patches/vlc-2.2.8.patchset deleted file mode 100644 index 0036ae361..000000000 --- a/media-video/vlc/patches/vlc-2.2.8.patchset +++ /dev/null @@ -1,1313 +0,0 @@ -From 4f1bd749631c9b1cfee90170aa8ae2b225910c2c Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Wed, 23 Aug 2017 16:56:18 +0300 -Subject: initial Haiku support - - -diff --git a/Makefile.am b/Makefile.am -index febdc63..992fff9 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -981,15 +981,16 @@ dist_noinst_SCRIPTS += test/run_vlc.sh - ############################################################################### - # Installing plugins cache - ############################################################################### --install-exec-hook: -- if test "$(build)" = "$(host)"; then \ -- PATH="$(DESTDIR)$(bindir):$$PATH" \ -- LD_LIBRARY_PATH="$(DESTDIR)$(libdir):$$LD_LIBRARY_PATH" \ -- "$(DESTDIR)$(vlclibdir)/vlc-cache-gen$(EXEEXT)" \ -- "$(DESTDIR)$(vlclibdir)/plugins" ; \ -- else \ -- echo "Cross-compilation: cache generation skipped!" ; \ -- fi -+#Haiku bug #13159 -+#install-exec-hook: -+# if test "$(build)" = "$(host)"; then \ -+# PATH="$(DESTDIR)$(bindir):$$PATH" \ -+# LD_LIBRARY_PATH="$(DESTDIR)$(libdir):$$LD_LIBRARY_PATH" \ -+# "$(DESTDIR)$(vlclibdir)/vlc-cache-gen$(EXEEXT)" \ -+# "$(DESTDIR)$(vlclibdir)/plugins" ; \ -+# else \ -+# echo "Cross-compilation: cache generation skipped!" ; \ -+# fi - - uninstall-hook: - rm -f -- "$(DESTDIR)$(vlclibdir)/plugins/plugins.dat" -diff --git a/bin/Makefile.am b/bin/Makefile.am -index 869ac56..669f612 100644 ---- a/bin/Makefile.am -+++ b/bin/Makefile.am -@@ -79,11 +79,11 @@ noinst_DATA += ../modules/plugins.dat - MOSTLYCLEANFILES = $(noinst_DATA) - - .PHONY: ../modules/plugins.dat -- --../modules/plugins.dat: vlc-cache-gen$(EXEEXT) -- $(AM_V_at)rm -f ../modules/plugins.dat -- $(AM_V_GEN)if test "$(build)" = "$(host)"; then \ -- ./vlc-cache-gen$(EXEEXT) ../modules ; \ -- else \ -- echo "Cross-compilation: cache generation skipped!" ; \ -- fi -+# Haiku bug #13159 -+#../modules/plugins.dat: vlc-cache-gen$(EXEEXT) -+# $(AM_V_at)rm -f ../modules/plugins.dat -+# $(AM_V_GEN)if test "$(build)" = "$(host)"; then \ -+# ./vlc-cache-gen$(EXEEXT) ../modules ; \ -+# else \ -+# echo "Cross-compilation: cache generation skipped!" ; \ -+# fi -diff --git a/bin/override.c b/bin/override.c -index fb4608c..9c7c085 100644 ---- a/bin/override.c -+++ b/bin/override.c -@@ -125,6 +125,8 @@ static void *getsym (const char *name) - * - * Some evil libraries modify the environment. We currently ignore the calls as - * they could crash the process. This may cause funny behaviour though. */ -+#ifndef __HAIKU__ -+//not working - int putenv (char *str) - { - if (override) -@@ -135,6 +137,7 @@ int putenv (char *str) - return CALL(putenv, str); - } - -+#endif - int setenv (const char *name, const char *value, int overwrite) - { - if (override) -diff --git a/configure.ac b/configure.ac -index b49281c..2ec9809 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -298,11 +298,19 @@ case "${host_os}" in - LDFLAGS="${LDFLAGS} -Zomf -Zbin-files -Zargs-wild -Zhigh-mem" - AC_LIBOBJ([freeaddrinfo]) - ;; -+ *haiku*) -+ SYS=haiku -+ VLC_ADD_LIBS([libvlccore libvlc vlc],[-lnetwork -lbe]) -+ VLC_ADD_PLUGIN([haiku_aout]) -+ VLC_ADD_LIBS([haiku_aout],[-lmedia]) -+ VLC_ADD_CXXFLAGS([qt4],[-std=c++11]) -+ ;; - *) - SYS="${host_os}" - ;; - esac - AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin") -+AM_CONDITIONAL(HAVE_HAIKU, test "${SYS}" = "haiku") - AM_CONDITIONAL(HAVE_LINUX, test "${SYS}" = "linux") - AM_CONDITIONAL(HAVE_OS2, test "${SYS}" = "os2") - AM_CONDITIONAL(HAVE_WIN32, test "${SYS}" = "mingw32") -@@ -535,10 +543,13 @@ VLC_LIBRARY_SUFFIX - dnl Check for system libs needed - need_libc=false - -+# this fails to detect that we have if_nameindex and if_nametoindex on Haiku -+# and then it fails to detect that we don't have tdestroy... -+ - dnl Check for usual libc functions - AC_CHECK_DECLS([nanosleep],,,[#include ]) - AC_CHECK_FUNCS([daemon fcntl fstatvfs fork getenv getpwuid_r isatty lstat memalign mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale]) --AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab tdestroy strverscmp]) -+AC_REPLACE_FUNCS([atof atoll dirfd fdopendir flockfile fsync getdelim getpid gmtime_r lldiv localtime_r nrand48 poll posix_memalign rewind setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strsep strtof strtok_r strtoll swab strverscmp]) - AC_CHECK_FUNCS(fdatasync,, - [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) - ]) -@@ -606,8 +617,10 @@ AC_SEARCH_LIBS(connect, [socket], [ - AS_IF([test "${SYS}" = "mingw32"], [ - SOCKET_LIBS="-lws2_32" - ]) -+ AS_IF([test "${SYS}" = "haiku"], [ -+ SOCKET_LIBS="-lnetwork" -+ ]) - ]) -- - AC_SEARCH_LIBS([inet_pton], [nsl], [ - AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [ - SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS" -@@ -867,7 +880,7 @@ dnl - dnl Compiler warnings - dnl - --RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration]) -+RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var]) - RDC_PROG_CC_FLAGS([-pipe]) - AC_LANG_PUSH([C++]) - RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var]) -@@ -2549,7 +2562,7 @@ then - VLC_SAVE_FLAGS - CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}" - CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}" -- AC_CHECK_HEADERS(postproc/postprocess.h) -+ AC_CHECK_HEADERS(libpostproc/postprocess.h) - VLC_ADD_PLUGIN([postproc]) - VLC_ADD_LIBS([postproc],[$POSTPROC_LIBS $AVUTIL_LIBS]) - VLC_ADD_CFLAGS([postproc],[$POSTPROC_CFLAGS $AVUTIL_CFLAGS]) -@@ -3109,7 +3122,7 @@ dnl X C Bindings modules - dnl - AC_ARG_ENABLE(xcb, - [ --enable-xcb X11 support with XCB (default enabled)],, [ -- AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "symbian"], [ -+ AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "haiku" -a "${SYS}" != "symbian"], [ - enable_xcb="yes" - ], [ - enable_xcb="no" -@@ -3207,7 +3220,7 @@ then - if test "${SYS}" != "darwin"; then - VLC_ADD_PLUGIN([vout_sdl]) - fi -- if test "${SYS}" != "mingw32" -a "${SYS}" != "os2"; then -+ if test "${SYS}" != "mingw32" -a "${SYS}" != "os2" -a "${SYS}" != "haiku"; then - VLC_ADD_LIBS([vout_sdl],[${X_LIBS} ${X_PRE_LIBS} -lX11]) - fi - VLC_ADD_CFLAGS([vout_sdl],[${SDL_CFLAGS}]) -@@ -4166,7 +4179,7 @@ AC_ARG_WITH(kde-solid, - AS_HELP_STRING([--with-kde-solid=PATH], - [KDE Solid actions directory (auto)]),, [ - --if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" ; then -+if test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "haiku" ; then - with_kde_solid="yes" - fi - ]) -diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h -index 997f600..47b566e 100644 ---- a/include/vlc_fixups.h -+++ b/include/vlc_fixups.h -@@ -261,10 +261,13 @@ void swab (const void *, void *, ssize_t); - #endif - - /* Socket stuff */ -+// configure doesn't detect these, likely not linking to -lnetwork, must investigate -+#ifndef __HAIKU__ - #ifndef HAVE_INET_PTON - int inet_pton(int, const char *, void *); - const char *inet_ntop(int, const void *, char *, int); - #endif -+#endif - - #ifndef HAVE_STRUCT_POLLFD - enum -@@ -289,6 +292,8 @@ struct pollfd; - int poll (struct pollfd *, unsigned, int); - #endif - -+// or these -+#ifndef __HAIKU__ - #ifndef HAVE_IF_NAMEINDEX - #include - struct if_nameindex -@@ -302,6 +307,7 @@ struct if_nameindex - # define if_nameindex() (errno = ENOBUFS, NULL) - # define if_freenameindex(list) (void)0 - #endif -+#endif - - /* search.h */ - #ifndef HAVE_SEARCH_H -diff --git a/include/vlc_threads.h b/include/vlc_threads.h -index ff43d6f..deb3bc7 100644 ---- a/include/vlc_threads.h -+++ b/include/vlc_threads.h -@@ -166,7 +166,13 @@ typedef struct - #define VLC_STATIC_COND { PTHREAD_COND_INITIALIZER, 0 } - typedef semaphore_t vlc_sem_t; - typedef pthread_rwlock_t vlc_rwlock_t; -+// Haiku bug #8798 -+#ifdef __HAIKU__ -+#define VLC_STATIC_RWLOCK \ -+ { VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 } -+#else - #define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER -+#endif - typedef pthread_key_t vlc_threadvar_t; - typedef struct vlc_timer *vlc_timer_t; - -@@ -192,7 +198,13 @@ typedef pthread_cond_t vlc_cond_t; - #define VLC_STATIC_COND PTHREAD_COND_INITIALIZER - typedef sem_t vlc_sem_t; - typedef pthread_rwlock_t vlc_rwlock_t; -+// Haiku bug #8798 -+#ifdef __HAIKU__ -+#define VLC_STATIC_RWLOCK \ -+ { VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 } -+#else - #define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER -+#endif - typedef pthread_key_t vlc_threadvar_t; - typedef struct vlc_timer *vlc_timer_t; - -diff --git a/modules/audio_output/Makefile.am b/modules/audio_output/Makefile.am -index 1e6a233..ba072a4 100644 ---- a/modules/audio_output/Makefile.am -+++ b/modules/audio_output/Makefile.am -@@ -91,6 +91,12 @@ if HAVE_SNDIO - aout_LTLIBRARIES += libsndio_plugin.la - endif - -+libhaiku_aout_plugin_la_SOURCES = audio_output/haiku.cpp -+libhaiku_aout_plugin_la_LIBADD = -lmedia -+#if HAVE_HAIKU -+#aout_LTLIBRARIES += libhaiku_aout_plugin.la -+#endif -+ - libwaveout_plugin_la_SOURCES = audio_output/waveout.c \ - audio_output/windows_audio_common.h - libwaveout_plugin_la_LIBADD = -lwinmm -diff --git a/modules/audio_output/haiku.cpp b/modules/audio_output/haiku.cpp -new file mode 100644 -index 0000000..7a8c2ec ---- /dev/null -+++ b/modules/audio_output/haiku.cpp -@@ -0,0 +1,196 @@ -+/***************************************************************************** -+ * Haiku.cpp - Haiku Media Kit audio output -+ ***************************************************************************** -+ * Copyright (C) 1999, 2000, 2001, 2012 the VideoLAN team -+ * -+ * Authors: Jean-Marc Dressler -+ * Samuel Hocevar -+ * Eric Petit -+ * Cian Duffy -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -+ *****************************************************************************/ -+ -+/***************************************************************************** -+ * Preamble -+ *****************************************************************************/ -+#include -+#include /* malloc(), free() */ -+#include -+#include -+ -+#include -+#include -+using namespace std; -+ -+#include -+#include -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+ -+#include -+#include -+#include -+ -+/***************************************************************************** -+ * aout_sys_t: BeOS audio output method descriptor -+ *****************************************************************************/ -+ -+queue a_queue; -+ -+struct aout_sys_t -+{ -+ BSoundPlayer * p_player; -+ mtime_t latency; -+ media_raw_audio_format * p_format; -+}; -+ -+/***************************************************************************** -+ * Local prototypes. -+ *****************************************************************************/ -+static void Close ( vlc_object_t * ); -+static void Pause (audio_output_t *, bool, mtime_t); -+static void Play (audio_output_t *, block_t *); -+ -+static void Flush (audio_output_t *, bool);static int Open ( vlc_object_t * ); -+static void BufferProc ( void * p_aout, void * p_buffer, size_t size, -+ const media_raw_audio_format & format ); -+ -+/***************************************************************************** -+ * Module descriptor -+ *****************************************************************************/ -+vlc_module_begin () -+ set_shortname( "haiku_aout" ) -+ set_description( N_("Haiku Media Kit audio output") ) -+ set_capability( "audio output", 100 ) -+ set_category( CAT_AUDIO ) -+ set_subcategory( SUBCAT_AUDIO_AOUT ) -+ set_callbacks( Open, Close ) -+vlc_module_end () -+/***************************************************************************** -+ * OpenAudio -+ *****************************************************************************/ -+static int Open( vlc_object_t * p_this ) -+{ -+ audio_output_t *p_aout = (audio_output_t *)p_this; -+ p_aout->sys = (aout_sys_t*)malloc( sizeof( aout_sys_t ) ); -+ if( p_aout->sys == NULL ) -+ { -+ return VLC_ENOMEM; -+ } -+ -+ aout_sys_t * p_sys = p_aout->sys; -+ -+ audio_format_t format = p_aout->format; -+ -+ int i_nb_channels = aout_FormatNbChannels( &format ); -+ -+// media_raw_audio_format must be passed to BSoundPlayer -+ p_sys->p_format = (media_raw_audio_format*) -+ malloc( sizeof( media_raw_audio_format ) ); -+ -+ p_aout->format.i_format = VLC_CODEC_FI32; -+ p_aout->format.i_physical_channels = AOUT_CHAN_LEFT | AOUT_CHAN_RIGHT; -+ p_aout->format.i_rate = 44100; -+ -+ p_sys->p_format->channel_count = i_nb_channels; -+ p_sys->p_format->frame_rate = p_aout->format.i_rate; -+ p_sys->p_format->format = media_raw_audio_format::B_AUDIO_INT; -+ p_sys->p_format->byte_order = B_MEDIA_LITTLE_ENDIAN; -+ // 'magic' number obtained from checking what size the buffers being -+ // passed by the callback were -+ // in theory, any buffer size should work -+ p_sys->p_format->buffer_size = 9216; -+ -+ aout_VolumeSoftInit( p_aout ); -+ -+ //BSoundPlayer init - format, name, buffer producer, notifier, cookie -+ -+ p_sys->p_player = new BSoundPlayer( p_sys->p_format, "player", BufferProc, NULL, NULL ); -+ if( p_sys->p_player->InitCheck() != B_OK ) -+ { -+ msg_Err( p_aout, "BSoundPlayer InitCheck failed" ); -+ delete p_sys->p_player; -+ free( p_sys ); -+ } -+ p_sys->latency = p_sys->p_player->Latency(); -+ -+ p_aout->pf_play = Play; -+ p_aout->pf_pause = Pause; -+ p_aout->pf_flush = Flush; -+ -+ return VLC_SUCCESS; -+ -+} -+ -+/***************************************************************************** -+ * BufferProc- buffer producer function -+ *****************************************************************************/ -+static void BufferProc( void * _p_aout, void * _p_buffer, size_t i_size, -+ const media_raw_audio_format &format ) -+{ -+// Load buffer -+ for (size_t i = 0; i < i_size; i++) -+ { -+ uint8 data = a_queue.front(); -+ vlc_memset(_p_buffer + i, data, 1); -+ a_queue.pop(); -+ } -+ -+} -+/***************************************************************************** -+ * CloseAudio -+ *****************************************************************************/ -+static void Close( vlc_object_t * p_this ) -+{ -+ printf("Close Called"); -+ audio_output_t *p_aout = (audio_output_t *)p_this; -+ struct aout_sys_t *p_sys; -+ p_aout->sys = p_sys; -+ -+ /* Clean up */ -+ p_sys->p_player->Stop(); -+ delete p_sys->p_player; -+ free( p_sys ); -+} -+ -+ -+static void Play (audio_output_t *aout, block_t *block) -+{ -+ aout_sys_t * p_sys = aout->sys; -+ -+// load buffer to STL queue, sample by sample -+ for (size_t i = 0; i < block->i_buffer; i++) -+ { -+ a_queue.push(block->p_buffer[i]); -+ } -+ -+ p_sys->p_player->Start(); -+ p_sys->p_player->SetHasData( true ); -+// release buffer -+ block_Release (block); -+} -+ -+ -+static void Pause (audio_output_t *aout, bool pause, mtime_t date) -+{ -+} -+ -+ -+static void Flush (audio_output_t *aout, bool wait) -+{ -+} -diff --git a/modules/gui/qt4/Makefile.am b/modules/gui/qt4/Makefile.am -index 1a564cf..4d12501 100644 ---- a/modules/gui/qt4/Makefile.am -+++ b/modules/gui/qt4/Makefile.am -@@ -22,7 +22,7 @@ else - if HAVE_WIN32 - libqt4_plugin_la_LIBADD += -lole32 -lcomctl32 -luuid - else --libqt4_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIB) -lX11 -+libqt4_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIB) - endif - endif - if HAVE_DARWIN -diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am -index 51bd09c..fcf60c7 100644 ---- a/modules/video_output/Modules.am -+++ b/modules/video_output/Modules.am -@@ -226,7 +226,7 @@ libcaca_plugin_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) - libcaca_plugin_la_LIBADD = $(CACA_LIBS) - if !HAVE_WIN32 - if !HAVE_DARWIN --libcaca_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIBS) -lX11 -+libcaca_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIBS) - endif - endif - libcaca_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' -diff --git a/modules/video_output/caca.c b/modules/video_output/caca.c -index 75c83e6..8922732 100644 ---- a/modules/video_output/caca.c -+++ b/modules/video_output/caca.c -@@ -34,7 +34,7 @@ - #include - #include - #include --#if !defined(_WIN32) && !defined(__APPLE__) -+#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__HAIKU__) - # ifdef X_DISPLAY_MISSING - # error Xlib required due to XInitThreads - # endif -diff --git a/modules/video_output/sdl.c b/modules/video_output/sdl.c -index e56c976..76b7ef4 100644 ---- a/modules/video_output/sdl.c -+++ b/modules/video_output/sdl.c -@@ -40,7 +40,7 @@ - - #include - --#if !defined(_WIN32) && !defined(__OS2__) -+#if !defined(_WIN32) && !defined(__OS2__) && !defined(__HAIKU__) - # ifdef X_DISPLAY_MISSING - # error Xlib required due to XInitThreads - # endif -@@ -116,7 +116,7 @@ static int Open(vlc_object_t *object) - vout_display_t *vd = (vout_display_t *)object; - vout_display_sys_t *sys; - --#if !defined(_WIN32) && !defined(__OS2__) -+#if !defined(_WIN32) && !defined(__OS2__) && !defined(__HAIKU__) - if (!vlc_xlib_init (object)) - return VLC_EGENERIC; - #endif -diff --git a/src/Makefile.am b/src/Makefile.am -index 4aaf405..b2ead2c 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -231,6 +231,9 @@ else - if HAVE_OS2 - libvlccore_la_SOURCES += $(SOURCES_libvlc_os2) - else -+if HAVE_HAIKU -+libvlccore_la_SOURCES += $(SOURCES_libvlc_haiku) -+else - libvlccore_la_SOURCES += $(SOURCES_libvlc_other) - endif - endif -@@ -238,6 +241,7 @@ endif - endif - endif - endif -+endif - if BUILD_HTTPD - libvlccore_la_SOURCES += $(SOURCES_libvlc_httpd) - endif -@@ -319,6 +323,18 @@ SOURCES_libvlc_os2 = \ - os2/rand.c \ - $(NULL) - -+SOURCES_libvlc_haiku = \ -+ posix/dirs.c \ -+ posix/error.c \ -+ posix/filesystem.c \ -+ posix/netconf.c \ -+ posix/plugin.c \ -+ posix/rand.c \ -+ posix/thread.c \ -+ posix/timer.c \ -+ haiku/specific.cpp \ -+ $(NULL) -+ - SOURCES_libvlc_other = \ - posix/dirs.c \ - posix/error.c \ -diff --git a/src/haiku/specific.cpp b/src/haiku/specific.cpp -new file mode 100644 -index 0000000..ddf7070 ---- /dev/null -+++ b/src/haiku/specific.cpp -@@ -0,0 +1,57 @@ -+/***************************************************************************** -+ * specific.c: stubs for POSIX OS-specific initialization -+ ***************************************************************************** -+ * Copyright © 2008 Rémi Denis-Courmont -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU Lesser General Public License as published by -+ * the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this program; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -+ *****************************************************************************/ -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+ -+#include -+ -+ -+#include -+extern "C" -+{ -+#include "../libvlc.h" -+#include -+ -+ -+static void set_libvlc_path (void) -+{ -+ return; -+} -+ -+void system_Init (void) -+{ -+ BApplication app("application/x-vnd.vlc"); -+ pthread_once_t once = PTHREAD_ONCE_INIT; -+ -+ pthread_once (&once, set_libvlc_path); -+} -+ -+void system_Configure (libvlc_int_t *libvlc, -+ int argc, const char *const argv[]) -+{ -+ (void)libvlc; (void)argc; (void)argv; -+} -+ -+void system_End (void) -+{ -+} -+} -diff --git a/src/modules/bank.c b/src/modules/bank.c -index b439440..d4245cd 100644 ---- a/src/modules/bank.c -+++ b/src/modules/bank.c -@@ -67,6 +67,7 @@ static void module_StoreBank (module_t *module) - modules.head = module; - } - -+/* Haiku bug #8288 - #if defined(__ELF__) || !HAVE_DYNAMIC_PLUGINS - # ifdef __GNUC__ - __attribute__((weak)) -@@ -86,9 +87,9 @@ static void module_InitStaticModules(void) - module_StoreBank (module); - } - } --#else -+#else */ - static void module_InitStaticModules(void) { } --#endif -+//#endif - - /** - * Init bank -diff --git a/src/network/io.c b/src/network/io.c -index ea1b1b9..acdd9b1 100644 ---- a/src/network/io.c -+++ b/src/network/io.c -@@ -216,7 +216,9 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, - switch (ptr->ai_socktype) - { - case SOCK_STREAM: -+#ifdef SOCK_RDM - case SOCK_RDM: -+#endif - case SOCK_SEQPACKET: - #ifdef SOCK_DCCP - case SOCK_DCCP: --- -2.16.4 - - -From f8f783594747bb967335b7bf35d7e9a0d2e7140b Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Wed, 23 Aug 2017 16:58:12 +0300 -Subject: fix build with ffmpeg 3.x and lua 5.2 - - -diff --git a/configure.ac b/configure.ac -index 2ec9809..bbb6ce6 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1535,7 +1535,7 @@ then - AC_MSG_ERROR([Could not find lua. Lua is needed for some interfaces (rc, telnet, http) as well as many other custom scripts. Use --disable-lua to ignore this error.]) - fi - AC_ARG_VAR([LUAC], [LUA byte compiler]) -- AC_PATH_PROGS(LUAC,[${LUAC} luac], [false]) -+ AC_PATH_PROGS(LUAC,[${LUAC} luac5.2], [false]) - AS_IF([test "${LUAC}" = "false"], [ - AC_MSG_ERROR([Could not find the LUA byte compiler.]) - ]) -@@ -2330,7 +2330,7 @@ AC_ARG_ENABLE(avcodec, - [ --enable-avcodec libavcodec codec (default enabled)]) - AS_IF([test "${enable_avcodec}" != "no"], [ - PKG_CHECK_MODULES(AVCODEC,[libavcodec >= 53.34.0 libavutil >= 51.22.0], [ -- PKG_CHECK_EXISTS([libavutil < 55],, [ -+ PKG_CHECK_EXISTS([libavutil > 55],, [ - AC_MSG_ERROR([libavutil versions 55 and later are not supported.]) - ]) - VLC_SAVE_FLAGS -@@ -2389,7 +2389,7 @@ have_avcodec_vaapi="no" - AS_IF([test "${have_vaapi}" = "yes" -a "${have_avcodec}" = "yes"], [ - case "${avfork}" in - ffmpeg) -- PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [ -+ PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [ - AC_MSG_ERROR([VA API requires FFmpeg libavcodec < 57.10 or libav.]) - ]) - ;; -@@ -2423,7 +2423,7 @@ AS_IF([test "${enable_dxva2}" != "no"], [ - AS_IF([test "x${have_avcodec}" = "xyes"], [ - case "${avfork}" in - ffmpeg) -- PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [ -+ PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [ - AC_MSG_ERROR([DXVA2 requires FFmpeg libavcodec < 57.10 or libav.]) - ]) - ;; -@@ -3187,7 +3187,7 @@ AS_IF([test "${have_vdpau}" = "yes" -a "${have_avcodec}" = "yes"], [ - case "${avfork}" in - libav) av_vdpau_ver="55.26.0" ;; - ffmpeg) av_vdpau_ver="55.42.100" -- PKG_CHECK_EXISTS([libavcodec >= 57.10.100], [ -+ PKG_CHECK_EXISTS([libavcodec >= 60.10.100], [ - AC_MSG_ERROR([VDPAU requires FFmpeg libavcodec < 57.10 or libav.]) - ]) - ;; -@@ -3746,7 +3746,7 @@ AS_IF([test "${enable_qt}" != "no"], [ - PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [ - PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [ - VLC_ADD_LIBS([qt4],[${QTX11_LIBS}]) -- VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11]) -+ VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11 -std=c++11]) - PKG_CHECK_MODULES([XI], [xi], [ - VLC_ADD_LIBS([qt4], [${XI_LIBS}]) - VLC_ADD_CXXFLAGS([qt4], [${XI_CFLAGS} -DHAVE_XI]) -diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c -index c6a0a6c..cb17991 100644 ---- a/modules/codec/avcodec/audio.c -+++ b/modules/codec/avcodec/audio.c -@@ -36,12 +36,11 @@ - #include - #include - -+#include "avcodec.h" -+ - #include - #include - --#include -- --#include "avcodec.h" - - /***************************************************************************** - * decoder_sys_t : decoder descriptor -diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h -index 91b3f5b..3c66a1e 100644 ---- a/modules/codec/avcodec/avcommon_compat.h -+++ b/modules/codec/avcodec/avcommon_compat.h -@@ -506,6 +506,15 @@ enum { - - #endif /* HAVE_LIBAVUTIL_AVUTIL_H */ - -+#if LIBAVUTIL_VERSION_MAJOR >= 55 -+# define FF_API_AUDIOCONVERT 1 -+#endif -+ -+/* libavutil/pixfmt.h */ -+#ifndef PixelFormat -+# define PixelFormat AVPixelFormat -+#endif -+ - #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H - # include - -diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c -index ca7674f..9020576 100644 ---- a/modules/codec/avcodec/encoder.c -+++ b/modules/codec/avcodec/encoder.c -@@ -41,7 +41,6 @@ - #include - - #include --#include - - #include "avcodec.h" - #include "avcommon.h" -@@ -311,7 +310,7 @@ int OpenEncoder( vlc_object_t *p_this ) - else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id, - &psz_namecodec ) ) - { -- if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE ) -+ if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE ) - return VLC_EGENERIC; /* handed chroma output */ - - i_cat = VIDEO_ES; -@@ -1017,7 +1016,7 @@ errmsg: - } - } - -- p_sys->frame = avcodec_alloc_frame(); -+ p_sys->frame = av_frame_alloc(); - if( !p_sys->frame ) - { - goto error; -@@ -1088,7 +1087,8 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict ) - AVFrame *frame = NULL; - if( likely(p_pict) ) { - frame = p_sys->frame; -- avcodec_get_frame_defaults( frame ); -+ av_frame_unref( frame ); -+ - for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ ) - { - p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels; -@@ -1329,7 +1329,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, int - //How much we need to copy from new packet - const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes; - -- avcodec_get_frame_defaults( p_sys->frame ); -+ av_frame_unref( p_sys->frame ); - p_sys->frame->format = p_sys->p_context->sample_fmt; - p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay; - -@@ -1451,7 +1451,8 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf ) - while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) || - ( p_sys->b_variable && p_aout_buf->i_nb_samples ) ) - { -- avcodec_get_frame_defaults( p_sys->frame ); -+ av_frame_unref( p_sys->frame ); -+ - if( p_sys->b_variable ) - p_sys->frame->nb_samples = p_aout_buf->i_nb_samples; - else -diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c -index 1d8f7fa..d9643d0 100644 ---- a/modules/codec/avcodec/vaapi.c -+++ b/modules/codec/avcodec/vaapi.c -@@ -595,7 +595,7 @@ static int Create( vlc_va_t *p_va, AVCodecContext *ctx, - return err; - - /* Only VLD supported */ -- p_va->pix_fmt = PIX_FMT_VAAPI_VLD; -+ p_va->pix_fmt = AV_PIX_FMT_VAAPI_VLD; - p_va->setup = Setup; - p_va->get = Get; - p_va->release = Release; -diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c -index 4c3e9bc..a720fd8 100644 ---- a/modules/codec/avcodec/video.c -+++ b/modules/codec/avcodec/video.c -@@ -236,7 +236,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - p_sys->p_codec = p_codec; - p_sys->i_codec_id = i_codec_id; - p_sys->psz_namecodec = psz_namecodec; -- p_sys->p_ff_pic = avcodec_alloc_frame(); -+ p_sys->p_ff_pic = av_frame_alloc(); - p_sys->b_delayed_open = true; - p_sys->p_va = NULL; - vlc_sem_init( &p_sys->sem_mt, 0 ); -@@ -448,7 +448,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - if( ffmpeg_OpenCodec( p_dec ) < 0 ) - { - msg_Err( p_dec, "cannot open codec (%s)", p_sys->psz_namecodec ); -- avcodec_free_frame( &p_sys->p_ff_pic ); -+ av_frame_free( &p_sys->p_ff_pic ); - vlc_sem_destroy( &p_sys->sem_mt ); - free( p_sys ); - return VLC_EGENERIC; -@@ -849,7 +849,7 @@ void EndVideoDec( decoder_t *p_dec ) - wait_mt( p_sys ); - - if( p_sys->p_ff_pic ) -- avcodec_free_frame( &p_sys->p_ff_pic ); -+ av_frame_free( &p_sys->p_ff_pic ); - - if( p_sys->p_va ) - vlc_va_Delete( p_sys->p_va ); --- -2.16.4 - - -From 8ff84f986f9a180c2e2a84c14d5b6d29e1f9a69b Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Wed, 23 Aug 2017 18:44:51 +0300 -Subject: backport static assert fix from vlc 3.0 - - -diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h -index 47b566e..9ee135f 100644 ---- a/include/vlc_fixups.h -+++ b/include/vlc_fixups.h -@@ -239,11 +239,14 @@ static inline locale_t newlocale(int mask, const char * locale, locale_t base) - } - #endif - --#if !defined (HAVE_STATIC_ASSERT) --# define _Static_assert(x, s) ((void) sizeof (struct { unsigned:-!(x); })) -+#if !defined (HAVE_STATIC_ASSERT) && !defined(__cpp_static_assert) -+# define STATIC_ASSERT_CONCAT_(a, b) a##b -+# define STATIC_ASSERT_CONCAT(a, b) STATIC_ASSERT_CONCAT_(a, b) -+# define _Static_assert(x, s) extern char STATIC_ASSERT_CONCAT(static_assert_, __LINE__)[sizeof(struct { unsigned:-!(x); })] - # define static_assert _Static_assert - #endif - -+ - /* Alignment of critical static data structures */ - #ifdef ATTRIBUTE_ALIGNED_MAX - # define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) --- -2.16.4 - - -From 2957d5ed6e13d52863ac9b2835f8beb93c7bb3f4 Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Thu, 30 Aug 2018 12:54:55 +0300 -Subject: Fix build on Qt 5.11 - - -diff --git a/modules/gui/qt4/actions_manager.cpp b/modules/gui/qt4/actions_manager.cpp -index a88c972..2b7ce9d 100644 ---- a/modules/gui/qt4/actions_manager.cpp -+++ b/modules/gui/qt4/actions_manager.cpp -@@ -27,6 +27,8 @@ - - #include "qt4.hpp" - -+#include -+ - #include - #include - -diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp -index eca0a45..3ef7880 100644 ---- a/modules/gui/qt4/components/simple_preferences.cpp -+++ b/modules/gui/qt4/components/simple_preferences.cpp -@@ -33,6 +33,7 @@ - #include - #include - -+#include - #include - #include - #include --- -2.16.4 - - -From 54b75e39cd706655e1e987658944d6a211789d6a Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Thu, 30 Aug 2018 12:56:59 +0300 -Subject: Fix build with ffmpeg 4.0 - - -diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h -index 3c66a1e..b977ef5 100644 ---- a/modules/codec/avcodec/avcommon_compat.h -+++ b/modules/codec/avcodec/avcommon_compat.h -@@ -47,6 +47,45 @@ - # define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32 - # define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT - # define AV_SAMPLE_FMT_DBL SAMPLE_FMT_DBL -+#ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT -+# define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT -+#endif -+#ifndef AV_CODEC_FLAG_GRAY -+# define AV_CODEC_FLAG_GRAY CODEC_FLAG_GRAY -+#endif -+#ifndef AV_CODEC_FLAG_DR1 -+# define AV_CODEC_FLAG_DR1 CODEC_FLAG_DR1 -+#endif -+#ifndef AV_CODEC_FLAG_DELAY -+# define AV_CODEC_FLAG_DELAY CODEC_FLAG_DELAY -+#endif -+#ifndef AV_CODEC_FLAG2_FAST -+# define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST -+#endif -+#ifndef FF_INPUT_BUFFER_PADDING_SIZE -+# define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE -+#endif -+#ifndef AV_CODEC_FLAG_INTERLACED_DCT -+# define AV_CODEC_FLAG_INTERLACED_DCT CODEC_FLAG_INTERLACED_DCT -+#endif -+#ifndef AV_CODEC_FLAG_INTERLACED_ME -+# define AV_CODEC_FLAG_INTERLACED_ME CODEC_FLAG_INTERLACED_ME -+#endif -+#ifndef AV_CODEC_FLAG_GLOBAL_HEADER -+# define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER -+#endif -+#ifndef AV_CODEC_FLAG_LOW_DELAY -+# define AV_CODEC_FLAG_LOW_DELAY CODEC_FLAG_LOW_DELAY -+#endif -+#ifndef AV_CODEC_CAP_SMALL_LAST_FRAME -+# define AV_CODEC_CAP_SMALL_LAST_FRAME CODEC_CAP_SMALL_LAST_FRAME -+#endif -+#ifndef AV_INPUT_BUFFER_MIN_SIZE -+# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE -+#endif -+#ifndef FF_MAX_B_FRAMES -+# define FF_MAX_B_FRAMES 16 // FIXME: remove this -+#endif - - #ifndef AV_CH_FRONT_LEFT - # define AV_CH_FRONT_LEFT CH_FRONT_LEFT -@@ -479,6 +518,46 @@ enum { - # define err_recognition error_recognition - #endif - -+#ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT -+# define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT -+#endif -+#ifndef AV_CODEC_FLAG_GRAY -+# define AV_CODEC_FLAG_GRAY CODEC_FLAG_GRAY -+#endif -+#ifndef AV_CODEC_FLAG_DR1 -+# define AV_CODEC_FLAG_DR1 CODEC_FLAG_DR1 -+#endif -+#ifndef AV_CODEC_FLAG_DELAY -+# define AV_CODEC_FLAG_DELAY CODEC_FLAG_DELAY -+#endif -+#ifndef AV_CODEC_FLAG2_FAST -+# define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST -+#endif -+#ifndef FF_INPUT_BUFFER_PADDING_SIZE -+# define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE -+#endif -+#ifndef AV_CODEC_FLAG_INTERLACED_DCT -+# define AV_CODEC_FLAG_INTERLACED_DCT CODEC_FLAG_INTERLACED_DCT -+#endif -+#ifndef AV_CODEC_FLAG_INTERLACED_ME -+# define AV_CODEC_FLAG_INTERLACED_ME CODEC_FLAG_INTERLACED_ME -+#endif -+#ifndef AV_CODEC_FLAG_GLOBAL_HEADER -+# define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER -+#endif -+#ifndef AV_CODEC_FLAG_LOW_DELAY -+# define AV_CODEC_FLAG_LOW_DELAY CODEC_FLAG_LOW_DELAY -+#endif -+#ifndef AV_CODEC_CAP_SMALL_LAST_FRAME -+# define AV_CODEC_CAP_SMALL_LAST_FRAME CODEC_CAP_SMALL_LAST_FRAME -+#endif -+#ifndef AV_INPUT_BUFFER_MIN_SIZE -+# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE -+#endif -+#ifndef FF_MAX_B_FRAMES -+# define FF_MAX_B_FRAMES 16 // FIXME: remove this -+#endif -+ - #endif /* HAVE_LIBAVCODEC_AVCODEC_H */ - - #ifdef HAVE_LIBAVUTIL_AVUTIL_H -diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c -index 9020576..5016226 100644 ---- a/modules/codec/avcodec/encoder.c -+++ b/modules/codec/avcodec/encoder.c -@@ -284,6 +284,24 @@ static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context, - msg_Dbg( p_enc, "Time base set to %d/%d", p_context->time_base.num, p_context->time_base.den ); - } - -+static void add_av_option_int( encoder_t *p_enc, AVDictionary** pp_dict, const char* psz_name, int i_value ) -+{ -+ char buff[32]; -+ if ( snprintf( buff, sizeof(buff), "%d", i_value ) < 0 ) -+ return; -+ if( av_dict_set( pp_dict, psz_name, buff, 0 ) < 0 ) -+ msg_Warn( p_enc, "Failed to set encoder option %s", psz_name ); -+} -+ -+static void add_av_option_float( encoder_t *p_enc, AVDictionary** pp_dict, const char* psz_name, float f_value ) -+{ -+ char buff[128]; -+ if ( snprintf( buff, sizeof(buff), "%f", f_value ) < 0 ) -+ return; -+ if( av_dict_set( pp_dict, psz_name, buff, 0 ) < 0 ) -+ msg_Warn( p_enc, "Failed to set encoder option %s", psz_name ); -+} -+ - int OpenEncoder( vlc_object_t *p_this ) - { - encoder_t *p_enc = (encoder_t *)p_this; -@@ -492,6 +510,7 @@ int OpenEncoder( vlc_object_t *p_this ) - } - } - free( psz_val ); -+ AVDictionary *options = NULL; - - if( p_enc->fmt_in.i_cat == VIDEO_ES ) - { -@@ -521,7 +540,7 @@ int OpenEncoder( vlc_object_t *p_this ) - p_context->lumi_masking = p_sys->f_lumi_masking; - p_context->dark_masking = p_sys->f_dark_masking; - p_context->p_masking = p_sys->f_p_masking; -- p_context->border_masking = p_sys->f_border_masking; -+ add_av_option_float( p_enc, &options, "border_mask", p_sys->f_border_masking ); - #if (LIBAVCODEC_VERSION_MAJOR < 55) - p_context->luma_elim_threshold = p_sys->i_luma_elim; - p_context->chroma_elim_threshold = p_sys->i_chroma_elim; -@@ -535,7 +554,7 @@ int OpenEncoder( vlc_object_t *p_this ) - if( !p_context->max_b_frames && - ( p_enc->fmt_out.i_codec == VLC_CODEC_MPGV || - p_enc->fmt_out.i_codec == VLC_CODEC_MP2V ) ) -- p_context->flags |= CODEC_FLAG_LOW_DELAY; -+ p_context->flags |= AV_CODEC_FLAG_LOW_DELAY; - - av_reduce( &p_context->sample_aspect_ratio.num, - &p_context->sample_aspect_ratio.den, -@@ -593,16 +612,16 @@ int OpenEncoder( vlc_object_t *p_this ) - } - else - { -- p_context->flags |= CODEC_FLAG_INTERLACED_DCT; -+ p_context->flags |= AV_CODEC_FLAG_INTERLACED_DCT; - if ( p_sys->b_interlace_me ) -- p_context->flags |= CODEC_FLAG_INTERLACED_ME; -+ p_context->flags |= AV_CODEC_FLAG_INTERLACED_ME; - } - } - - p_context->trellis = p_sys->b_trellis; - - if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax ) -- p_context->flags |= CODEC_FLAG_QSCALE; -+ p_context->flags |= AV_CODEC_FLAG_QSCALE; - /* These codecs cause libavcodec to exit if thread_count is > 1. - See libavcodec/mpegvideo_enc.c:MPV_encode_init and - libavcodec/svq3.c , WMV2 calls MPV_encode_init also. -@@ -638,12 +657,14 @@ int OpenEncoder( vlc_object_t *p_this ) - if( p_sys->i_qmin > 0 ) - { - p_context->qmin = p_sys->i_qmin; -- p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA; -+ p_context->mb_lmin = p_sys->i_qmin * FF_QP2LAMBDA; -+ add_av_option_int( p_enc, &options, "lmin", p_context->mb_lmin); - } - if( p_sys->i_qmax > 0 ) - { - p_context->qmax = p_sys->i_qmax; -- p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA; -+ p_context->mb_lmax = p_sys->i_qmax * FF_QP2LAMBDA; -+ add_av_option_int( p_enc, &options, "lmax", p_context->mb_lmax); - } - p_context->max_qdiff = 3; - -@@ -651,12 +672,12 @@ int OpenEncoder( vlc_object_t *p_this ) - - if( p_sys->i_quality && !p_enc->fmt_out.i_bitrate ) - { -- p_context->flags |= CODEC_FLAG_QSCALE; -+ p_context->flags |= AV_CODEC_FLAG_QSCALE; - p_context->global_quality = p_sys->i_quality; - } - else - { -- p_context->rc_qsquish = 1.0; -+ av_dict_set(&options, "qsquish", "1.0", 0); - /* Default to 1/2 second buffer for given bitrate unless defined otherwise*/ - if( !p_sys->i_rc_buffer_size ) - { -@@ -670,7 +691,7 @@ int OpenEncoder( vlc_object_t *p_this ) - /* This is from ffmpeg's ffmpeg.c : */ - p_context->rc_initial_buffer_occupancy - = p_sys->i_rc_buffer_size * 3/4; -- p_context->rc_buffer_aggressivity = p_sys->f_rc_buffer_aggressivity; -+ add_av_option_float( p_enc, &options, "rc_buffer_aggressivity", p_sys->f_rc_buffer_aggressivity ); - } - } - else if( p_enc->fmt_in.i_cat == AUDIO_ES ) -@@ -807,20 +828,23 @@ int OpenEncoder( vlc_object_t *p_this ) - if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) ) - { - p_context->qmin = 10; -- p_context->mb_lmin = p_context->lmin = 10 * FF_QP2LAMBDA; -+ p_context->mb_lmin = 10 * FF_QP2LAMBDA; -+ add_av_option_int( p_enc, &options, "lmin", p_context->mb_lmin ); - } - - if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmax" ) ) - { - p_context->qmax = 42; -- p_context->mb_lmax = p_context->lmax = 42 * FF_QP2LAMBDA; -+ p_context->mb_lmax = 42 * FF_QP2LAMBDA; -+ add_av_option_int( p_enc, &options, "lmax", p_context->mb_lmax ); - } - - } else { - if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) ) - { - p_context->qmin = 1; -- p_context->mb_lmin = p_context->lmin = FF_QP2LAMBDA; -+ p_context->mb_lmin = FF_QP2LAMBDA; -+ add_av_option_int( p_enc, &options, "lmin", p_context->mb_lmin ); - } - } - -@@ -845,7 +869,7 @@ int OpenEncoder( vlc_object_t *p_this ) - /* Make sure we get extradata filled by the encoder */ - p_context->extradata_size = 0; - p_context->extradata = NULL; -- p_context->flags |= CODEC_FLAG_GLOBAL_HEADER; -+ p_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; - - if( p_enc->i_threads >= 1) - p_context->thread_count = p_enc->i_threads; -@@ -854,7 +878,6 @@ int OpenEncoder( vlc_object_t *p_this ) - - int ret; - char *psz_opts = var_InheritString(p_enc, ENC_CFG_PREFIX "options"); -- AVDictionary *options = NULL; - if (psz_opts && *psz_opts) - options = vlc_av_get_options(psz_opts); - free(psz_opts); -@@ -982,7 +1005,7 @@ errmsg: - } - } - -- p_context->flags &= ~CODEC_FLAG_GLOBAL_HEADER; -+ p_context->flags &= ~AV_CODEC_FLAG_GLOBAL_HEADER; - - if( p_enc->fmt_in.i_cat == AUDIO_ES ) - { -@@ -992,7 +1015,7 @@ errmsg: - p_sys->i_sample_bytes = (p_enc->fmt_in.audio.i_bitspersample / 8); - p_sys->i_frame_size = p_context->frame_size > 1 ? - p_context->frame_size : -- FF_MIN_BUFFER_SIZE; -+ AV_INPUT_BUFFER_MIN_SIZE; - p_sys->i_buffer_out = av_samples_get_buffer_size(NULL, - p_sys->p_context->channels, p_sys->i_frame_size, - p_sys->p_context->sample_fmt, DEFAULT_ALIGN); -@@ -1359,7 +1382,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, int - } - - if(unlikely( ( (leftover + buffer_delay) < p_sys->i_buffer_out ) && -- !(p_sys->p_codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME ))) -+ !(p_sys->p_codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME ))) - { - msg_Dbg( p_enc, "No small last frame support, padding"); - size_t padding_size = p_sys->i_buffer_out - (leftover+buffer_delay); -diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c -index a720fd8..975ab5d 100644 ---- a/modules/codec/avcodec/video.c -+++ b/modules/codec/avcodec/video.c -@@ -251,11 +251,11 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - var_InheritInteger( p_dec, "avcodec-error-resilience" ); - - if( var_CreateGetBool( p_dec, "grayscale" ) ) -- p_sys->p_context->flags |= CODEC_FLAG_GRAY; -+ p_sys->p_context->flags |= AV_CODEC_FLAG_GRAY; - - /* ***** Output always the frames ***** */ - #if LIBAVCODEC_VERSION_CHECK(55, 23, 1, 40, 101) -- p_sys->p_context->flags |= CODEC_FLAG_OUTPUT_CORRUPT; -+ p_sys->p_context->flags |= AV_CODEC_FLAG_OUTPUT_CORRUPT; - #endif - - i_val = var_CreateGetInteger( p_dec, "avcodec-vismv" ); -@@ -268,7 +268,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF; - - if( var_CreateGetBool( p_dec, "avcodec-fast" ) ) -- p_sys->p_context->flags2 |= CODEC_FLAG2_FAST; -+ p_sys->p_context->flags2 |= AV_CODEC_FLAG2_FAST; - - /* ***** libavcodec frame skipping ***** */ - p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" ); -@@ -295,7 +295,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - p_sys->b_direct_rendering = false; - p_sys->i_direct_rendering_used = -1; - if( var_CreateGetBool( p_dec, "avcodec-dr" ) && -- (p_sys->p_codec->capabilities & CODEC_CAP_DR1) && -+ (p_sys->p_codec->capabilities & AV_CODEC_CAP_DR1) && - /* No idea why ... but this fixes flickering on some TSCC streams */ - p_sys->i_codec_id != AV_CODEC_ID_TSCC && p_sys->i_codec_id != AV_CODEC_ID_CSCD && - p_sys->i_codec_id != AV_CODEC_ID_CINEPAK && -@@ -308,16 +308,9 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, - - /* libavcodec doesn't properly release old pictures when frames are skipped */ - //if( p_sys->b_hurry_up ) p_sys->b_direct_rendering = false; -- if( p_sys->b_direct_rendering ) -- { -- msg_Dbg( p_dec, "trying to use direct rendering" ); -- p_sys->p_context->flags |= CODEC_FLAG_EMU_EDGE; -- } -- else -- { -- msg_Dbg( p_dec, "direct rendering is disabled" ); -- } -- -+#if !LIBAVCODEC_VERSION_CHECK(55, 32, 1, 48, 102) -+ p_sys->p_context->flags |= CODEC_FLAG_EMU_EDGE; -+#endif - p_sys->p_context->get_format = ffmpeg_GetFormat; - /* Always use our get_buffer wrapper so we can calculate the - * PTS correctly */ -@@ -484,7 +477,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) - } - - p_block = *pp_block; -- if(!p_block && !(p_sys->p_codec->capabilities & CODEC_CAP_DELAY) ) -+ if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) ) - return NULL; - - if( p_sys->b_delayed_open ) -@@ -621,7 +614,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) - } - else - { -- /* Return delayed frames if codec has CODEC_CAP_DELAY */ -+ /* Return delayed frames if codec has AV_CODEC_CAP_DELAY */ - pkt.data = NULL; - pkt.size = 0; - } --- -2.16.4 - diff --git a/media-video/vlc/patches/vlc-3.0.11.1.patchset b/media-video/vlc/patches/vlc-3.0.11.1.patchset new file mode 100644 index 000000000..6a26424e7 --- /dev/null +++ b/media-video/vlc/patches/vlc-3.0.11.1.patchset @@ -0,0 +1,2346 @@ +From 612b829b20f70ead98abe64b484166259644c0f9 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 20 Oct 2020 16:31:09 +1000 +Subject: Add Haiku support + + +diff --git a/bin/override.c b/bin/override.c +index fb4608c..9c7c085 100644 +--- a/bin/override.c ++++ b/bin/override.c +@@ -125,6 +125,8 @@ static void *getsym (const char *name) + * + * Some evil libraries modify the environment. We currently ignore the calls as + * they could crash the process. This may cause funny behaviour though. */ ++#ifndef __HAIKU__ ++//not working + int putenv (char *str) + { + if (override) +@@ -135,6 +137,7 @@ int putenv (char *str) + return CALL(putenv, str); + } + ++#endif + int setenv (const char *name, const char *value, int overwrite) + { + if (override) +diff --git a/compat/recvmsg.c b/compat/recvmsg.c +index c037ab9..bd8a886 100644 +--- a/compat/recvmsg.c ++++ b/compat/recvmsg.c +@@ -83,7 +83,7 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags) + return -1; + } + +-#elif defined __native_client__ ++#elif defined __native_client__ || defined __HAIKU__ + #include + #include + #include +diff --git a/compat/sendmsg.c b/compat/sendmsg.c +index 0f42e78..0ce5aef 100644 +--- a/compat/sendmsg.c ++++ b/compat/sendmsg.c +@@ -73,7 +73,7 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) + return -1; + } + +-#elif defined __native_client__ ++#elif defined __native_client__ || defined __HAIKU__ + #include + #include + #include +diff --git a/configure.ac b/configure.ac +index 1f74566..5b504a2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -46,7 +46,6 @@ dnl + AC_PROG_CC + AC_USE_SYSTEM_EXTENSIONS + VLC_PROG_CC_C11 +-AC_DEFINE([_FORTIFY_SOURCE], 2, [Define to 2 to get glibc warnings.]) + AC_DEFINE([_FILE_OFFSET_BITS], 64, [Define to 64 for large files support.]) + AH_TOP([ + #ifndef _REENTRANT +@@ -325,6 +324,13 @@ case "${host_os}" in + AC_LIBOBJ([recvmsg]) + AC_LIBOBJ([sendmsg]) + ;; ++ *haiku*) ++ SYS=haiku ++ VLC_ADD_LIBS([libvlccore libvlc vlc],[-lnetwork -lbe -lgnu]) ++# VLC_ADD_PLUGIN([haiku_aout]) ++# VLC_ADD_LIBS([haiku_aout],[-lmedia]) ++# VLC_ADD_CXXFLAGS([qt4],[-std=c++11]) ++ ;; + *) + SYS="${host_os}" + ;; +@@ -363,6 +369,7 @@ AS_IF([test "${SYS}" = "mingw32"],[ + + AM_CONDITIONAL(HAVE_LINUX, test "${SYS}" = "linux") + AM_CONDITIONAL(HAVE_OS2, test "${SYS}" = "os2") ++AM_CONDITIONAL(HAVE_HAIKU, test "${SYS}" = "haiku") + + AM_CONDITIONAL(HAVE_DARWIN, test "${SYS}" = "darwin") + AM_CONDITIONAL(HAVE_IOS, test "${HAVE_IOS}" = "1") +@@ -632,7 +639,7 @@ need_libc=false + + dnl Check for usual libc functions + AC_CHECK_FUNCS([accept4 daemon fcntl flock fstatvfs fork getenv getmntent_r getpwuid_r isatty lstat memalign mkostemp mmap newlocale open_memstream openat pipe2 pread posix_fadvise posix_madvise posix_memalign setlocale stricmp strnicmp strptime uselocale]) +-AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf]) ++AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp pathconf]) + AC_REPLACE_FUNCS([gettimeofday]) + AC_CHECK_FUNC(fdatasync,, + [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) +@@ -972,8 +979,10 @@ AC_SEARCH_LIBS(connect, [socket], [ + AS_IF([test "${SYS}" = "mingw32"], [ + SOCKET_LIBS="-lws2_32 -liphlpapi" + ]) ++ AS_IF([test "${SYS}" = "haiku"], [ ++ SOCKET_LIBS="-lnetwork" ++ ]) + ]) +- + AC_SEARCH_LIBS([inet_pton], [nsl], [ + AS_IF([test "$ac_cv_search_inet_pton" != "none required"], [ + SOCKET_LIBS="$ac_cv_search_inet_pton $SOCKET_LIBS" +@@ -1186,9 +1195,12 @@ AH_BOTTOM([ + AS_IF([test "${ac_cv_c_omit_frame_pointer}" = "no"], [VLC_RESTORE_FLAGS]) + ]) + +- AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong]) +- AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong], [CXXFLAGS]) +- dnl Win32 requires linking to ssp for stack-protection ++ AS_IF([test "${SYS}" != "haiku"], [ ++ AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong]) ++ AX_APPEND_COMPILE_FLAGS([-fstack-protector-strong], [CXXFLAGS]) ++ dnl Win32 requires linking to ssp for stack-protection ++ ]) ++ + AS_IF([test "${SYS}" = "mingw32"], [ + LDFLAGS="${LDFLAGS} -lssp" + AS_IF([test "${vlc_winstore_app}" != 1], [LDFLAGS="${LDFLAGS} -ladvapi32"]) +@@ -1712,7 +1724,7 @@ then + fi + AC_ARG_VAR([LUAC], [LUA byte compiler]) + AS_IF([test -z "$LUAC"], [ +- AC_CHECK_TOOL(LUAC, [luac], [false]) ++ AC_CHECK_TOOL(LUAC, [luac5.2], [false]) + ]) + AS_IF([test "${LUAC}" = "false"], [ + AC_MSG_ERROR([Could not find the LUA byte compiler.]) +@@ -2644,7 +2656,7 @@ then + VLC_SAVE_FLAGS + CPPFLAGS="${CPPFLAGS} ${POSTPROC_CFLAGS}" + CFLAGS="${CFLAGS} ${POSTPROC_CFLAGS}" +- AC_CHECK_HEADERS(postproc/postprocess.h) ++ AC_CHECK_HEADERS(libpostproc/postprocess.h) + VLC_ADD_PLUGIN([postproc]) + VLC_RESTORE_FLAGS + ],[ +@@ -3122,7 +3134,7 @@ dnl X C Bindings modules + dnl + AC_ARG_ENABLE(xcb, + [ --enable-xcb X11 support with XCB (default enabled)],, [ +- AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin"], [ ++ AS_IF([test "${SYS}" != "mingw32" -a "${SYS}" != "darwin" -a "${SYS}" != "haiku"], [ + enable_xcb="yes" + ], [ + enable_xcb="no" +diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h +index 9b9d008..ed853e8 100644 +--- a/include/vlc_fixups.h ++++ b/include/vlc_fixups.h +@@ -103,7 +103,7 @@ typedef struct + + #if !defined (HAVE_GETDELIM) || \ + !defined (HAVE_GETPID) || \ +- !defined (HAVE_SWAB) ++ !defined (HAVE_SWAB) || defined(__HAIKU__) + # include /* ssize_t, pid_t */ + #endif + +@@ -373,6 +373,7 @@ void swab (const void *, void *, ssize_t); + #endif + + /* Socket stuff */ ++#ifndef __HAIKU__ + #ifndef HAVE_INET_PTON + # ifndef _WIN32 + # include +@@ -382,6 +383,7 @@ typedef int socklen_t; + int inet_pton(int, const char *, void *); + const char *inet_ntop(int, const void *, char *, socklen_t); + #endif ++#endif + + /* NaCl has a broken netinet/tcp.h, so TCP_NODELAY is not set */ + #if defined(__native_client__) && !defined( HAVE_NETINET_TCP_H ) +@@ -415,6 +417,8 @@ struct pollfd; + int poll (struct pollfd *, unsigned, int); + #endif + ++// or these ++#ifndef __HAIKU__ + #ifndef HAVE_IF_NAMEINDEX + #include + # ifndef HAVE_STRUCT_IF_NAMEINDEX +@@ -430,6 +434,7 @@ struct if_nameindex + # define if_nameindex() (errno = ENOBUFS, NULL) + # define if_freenameindex(list) (void)0 + #endif ++#endif + + #ifndef HAVE_STRUCT_TIMESPEC + struct timespec { +diff --git a/include/vlc_threads.h b/include/vlc_threads.h +index 960d458..0077000 100644 +--- a/include/vlc_threads.h ++++ b/include/vlc_threads.h +@@ -220,7 +220,13 @@ typedef pthread_cond_t vlc_cond_t; + #define VLC_STATIC_COND PTHREAD_COND_INITIALIZER + typedef semaphore_t vlc_sem_t; + typedef pthread_rwlock_t vlc_rwlock_t; ++// Haiku bug #8798 ++#ifdef __HAIKU__ ++#define VLC_STATIC_RWLOCK \ ++ { VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 } ++#else + #define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER ++#endif + typedef pthread_key_t vlc_threadvar_t; + typedef struct vlc_timer *vlc_timer_t; + +@@ -306,7 +312,13 @@ typedef pthread_rwlock_t vlc_rwlock_t; + /** + * Static initializer for (static) read/write lock. + */ ++// Haiku bug #8798 ++#ifdef __HAIKU__ ++#define VLC_STATIC_RWLOCK \ ++ { VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 } ++#else + #define VLC_STATIC_RWLOCK PTHREAD_RWLOCK_INITIALIZER ++#endif + + /** + * Thread-local key handle. +diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h +index 36f1227..e31d87d 100644 +--- a/include/vlc_vout_display.h ++++ b/include/vlc_vout_display.h +@@ -81,7 +81,7 @@ enum { + * Initial/Current configuration for a vout_display_t + */ + typedef struct { +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + bool is_fullscreen VLC_DEPRECATED; /* Is the display fullscreen */ + #endif + +@@ -148,7 +148,7 @@ enum { + */ + VOUT_DISPLAY_RESET_PICTURES, + +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + /* Ask the module to acknowledge/refuse the fullscreen state change after + * being requested (externally or by VOUT_DISPLAY_EVENT_FULLSCREEN */ + VOUT_DISPLAY_CHANGE_FULLSCREEN VLC_DEPRECATED_ENUM, /* bool fs */ +@@ -196,7 +196,7 @@ enum { + /* */ + VOUT_DISPLAY_EVENT_PICTURES_INVALID, /* The buffer are now invalid and need to be changed */ + +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + VOUT_DISPLAY_EVENT_FULLSCREEN, + VOUT_DISPLAY_EVENT_WINDOW_STATE, + #endif +@@ -369,7 +369,7 @@ static inline void vout_display_SendEventKey(vout_display_t *vd, int key) + { + vout_display_SendEvent(vd, VOUT_DISPLAY_EVENT_KEY, key); + } +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + static inline void vout_display_SendEventFullscreen(vout_display_t *vd, bool is_fullscreen, + bool is_window_fullscreen) + { +diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h +index edc94fe..88eee0c 100644 +--- a/include/vlc_vout_window.h ++++ b/include/vlc_vout_window.h +@@ -53,6 +53,7 @@ enum vout_window_type { + VOUT_WINDOW_TYPE_NSOBJECT /**< MacOS X view */, + VOUT_WINDOW_TYPE_ANDROID_NATIVE /**< Android native window */, + VOUT_WINDOW_TYPE_WAYLAND /**< Wayland surface */, ++ VOUT_WINDOW_TYPE_HAIKU /**< Haiku */, + }; + + /** +@@ -159,6 +160,7 @@ struct vout_window_t { + void *nsobject; /**< Mac OSX view object */ + void *anativewindow; /**< Android native window */ + struct wl_surface *wl; /**< Wayland surface (client pointer) */ ++ void *haikuwindow; /**< Haiku */ + } handle; + + /** Display server (mandatory) +diff --git a/include/vlc_vout_wrapper.h b/include/vlc_vout_wrapper.h +index b808f55..4f918d5 100644 +--- a/include/vlc_vout_wrapper.h ++++ b/include/vlc_vout_wrapper.h +@@ -62,7 +62,7 @@ static inline void vout_display_Display(vout_display_t *vd, + */ + typedef struct { + vout_display_cfg_t cfg; +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + unsigned wm_state; + #endif + vlc_rational_t sar; +diff --git a/modules/audio_output/Makefile.am b/modules/audio_output/Makefile.am +index 13cf5ba..c60ea48 100644 +--- a/modules/audio_output/Makefile.am ++++ b/modules/audio_output/Makefile.am +@@ -93,6 +93,12 @@ if HAVE_SNDIO + aout_LTLIBRARIES += libsndio_plugin.la + endif + ++libhaiku_aout_plugin_la_SOURCES = audio_output/haiku.cpp ++libhaiku_aout_plugin_la_LIBADD = -lmedia ++if HAVE_HAIKU ++aout_LTLIBRARIES += libhaiku_aout_plugin.la ++endif ++ + libwaveout_plugin_la_SOURCES = audio_output/waveout.c \ + audio_output/windows_audio_common.h + libwaveout_plugin_la_LIBADD = -lwinmm +diff --git a/modules/audio_output/haiku.cpp b/modules/audio_output/haiku.cpp +new file mode 100644 +index 0000000..025c285 +--- /dev/null ++++ b/modules/audio_output/haiku.cpp +@@ -0,0 +1,394 @@ ++/***************************************************************************** ++ * haiku.cpp : Haiku MediaKit audio output plugin for vlc ++ ***************************************************************************** ++ * Copyright (C) 2010-2013 VLC authors and VideoLAN ++ * Copyright (C) 2020 Gerasim Troeglazov (3dEyes**) ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; either version 2.1 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. ++ *****************************************************************************/ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define FRAME_SIZE 2048 ++#define AUDIO_BUFFER_SIZE_IN_SECONDS 1.0 ++ ++struct audio_buffer_t ++{ ++ uint8_t *data; ++ int read_pos; ++ int write_pos; ++ int length; ++ int size; ++ vlc_mutex_t mutex; ++ vlc_cond_t cond; ++}; ++ ++typedef struct audio_buffer_t audio_buffer_t; ++ ++struct aout_sys_t ++{ ++ audio_buffer_t* buffer; ++ BSoundPlayer* player; ++ bool mute; ++ float volume; ++ audio_sample_format_t format; ++}; ++ ++static int Open ( vlc_object_t * ); ++static void Close ( vlc_object_t * ); ++static void Play ( audio_output_t *_p_aout, block_t *block ); ++static void Pause ( audio_output_t *, bool, mtime_t ); ++static void Flush ( audio_output_t *, bool ); ++static int TimeGet ( audio_output_t *, mtime_t *restrict ); ++static int VolumeSet(audio_output_t* aout, float volume); ++static int MuteSet (audio_output_t* aout, bool mute); ++ ++static void PlayBuffer(void* cookie, void* buffer, size_t size, const media_raw_audio_format &format); ++ ++static int CreateBuffer ( audio_output_t *, int ); ++static void DestroyBuffer( audio_output_t * ); ++static int ReadBuffer ( audio_output_t *, uint8_t *, int ); ++static int WriteBuffer ( audio_output_t *, uint8_t *, int ); ++ ++vlc_module_begin () ++ set_shortname(N_("Haiku audio")) ++ set_description(N_("Haiku Mediakit audio output")) ++ set_capability( "audio output", 100 ) ++ set_category( CAT_AUDIO ) ++ set_subcategory( SUBCAT_AUDIO_AOUT ) ++ set_callbacks( Open, Close ) ++ add_shortcut("haiku") ++vlc_module_end () ++ ++ ++static int Start ( audio_output_t *p_aout, audio_sample_format_t *fmt ) ++{ ++ aout_sys_t *p_sys = p_aout->sys; ++ media_raw_audio_format hformat; ++ ++ int i_nb_channels; ++ int i_bytes_per_frame; ++ audio_sample_format_t format = *fmt; ++ ++ if( aout_FormatNbChannels( fmt ) == 0 ) ++ return VLC_EGENERIC; ++ ++ i_nb_channels = aout_FormatNbChannels( &format ); ++ ++ if ( i_nb_channels >= 2 ) { ++ i_nb_channels = 2; ++ format.i_physical_channels = AOUT_CHANS_STEREO; ++ } else { ++ format.i_physical_channels = AOUT_CHAN_CENTER; ++ } ++ ++ format.i_format = VLC_CODEC_S16N; ++ ++ aout_FormatPrepare( &format ); ++ ++ i_bytes_per_frame = format.i_bytes_per_frame; ++ ++ hformat.frame_rate = fmt->i_rate; ++ hformat.channel_count = i_nb_channels; ++ hformat.format = media_raw_audio_format::B_AUDIO_SHORT; ++ hformat.byte_order = B_MEDIA_HOST_ENDIAN; ++ hformat.buffer_size = FRAME_SIZE * i_bytes_per_frame; ++ ++ p_sys->player = new BSoundPlayer(&hformat, "VLC Media Player", PlayBuffer, NULL, p_aout); ++ ++ if (p_sys->player->InitCheck() != B_OK) { ++ msg_Err( p_aout, "cannot initialize BSoundPlayer"); ++ delete p_sys->player; ++ free(p_sys); ++ return VLC_EGENERIC; ++ } ++ ++ format.channel_type = AUDIO_CHANNEL_TYPE_BITMAP; ++ p_sys->format = *fmt = format; ++ ++ p_aout->time_get = TimeGet; ++ p_aout->play = Play; ++ p_aout->pause = Pause; ++ p_aout->flush = Flush; ++ ++ CreateBuffer( p_aout, AUDIO_BUFFER_SIZE_IN_SECONDS * format.i_rate * format.i_bytes_per_frame ); ++ ++ VolumeSet(p_aout, 1.0 ); ++ ++ p_sys->player->Start(); ++ ++ return VLC_SUCCESS; ++} ++ ++static void Play (audio_output_t *p_aout, block_t *block) ++{ ++ aout_sys_t *p_sys = p_aout->sys; ++ ++ WriteBuffer( p_aout, block->p_buffer, block->i_buffer ); ++ ++ p_sys->player->SetHasData(true); ++ ++ block_Release( block ); ++} ++ ++static void Stop ( audio_output_t *p_aout ) ++{ ++ aout_sys_t *p_sys = p_aout->sys; ++ ++ p_sys->player->SetHasData(false); ++ p_sys->player->Stop(true, false); ++ delete p_sys->player; ++ p_sys->player = NULL; ++ ++ DestroyBuffer( p_aout ); ++} ++ ++static void PlayBuffer(void* cookie, void* p_buffer, size_t i_buf_size, const media_raw_audio_format &format) ++{ ++ VLC_UNUSED( format ); ++ ++ audio_output_t *p_aout = (audio_output_t *)cookie; ++ size_t i_len; ++ ++ i_len = ReadBuffer( p_aout, (uint8_t*)p_buffer, i_buf_size ); ++ if(i_len < i_buf_size ) ++ memset(( uint8_t * )p_buffer + i_len, 0, i_buf_size - i_len ); ++} ++ ++static int Open (vlc_object_t *obj) ++{ ++ audio_output_t *aout = (audio_output_t *)obj; ++ aout_sys_t *sys = (aout_sys_t*)calloc( 1, sizeof( aout_sys_t ) ); ++ ++ if( unlikely( sys == NULL )) ++ return VLC_ENOMEM; ++ ++ aout->sys = sys; ++ aout->start = Start; ++ aout->stop = Stop; ++ aout->mute_set = MuteSet; ++ aout->volume_set = VolumeSet; ++ ++ sys->player = NULL; ++ ++ return VLC_SUCCESS; ++} ++ ++static void Close( vlc_object_t *obj ) ++{ ++ audio_output_t *aout = (audio_output_t *)obj; ++ aout_sys_t *sys = aout->sys; ++ ++ free(sys); ++} ++ ++static void Pause( audio_output_t *aout, bool pause, mtime_t date ) ++{ ++ VLC_UNUSED( date ); ++ ++ aout_sys_t *sys = aout->sys; ++ ++ if (sys->player == NULL) ++ return; ++ ++ if (pause) ++ sys->player->SetHasData(false); ++ else ++ sys->player->SetHasData(true); ++} ++ ++static void Flush( audio_output_t *aout, bool drain ) ++{ ++ audio_buffer_t *buffer = aout->sys->buffer; ++ ++ vlc_mutex_lock( &buffer->mutex ); ++ ++ if( drain ) { ++ while( buffer->length > 0 ) ++ vlc_cond_wait( &buffer->cond, &buffer->mutex ); ++ } else { ++ buffer->read_pos = buffer->write_pos; ++ buffer->length = 0; ++ } ++ ++ vlc_mutex_unlock( &buffer->mutex ); ++} ++ ++static int TimeGet( audio_output_t *aout, mtime_t *restrict delay ) ++{ ++ aout_sys_t *sys = aout->sys; ++ audio_sample_format_t *format = &sys->format; ++ audio_buffer_t *buffer = sys->buffer; ++ ++ vlc_mutex_lock( &buffer->mutex ); ++ ++ *delay = ( buffer->length / format->i_bytes_per_frame ) * CLOCK_FREQ / ++ format->i_rate; ++ ++ vlc_mutex_unlock( &buffer->mutex ); ++ ++ return 0; ++} ++ ++static int VolumeSet(audio_output_t* aout, float volume) ++{ ++ aout_sys_t* sys = (aout_sys_t*)aout->sys; ++ ++ if (sys->player == NULL) ++ return VLC_EGENERIC; ++ ++ sys->volume = volume; ++ aout_VolumeReport(aout, volume); ++ ++ float dbVol = lroundf(125.f * log10f(volume)); ++ ++ if (sys->mute == false) ++ sys->player->SetVolumeDB(dbVol); ++ ++ return VLC_SUCCESS; ++} ++ ++static int MuteSet(audio_output_t* aout, bool mute) ++{ ++ aout_sys_t* sys = (aout_sys_t*)aout->sys; ++ ++ if (sys->player == NULL) ++ return VLC_EGENERIC; ++ ++ sys->mute = mute; ++ aout_MuteReport(aout, mute); ++ ++ float dbVol = lroundf(125.f * log10f(sys->volume)); ++ ++ if (mute == false) ++ sys->player->SetVolumeDB(dbVol); ++ else ++ sys->player->SetVolume(0.0); ++ ++ return VLC_SUCCESS; ++} ++ ++static int CreateBuffer( audio_output_t *aout, int size ) ++{ ++ audio_buffer_t *buffer; ++ ++ buffer = (audio_buffer_t*)calloc( 1, sizeof( *buffer )); ++ if( !buffer ) ++ return -1; ++ ++ buffer->data = (uint8_t*)malloc( size ); ++ if( !buffer->data ) { ++ free( buffer ); ++ return -1; ++ } ++ ++ buffer->size = size; ++ ++ vlc_mutex_init( &buffer->mutex ); ++ vlc_cond_init( &buffer->cond ); ++ ++ aout->sys->buffer = buffer; ++ ++ return 0; ++} ++ ++static void DestroyBuffer( audio_output_t *aout ) ++{ ++ audio_buffer_t *buffer = aout->sys->buffer; ++ ++ vlc_mutex_destroy( &buffer->mutex ); ++ vlc_cond_destroy( &buffer->cond ); ++ ++ free( buffer->data ); ++ free( buffer ); ++} ++ ++static int ReadBuffer( audio_output_t *aout, uint8_t *data, int size ) ++{ ++ audio_buffer_t *buffer = aout->sys->buffer; ++ int len; ++ int remain_len = 0; ++ ++ vlc_mutex_lock( &buffer->mutex ); ++ ++ len = MIN( buffer->length, size ); ++ if( buffer->read_pos + len > buffer->size ) { ++ remain_len = len; ++ len = buffer->size - buffer->read_pos; ++ remain_len -= len; ++ } ++ ++ memcpy( data, buffer->data + buffer->read_pos, len ); ++ if( remain_len ) ++ memcpy( data + len, buffer->data, remain_len ); ++ ++ len += remain_len; ++ ++ buffer->read_pos += len; ++ buffer->read_pos %= buffer->size; ++ ++ buffer->length -= len; ++ ++ vlc_cond_signal( &buffer->cond ); ++ ++ vlc_mutex_unlock( &buffer->mutex ); ++ ++ return len; ++} ++ ++static int WriteBuffer( audio_output_t *aout, uint8_t *data, int size ) ++{ ++ audio_buffer_t *buffer = aout->sys->buffer; ++ int len; ++ int remain_len = 0; ++ ++ vlc_mutex_lock( &buffer->mutex ); ++ ++ while( buffer->length + size > buffer->size ) ++ vlc_cond_wait( &buffer->cond, &buffer->mutex ); ++ ++ len = size; ++ if( buffer->write_pos + len > buffer->size ) { ++ remain_len = len; ++ len = buffer->size - buffer->write_pos; ++ remain_len -= len; ++ } ++ ++ memcpy( buffer->data + buffer->write_pos, data, len ); ++ if( remain_len ) ++ memcpy( buffer->data, data + len, remain_len ); ++ ++ buffer->write_pos += size; ++ buffer->write_pos %= buffer->size; ++ ++ buffer->length += size; ++ ++ vlc_mutex_unlock( &buffer->mutex ); ++ ++ return size; ++} +diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h +index d386444..5ed96c1 100644 +--- a/modules/codec/avcodec/avcommon_compat.h ++++ b/modules/codec/avcodec/avcommon_compat.h +@@ -78,6 +78,46 @@ + # define FF_MAX_B_FRAMES 16 // FIXME: remove this + #endif + ++#ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT ++# define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT ++#endif ++#ifndef AV_CODEC_FLAG_GRAY ++# define AV_CODEC_FLAG_GRAY CODEC_FLAG_GRAY ++#endif ++#ifndef AV_CODEC_FLAG_DR1 ++# define AV_CODEC_FLAG_DR1 CODEC_FLAG_DR1 ++#endif ++#ifndef AV_CODEC_FLAG_DELAY ++# define AV_CODEC_FLAG_DELAY CODEC_FLAG_DELAY ++#endif ++#ifndef AV_CODEC_FLAG2_FAST ++# define AV_CODEC_FLAG2_FAST CODEC_FLAG2_FAST ++#endif ++#ifndef FF_INPUT_BUFFER_PADDING_SIZE ++# define FF_INPUT_BUFFER_PADDING_SIZE AV_INPUT_BUFFER_PADDING_SIZE ++#endif ++#ifndef AV_CODEC_FLAG_INTERLACED_DCT ++# define AV_CODEC_FLAG_INTERLACED_DCT CODEC_FLAG_INTERLACED_DCT ++#endif ++#ifndef AV_CODEC_FLAG_INTERLACED_ME ++# define AV_CODEC_FLAG_INTERLACED_ME CODEC_FLAG_INTERLACED_ME ++#endif ++#ifndef AV_CODEC_FLAG_GLOBAL_HEADER ++# define AV_CODEC_FLAG_GLOBAL_HEADER CODEC_FLAG_GLOBAL_HEADER ++#endif ++#ifndef AV_CODEC_FLAG_LOW_DELAY ++# define AV_CODEC_FLAG_LOW_DELAY CODEC_FLAG_LOW_DELAY ++#endif ++#ifndef AV_CODEC_CAP_SMALL_LAST_FRAME ++# define AV_CODEC_CAP_SMALL_LAST_FRAME CODEC_CAP_SMALL_LAST_FRAME ++#endif ++#ifndef AV_INPUT_BUFFER_MIN_SIZE ++# define AV_INPUT_BUFFER_MIN_SIZE FF_MIN_BUFFER_SIZE ++#endif ++#ifndef FF_MAX_B_FRAMES ++# define FF_MAX_B_FRAMES 16 // FIXME: remove this ++#endif ++ + #endif /* HAVE_LIBAVCODEC_AVCODEC_H */ + + #ifdef HAVE_LIBAVUTIL_AVUTIL_H +diff --git a/modules/gui/qt/components/controller.cpp b/modules/gui/qt/components/controller.cpp +index f91d748..56918a2 100644 +--- a/modules/gui/qt/components/controller.cpp ++++ b/modules/gui/qt/components/controller.cpp +@@ -229,7 +229,11 @@ void AbstractController::createAndAddWidget( QBoxLayout *controlLayout_, + + QWidget *AbstractController::createWidget( buttonType_e button, int options ) + { ++#ifdef __HAIKU__ ++ bool b_flat = true; // Flat for Haiku ++#else + bool b_flat = options & WIDGET_FLAT; ++#endif + bool b_big = options & WIDGET_BIG; + bool b_shiny = options & WIDGET_SHINY; + bool b_special = false; +@@ -731,10 +735,10 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, + QString line2 = getSettings()->value( "MainWindow/MainToolbar2", MAIN_TB2_DEFAULT ) + .toString(); + parseAndCreate( line2, controlLayout2 ); +- ++#ifndef __HAIKU__ + grip = new QSizeGrip( this ); + controlLayout2->addWidget( grip, 0, Qt::AlignBottom|Qt::AlignRight ); +- ++#endif + if( !b_advancedVisible && advControls ) advControls->hide(); + + controlLayout->addLayout( controlLayout1 ); +diff --git a/modules/gui/qt/components/controller.hpp b/modules/gui/qt/components/controller.hpp +index 8650029..40be498 100644 +--- a/modules/gui/qt/components/controller.hpp ++++ b/modules/gui/qt/components/controller.hpp +@@ -210,17 +210,17 @@ public: + /* p_intf, advanced control visible or not, blingbling or not */ + ControlsWidget( intf_thread_t *_p_i, bool b_advControls, + QWidget *_parent = 0 ); +- ++#ifndef __HAIKU__ + void setGripVisible( bool b_visible ) + { grip->setVisible( b_visible ); } +- ++#endif + protected: + friend class MainInterface; + + bool b_advancedVisible; + + private: +- QSizeGrip *grip; ++ QWidget *grip; + + protected slots: + void toggleAdvanced(); +diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp +index bcf65d2..ff2babd 100644 +--- a/modules/gui/qt/components/interface_widgets.cpp ++++ b/modules/gui/qt/components/interface_widgets.cpp +@@ -158,6 +158,9 @@ bool VideoWidget::request( struct vout_window_t *p_wnd ) + case VOUT_WINDOW_TYPE_HWND: + p_wnd->handle.hwnd = (void *)stable->winId(); + break; ++ case VOUT_WINDOW_TYPE_HAIKU: ++ p_wnd->handle.haikuwindow = (void *)stable->winId(); ++ break; + case VOUT_WINDOW_TYPE_NSOBJECT: + p_wnd->handle.nsobject = (void *)stable->winId(); + break; +diff --git a/modules/gui/qt/components/playlist/views.cpp b/modules/gui/qt/components/playlist/views.cpp +index 24db9d9..73c1779 100644 +--- a/modules/gui/qt/components/playlist/views.cpp ++++ b/modules/gui/qt/components/playlist/views.cpp +@@ -27,6 +27,7 @@ + #include "input_manager.hpp" /* THEMIM */ + + #include ++#include + #include + #include + #include +diff --git a/modules/gui/qt/dialogs/plugins.cpp b/modules/gui/qt/dialogs/plugins.cpp +index d233382..69728eb 100644 +--- a/modules/gui/qt/dialogs/plugins.cpp ++++ b/modules/gui/qt/dialogs/plugins.cpp +@@ -53,6 +53,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp +index bb5dad8..f9dc8fe 100644 +--- a/modules/gui/qt/main_interface.cpp ++++ b/modules/gui/qt/main_interface.cpp +@@ -127,7 +127,13 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) + setWindowRole( "vlc-main" ); + setWindowIcon( QApplication::windowIcon() ); + setWindowOpacity( var_InheritFloat( p_intf, "qt-opacity" ) ); +- ++#ifdef __HAIKU__ ++ setWindowFlags(Qt::Window ++ | Qt::MSWindowsFixedSizeDialogHint ++ | Qt::WindowMinimizeButtonHint ++ | Qt::WindowCloseButtonHint ++ | Qt::CustomizeWindowHint); ++#endif + /* Does the interface resize to video size or the opposite */ + b_autoresize = var_InheritBool( p_intf, "qt-video-autoresize" ); + +@@ -144,7 +150,11 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) + settings = getSettings(); + + /* */ ++#ifndef __HAIKU__ + b_plDocked = getSettings()->value( "MainWindow/pl-dock-status", true ).toBool(); ++#else ++ b_plDocked = false; ++#endif + + /* Should the UI stays on top of other windows */ + b_interfaceOnTop = var_InheritBool( p_intf, "video-on-top" ); +@@ -318,6 +328,17 @@ void MainInterface::computeMinimumSize() + minWidth += controls->sizeHint().width(); + + setMinimumWidth( minWidth ); ++#ifdef __HAIKU__ ++ int minHeight = 50; ++ minHeight += controls->sizeHint().height(); ++ if( statusBar()->isVisible() ) ++ minHeight += statusBar()->sizeHint().height(); ++ if( resumePanel->isVisible() ) ++ minHeight += resumePanel->sizeHint().height(); ++ setMinimumHeight(minHeight); ++ setMaximumHeight(minHeight); ++ setMaximumWidth(minWidth); ++#endif + } + + /***************************** +@@ -411,6 +432,9 @@ void MainInterface::showResumePanel( int64_t _time ) { + if( !isFullScreen() && !isMaximized() && !b_isWindowTiled ) + resizeWindow( width(), height() + resumePanel->height() ); + resumePanel->setVisible(true); ++#ifdef __HAIKU__ ++ computeMinimumSize(); ++#endif + resumeTimer->start(); + } + } +@@ -423,6 +447,9 @@ void MainInterface::hideResumePanel() + resizeWindow( width(), height() - resumePanel->height() ); + resumePanel->hide(); + resumeTimer->stop(); ++#ifdef __HAIKU__ ++ computeMinimumSize(); ++#endif + } + } + +@@ -463,7 +490,7 @@ void MainInterface::createMainWidget( QSettings *creationSettings ) + createResumePanel( main ); + /* */ + stackCentralW = new QVLCStackedWidget( main ); +- ++#ifndef __HAIKU__ + /* Bg Cone */ + if ( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY + && var_InheritBool( p_intf, "qt-icon-change" ) ) +@@ -493,7 +520,9 @@ void MainInterface::createMainWidget( QSettings *creationSettings ) + creationSettings->value( "MainWindow/bgSize", QSize( 600, 0 ) ).toSize(); + /* Resize even if no-auto-resize, because we are at creation */ + resizeStack( stackWidgetsSizes[bgWidget].width(), stackWidgetsSizes[bgWidget].height() ); +- ++#else ++ mainLayout->insertWidget( 1, stackCentralW ); ++#endif + /* Create the CONTROLS Widget */ + controls = new ControlsWidget( p_intf, + creationSettings->value( "MainWindow/adv-controls", false ).toBool(), this ); +@@ -1202,6 +1231,9 @@ void MainInterface::toggleMinimalView( bool b_minimal ) + void MainInterface::toggleAdvancedButtons() + { + controls->toggleAdvanced(); ++#ifdef __HAIKU__ ++ computeMinimumSize(); ++#endif + // if( fullscreenControls ) fullscreenControls->toggleAdvanced(); + } + +@@ -1223,7 +1255,11 @@ void MainInterface::setStatusBarVisibility( bool b_visible ) + { + statusBar()->setVisible( b_visible ); + b_statusbarVisible = b_visible; ++#ifdef __HAIKU__ ++ computeMinimumSize(); ++#else + if( controls ) controls->setGripVisible( !b_statusbarVisible ); ++#endif + } + + +@@ -1294,9 +1330,9 @@ void MainInterface::createSystray() + { + QIcon iconVLC; + if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) +- iconVLC = QIcon::fromTheme( "vlc-xmas", QIcon( ":/logo/vlc128-xmas.png" ) ); ++ iconVLC = QIcon( ":/logo/vlc128-xmas.png" ); + else +- iconVLC = QIcon::fromTheme( "vlc", QIcon( ":/logo/vlc256.png" ) ); ++ iconVLC = QIcon( ":/logo/vlc256.png" ); + sysTray = new QSystemTrayIcon( iconVLC, this ); + sysTray->setToolTip( qtr( "VLC media player" )); + +diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp +index aea98c9..c946f9b 100644 +--- a/modules/gui/qt/menus.cpp ++++ b/modules/gui/qt/menus.cpp +@@ -486,7 +486,7 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac + #endif + qtr( "Play&list" ), mi, + SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) ); +- ++#ifndef __HAIKU__ + /* Docked Playlist */ + action = menu->addAction( qtr( "Docked Playlist" ) ); + action->setCheckable( true ); +@@ -495,7 +495,7 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac + + if( mi->getPlaylistView() ) + menu->addMenu( StandardPLPanel::viewSelectionMenu( mi->getPlaylistView() ) ); +- ++#endif + menu->addSeparator(); + + action = menu->addAction( qtr( "Always on &top" ) ); +@@ -504,7 +504,7 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac + CONNECT( action, triggered( bool ), mi, setInterfaceAlwaysOnTop( bool ) ); + + menu->addSeparator(); +- ++#ifndef __HAIKU__ + /* Minimal View */ + action = menu->addAction( qtr( "Mi&nimal Interface" ) ); + action->setShortcut( qtr( "Ctrl+H" ) ); +@@ -529,7 +529,7 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac + action->setCheckable( true ); + if( mi->getControlsVisibilityStatus() & MainInterface::CONTROLS_ADVANCED ) + action->setChecked( true ); +- ++#endif + action = menu->addAction( qtr( "Status Bar" ) ); + action->setCheckable( true ); + action->setChecked( mi->statusBar()->isVisible() ); +diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp +index ab912fd..e3c9ed8 100644 +--- a/modules/gui/qt/qt.cpp ++++ b/modules/gui/qt/qt.cpp +@@ -604,6 +604,8 @@ static void *ThreadPlatform( void *obj, char *platform_name ) + else if( platform == qfu("windows") ) + p_sys->voutWindowType = VOUT_WINDOW_TYPE_HWND; + else if( platform == qfu("cocoa" ) ) ++ p_sys->voutWindowType = VOUT_WINDOW_TYPE_HAIKU; ++ else if( platform == qfu("haiku" ) ) + p_sys->voutWindowType = VOUT_WINDOW_TYPE_NSOBJECT; + else + msg_Err( p_intf, "unknown Qt platform: %s", qtu(platform) ); +diff --git a/modules/gui/qt/util/timetooltip.cpp b/modules/gui/qt/util/timetooltip.cpp +index 81789df..ce5f87c 100644 +--- a/modules/gui/qt/util/timetooltip.cpp ++++ b/modules/gui/qt/util/timetooltip.cpp +@@ -28,7 +28,11 @@ + #include + #include + ++#ifdef __HAIKU__ ++#define TIP_HEIGHT 0 ++#else + #define TIP_HEIGHT 5 ++#endif + + TimeTooltip::TimeTooltip( QWidget *parent ) : + QWidget( parent ) +diff --git a/modules/gui/qt/util/timetooltip.hpp b/modules/gui/qt/util/timetooltip.hpp +index 6a1329e..9f50b18 100644 +--- a/modules/gui/qt/util/timetooltip.hpp ++++ b/modules/gui/qt/util/timetooltip.hpp +@@ -25,6 +25,7 @@ + #include "qt.hpp" + + #include ++#include + + class TimeTooltip : public QWidget + { +diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am +index 78c06cf..0ae24ec 100644 +--- a/modules/video_output/Makefile.am ++++ b/modules/video_output/Makefile.am +@@ -356,6 +356,13 @@ if HAVE_WIN32 + vout_LTLIBRARIES += libdrawable_plugin.la + endif + ++### HAIKU ### ++libhaiku_vout_plugin_la_SOURCES = video_output/haiku.cpp ++libhaiku_vout_plugin_la_LIBADD = -lbe ++if HAVE_HAIKU ++vout_LTLIBRARIES += libhaiku_vout_plugin.la ++endif ++ + ### OS/2 ### + if HAVE_OS2 + vout_LTLIBRARIES += libdrawable_plugin.la +@@ -422,9 +429,11 @@ libcaca_plugin_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) + libcaca_plugin_la_LIBADD = libevent_thread.la $(CACA_LIBS) + if !HAVE_WIN32 + if !HAVE_DARWIN ++if !HAVE_HAIKU + libcaca_plugin_la_LIBADD += $(X_LIBS) $(X_PRE_LIBS) -lX11 + endif + endif ++endif + libcaca_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' + EXTRA_LTLIBRARIES += libcaca_plugin.la + vout_LTLIBRARIES += $(LTLIBcaca) +diff --git a/modules/video_output/haiku.cpp b/modules/video_output/haiku.cpp +new file mode 100644 +index 0000000..d2de038 +--- /dev/null ++++ b/modules/video_output/haiku.cpp +@@ -0,0 +1,779 @@ ++/***************************************************************************** ++ * haiku.c: Haiku video output display method for testing purposes ++ ***************************************************************************** ++ * Copyright (C) 2020 Gerasim Troeglazov (3dEyes**) ++ ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; either version 2.1 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. ++ *****************************************************************************/ ++ ++/***************************************************************************** ++ * Preamble ++ *****************************************************************************/ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static uint32 platformHaikuScanCodes[] = { ++ KEY_ESC, 0x01, ++ KEY_F1, 0x02, ++ KEY_F2, 0x03, ++ KEY_F3, 0x04, ++ KEY_F4, 0x05, ++ KEY_F5, 0x06, ++ KEY_F6, 0x07, ++ KEY_F7, 0x08, ++ KEY_F8, 0x09, ++ KEY_F9, 0x0A, ++ KEY_F10, 0x0B, ++ KEY_F11, 0x0C, ++ KEY_F12, 0x0D, ++ KEY_PAUSE, 0x22, ++ ++ '`', 0x11, ++ '1', 0x12, ++ '2', 0x13, ++ '3', 0x14, ++ '4', 0x15, ++ '5', 0x16, ++ '6', 0x17, ++ '7', 0x18, ++ '8', 0x19, ++ '9', 0x1A, ++ '0', 0x1B, ++ '-', 0x1C, ++ '+', 0x1D, ++ KEY_BACKSPACE, 0x1E, ++ KEY_INSERT, 0x1F, ++ KEY_HOME, 0x20, ++ KEY_PAGEUP, 0x21, ++ '/', 0x23, ++ '*', 0x24, ++ '-', 0x25, ++ ++ KEY_TAB, 0x26, ++ 'q', 0x27, ++ 'w', 0x28, ++ 'e', 0x29, ++ 'r', 0x2A, ++ 't', 0x2B, ++ 'y', 0x2C, ++ 'u', 0x2D, ++ 'i', 0x2E, ++ 'o', 0x2F, ++ 'p', 0x30, ++ '[', 0x31, ++ ']', 0x32, ++ '\\', 0x33, ++ KEY_DELETE, 0x34, ++ KEY_END, 0x35, ++ KEY_PAGEDOWN, 0x36, ++ '7', 0x37, ++ '8', 0x38, //numpad ++ '9', 0x39, //numpad ++ '+', 0x3A, //numpad ++ ++ 'a', 0x3C, ++ 's', 0x3D, ++ 'd', 0x3E, ++ 'f', 0x3F, ++ 'g', 0x40, ++ 'h', 0x41, ++ 'j', 0x42, ++ 'k', 0x43, ++ 'l', 0x44, ++ ';', 0x45, ++ '"', 0x46, ++ KEY_ENTER, 0x47, ++ '4', 0x48, //numpad ++ '5', 0x49, //numpad ++ '6', 0x4A, //numpad ++ ++ 'z', 0x4C, ++ 'x', 0x4D, ++ 'c', 0x4E, ++ 'v', 0x4F, ++ 'b', 0x50, ++ 'n', 0x51, ++ 'm', 0x52, ++ ',', 0x53, ++ '.', 0x54, ++ '/', 0x55, ++ KEY_UP, 0x57, //cursor ++ '1', 0x58, //numpad ++ '2', 0x59, //numpad ++ '3', 0x5A, //numpad ++ KEY_ENTER, 0x5B, //numpad ++ ++ ' ', 0x5E, ++ KEY_LEFT, 0x61, //cursor ++ KEY_DOWN, 0x62, //cursor ++ KEY_RIGHT, 0x63, //cursor ++ '0', 0x64, //cursor ++ '.', 0x65, //numpad ++ 0, 0x00 ++ }; ++ ++static const struct { ++ int haiku; ++ int vlc; ++} platformHaikuMouseButtons[] = { ++ { B_PRIMARY_MOUSE_BUTTON, MOUSE_BUTTON_LEFT }, ++ { B_TERTIARY_MOUSE_BUTTON, MOUSE_BUTTON_CENTER }, ++ { B_SECONDARY_MOUSE_BUTTON, MOUSE_BUTTON_RIGHT }, ++ { -1, -1 } ++}; ++ ++class FrameBufferView : public BView ++{ ++ public: ++ FrameBufferView(BRect rect, int width, int height); ++ ~FrameBufferView(); ++ ++ virtual void MessageReceived(BMessage *message); ++ virtual void Draw(BRect rect); ++ ++ void Paint(); ++ uint32 *GetBuffer(); ++ uint32 GetBufferSize(); ++ void ResizeBitmap(int width, int height); ++ ++ int Width() { return buffer_width; } ++ int Height() { return buffer_height; } ++ private: ++ int buffer_width; ++ int buffer_height; ++ BView *bufferView; ++ BBitmap *bufferBitmap; ++}; ++ ++class VLCVideoWindow : public BWindow { ++ public: ++ VLCVideoWindow(BRect rect, const char* name); ++ virtual ~VLCVideoWindow(); ++ ++ virtual void DispatchMessage(BMessage *message, BHandler *handler); ++ bool QuitRequested(); ++ ++ FrameBufferView* View(void) { return frameBufferView; } ++ BMessageQueue* Queue(void) { return queue; } ++ void CloneAndPushMessage(BMessage *message); ++ ++ void SetFullscreen(bool fullscreen); ++ bool IsFullscreen(void) {return is_fullscreen; } ++ ++ void HideCursor(bool hide); ++ ++ private: ++ bool is_fullscreen; ++ BRect lastPosition; ++ BPoint lastMouseClick; ++ ++ FrameBufferView *frameBufferView; ++ BMessageQueue *queue; ++ BCursor *emptyCursor; ++ bool dragWindow; ++}; ++ ++FrameBufferView::FrameBufferView(BRect rect, int width, int height) : ++ BView(rect, "FrameBufferView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS) ++{ ++ buffer_width = width; ++ buffer_height = height; ++ ++ BRect fbRect = BRect(0, 0, buffer_width - 1, buffer_height - 1); ++ bufferBitmap = new BBitmap(fbRect, B_RGB32, true); ++} ++ ++FrameBufferView::~FrameBufferView() ++{ ++ delete bufferBitmap; ++} ++ ++ ++void ++FrameBufferView::MessageReceived(BMessage *message) ++{ ++ switch (message->what) { ++ case B_MOUSE_MOVED: ++ case B_MOUSE_WHEEL_CHANGED: ++ { ++ Window()->PostMessage(message); ++ break; ++ } ++ case B_MOUSE_DOWN: ++ case B_MOUSE_UP: ++ { ++ Window()->PostMessage(message); ++ break; ++ } ++ default: ++ BView::MessageReceived(message); ++ break; ++ } ++} ++ ++void ++FrameBufferView::Draw(BRect rect) ++{ ++ SetDrawingMode(B_OP_COPY); ++ DrawBitmap(bufferBitmap, rect, rect); ++} ++ ++void ++FrameBufferView::Paint() ++{ ++ if(LockLooper()) { ++ SetDrawingMode(B_OP_COPY); ++ DrawBitmap(bufferBitmap); ++ UnlockLooper(); ++ } ++} ++ ++uint32 * ++FrameBufferView::GetBuffer() ++{ ++ if(bufferBitmap == NULL) ++ return NULL; ++ return (uint32*)bufferBitmap->Bits(); ++} ++ ++uint32 ++FrameBufferView::GetBufferSize() ++{ ++ if(bufferBitmap == NULL) ++ return 0; ++ return bufferBitmap->BitsLength(); ++} ++ ++void ++FrameBufferView::ResizeBitmap(int w, int h) ++{ ++ if(w == buffer_width && h == buffer_height && bufferBitmap != NULL) ++ return; ++ if(LockLooper()) { ++ delete bufferBitmap; ++ ++ buffer_width = w; ++ buffer_height = h; ++ ++ BRect fbRect = BRect(0, 0, buffer_width - 1, buffer_height - 1); ++ bufferBitmap = new BBitmap(fbRect, B_RGB32, true); ++ ++ UnlockLooper(); ++ } ++} ++ ++ ++VLCVideoWindow::VLCVideoWindow(BRect frame, const char* title) ++ : BWindow(frame, title, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, 0), ++ is_fullscreen(false), ++ dragWindow(false) ++{ ++ frameBufferView = new FrameBufferView(Bounds(), frame.Width(), frame.Height()); ++ frameBufferView->SetViewColor(0, 0, 0); ++ AddChild(frameBufferView); ++ queue = new BMessageQueue(); ++ emptyCursor = new BCursor(B_CURSOR_ID_NO_CURSOR); ++} ++ ++ ++VLCVideoWindow::~VLCVideoWindow() ++{ ++ delete emptyCursor; ++ delete queue; ++} ++ ++void ++VLCVideoWindow::CloneAndPushMessage(BMessage *message) ++{ ++ BMessage *clone = new BMessage(*message); ++ queue->Lock(); ++ queue->AddMessage(clone); ++ queue->Unlock(); ++} ++ ++void ++VLCVideoWindow::DispatchMessage(BMessage *message, BHandler *handler) ++{ ++ switch (message->what) { ++ case B_MOUSE_DOWN: ++ { ++ uint32 buttons = 0; ++ message->FindInt32("buttons", (int32 *)&buttons); ++ ++ if (buttons & B_PRIMARY_MOUSE_BUTTON) { ++ frameBufferView->SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); ++ message->FindPoint("where", &lastMouseClick); ++ dragWindow = true; ++ } ++ CloneAndPushMessage(message); ++ break; ++ } ++ case B_MOUSE_UP: ++ { ++ frameBufferView->SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); ++ dragWindow = false; ++ CloneAndPushMessage(message); ++ BWindow::DispatchMessage(message, handler); ++ break; ++ } ++ case B_MOUSE_MOVED: ++ { ++ uint32 buttons = 0; ++ message->FindInt32("buttons", (int32 *)&buttons); ++ BPoint where; ++ message->FindPoint("where", &where); ++ BPoint screenWhere; ++ message->FindPoint("screen_where", &screenWhere); ++ ++ if (dragWindow ++ && buttons & B_PRIMARY_MOUSE_BUTTON ++ && (fabs(where.x - lastMouseClick.x) >= 0.5 ++ || fabs(where.y - lastMouseClick.y) >= 0.5)) { ++ BCursor cursor(B_CURSOR_ID_MOVE); ++ frameBufferView->SetViewCursor(&cursor); ++ MoveTo(screenWhere - lastMouseClick); ++ break; ++ } ++ CloneAndPushMessage(message); ++ break; ++ } ++ case B_ZOOM: ++ case B_WINDOW_RESIZED: ++ case B_MOUSE_WHEEL_CHANGED: ++ { ++ CloneAndPushMessage(message); ++ break; ++ } ++ case B_UNMAPPED_KEY_DOWN: ++ case B_KEY_DOWN: ++ { ++ CloneAndPushMessage(message); ++ BWindow::DispatchMessage(message, handler); ++ break; ++ } ++ default: ++ { ++ BWindow::DispatchMessage(message, handler); ++ break; ++ } ++ } ++} ++ ++bool ++VLCVideoWindow::QuitRequested() ++{ ++ Minimize(true); ++ return false; ++} ++ ++void ++VLCVideoWindow::SetFullscreen(bool fullscreen) ++{ ++ if (fullscreen == is_fullscreen) ++ return; ++ ++ if (fullscreen) { ++ BScreen screen(B_MAIN_SCREEN_ID); ++ lastPosition = Frame(); ++ MoveTo(0,0); ++ ResizeTo(screen.Frame().Width() + 1, screen.Frame().Height() + 1); ++ Activate(); ++ } else { ++ MoveTo(lastPosition.left, lastPosition.top); ++ ResizeTo(lastPosition.Width(), lastPosition.Height()); ++ } ++ ++ is_fullscreen = fullscreen; ++} ++ ++void ++VLCVideoWindow::HideCursor(bool hide) ++{ ++ if (hide && dragWindow) ++ return; ++ if (frameBufferView->LockLooper()) { ++ frameBufferView->SetViewCursor(hide ? emptyCursor : B_CURSOR_SYSTEM_DEFAULT); ++ frameBufferView->UnlockLooper(); ++ } ++} ++ ++ ++extern "C" { ++ ++static int Open( vlc_object_t * ); ++static void Close( vlc_object_t * ); ++static picture_pool_t *Pool(vout_display_t *, unsigned count); ++static void Display(vout_display_t *, picture_t *, subpicture_t *); ++static int Control(vout_display_t *, int, va_list); ++static void Manage (vout_display_t *); ++ ++} ++ ++vlc_module_begin () ++ set_shortname("Haiku") ++ set_category(CAT_VIDEO) ++ set_subcategory(SUBCAT_VIDEO_VOUT) ++ set_description("Haiku video output") ++ set_capability("vout display", 100 ) ++ add_shortcut("haiku") ++ add_obsolete_string("haiku-video-driver") ++ set_callbacks(Open, Close) ++vlc_module_end () ++ ++ ++/***************************************************************************** ++ * Local prototypes ++ *****************************************************************************/ ++struct vout_display_sys_t { ++ vout_display_place_t place; ++ picture_pool_t *pool; ++ VLCVideoWindow *win; ++ uint32 lastMouseButtons; ++ int resizeDisplayCount; ++}; ++ ++/***************************************************************************** ++ * OpenVideo: activates haiku vout display method ++ *****************************************************************************/ ++static int Open(vlc_object_t *object) ++{ ++ vout_display_t *vd = (vout_display_t *)object; ++ vout_display_sys_t *sys; ++ ++ vd->sys = sys = (vout_display_sys_t*)calloc(1, sizeof(*sys)); ++ if (!sys) ++ return VLC_EGENERIC; ++ sys->pool = NULL; ++ sys->lastMouseButtons = 0; ++ sys->resizeDisplayCount = 0; ++ ++ video_format_t fmt; ++ video_format_ApplyRotation(&fmt, &vd->fmt); ++ ++ BScreen screen(B_MAIN_SCREEN_ID); ++ ++ int display_margin = 128; ++ int display_width = vd->cfg->display.width; ++ int display_height = vd->cfg->display.height; ++ ++ if (display_margin + display_width > screen.Frame().Width() - display_margin) { ++ float zoom = (screen.Frame().Width() - display_margin * 2) / (float)display_width; ++ display_width = (float)display_width * zoom; ++ display_height = (float)display_height * zoom; ++ } ++ if (display_margin + display_height > screen.Frame().Height() - display_margin) { ++ float zoom = (screen.Frame().Height() - display_margin * 2) / (float)display_height; ++ display_width = (float)display_width * zoom; ++ display_height = (float)display_height * zoom; ++ } ++ ++ vout_display_DeleteWindow(vd, NULL); ++ ++ sys->win = new VLCVideoWindow(BRect(display_margin, display_margin, display_margin + display_width, display_margin + display_height), VOUT_TITLE); ++ sys->win->Show(); ++ ++ if (vd->cfg->display.title) ++ sys->win->SetTitle(vd->cfg->display.title); ++ else ++ sys->win->SetTitle(VOUT_TITLE); ++ ++ vout_display_cfg_t place_cfg = *vd->cfg; ++ place_cfg.display.width = display_width; ++ place_cfg.display.height = display_height; ++ vout_display_PlacePicture(&sys->place, &vd->source, &place_cfg, true); ++ ++ fmt.i_chroma = VLC_CODEC_RGB32; ++ fmt.i_width = display_width; ++ fmt.i_height = display_height; ++ fmt.i_rmask = 0x00ff0000; ++ fmt.i_gmask = 0x0000ff00; ++ fmt.i_bmask = 0x000000ff; ++ fmt.i_visible_width = fmt.i_width; ++ fmt.i_visible_height = fmt.i_height; ++ ++ vd->info.has_pictures_invalid = true; ++ vd->info.needs_hide_mouse = true; ++ ++ vd->fmt = fmt; ++ ++ vd->pool = Pool; ++ vd->prepare = NULL; ++ vd->display = Display; ++ vd->control = Control; ++ vd->manage = Manage; ++ ++ vout_display_SendEventDisplaySize(vd, display_width, display_height); ++ ++ return VLC_SUCCESS; ++} ++ ++static void Close(vlc_object_t *object) ++{ ++ vout_display_t *vd = (vout_display_t *)object; ++ vout_display_sys_t *sys = vd->sys; ++ ++ sys->win->Lock(); ++ sys->win->Quit(); ++ ++ if (sys->pool) ++ picture_pool_Release(sys->pool); ++ free(sys); ++} ++ ++static picture_pool_t *Pool(vout_display_t *vd, unsigned count) ++{ ++ vout_display_sys_t *sys = vd->sys; ++ if (!sys->pool) { ++ picture_resource_t rsc; ++ ++ memset(&rsc, 0, sizeof(rsc)); ++ ++ memset((uint8_t*)sys->win->View()->GetBuffer(), 0, sys->win->View()->GetBufferSize()); ++ ++ rsc.p[0].p_pixels = (uint8_t*)sys->win->View()->GetBuffer(); ++ rsc.p[0].i_pitch = sys->win->View()->Width() * 4; ++ rsc.p[0].i_lines = sys->win->View()->Height(); ++ ++ picture_t *p_picture = picture_NewFromResource(&vd->fmt, &rsc); ++ if (!p_picture) ++ return NULL; ++ ++ sys->pool = picture_pool_New(1, &p_picture); ++ } ++ return sys->pool; ++} ++ ++static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture) ++{ ++ vout_display_sys_t *sys = vd->sys; ++ sys->win->View()->Paint(); ++ picture_Release(picture); ++} ++ ++static int Control(vout_display_t *vd, int query, va_list args) ++{ ++ vout_display_sys_t *sys = vd->sys; ++ ++ switch (query) ++ { ++ case VOUT_DISPLAY_HIDE_MOUSE: ++ sys->win->HideCursor(true); ++ return VLC_SUCCESS; ++ case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: ++ { ++ const vout_display_cfg_t *cfg = va_arg(args, const vout_display_cfg_t *); ++ if ((sys->resizeDisplayCount == 1 || sys->resizeDisplayCount == 2) && !cfg->is_fullscreen) { ++ sys->resizeDisplayCount++; ++ return VLC_EGENERIC; ++ } ++ sys->win->View()->ResizeBitmap(cfg->display.width, cfg->display.height); ++ if (cfg->is_fullscreen) { ++ vout_display_SendEventPicturesInvalid(vd); ++ return VLC_EGENERIC; ++ } else { ++ sys->win->ResizeTo(cfg->display.width - 1, cfg->display.height - 1); ++ } ++ vout_display_SendEventPicturesInvalid(vd); ++ sys->resizeDisplayCount++; ++ return VLC_SUCCESS; ++ } ++ case VOUT_DISPLAY_CHANGE_ZOOM: ++ case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: ++ case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT: ++ { ++ const vout_display_cfg_t *cfg; ++ const video_format_t *source; ++ ++ if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT) { ++ source = va_arg(args, const video_format_t *); ++ cfg = vd->cfg; ++ } else { ++ source = &vd->source; ++ cfg = va_arg(args, const vout_display_cfg_t *); ++ } ++ vout_display_SendEventPicturesInvalid(vd); ++ return VLC_SUCCESS; ++ } ++ case VOUT_DISPLAY_RESET_PICTURES: ++ { ++ vout_display_place_t place; ++ video_format_t src; ++ ++ vout_display_PlacePicture(&place, &vd->source, vd->cfg, false); ++ video_format_ApplyRotation(&src, &vd->source); ++ ++ vd->fmt.i_width = src.i_width; ++ vd->fmt.i_height = src.i_height; ++ vd->fmt.i_visible_width = place.width; ++ vd->fmt.i_visible_height = place.height; ++ vd->fmt.i_x_offset = place.x; ++ vd->fmt.i_y_offset = place.y; ++ ++ if (sys->pool) ++ picture_pool_Release(sys->pool); ++ ++ sys->pool = NULL; ++ ++ return VLC_SUCCESS; ++ } ++ case VOUT_DISPLAY_CHANGE_SOURCE_CROP: ++ return VLC_EGENERIC; ++ case VOUT_DISPLAY_CHANGE_FULLSCREEN: ++ { ++ bool fs = va_arg(args, int); ++ sys->win->SetFullscreen(fs); ++ return VLC_SUCCESS; ++ } ++ ++ default: ++ msg_Err(vd, "Unsupported query"); ++ return VLC_EGENERIC; ++ } ++} ++ ++static void Manage( vout_display_t *vd ) ++{ ++ vout_display_sys_t *sys = vd->sys; ++ ++ while (BMessage* request = sys->win->Queue()->NextMessage()) { ++ switch (request->what) { ++ case B_MOUSE_WHEEL_CHANGED: ++ { ++ uint32 modifiers = 0; ++ request->FindInt32("modifiers", (int32 *)&modifiers); ++ ++ int code = 0; ++ ++ if (modifiers & B_SHIFT_KEY) ++ code |= KEY_MODIFIER_SHIFT; ++ if (modifiers & B_CONTROL_KEY) ++ code |= KEY_MODIFIER_ALT; ++ if (modifiers & B_COMMAND_KEY) ++ code |= KEY_MODIFIER_CTRL; ++ ++ float dx = request->FindFloat("be:wheel_delta_x"); ++ float dy = request->FindFloat("be:wheel_delta_y"); ++ if (dx > 0.1) ++ vout_display_SendEventKey(vd, KEY_MOUSEWHEELRIGHT | code); ++ if (dx < -0.1) ++ vout_display_SendEventKey(vd, KEY_MOUSEWHEELLEFT | code); ++ if (dy > 0.1) ++ vout_display_SendEventKey(vd, KEY_MOUSEWHEELDOWN | code); ++ if (dy < -0.1) ++ vout_display_SendEventKey(vd, KEY_MOUSEWHEELUP | code); ++ break; ++ } ++ case B_MOUSE_DOWN: ++ { ++ uint32 buttons = 0; ++ request->FindInt32("buttons", (int32 *)&buttons); ++ ++ for (int i = 0; platformHaikuMouseButtons[i].haiku != -1; i++) { ++ if (buttons & platformHaikuMouseButtons[i].haiku) ++ vout_display_SendEventMousePressed(vd, platformHaikuMouseButtons[i].vlc); ++ } ++ ++ sys->lastMouseButtons = buttons; ++ break; ++ } ++ case B_MOUSE_UP: ++ { ++ uint32 buttons = 0; ++ request->FindInt32("buttons", (int32 *)&buttons); ++ ++ for (int i = 0; platformHaikuMouseButtons[i].haiku != -1; i++) { ++ if (sys->lastMouseButtons & platformHaikuMouseButtons[i].haiku && !(buttons & platformHaikuMouseButtons[i].haiku)) ++ vout_display_SendEventMouseReleased(vd, platformHaikuMouseButtons[i].vlc); ++ } ++ break; ++ } ++ case B_MOUSE_MOVED: ++ { ++ uint32 transit; ++ request->FindInt32("be:transit", (int32*)&transit); ++ if (transit == B_ENTERED_VIEW || transit == B_INSIDE_VIEW) { ++ BPoint where; ++ request->FindPoint("be:view_where", &where); ++ vout_display_place_t place; ++ vout_display_PlacePicture(&place, &vd->source, vd->cfg, false); ++ where.x = (where.x - place.x) * vd->source.i_visible_width / place.width; ++ where.y = (where.y - place.y) * vd->source.i_visible_height / place.height; ++ vout_display_SendEventMouseMoved(vd, where.x, where.y); ++ sys->win->HideCursor(false); ++ } ++ break; ++ } ++ case B_ZOOM: ++ { ++// vout_display_SendEventFullscreen(vd, true, false); ++ vout_display_SendEventKey(vd, 'f'); ++ break; ++ } ++ case B_WINDOW_RESIZED: ++ { ++ int width = request->FindInt32("width"); ++ int height = request->FindInt32("height"); ++ vout_display_SendEventDisplaySize(vd, width + 1, height + 1); ++ break; ++ } ++ case B_UNMAPPED_KEY_DOWN: ++ case B_KEY_DOWN: ++ { ++ uint32 modifiers = request->FindInt32("modifiers"); ++ uint32 key = request->FindInt32("key"); ++ ++ int code = KEY_UNSET; ++ int i = 0; ++ while (platformHaikuScanCodes[i]) { ++ if ( key == platformHaikuScanCodes[i + 1]) { ++ code = platformHaikuScanCodes[i]; ++ break; ++ } ++ i += 2; ++ } ++ if (modifiers & B_SHIFT_KEY) ++ code |= KEY_MODIFIER_SHIFT; ++ if (modifiers & B_CONTROL_KEY) ++ code |= KEY_MODIFIER_ALT; ++ if (modifiers & B_COMMAND_KEY) ++ code |= KEY_MODIFIER_CTRL; ++ ++ if (code != KEY_UNSET) { ++ vout_display_SendEventKey(vd, code); ++ } ++ break; ++ } ++ default: ++ break; ++ } ++ delete request; ++ } ++} +diff --git a/src/Makefile.am b/src/Makefile.am +index 502990c..f1c1a85 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -411,6 +411,16 @@ libvlccore_la_SOURCES += \ + linux/dirs.c \ + linux/thread.c + else ++if HAVE_HAIKU ++libvlccore_la_SOURCES += \ ++ haiku/dirs.cpp \ ++ haiku/specific.c \ ++ posix/error.c \ ++ posix/netconf.c \ ++ posix/getaddrinfo.c \ ++ posix/thread.c ++libvlccore_la_LIBADD += -lgnu -lnetwork ++else + if HAVE_DARWIN + libvlccore_la_SOURCES += \ + darwin/dirs.c \ +@@ -444,6 +454,7 @@ endif + endif + endif + endif ++endif + + if ENABLE_SOUT + libvlccore_la_SOURCES += \ +diff --git a/src/haiku/dirs.cpp b/src/haiku/dirs.cpp +new file mode 100644 +index 0000000..712bf08 +--- /dev/null ++++ b/src/haiku/dirs.cpp +@@ -0,0 +1,83 @@ ++/***************************************************************************** ++ * dirs.c: XDG directories configuration ++ ***************************************************************************** ++ * Copyright (C) 2001-2007 VLC authors and VideoLAN ++ * Copyright © 2007-2009 Rémi Denis-Courmont ++ * ++ * Authors: Gildas Bazin ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; either version 2.1 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. ++ *****************************************************************************/ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++ ++#include "../libvlc.h" ++#include "config/configuration.h" ++ ++#include ++#include ++ ++#include ++ ++char *config_GetDataDir (void) ++{ ++ return strdup (PKGDATADIR); ++} ++ ++char *config_GetLibDir (void) ++{ ++ return strdup (PKGLIBDIR); ++} ++ ++static char *config_GetHaikuDir (directory_which which, char *leaf = NULL) ++{ ++ char path[B_PATH_NAME_LENGTH]; ++ find_directory(which, 0, false, path, B_PATH_NAME_LENGTH); ++ if (leaf != NULL) { ++ strcat(path, "/"); ++ strcat(path, leaf); ++ } ++ return strdup (path); ++} ++ ++char *config_GetUserDir (vlc_userdir_t type) ++{ ++ switch (type) ++ { ++ case VLC_HOME_DIR: ++ break; ++ case VLC_CONFIG_DIR: ++ case VLC_DATA_DIR: ++ return config_GetHaikuDir (B_USER_SETTINGS_DIRECTORY, "vlc"); ++ case VLC_CACHE_DIR: ++ return config_GetHaikuDir (B_USER_CACHE_DIRECTORY, "vlc"); ++ ++ case VLC_DESKTOP_DIR: ++ return config_GetHaikuDir (B_DESKTOP_DIRECTORY); ++ case VLC_DOWNLOAD_DIR: ++ case VLC_TEMPLATES_DIR: ++ case VLC_PUBLICSHARE_DIR: ++ case VLC_DOCUMENTS_DIR: ++ case VLC_MUSIC_DIR: ++ case VLC_PICTURES_DIR: ++ case VLC_VIDEOS_DIR: ++ break; ++ } ++ return config_GetHaikuDir (B_USER_DIRECTORY); ++} +diff --git a/src/haiku/specific.c b/src/haiku/specific.c +new file mode 100644 +index 0000000..1c26497 +--- /dev/null ++++ b/src/haiku/specific.c +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++ * specific.c: stubs for POSIX OS-specific initialization ++ ***************************************************************************** ++ * Copyright © 2008 Rémi Denis-Courmont ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; either version 2.1 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. ++ *****************************************************************************/ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include ++#include "../libvlc.h" ++#include "../lib/libvlc_internal.h" ++ ++void system_Init (void) ++{ ++} ++ ++void system_Configure(libvlc_int_t *libvlc, int argc, const char *const argv[]) ++{ ++} +diff --git a/src/modules/bank.c b/src/modules/bank.c +index 2e67a0d..e927851 100644 +--- a/src/modules/bank.c ++++ b/src/modules/bank.c +@@ -172,6 +172,7 @@ static vlc_plugin_t *module_InitStatic(vlc_plugin_cb entry) + return lib; + } + ++/* Haiku bug #8288 + #if defined(__ELF__) || !HAVE_DYNAMIC_PLUGINS + # ifdef __GNUC__ + __attribute__((weak)) +@@ -192,9 +193,9 @@ static void module_InitStaticModules(void) + vlc_plugin_store(lib); + } + } +-#else ++#else */ + static void module_InitStaticModules(void) { } +-#endif ++//#endif + + #ifdef HAVE_DYNAMIC_PLUGINS + static const char vlc_entry_name[] = "vlc_entry" MODULE_SUFFIX; +diff --git a/src/network/io.c b/src/network/io.c +index 603624a..256030b 100644 +--- a/src/network/io.c ++++ b/src/network/io.c +@@ -192,7 +192,9 @@ int *net_Listen (vlc_object_t *p_this, const char *psz_host, + switch (ptr->ai_socktype) + { + case SOCK_STREAM: ++#ifdef SOCK_RDM + case SOCK_RDM: ++#endif + case SOCK_SEQPACKET: + #ifdef SOCK_DCCP + case SOCK_DCCP: +diff --git a/src/posix/error.c b/src/posix/error.c +index db51004..9ae11dd 100644 +--- a/src/posix/error.c ++++ b/src/posix/error.c +@@ -48,7 +48,7 @@ static const char *vlc_strerror_l(int errnum, const char *lname) + errno = saved_errno; + } + +- const char *buf = strerror_l(errnum, loc); ++ const char *buf = strerror(errnum); + + freelocale(loc); + return buf; +diff --git a/src/video_output/display.c b/src/video_output/display.c +index ba4dba0..49c7901 100644 +--- a/src/video_output/display.c ++++ b/src/video_output/display.c +@@ -341,7 +341,7 @@ typedef struct { + + bool ch_zoom; + vlc_rational_t zoom; +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + unsigned width_saved; + unsigned height_saved; + bool ch_fullscreen; +@@ -600,7 +600,7 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args) + va_arg(args, const vlc_viewpoint_t *)); + break; + +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + case VOUT_DISPLAY_EVENT_FULLSCREEN: { + const int is_fullscreen = (int)va_arg(args, int); + const bool window_fullscreen = va_arg(args, int); +@@ -760,7 +760,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) + for (;;) { + + vlc_mutex_lock(&osys->lock); +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + bool ch_fullscreen = osys->ch_fullscreen; + bool is_fullscreen = osys->is_fullscreen; + osys->ch_fullscreen = false; +@@ -789,7 +789,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) + !reset_pictures && + osys->is_display_filled == osys->cfg.is_display_filled && + !osys->ch_zoom && +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + !ch_fullscreen && + !ch_wm_state && + #endif +@@ -806,7 +806,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) + } + + /* */ +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + if (ch_fullscreen) { + if (osys->window_fullscreen + || vout_display_Control(vd, VOUT_DISPLAY_CHANGE_FULLSCREEN, +@@ -826,7 +826,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) + + /* */ + if (ch_display_size) { +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + osys->width_saved = osys->cfg.display.width; + osys->height_saved = osys->cfg.display.height; + #endif +@@ -852,7 +852,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures) + + vout_display_Control(vd, VOUT_DISPLAY_CHANGE_ZOOM, &osys->cfg); + } +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + /* */ + if (ch_wm_state) { + if (vout_display_Control(vd, VOUT_DISPLAY_CHANGE_WINDOW_STATE, wm_state)) { +@@ -1154,7 +1154,7 @@ static vout_display_t *DisplayNew(vout_thread_t *vout, + + osys->zoom.num = cfg->zoom.num; + osys->zoom.den = cfg->zoom.den; +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + osys->is_fullscreen = cfg->is_fullscreen; + osys->width_saved = cfg->display.width; + osys->height_saved = cfg->display.height; +@@ -1228,7 +1228,7 @@ void vout_DeleteDisplay(vout_display_t *vd, vout_display_state_t *state) + if (state) { + if (!osys->is_splitter) + state->cfg = osys->cfg; +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + state->wm_state = osys->wm_state; + #endif + state->sar = osys->sar_initial; +diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c +index d936d42..8b9a976 100644 +--- a/src/video_output/video_output.c ++++ b/src/video_output/video_output.c +@@ -570,7 +570,7 @@ void vout_ControlChangeViewpoint(vout_thread_t *vout, + static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, const char *title) + { + /* Load configuration */ +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + cfg->is_fullscreen = var_GetBool(vout, "fullscreen") + || var_GetBool(vout, "video-wallpaper"); + #endif +@@ -1363,7 +1363,7 @@ static void ThreadChangeFullscreen(vout_thread_t *vout, bool fullscreen) + { + vout_window_t *window = vout->p->window; + +-#if !defined(_WIN32) && !defined(__OS2__) ++#if !defined(_WIN32) && !defined(__OS2__) && !defined(__HAIKU__) + if (window != NULL) + vout_window_SetFullScreen(window, fullscreen); + #else +@@ -1383,7 +1383,7 @@ static void ThreadChangeWindowState(vout_thread_t *vout, unsigned state) + + if (window != NULL) + vout_window_SetState(window, state); +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + else /* FIXME: remove this event */ + if (vout->p->display.vd != NULL) + vout_display_SendWindowState(vout->p->display.vd, state); +@@ -1514,7 +1514,7 @@ static int ThreadStart(vout_thread_t *vout, vout_display_state_t *state) + if (!state) { + VoutGetDisplayCfg(vout, &state_default.cfg, vout->p->display.title); + +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + bool below = var_InheritBool(vout, "video-wallpaper"); + bool above = var_InheritBool(vout, "video-on-top"); + +@@ -1643,7 +1643,7 @@ static int ThreadReinit(vout_thread_t *vout, + + vout_ReinitInterlacingSupport(vout); + +-#if defined(_WIN32) || defined(__OS2__) ++#if defined(_WIN32) || defined(__OS2__) || defined(__HAIKU__) + if (!state.cfg.is_fullscreen) + #endif + { +diff --git a/src/video_output/window.c b/src/video_output/window.c +index ff482dc..fe3c06c 100644 +--- a/src/video_output/window.c ++++ b/src/video_output/window.c +@@ -79,7 +79,7 @@ vout_window_t *vout_window_New(vlc_object_t *obj, const char *module, + /* Hook for screensaver inhibition */ + if (var_InheritBool(obj, "disable-screensaver") && + (window->type == VOUT_WINDOW_TYPE_XID || window->type == VOUT_WINDOW_TYPE_HWND +- || window->type == VOUT_WINDOW_TYPE_WAYLAND)) ++ || window->type == VOUT_WINDOW_TYPE_WAYLAND || window->type == VOUT_WINDOW_TYPE_HAIKU)) + { + w->inhibit = vlc_inhibit_Create(VLC_OBJECT (window)); + if (w->inhibit != NULL) +-- +2.28.0 + + +From 753d2e8ac3eea065a6751bbfe48811aa192315b3 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 20 Oct 2020 18:53:09 +1000 +Subject: Add launcher for Haiku + + +diff --git a/haiku/VLCLauncher.cpp b/haiku/VLCLauncher.cpp +new file mode 100644 +index 0000000..37af2e8 +--- /dev/null ++++ b/haiku/VLCLauncher.cpp +@@ -0,0 +1,89 @@ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++class VLCLauncherApp : public BApplication { ++ public: ++ VLCLauncherApp(const char *signature, int argc, char **argv); ++ ~VLCLauncherApp() {}; ++ void RefsReceived(BMessage *pmsg); ++ virtual void ReadyToRun(); ++ BString GetVLCPath(void); ++ private: ++ BMessenger fTrackerMessenger; ++}; ++ ++VLCLauncherApp::VLCLauncherApp(const char *signature, int argc, char **argv) ++ : BApplication(signature) ++{ ++} ++ ++BString ++VLCLauncherApp::GetVLCPath(void) ++{ ++ app_info inf; ++ be_app->GetAppInfo(&inf); ++ BPath binPath = BPath(&(inf.ref)); ++ BPath appPath; ++ binPath.GetParent(&appPath); ++ appPath.Append("VLC"); ++ return appPath.Path(); ++} ++ ++void ++VLCLauncherApp::RefsReceived(BMessage *pmsg) ++{ ++ if (pmsg->HasMessenger("TrackerViewToken")) { ++ pmsg->FindMessenger("TrackerViewToken", &fTrackerMessenger); ++ } ++ ++ uint32 type; ++ int32 count; ++ status_t ret = pmsg->GetInfo("refs", &type, &count); ++ if (ret != B_OK || type != B_REF_TYPE) ++ return; ++ ++ BString commandLine = GetVLCPath(); ++ ++ entry_ref ref; ++ for (int32 i = 0; i < count; i++) { ++ if (pmsg->FindRef("refs", i, &ref) == B_OK) ++ { ++ BPath file=BPath(&ref); ++ commandLine += " \""; ++ commandLine += file.Path(); ++ commandLine += "\""; ++ } ++ } ++ commandLine += " &"; ++ system(commandLine.String()); ++ Quit(); ++} ++ ++void ++VLCLauncherApp::ReadyToRun() ++{ ++ BString commandLine = GetVLCPath(); ++ commandLine += " &"; ++ system(commandLine.String()); ++ Quit(); ++} ++ ++ ++int main(int argc, char **argv) ++{ ++ VLCLauncherApp application("application/x-vnd.vlc-launcher", argc, argv); ++ application.Run(); ++ return 0; ++} ++ ++ +-- +2.28.0 + diff --git a/media-video/vlc/vlc-2.2.8.recipe b/media-video/vlc/vlc-3.0.11.1.recipe similarity index 50% rename from media-video/vlc/vlc-2.2.8.recipe rename to media-video/vlc/vlc-3.0.11.1.recipe index 9cb64e20e..285722304 100644 --- a/media-video/vlc/vlc-2.2.8.recipe +++ b/media-video/vlc/vlc-3.0.11.1.recipe @@ -3,86 +3,68 @@ DESCRIPTION="VLC is a free and open source cross-platform multimedia player \ and framework that plays most multimedia files as well as DVDs, Audio CDs, \ VCDs, and various streaming protocols." HOMEPAGE="https://www.videolan.org/vlc/" -COPYRIGHT="1998-2017 VideoLAN" +COPYRIGHT="1998-2020 VideoLAN" LICENSE="GNU GPL v2" -REVISION="7" +REVISION="1" SOURCE_URI="https://download.videolan.org/pub/videolan/vlc/$portVersion/vlc-$portVersion.tar.xz" -CHECKSUM_SHA256="9bf046848fb56d93518881b39099b8288ee005d5ba0ddf705b6f6643b8d562ec" +CHECKSUM_SHA256="189311d28aa814f106a7b3645211ac52c0b3e2b9f4b348de2f63bab3218086b8" PATCHES="vlc-$portVersion.patchset" -ADDITIONAL_FILES="vlc.rdef.in" +ADDITIONAL_FILES=" + vlc.rdef.in + vlc_launcher.rdef.in + haikuicons.zip + " -ARCHITECTURES="!x86_gcc2 ?x86_64" -SECONDARY_ARCHITECTURES="?x86" +ARCHITECTURES="!x86_gcc2 x86_64" +SECONDARY_ARCHITECTURES="!x86" PROVIDES=" vlc$secondaryArchSuffix = $portVersion - cmd:cvlc$secondaryArchSuffix - cmd:nvlc$secondaryArchSuffix - cmd:qvlc$secondaryArchSuffix - cmd:rvlc$secondaryArchSuffix - cmd:vlc$secondaryArchSuffix - cmd:vlc_wrapper$secondaryArchSuffix - lib:libvlc$secondaryArchSuffix - lib:libvlccore$secondaryArchSuffix + app:VLC$secondaryArchSuffix = $portVersion + cmd:vlc = $portVersion " REQUIRES=" haiku$secondaryArchSuffix lib:liba52$secondaryArchSuffix - lib:libass$secondaryArchSuffix lib:libavcodec$secondaryArchSuffix lib:libavformat$secondaryArchSuffix lib:libavutil$secondaryArchSuffix lib:libbluray$secondaryArchSuffix - lib:libcaca$secondaryArchSuffix + lib:libcddb$secondaryArchSuffix lib:libdca$secondaryArchSuffix lib:libdvbpsi$secondaryArchSuffix + lib:libdvdcss$secondaryArchSuffix lib:libdvdnav$secondaryArchSuffix lib:libdvdread$secondaryArchSuffix lib:libebml$secondaryArchSuffix + lib:libenca$secondaryArchSuffix lib:libfaad$secondaryArchSuffix lib:libFLAC$secondaryArchSuffix - lib:libfluidsynth$secondaryArchSuffix lib:libfontconfig$secondaryArchSuffix lib:libfreetype$secondaryArchSuffix - lib:libfribidi$secondaryArchSuffix - lib:libgcrypt$secondaryArchSuffix lib:libGL$secondaryArchSuffix -# lib:libgnutls$secondaryArchSuffix - lib:libgpg_error$secondaryArchSuffix lib:libiconv$secondaryArchSuffix - lib:libidn$secondaryArchSuffix - lib:libintl$secondaryArchSuffix - lib:libixml$secondaryArchSuffix + lib:libintl$secondaryArchSuffix lib:libjpeg$secondaryArchSuffix - lib:liblua$secondaryArchSuffix lib:libmad$secondaryArchSuffix lib:libmatroska$secondaryArchSuffix lib:libmodplug$secondaryArchSuffix lib:libmpcdec$secondaryArchSuffix lib:libmpeg2$secondaryArchSuffix - lib:libmtp$secondaryArchSuffix - lib:libncursesw$secondaryArchSuffix lib:libogg$secondaryArchSuffix lib:libopus$secondaryArchSuffix lib:libpng16$secondaryArchSuffix - lib:libpostproc$secondaryArchSuffix lib:libQt5Core$secondaryArchSuffix lib:libQt5Gui$secondaryArchSuffix lib:libQt5Widgets$secondaryArchSuffix lib:libsamplerate$secondaryArchSuffix -# lib:libschroedinger_1.0$secondaryArchSuffix - lib:libSDL_1.2$secondaryArchSuffix - lib:libSDL_image_1.2$secondaryArchSuffix -# lib:libshout$secondaryArchSuffix - lib:libsmbclient$secondaryArchSuffix lib:libspeex$secondaryArchSuffix - lib:libssh2$secondaryArchSuffix lib:libswscale$secondaryArchSuffix lib:libtag$secondaryArchSuffix lib:libtheoradec$secondaryArchSuffix lib:libtheoraenc$secondaryArchSuffix lib:libtwolame$secondaryArchSuffix - lib:libupnp$secondaryArchSuffix +# lib:libupnp$secondaryArchSuffix # dedlock when scan upnp devices lib:libvorbis$secondaryArchSuffix lib:libvorbisenc$secondaryArchSuffix lib:libvpx$secondaryArchSuffix @@ -92,24 +74,13 @@ REQUIRES=" lib:libz$secondaryArchSuffix " -PROVIDES_devel=" - vlc${secondaryArchSuffix}_devel = $portVersion - devel:libvlc$secondaryArchSuffix = 5.5.0 compat >= 5 - devel:libvlccore$secondaryArchSuffix = 8.8.0 compat >= 8 - " -REQUIRES_devel=" - haiku${secondaryArchSuffix}_devel - " - BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel - devel:liba52$secondaryArchSuffix - devel:libass$secondaryArchSuffix # crashes vlc-cache-gen - devel:libavcodec$secondaryArchSuffix >= 58 - devel:libavformat$secondaryArchSuffix >= 58 - devel:libavutil$secondaryArchSuffix >= 56 + a52dec${secondaryArchSuffix}_devel + devel:libavcodec$secondaryArchSuffix + devel:libavformat$secondaryArchSuffix + devel:libavutil$secondaryArchSuffix devel:libbluray$secondaryArchSuffix - devel:libcaca$secondaryArchSuffix devel:libcddb$secondaryArchSuffix devel:libdca$secondaryArchSuffix devel:libdvbpsi$secondaryArchSuffix @@ -120,99 +91,93 @@ BUILD_REQUIRES=" devel:libenca$secondaryArchSuffix devel:libfaad$secondaryArchSuffix devel:libflac$secondaryArchSuffix - devel:libfluidsynth$secondaryArchSuffix # crashes vlc-cache-gen devel:libfontconfig$secondaryArchSuffix devel:libfreetype$secondaryArchSuffix - devel:libfribidi$secondaryArchSuffix - devel:libgcrypt$secondaryArchSuffix devel:libgl$secondaryArchSuffix -# devel:libgnutls$secondaryArchSuffix # crashes vlc on start - devel:libgpg_error$secondaryArchSuffix - devel:libharfbuzz$secondaryArchSuffix devel:libiconv$secondaryArchSuffix - devel:libidn$secondaryArchSuffix devel:libjpeg$secondaryArchSuffix - devel:liblua52$secondaryArchSuffix devel:libmad$secondaryArchSuffix devel:libmatroska$secondaryArchSuffix devel:libmodplug$secondaryArchSuffix devel:libmpcdec$secondaryArchSuffix devel:libmpeg2$secondaryArchSuffix - devel:libmtp$secondaryArchSuffix devel:libogg$secondaryArchSuffix devel:libopus$secondaryArchSuffix - devel:libpng$secondaryArchSuffix - devel:libpthread_stubs$secondaryArchSuffix - devel:libQt5Core$secondaryArchSuffix >= 5.7 - devel:libQt5Gui$secondaryArchSuffix >= 5.7 - devel:libQt5Widgets$secondaryArchSuffix >= 5.7 + devel:libpng16$secondaryArchSuffix + devel:libQt5Core$secondaryArchSuffix devel:libsamplerate$secondaryArchSuffix -# devel:libschroedinger_1.0$secondaryArchSuffix # fix libschroedinger.pc - devel:libsdl_1.2$secondaryArchSuffix - devel:libsdl_image_1.2$secondaryArchSuffix -# devel:libshout$secondaryArchSuffix # crashes vlc on quit. Haiku #8600 - devel:libsmbclient$secondaryArchSuffix devel:libspeex$secondaryArchSuffix - devel:libssh2$secondaryArchSuffix devel:libssl$secondaryArchSuffix - devel:libswscale$secondaryArchSuffix >= 5 + devel:libswscale$secondaryArchSuffix devel:libtag$secondaryArchSuffix devel:libtheora$secondaryArchSuffix devel:libtwolame$secondaryArchSuffix - devel:libupnp$secondaryArchSuffix +# devel:libupnp$secondaryArchSuffix # dedlock when scan upnp devices devel:libvorbis$secondaryArchSuffix devel:libvpx$secondaryArchSuffix devel:libx264$secondaryArchSuffix devel:libx265$secondaryArchSuffix - devel:libxcb$secondaryArchSuffix devel:libxml2$secondaryArchSuffix devel:libz$secondaryArchSuffix - devel:live555$secondaryArchSuffix " + BUILD_PREREQUIRES=" cmd:aclocal cmd:autoreconf - cmd:g++$secondaryArchSuffix + cmd:gcc$secondaryArchSuffix cmd:gettext$secondaryArchSuffix cmd:libtoolize$secondaryArchSuffix cmd:make cmd:pkg_config$secondaryArchSuffix cmd:xargs + cmd:yacc " -PATCH() -{ - # Remove unnecessary warnings about unimplemented pragmas on gcc for now. - # config.h:798: warning: ignoring #pragma STDC FENV_ACCESS [-Wunknown-pragmas] - # config.h:799: warning: ignoring #pragma STDC FP_CONTRACT [-Wunknown-pragmas] - # doesn't work for some reason - sed -i 's/ifndef __FAST_MATH__/if 0/g' configure.ac || die - - # _FORTIFY_SOURCE is set to 2 by default on Haiku, remove redefine warnings. - sed -i '/_FORTIFY_SOURCE.*, 2,/d' configure.ac || die -} - BUILD() { + unzip -o $portDir/additional-files/haikuicons.zip -d $sourceDir + autoreconf - runConfigure ./configure --disable-rpath \ + + export BUILDCC=gcc + export CFLAGS="-lgnu -lnetwork" + + runConfigure ./configure \ + --prefix=$appsDir/VLC \ + --bindir=$appsDir/VLC \ + --libdir=$appsDir/VLC/lib \ + --datarootdir=$appsDir/VLC/data \ + --datadir=$appsDir/VLC/data \ + --disable-rpath \ --with-default-font=`finddir B_SYSTEM_FONTS_DIRECTORY`/ttfonts/NotoMono-Regular.ttf \ --with-default-font-family=Sans \ - --with-default-monospace-font-family=Monospace --disable-update-check \ - --disable-dependency-tracking --enable-run-as-root \ - --disable-update-check --enable-fast-install --disable-dependency-tracking -# --bindir=$appsDir/VLC --libdir=$appsDir/VLC/plugins + --with-default-monospace-font-family=Monospace \ + --disable-dependency-tracking \ + --enable-run-as-root \ + --disable-update-check \ + --enable-fast-install \ + --disable-lua + make $jobArgs + + cd haiku + gcc VLCLauncher.cpp -lbe -o "VLC media player" } INSTALL() { make install-strip - rm -rf $dataDir/{applications,icons,kde4,vlc} + rm -rf $appsDir/VLC/data/{applications,icons,kde4,vlc} + rm -rf $appsDir/VLC/{cvlc,qvlc,rvlc,vlc-wrapper} + rm -rf $developDir $manDir $docDir $appsDir/VLC/lib/pkgconfig + find $appsDir/VLC/lib -name '*.a' -delete + find $appsDir/VLC/lib -name '*.la' -delete - # Punt useless libtool's .la files - find $libDir -name '*.la' -delete + cp "haiku/VLC media player" $appsDir/VLC + mv $appsDir/VLC/vlc $appsDir/VLC/VLC + mkdir -p $prefix/bin + ln -s $appsDir/VLC/VLC $prefix/bin/vlc local APP_SIGNATURE="application/x-vnd.vlc" local MAJOR="`echo "$portVersion" | cut -d. -f1`" @@ -227,21 +192,18 @@ INSTALL() -e "s|@LONG_INFO@|$LONG_INFO|" \ $portDir/additional-files/vlc.rdef.in > vlc.rdef - addResourcesToBinaries vlc.rdef $binDir/vlc - addAppDeskbarSymlink $binDir/vlc "VLC media player" + addResourcesToBinaries vlc.rdef $appsDir/VLC/VLC - fixPkgconfig - mkdir -p $prefix/develop/lib${secondaryArchSuffix/_//} - # TODO: fix libvlc.pc location - # mv -f $prefix/lib/pkgconfig $prefix/develop/lib${secondaryArchSuffix/_//}/ + local APP_SIGNATURE="application/x-vnd.vlc-launcher" + sed \ + -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \ + -e "s|@MAJOR@|$MAJOR|" \ + -e "s|@MIDDLE@|$MIDDLE|" \ + -e "s|@MINOR@|$MINOR|" \ + -e "s|@LONG_INFO@|$LONG_INFO|" \ + $portDir/additional-files/vlc_launcher.rdef.in > vlc_launcher.rdef - prepareInstalledDevelLibs \ - libvlc libvlccore - packageEntries devel \ - $developDir -} - -TEST() -{ - make check + addResourcesToBinaries vlc_launcher.rdef "$appsDir/VLC/VLC media player" + + addAppDeskbarSymlink $appsDir/VLC/VLC "VLC media player" }