Gnash: bump to git version

This commit is contained in:
Gerasim Troeglazov
2021-09-28 17:40:07 +10:00
parent 77e79c185e
commit 2ad76d80f9
8 changed files with 967 additions and 577 deletions

View File

@@ -0,0 +1,53 @@
resource app_flags B_MULTIPLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "Gnash",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource file_types message {
"types" = "application/x-shockwave-flash"
};
resource vector_icon {
$"6E636966070500020106033C64803CA1ADBCC3FA3C83B0483A904784FF00FFFF"
$"FFE5F8A7A7FFFF9E9E020106023CE0000000000000003DA00048E00048200000"
$"FF2929FFDC050505FF020006023C40000000000000003CE0004AB0004A400000"
$"D50505FF790303020116013F37F7000000000000BF37F74455184B74C300FF03"
$"FFAA060A0204532FC4B2B5FA5A374F49C973BFE542552B4A304FB3C6C020312D"
$"B5A1BABA3E250607BE3B27433155B638C5A3BB7AC94E4658BEE1CA2056545848"
$"583D5947C931BD5D57373F4E584AB96FC64602044D2EBF6BB54552314C45C87F"
$"BE22414F3048BAF3C433264030312C34BBA3B8130214C39FBFB8C56DC014C1D0"
$"BF5BBD6CBE74BD6CBF05BD6CBDA1C30FBBB4C189BD39C30FBBB4C30EBBB4C30E"
$"BBB4C3F3BADDC47FB88CC47FB9C2C47FB825C4532BC46FB7C1C4A0B740C534B6"
$"9AC50CB6F4C569B61DC457B50DC4E7B4F7C342B537C208B4A1C2A3B4F0C1C5B4"
$"7BC137B43DC180B459C136B43DC135B43BC135B43BC07AB3F3BED122BFAB22BB"
$"AD22B924B88CB924B5ECB924BAA4BD07BD0EBAC5BC6CBC50BD67BA9CBF41BA9C"
$"BE51BA9CBFE1BC14C0D6BB3CC06DBB28C160B915C518B915C2D8B915C75CBE1E"
$"C831BB0DC831C132C831C4BBC5D1C38AC701C5EBC4A1C669C2A3C669C3D4C669"
$"C1730204BB27B88CBB2733BB27B684BED0B4E1BCCBB4E1C0D8B4E1C27BB88CC2"
$"7BB684C27B33BED0BC36C0D8BC36BCCBBC360205BEA9C6F2C10AC6F2BC4AC6F2"
$"BBA5C486BBA5C5D6BBA5C350BD41C14ABC0DC28BBDB4C16EBE96C19B3CC189C0"
$"51C1E3C478C3A4C478C220C478C52A0204BED1B550BF72B550BE31B550BDAFB6"
$"74BDAFB5D3BDAFB768BED1B81ABED1B7AABED1B7AABFF4B674BFF4B768BFF3B5"
$"D30204BB96B88CBB96B7EABB96B92CBCB9B9ADBC1AB9ADBDAFB9ADBE60B88CBD"
$"F1B88CBDF1B88CBCB9B768BDAFB768BC1AB7680204BED1BBC5BE31BBC5BF72BB"
$"C5BFF4BAA2BFF4BB43BFF4B9ADBED1B8FBBED1B96CBED1B96CBDAFBAA2BDAFB9"
$"ADBDAFBB430204C20BB88CC20BB92CC20BB7EAC0E9B768C18AB768BFF3B768BF"
$"41B88CBFB2B88CBFB2B88CC0E9B9ADBFF3B9ADC189B9AD090A00030201001001"
$"178422040A040101000A010100000A020102000A0503030405023DCB083C06B4"
$"BC84B03D7AA44913464552C90A060106023CCE233AF903BBB9633C8D2C4963F4"
$"4690C70A060107023CCE233AF903BBB9633C8D2C4963F44690C70A060108023C"
$"CE233AF903BBB9633C8D2C4963F44690C70A060109023CCE233AF903BBB9633C"
$"8D2C4963F44690C7"
};

View File

@@ -1,127 +0,0 @@
SUMMARY="A player for Adobe Flash"
DESCRIPTION="GNU Gnash is the GNU Flash movie player — Flash is an animation \
file format pioneered by Macromedia which continues to be supported by their \
successor company, Adobe. Flash has been extended to include audio and video \
content, and programs written in ActionScript, an ECMAScript-compatible language."
HOMEPAGE="http://www.gnu.org/software/gnash/"
COPYRIGHT="2005-2012 Free Software Foundation"
LICENSE="GNU GPL v3"
REVISION="7"
SOURCE_URI="ftp://ftp.gnu.org/pub/gnu/gnash/0.8.10/gnash-0.8.10.tar.bz2"
CHECKSUM_SHA256="9625072e45df92baa2c28fc9999d4e2deb66bc827530baedfad2e4e2292d1224"
PATCHES="gnash-0.8.10.patchset"
ARCHITECTURES="!all"
SECONDARY_ARCHITECTURES="!x86_gcc2 !x86"
GLOBAL_WRITABLE_FILES="
settings/gnashpluginrc auto-merge
settings/gnashrc auto-merge
"
PROVIDES="
gnash$secondaryArchSuffix = $portVersion
app:Gnash = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libagg$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libboost_date_time$secondaryArchSuffix
lib:libboost_iostreams$secondaryArchSuffix
lib:libboost_program_options$secondaryArchSuffix
lib:libboost_serialization$secondaryArchSuffix
lib:libboost_system$secondaryArchSuffix
lib:libboost_thread$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libexpat$secondaryArchSuffix
#lib:libfontconfig$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libgif$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libpng$secondaryArchSuffix
lib:libsdl$secondaryArchSuffix
lib:libsdl_sound$secondaryArchSuffix
lib:libspeex$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
boost${secondaryArchSuffix}_devel
devel:libagg$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libboost_date_time$secondaryArchSuffix
devel:libboost_iostreams$secondaryArchSuffix
devel:libboost_program_options$secondaryArchSuffix
devel:libboost_serialization$secondaryArchSuffix
devel:libboost_system$secondaryArchSuffix
devel:libboost_thread$secondaryArchSuffix
devel:libbz2$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libexpat$secondaryArchSuffix
#devel:libfontconfig$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libgif$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libpng$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libsdl_sound$secondaryArchSuffix
devel:libspeex$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:sdl_config$secondaryArchSuffix
cmd:sed
cmd:xargs
"
BUILD()
{
INCLUDE_DIR=`finddir B_SYSTEM_DIRECTORY`/$relativeIncludeDir
LIB_DIR=`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir
libtoolize --force --copy --install
aclocal
autoconf
automake
runConfigure ./configure --enable-renderer=agg --enable-media=ffmpeg \
--enable-gui=sdl --enable-sound=sdl --without-gconf \
--disable-extensions \
--with-boost-incl=$INCLUDE_DIR/boost \
--with-boost-lib=$LIB_DIR \
--includedir=$includeDir \
--bindir=$appsDir \
--libdir=$libDir
make $jobArgs
}
INSTALL()
{
make install
addAppDeskbarSymlink $appsDir/Gnash Gnash
}
TEST()
{
make check
}

View File

@@ -0,0 +1,186 @@
SUMMARY="A player for Adobe Flash"
DESCRIPTION="GNU Gnash is the GNU Flash movie player — Flash is an animation \
file format pioneered by Macromedia which continues to be supported by their \
successor company, Adobe. Flash has been extended to include audio and video \
content, and programs written in ActionScript, an ECMAScript-compatible language."
HOMEPAGE="http://www.gnu.org/software/gnash/"
COPYRIGHT="2005-2019 Free Software Foundation"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="8a11e60585db4ed6bc4eafadfbd9b3123ced45d9"
SOURCE_URI="http://git.savannah.gnu.org/cgit/gnash.git/snapshot/gnash-$srcGitRev.tar.gz"
CHECKSUM_SHA256="c2628665624a5d7b76cf68142f151da7cac61637c55052e048a3e8e958223f99"
SOURCE_DIR="gnash-$srcGitRev"
PATCHES="gnash-$portVersion.patchset"
ADDITIONAL_FILES="gnash.rdef.in"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
GLOBAL_WRITABLE_FILES="
settings/gnashpluginrc auto-merge
settings/gnashrc auto-merge
"
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion=${portVersion%~*}dev
PROVIDES="
gnash$secondaryArchSuffix = $portVersion
cmd:gnash = $portVersion
cmd:gprocessor = $portVersion
cmd:rtmpget = $portVersion
lib:libgnashbase$secondaryArchSuffix = $portVersion
lib:libgnashbase_$libVersion$secondaryArchSuffix = $portVersion
lib:libgnashcore$secondaryArchSuffix = $portVersion
lib:libgnashcore_$libVersion$secondaryArchSuffix = $portVersion
lib:libgnashdevice$secondaryArchSuffix = $portVersion
lib:libgnashdevice_$libVersion$secondaryArchSuffix = $portVersion
lib:libgnashmedia$secondaryArchSuffix = $portVersion
lib:libgnashmedia_$libVersion$secondaryArchSuffix = $portVersion
lib:libgnashrender$secondaryArchSuffix = $portVersion
lib:libgnashrender_$libVersion$secondaryArchSuffix = $portVersion
lib:libgnashsound$secondaryArchSuffix = $portVersion
lib:libgnashsound_$libVersion$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libagg$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libboost_program_options$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libexpat$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libgif$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libltdl$secondaryArchSuffix
lib:libpng$secondaryArchSuffix
lib:libspeex$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
gnash${secondaryArchSuffix}_devel = $portVersion
devel:libgnashbase$secondaryArchSuffix = $portVersion
devel:libgnashcore$secondaryArchSuffix = $portVersion
devel:libgnashdevice$secondaryArchSuffix = $portVersion
devel:libgnashmedia$secondaryArchSuffix = $portVersion
devel:libgnashrender$secondaryArchSuffix = $portVersion
devel:libgnashsound$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
gnash$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libagg$secondaryArchSuffix
devel:libavcodec$secondaryArchSuffix
devel:libboost_program_options$secondaryArchSuffix >= 1.69.0
devel:libbz2$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libexpat$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libgif$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libpng$secondaryArchSuffix
devel:libspeex$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:sed
cmd:xargs
"
BUILD()
{
INCLUDE_DIR=`finddir B_SYSTEM_DIRECTORY`/$relativeIncludeDir
LIB_DIR=`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir
autogen.sh
runConfigure ./configure \
--with-boost-incl=$INCLUDE_DIR/boost \
--with-boost-lib=$LIB_DIR \
--bindir=$commandBinDir \
--libdir=$libDir \
--enable-renderer=agg \
--enable-media=ffmpeg \
--enable-gui=haiku \
--enable-sound=mkit \
--disable-jemalloc \
--without-gconf \
--disable-extensions
make $jobArgs
}
INSTALL()
{
make install
mv $libDir/gnash/*dev.so $libDir
rm -rf $commandBinDir/gnash \
$dataDir/{applications,icons} \
$libDir/gnash
mv $commandBinDir/haiku-gnash $commandBinDir/gnash
strip $binDir/* $libDir/*.so
for i in $libDir/lib*.so;do
mv $i ${i%-*}.so
ln -fs ${i%-*}.so $i
done
prepareInstalledDevelLibs \
libgnashbase libgnashcore \
libgnashdevice libgnashmedia \
libgnashrender libgnashsound
fixPkgconfig
packageEntries devel \
$developDir
local APP_SIGNATURE="application/x-vnd.gnash-player"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"
local LONG_INFO="$SUMMARY"
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/gnash.rdef.in > gnash.rdef
addResourcesToBinaries gnash.rdef $commandBinDir/gnash
}
TEST()
{
make check
}

View File

@@ -1,146 +0,0 @@
#!/bin/bash
#
# Installing Gnash dependencies.
#
#
# Gnash at runtime needs
# Curl optional package
# OpenSSL optional package
# media-video/ffmpeg
# media-image/giflib
# boost::thread
# boost::date_time
#
#
# Gnash at compile-time needs
# sed
# gcc4
# libtool
# autotools
# Curl optional package
# OpenSSL optional package
# media-video/ffmpeg
# media-image/giflib
# boost-all
# agg >= 2.5 (the version in libbe is 2.4, cannot be used and proper care should be taken to link to -lagg before -lbe)
#
#
# Checking Gnash from repository requires
# Python >= 2.4
# dev-util/bzr
#
#
# Building the depreciated SDL gui additionally requires
# SDL (gcc4 build) http://students.mimuw.edu.pl/~ap262965/haiku-gnash/SDL-1.2.13-r1a1-x86-gcc4-2009-11-13.zip
# iconv_header (or the LibIconv optional package) http://students.mimuw.edu.pl/~ap262965/haiku-gnash/iconv-091128.h
#
function ask() {
case `alert --idea "Install $1?" "Install" "Already Installed" "Bail"` in
"Install")
wget "$2"
bn=`basename "$2"`
unzip -o -d /boot "$bn"
;;
"Already Installed")
;;
*)
alert --info "Aborted installing Gnash dependencies." Dismiss
exit
;;
esac
}
function ask_bzr() {
case `alert --idea "Install (unstable) bazaar 2.1.0? Bazaar is needed to checkout the Gnash sources." "Install" "Already Installed" "Bail"` in
"Install")
if test ! -e bzr-2.1.0.tar.gz ; then
wget http://launchpad.net/bzr/2.1/2.1.0/+download/bzr-2.1.0.tar.gz ;
tar xf bzr-2.1.0.tar.gz ;
fi ;
pushd bzr-2.1.0 ;
if test ! -e bzr.old ; then
mv bzr bzr.old ;
sed bzr.old > bzr -e 's|/usr/bin/env python|/boot/common/bin/python|' ;
chmod +x bzr ;
fi ;
if test ! -e setup.py.old ; then
mv setup.py setup.py.old ;
sed setup.py.old > setup.py -e 's|/usr/bin/env python|/boot/common/bin/python|' ;
chmod +x setup.py ;
fi ;
./setup.py install ;
popd ;
true
;;
"Already Installed")
true
;;
*)
echo "NOTE: aborting Gnash installation" ;
false
;;
esac ;
}
function ask_opt() {
case `alert --idea "Install $1?" "Install" "Already Installed" "Bail"` in
"Install")
installoptionalpackage -a "$1"
;;
"Already Installed")
;;
*)
alert --info "Aborted installing Gnash dependencies." Dismiss
exit
;;
esac
}
if [ $# -gt 1 ] || ( [ $# -eq 1 ] && [ x$1 != 'x--compile-time' ] )
then
alert --info "Usage: $0 [--compile-time]"
exit 1
fi
if [ $# -eq 1 ]
then
COMPILE_TIME=yes
else
COMPILE_TIME=no
fi
DIRNAME="gnash-dependencies"
if [ -e "$DIRNAME" ]
then
echo "Warning: directory \"$DIRNAME\"/ already present"
fi
mkdir "$DIRNAME"
pushd "$DIRNAME"
ask_opt Sed
ask Ffmpeg-gcc4 http://students.mimuw.edu.pl/~ap262965/haiku-gnash/ffmpeg-gcc4-haiku-2009-09-19.zip
ask giflib http://www.fileden.com/files/2008/8/23/2062382/packages/giflib-4.1.6-gcc2-2008-12-31.zip
if [ $COMPILE_TIME == yes ]
then
#ask Boost-all http://www.haiku-ports.de/packages/dev-libs/boost/boost-1.38.0-gcc4-haiku-2009-09-13.zip
ask Boost-all http://students.mimuw.edu.pl/~ap262965/haiku-gnash/boost-1.38.0-gcc4-haiku-2009-09-13.zip
ask agg-2.5-gcc4 http://students.mimuw.edu.pl/~ap262965/haiku-gnash/agg-2.5-gcc4-haiku-2009-09-13.zip
ask_bzr
else
ask Boost::thread http://students.mimuw.edu.pl/~ap262965/haiku-gnash/libboost_thread-1.38.0-gcc4-2009-11-14.zip
ask Boost::date_time http://students.mimuw.edu.pl/~ap262965/haiku-gnash/libboost_date_time-1.38.0-gcc4-2009-11-14.zip
fi
ask_opt Curl
ask_opt OpenSSL

View File

@@ -1,304 +0,0 @@
From 27ea051c05dcc53eb9ea2359f7e71eaacc8c2ada Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Thu, 24 Apr 2014 22:18:34 +0000
Subject: fix Haiku build
diff --git a/libbase/GnashImageGif.cpp b/libbase/GnashImageGif.cpp
index eeba4b7..bddb452 100644
--- a/libbase/GnashImageGif.cpp
+++ b/libbase/GnashImageGif.cpp
@@ -269,7 +269,8 @@ GifInput::processRecord(GifRecordType record)
void
GifInput::read()
{
- _gif = DGifOpen(_inStream.get(), &readData);
+ int error_code;
+ _gif = DGifOpen(_inStream.get(), &readData, &error_code);
GifRecordType record;
diff --git a/libbase/utility.h b/libbase/utility.h
index 8b9f48c..51ea858 100644
--- a/libbase/utility.h
+++ b/libbase/utility.h
@@ -61,7 +61,7 @@ namespace std
};
#endif
-#if defined(__HAIKU__)
+#if defined(__HAIKU_OLD)
namespace std {
class wstring : public std::basic_string<char>
{
diff --git a/macros/boost.m4 b/macros/boost.m4
index 845aaae..5788f57 100644
--- a/macros/boost.m4
+++ b/macros/boost.m4
@@ -37,7 +37,7 @@ AC_DEFUN([GNASH_PATH_BOOST],
boost_headers="detail/lightweight_mutex.hpp thread/thread.hpp multi_index_container.hpp multi_index/key_extractors.hpp thread/mutex.hpp program_options/options_description.hpp iostreams/stream.hpp"
dnl this is a list of *required* libraries. If any of these are missing, this
dnl test will return a failure, and Gnash won't build.
- boost_libs="thread program_options iostreams"
+ boost_libs="thread program_options iostreams system"
dnl this is a list of *recommended* libraries. If any of these are missing, this
dnl test will return a warning, and Gnash will build, but testing won't work.
--
1.8.3.4
From 4b3dae970549d42723c2528c250a1f95248145c7 Mon Sep 17 00:00:00 2001
From: Alexis Ballier <aballier@gentoo.org>
Date: Wed, 13 Feb 2013 17:38:44 +0000
Subject: Fix build with latest FFmpeg (second attempt)
Add ifdefery to be compatible with older versions.
See ticket #38122
Signed-off-by: Sandro Santilli <strk@keybit.net>
---
(limited to 'libmedia/ffmpeg')
diff --git a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
index 067e418..5c8e1ad 100644
--- a/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
@@ -84,8 +84,10 @@ AudioDecoderFfmpeg::~AudioDecoderFfmpeg()
void AudioDecoderFfmpeg::setup(SoundInfo& info)
{
- // Init the avdecoder-decoder
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
+ // Starting from this version avcodec_register calls avcodec_init
avcodec_init();
+#endif
avcodec_register_all();// change this to only register need codec?
enum CodecID codec_id;
@@ -158,14 +160,14 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
case CODEC_ID_PCM_U16LE:
_audioCodecCtx->channels = (info.isStereo() ? 2 : 1);
_audioCodecCtx->sample_rate = info.getSampleRate();
- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; // ?! arbitrary ?
+ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16; // ?! arbitrary ?
_audioCodecCtx->frame_size = 1;
break;
default:
_audioCodecCtx->channels = (info.isStereo() ? 2 : 1);
_audioCodecCtx->sample_rate = info.getSampleRate();
- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16; // ?! arbitrary ?
+ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16; // ?! arbitrary ?
break;
}
}
@@ -173,7 +175,10 @@ void AudioDecoderFfmpeg::setup(SoundInfo& info)
void AudioDecoderFfmpeg::setup(const AudioInfo& info)
{
// Init the avdecoder-decoder
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
+ // Starting from this version avcodec_register calls avcodec_init
avcodec_init();
+#endif
avcodec_register_all();// change this to only register need codec?
enum CodecID codec_id = CODEC_ID_NONE;
@@ -297,7 +302,7 @@ void AudioDecoderFfmpeg::setup(const AudioInfo& info)
_audioCodecCtx->channels = (info.stereo ? 2 : 1);
_audioCodecCtx->sample_rate = info.sampleRate;
// was commented out (why?):
- _audioCodecCtx->sample_fmt = SAMPLE_FMT_S16;
+ _audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
break;
}
diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index d6e6902..136cc08 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -344,8 +344,10 @@ MediaParserFfmpeg::initializeParser()
{
av_register_all(); // TODO: needs to be invoked only once ?
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
_byteIOCxt.buffer = NULL;
-
+#endif
+
_inputFmt = probeStream();
#ifdef GNASH_ALLOW_VCODEC_ENV
@@ -366,7 +368,11 @@ MediaParserFfmpeg::initializeParser()
// which isn't needed.
_byteIOBuffer.reset(new unsigned char[byteIOBufferSize]);
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
init_put_byte(&_byteIOCxt,
+#else
+ _avIOCxt = avio_alloc_context(
+#endif
_byteIOBuffer.get(), // buffer
byteIOBufferSize, // buffer size
0, // write flags
@@ -376,7 +382,11 @@ MediaParserFfmpeg::initializeParser()
MediaParserFfmpeg::seekMediaWrapper // seeker callback
);
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
_byteIOCxt.is_streamed = 1;
+#else
+ _avIOCxt->seekable = 0;
+#endif
#if !defined(LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
// Needed for Lenny.
@@ -387,12 +397,19 @@ MediaParserFfmpeg::initializeParser()
assert(_formatCtx);
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
// Otherwise av_open_input_stream will reallocate the context.
AVFormatParameters ap;
std::memset(&ap, 0, sizeof ap);
ap.prealloced_context = 1;
if (av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, &ap) < 0)
+#else
+
+ _formatCtx->pb = _avIOCxt;
+
+ if (avformat_open_input(&_formatCtx, "", _inputFmt, NULL) < 0)
+#endif
{
throw IOException("MediaParserFfmpeg couldn't open input stream");
}
@@ -400,10 +417,17 @@ MediaParserFfmpeg::initializeParser()
#if defined(LIBAVCODEC_VERSION_MAJOR) && LIBAVCODEC_VERSION_MAJOR >= 52
// Note: in at least some versions of ffmpeg, av_open_input_stream does
// not parse metadata; not sure why.
+#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,5,0)
AVMetadata* md = _formatCtx->metadata;
if (md) {
AVMetadataTag* tag = av_metadata_get(md, "album", 0,
AV_METADATA_MATCH_CASE);
+#else
+ AVDictionary* md = _formatCtx->metadata;
+ if (md) {
+ AVDictionaryEntry* tag = av_dict_get(md, "album", 0,
+ AV_DICT_MATCH_CASE);
+#endif
if (tag && tag->value) {
setId3Info(&Id3Info::album, std::string(tag->value),
_id3Object);
@@ -620,27 +644,27 @@ MediaParserFfmpeg::seekMedia(boost::int64_t offset, int whence)
}
boost::uint16_t
-MediaParserFfmpeg::SampleFormatToSampleSize(SampleFormat fmt)
+MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
{
switch (fmt)
{
- case SAMPLE_FMT_U8: // unsigned 8 bits
+ case AV_SAMPLE_FMT_U8: // unsigned 8 bits
return 1;
- case SAMPLE_FMT_S16: // signed 16 bits
- case SAMPLE_FMT_FLT: // float
+ case AV_SAMPLE_FMT_S16: // signed 16 bits
+ case AV_SAMPLE_FMT_FLT: // float
return 2;
#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
// Was dropped for version 52.0.0
- case SAMPLE_FMT_S24: // signed 24 bits
+ case AV_SAMPLE_FMT_S24: // signed 24 bits
return 3;
#endif
- case SAMPLE_FMT_S32: // signed 32 bits
+ case AV_SAMPLE_FMT_S32: // signed 32 bits
return 4;
- case SAMPLE_FMT_NONE:
+ case AV_SAMPLE_FMT_NONE:
default:
return 8; // arbitrary value
}
diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.h b/libmedia/ffmpeg/MediaParserFfmpeg.h
index 4e410d8..a14cfb6 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.h
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.h
@@ -154,7 +154,13 @@ private:
AVStream* _audioStream;
/// ?
- ByteIOContext _byteIOCxt;
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
+// AVIOContext was introduced a bit earlier but without version bump, so let's
+// be safe
+ ByteIOContext _byteIOCxt;
+#else
+ AVIOContext* _avIOCxt;
+#endif
/// Size of the ByteIO context buffer
//
@@ -172,7 +178,7 @@ private:
//
/// TODO: move somewhere in ffmpeg utils..
///
- boost::uint16_t SampleFormatToSampleSize(SampleFormat fmt);
+ boost::uint16_t SampleFormatToSampleSize(AVSampleFormat fmt);
/// Make an EncodedVideoFrame from an AVPacket and push to buffer
//
diff --git a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
index 40a5c80..eeefafe 100644
--- a/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
+++ b/libmedia/ffmpeg/VideoDecoderFfmpeg.cpp
@@ -171,7 +171,10 @@ VideoDecoderFfmpeg::init(enum CodecID codecId, int /*width*/, int /*height*/,
boost::uint8_t* extradata, int extradataSize)
{
// Init the avdecoder-decoder
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,6,2)
+ // Starting from this version avcodec_register calls avcodec_init
avcodec_init();
+#endif
avcodec_register_all();// change this to only register need codec?
_videoCodec = avcodec_find_decoder(codecId);
@@ -529,7 +532,11 @@ get_buffer(AVCodecContext* avctx, AVFrame* pic)
static unsigned int pic_num = 0;
pic->type = FF_BUFFER_TYPE_USER;
+#if LIBAVCODEC_VERSION_MAJOR < 54
+ // This field has been unused for longer but has been removed with
+ // libavcodec 54.
pic->age = ++pic_num - surface->getPicNum();
+#endif
surface->setPicNum(pic_num);
return 0;
#endif
diff --git a/libmedia/ffmpeg/ffmpegHeaders.h b/libmedia/ffmpeg/ffmpegHeaders.h
index 65a8d0c..7710121 100644
--- a/libmedia/ffmpeg/ffmpegHeaders.h
+++ b/libmedia/ffmpeg/ffmpegHeaders.h
@@ -83,5 +83,15 @@ extern "C" {
#define HAVE_SWSCALE_H 1
#endif
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,94,1)
+#define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
+#define AV_SAMPLE_FMT_U8 SAMPLE_FMT_U8
+#define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
+#define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
+#define AV_SAMPLE_FMT_DBL SAMPLE_FMT_DBL
+
+#define AVSampleFormat SampleFormat
+#endif
#endif // GNASH_MEDIA_FFMPEG_HEADERS_H
--
cgit v0.9.0.2

View File

@@ -0,0 +1,728 @@
From 309dfaa8d33d1b289729497dd2e59ff00310cfbd Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 28 Sep 2021 12:28:29 +1000
Subject: Fix build for Haiku
diff --git a/configure.ac b/configure.ac
index 97d3c87..790eada 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2948,7 +2948,7 @@ AC_ARG_WITH([gconf],
[Disable the use of gconf])],
[],
[case "${host}" in
- *-cygwin* | *-mingw* | *-pw32*) with_gconf=no ;;
+ *-cygwin* | *-mingw* | *-pw32* | *-haiku*) with_gconf=no ;;
*) with_gconf=yes ;;
esac])
AC_MSG_RESULT([$with_gconf])
diff --git a/gui/haiku/haiku.cpp b/gui/haiku/haiku.cpp
index c89e699..2c70f08 100644
--- a/gui/haiku/haiku.cpp
+++ b/gui/haiku/haiku.cpp
@@ -23,6 +23,7 @@
#include "RunResources.h"
+#include <iostream>
#include <boost/format.hpp>
#include "adipe.h"
@@ -204,6 +205,8 @@ public:
virtual ~BeApp()
{
+ //delete _gui->getStage()->runResources().soundHandler();
+
status_t st, exit_value;
do {
st = send_data(_pulse_tid, GNASH_QUITTING, NULL, 0);
@@ -356,8 +359,6 @@ HaikuGui::HaikuGui(unsigned long xid, float scale, bool loop, RunResources& r)
HaikuGui::~HaikuGui()
{
GNASH_REPORT_FUNCTION;
-
- delete _app;
}
bool
@@ -568,6 +569,12 @@ HaikuGui::getInterval()
return _interval;
}
+bool
+HaikuGui::showMouse(bool show)
+{
+ return _glue.ShowCursor(show);
+}
+
void
HaikuGui::resize_view(int width, int height)
{
diff --git a/gui/haiku/haiku_agg_glue.cpp b/gui/haiku/haiku_agg_glue.cpp
index ad546fc..f0f5eaa 100644
--- a/gui/haiku/haiku_agg_glue.cpp
+++ b/gui/haiku/haiku_agg_glue.cpp
@@ -34,6 +34,7 @@
#include <interface/Bitmap.h>
#include <View.h>
#include <Window.h>
+#include <Cursor.h>
#include <sys/mman.h>
@@ -85,6 +86,15 @@ public:
delete _bitmap; _bitmap = NULL;
_bitmap = new BBitmap(BRect(0,0,_width-1, _height-1), B_RGBA32);
}
+
+ void ShowCursor(bool show)
+ {
+ if (LockLooperWithTimeout(10000) == B_OK) {
+ BCursor cursor(show ? B_CURSOR_ID_SYSTEM_DEFAULT : B_CURSOR_ID_NO_CURSOR);
+ SetViewCursor(&cursor);
+ UnlockLooper();
+ }
+ }
enum gnash::key::code gnash_keycode(int code)
{
@@ -180,7 +190,7 @@ return c;
MakeFocus();
BPoint mouseWhere;
- ulong buttons;
+ uint32 buttons;
GetMouse(&mouseWhere, &buttons);
// XXX many buttons clicked simultaneously
BMessage msg(GNASH_MOUSE_CLICKED);
@@ -197,7 +207,7 @@ return c;
(void) where;
BPoint mouseWhere;
- ulong buttons;
+ uint32 buttons;
GetMouse(&mouseWhere, &buttons);
BMessage msg(GNASH_MOUSE_CLICKED);
@@ -223,7 +233,8 @@ HaikuAggGlue::HaikuAggGlue(Gui *gui, unsigned long xid)
_gui(gui),
_xid(xid),
_sharefd(-1),
- _viewhidden(false)
+ _viewhidden(false),
+ _cursorshow(true)
{
//GNASH_REPORT_FUNCTION;
}
@@ -497,6 +508,15 @@ HaikuAggGlue::Hidden()
_viewhidden = true;
}
+bool
+HaikuAggGlue::ShowCursor(bool show)
+{
+ bool prev = _cursorshow;
+ _view->ShowCursor(show);
+ _cursorshow = show;
+ return prev;
+}
+
//void
//HaikuAggGlue::BlankScreen()
//{
diff --git a/gui/haiku/haiku_agg_glue.h b/gui/haiku/haiku_agg_glue.h
index c52c373..2337ca1 100644
--- a/gui/haiku/haiku_agg_glue.h
+++ b/gui/haiku/haiku_agg_glue.h
@@ -25,6 +25,8 @@
#include <SupportDefs.h>
+#include "gui.h"
+
class BWindow;
namespace gnash
@@ -62,6 +64,8 @@ class HaikuAggGlue
void render(int minx, int miny, int maxx, int maxy);
void Shown();
void Hidden();
+ void SetCursor(gnash_cursor_type newcursor);
+ bool ShowCursor(bool show);
//void BlankScreen();
private:
unsigned char *_offscreenbuf;
@@ -80,6 +84,7 @@ class HaikuAggGlue
std::string _sharefilename;
int _sharefd;
bool _viewhidden;
+ bool _cursorshow;
};
}
diff --git a/gui/haiku/haikusup.h b/gui/haiku/haikusup.h
index 7ea0573..cc7b852 100644
--- a/gui/haiku/haikusup.h
+++ b/gui/haiku/haikusup.h
@@ -70,6 +70,7 @@ public:
virtual void renderBuffer();
virtual void setInterval(unsigned int interval);
virtual void setTimeout(unsigned int timeout);
+ virtual bool showMouse(bool show);
virtual void error(const std::string &msg);
virtual bool yesno(const std::string &question);
diff --git a/libbase/GnashImageGif.cpp b/libbase/GnashImageGif.cpp
index 2ae5ddb..fa7b569 100644
--- a/libbase/GnashImageGif.cpp
+++ b/libbase/GnashImageGif.cpp
@@ -120,7 +120,7 @@ GifInput::GifInput(std::shared_ptr<IOChannel> in)
GifInput::~GifInput()
{
// Clean up allocated data.
-#if GIFLIB_MAJOR==5 && GIFLIB_MINOR==1
+#if GIFLIB_MAJOR==5 && GIFLIB_MINOR>=1
DGifCloseFile(_gif, 0);
#else
DGifCloseFile(_gif);
diff --git a/libbase/rc.cpp b/libbase/rc.cpp
index 38ba3ed..e33c060 100644
--- a/libbase/rc.cpp
+++ b/libbase/rc.cpp
@@ -75,7 +75,11 @@ RcInitFile::RcInitFile()
_debugger(false),
_verbosity(-1),
// will be reset to something else if __OS2__x is defined:
+#ifdef __HAIKU__
+ _urlOpenerFormat("open '%u'"),
+#else
_urlOpenerFormat("xdg-open '%u'"),
+#endif
_flashVersionString(
DEFAULT_FLASH_PLATFORM_ID" "\
DEFAULT_FLASH_MAJOR_VERSION","\
diff --git a/libbase/utility.h b/libbase/utility.h
index 10f35aa..5fca0a4 100644
--- a/libbase/utility.h
+++ b/libbase/utility.h
@@ -61,7 +61,7 @@ namespace std
};
#endif
-#if defined(__HAIKU__)
+#if defined(__HAIKU_OLD)
namespace std {
class wstring : public std::basic_string<char>
{
diff --git a/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp b/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp
index 127aaaa..216d96b 100644
--- a/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaHandlerFfmpeg.cpp
@@ -149,7 +149,7 @@ MediaHandlerFfmpeg::cameraNames(std::vector<std::string>& /*names*/) const
size_t
MediaHandlerFfmpeg::getInputPaddingSize() const
{
- return FF_INPUT_BUFFER_PADDING_SIZE;
+ return AV_INPUT_BUFFER_PADDING_SIZE;
}
} // gnash.media.ffmpeg namespace
diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index 9ceb8b0..a27ca56 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -64,7 +64,7 @@ AVInputFormat*
MediaParserFfmpeg::probeStream()
{
const size_t probeSize = 4096;
- const size_t bufSize = probeSize + FF_INPUT_BUFFER_PADDING_SIZE;
+ const size_t bufSize = probeSize + AV_INPUT_BUFFER_PADDING_SIZE;
std::unique_ptr<std::uint8_t[]> buffer(new std::uint8_t[bufSize]);
@@ -173,7 +173,7 @@ MediaParserFfmpeg::parseVideoFrame(AVPacket& packet)
// TODO: We might avoid the copy as a whole by making EncodedVideoFrame
// virtual.
- size_t allocSize = packet.size + FF_INPUT_BUFFER_PADDING_SIZE;
+ size_t allocSize = packet.size + AV_INPUT_BUFFER_PADDING_SIZE;
std::uint8_t* data = new std::uint8_t[allocSize];
std::copy(packet.data, packet.data+packet.size, data);
std::unique_ptr<EncodedVideoFrame> frame(new EncodedVideoFrame(data, packet.size, 0, timestamp));
@@ -221,7 +221,7 @@ MediaParserFfmpeg::parseAudioFrame(AVPacket& packet)
// TODO: We might avoid the copy as a whole by making EncodedAudioFrame
// virtual.
- size_t allocSize = packet.size + FF_INPUT_BUFFER_PADDING_SIZE;
+ size_t allocSize = packet.size + AV_INPUT_BUFFER_PADDING_SIZE;
std::uint8_t* data = new std::uint8_t[allocSize];
std::copy(packet.data, packet.data+packet.size, data);
diff --git a/libmedia/ffmpeg/ffmpegHeaders.h b/libmedia/ffmpeg/ffmpegHeaders.h
index d8f9b26..01b6115 100644
--- a/libmedia/ffmpeg/ffmpegHeaders.h
+++ b/libmedia/ffmpeg/ffmpegHeaders.h
@@ -64,6 +64,16 @@ extern "C" {
}
#endif
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,94,1)
+#define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
+#define AV_SAMPLE_FMT_U8 SAMPLE_FMT_U8
+#define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+#define AV_SAMPLE_FMT_S32 SAMPLE_FMT_S32
+#define AV_SAMPLE_FMT_FLT SAMPLE_FMT_FLT
+#define AV_SAMPLE_FMT_DBL SAMPLE_FMT_DBL
+
+#define AVSampleFormat SampleFormat
+#endif
#ifdef HAVE_SWSCALE_H
extern "C" {
diff --git a/librender/opengl/Renderer_ogl.cpp b/librender/opengl/Renderer_ogl.cpp
index b377a9e..cd1afda 100644
--- a/librender/opengl/Renderer_ogl.cpp
+++ b/librender/opengl/Renderer_ogl.cpp
@@ -756,7 +756,7 @@ public:
return OSMesaGetCurrentContext();
}
# endif
- return glXGetCurrentContext();
+ return true;//glXGetCurrentContext();
#endif
}
diff --git a/librender/opengl/Renderer_ogl.h b/librender/opengl/Renderer_ogl.h
index a9caac8..0730ded 100644
--- a/librender/opengl/Renderer_ogl.h
+++ b/librender/opengl/Renderer_ogl.h
@@ -38,7 +38,7 @@
# ifdef WIN32
# define GL_CLAMP_TO_EDGE 0x812F
# else
-# include <GL/glx.h>
+# include <GL/gl.h>
# ifdef OSMESA_TESTING
# include <GL/osmesa.h>
# endif // OSMESA_TESTING
diff --git a/librender/opengl/tu_opengl_includes.h b/librender/opengl/tu_opengl_includes.h
index 230238e..1b05372 100644
--- a/librender/opengl/tu_opengl_includes.h
+++ b/librender/opengl/tu_opengl_includes.h
@@ -74,7 +74,7 @@
# include <OpenGL/glext.h>
#else
# include <GL/gl.h>
-# include <GL/glx.h>
+//# include <GL/glx.h>
# include <GL/glu.h>
#endif
#ifndef APIENTRY
diff --git a/libsound/mkit/sound_handler_mkit.cpp b/libsound/mkit/sound_handler_mkit.cpp
index 86235ee..f3dcf49 100644
--- a/libsound/mkit/sound_handler_mkit.cpp
+++ b/libsound/mkit/sound_handler_mkit.cpp
@@ -40,10 +40,8 @@
namespace gnash {
namespace sound {
-Mkit_sound_handler::Mkit_sound_handler(media::MediaHandler* m)
- :
- sound_handler(m),
- _audioopen(false)
+void
+Mkit_sound_handler::initAudio()
{
}
@@ -62,114 +60,98 @@ Mkit_sound_handler::openAudio()
B_MEDIA_BIG_ENDIAN : B_MEDIA_LITTLE_ENDIAN;
format.buffer_size = media_raw_audio_format::wildcard.buffer_size;
- _soundplayer.reset(new BSoundPlayer(&format, "Gnash",
- Mkit_sound_handler::FillNextBuffer, NULL, this));
+ _soundplayer = new BSoundPlayer(&format, "Gnash",
+ Mkit_sound_handler::FillNextBuffer, NULL, this);
if (B_OK != _soundplayer->InitCheck())
throw SoundException(_("Unable to open audio"));
_soundplayer->Start();
}
-Mkit_sound_handler::~Mkit_sound_handler()
+void
+Mkit_sound_handler::closeAudio()
{
- if (_soundplayer != NULL)
- _soundplayer->Stop(true, true);
+ if (_soundplayer != NULL) {
+ _soundplayer->SetHasData(false);
+ _soundplayer->Stop(true, true);
+ }
-// std::lock_guard<std::mutex> lock(_mutex);
-//#ifdef GNASH_DEBUG_HAIKU_AUDIO_PAUSING
-// log_debug("Pausing Mkit Audio on destruction");
-//#endif
-// SDL_PauseAudio(1);
-//
-// lock.unlock();
-
- // we already locked, so we call
- // the base class (non-locking) deleter
- delete_all_sounds();
-
- unplugAllInputStreams();
-
-// SDL_CloseAudio();
+ _audioopen = false;
- if (file_stream) file_stream.close();
+ delete _soundplayer;
+ _soundplayer = NULL;
}
-void
-Mkit_sound_handler::FillNextBuffer(void *cookie, void *buffer, size_t size,
- const media_raw_audio_format &format)
+Mkit_sound_handler::Mkit_sound_handler(media::MediaHandler* m)
+ :
+ sound_handler(m),
+ _audioopen(false)
{
- (void) format;
-
- size_t numSamples =
- size / sizeof(uint16);
- std::int16_t *data = (std::int16_t*) buffer;
-
- Mkit_sound_handler *that =
- reinterpret_cast<Mkit_sound_handler*>(cookie);
-
- that->fetchSamples(data, numSamples);
+ initAudio();
}
void
-Mkit_sound_handler::fetchSamples(std::int16_t* to, unsigned int nSamples)
+Mkit_sound_handler::reset()
{
std::lock_guard<std::mutex> lock(_mutex);
- sound_handler::fetchSamples(to, nSamples);
+ sound_handler::delete_all_sounds();
+ sound_handler::stop_all_sounds();
+}
- // TODO: move this to base class !
- if (file_stream)
- {
- // NOTE: if muted, the samples will be silent already
- std::uint8_t* stream = reinterpret_cast<std::uint8_t*>(to);
- unsigned int len = nSamples*2;
- file_stream.write((char*) stream, len);
+Mkit_sound_handler::~Mkit_sound_handler()
+{
+ std::lock_guard<std::mutex> lock(_mutex);
- // now, mute all audio
- std::fill(to, to+nSamples, 0);
- }
+ sound_handler::delete_all_sounds();
+ sound_handler::stop_all_sounds();
+ sound_handler::unplugAllInputStreams();
- // If nothing is left to play there is no reason to keep polling.
- if ( ! hasInputStreams() )
- {
-#ifdef GNASH_DEBUG_HAIKU_AUDIO_PAUSING
- log_debug("Pausing Mkit Audio...");
-#endif
- sound_handler::pause();
- }
+ closeAudio();
}
-void
-Mkit_sound_handler::reset()
+int
+Mkit_sound_handler::createStreamingSound(const media::SoundInfo& sinfo)
{
std::lock_guard<std::mutex> lock(_mutex);
- sound_handler::delete_all_sounds();
- sound_handler::stop_all_sounds();
+ return sound_handler::createStreamingSound(sinfo);
}
int
Mkit_sound_handler::create_sound(std::unique_ptr<SimpleBuffer> data,
- std::unique_ptr<media::SoundInfo> sinfo)
+ const media::SoundInfo& sinfo)
{
std::lock_guard<std::mutex> lock(_mutex);
- return sound_handler::create_sound(data, sinfo);
+ return sound_handler::create_sound(std::move(data), sinfo);
}
sound_handler::StreamBlockId
-Mkit_sound_handler::addSoundBlock(unsigned char* data,
- unsigned int dataBytes, unsigned int nSamples,
- int streamId)
+Mkit_sound_handler::addSoundBlock(SimpleBuffer buf,
+ size_t sampleCount, int seekSamples, int handle)
{
std::lock_guard<std::mutex> lock(_mutex);
- return sound_handler::addSoundBlock(data, dataBytes, nSamples, streamId);
+ return sound_handler::addSoundBlock(std::move(buf), sampleCount, seekSamples, handle);
}
void
-Mkit_sound_handler::stop_sound(int soundHandle)
+Mkit_sound_handler::stopEventSound(int soundHandle)
{
std::lock_guard<std::mutex> lock(_mutex);
- sound_handler::stop_sound(soundHandle);
+ sound_handler::stopEventSound(soundHandle);
}
+void
+Mkit_sound_handler::stopAllEventSounds()
+{
+ std::lock_guard<std::mutex> lock(_mutex);
+ sound_handler::stopAllEventSounds();
+}
+
+void
+Mkit_sound_handler::stopStreamingSound(int soundHandle)
+{
+ std::lock_guard<std::mutex> lock(_mutex);
+ sound_handler::stopStreamingSound(soundHandle);
+}
void
Mkit_sound_handler::delete_sound(int soundHandle)
@@ -185,7 +167,6 @@ Mkit_sound_handler::stop_all_sounds()
sound_handler::stop_all_sounds();
}
-
int
Mkit_sound_handler::get_volume(int soundHandle)
{
@@ -193,7 +174,6 @@ Mkit_sound_handler::get_volume(int soundHandle)
return sound_handler::get_volume(soundHandle);
}
-
void
Mkit_sound_handler::set_volume(int soundHandle, int volume)
{
@@ -222,12 +202,52 @@ Mkit_sound_handler::tell(int soundHandle)
return sound_handler::tell(soundHandle);
}
+
+sound_handler*
+create_sound_handler_mkit(media::MediaHandler* m)
+{
+ return new Mkit_sound_handler(m);
+}
+
+void
+Mkit_sound_handler::fetchSamples(std::int16_t* to, unsigned int nSamples)
+{
+ std::lock_guard<std::mutex> lock(_mutex);
+ sound_handler::fetchSamples(to, nSamples);
+
+ // If nothing is left to play there is no reason to keep polling.
+ if ( ! hasInputStreams() )
+ {
+#ifdef GNASH_DEBUG_HAIKU_AUDIO_PAUSING
+ log_debug("Pausing Mkit Audio...");
+#endif
+ sound_handler::pause();
+ }
+}
+
+void
+Mkit_sound_handler::FillNextBuffer(void *cookie, void *buffer, size_t size,
+ const media_raw_audio_format &format)
+{
+ (void) format;
+
+ size_t numSamples =
+ size / sizeof(uint16);
+ std::int16_t *data = (std::int16_t*) buffer;
+
+ Mkit_sound_handler *that =
+ reinterpret_cast<Mkit_sound_handler*>(cookie);
+
+ that->fetchSamples(data, numSamples);
+}
+
+
void
Mkit_sound_handler::plugInputStream(std::unique_ptr<InputStream> newStreamer)
{
std::lock_guard<std::mutex> lock(_mutex);
- sound_handler::plugInputStream(newStreamer);
+ sound_handler::plugInputStream(std::move(newStreamer));
{ // TODO: this whole block should only be executed when adding
// the first stream.
@@ -237,7 +257,6 @@ Mkit_sound_handler::plugInputStream(std::unique_ptr<InputStream> newStreamer)
#endif
openAudio();
sound_handler::unpause();
-
}
}
@@ -264,12 +283,12 @@ Mkit_sound_handler::unpause()
}
}
-
-sound_handler*
-create_sound_handler_mkit(media::MediaHandler* m)
-// Factory.
+void
+Mkit_sound_handler::unplugInputStream(InputStream* id)
{
- return new Mkit_sound_handler(m);
+ std::lock_guard<std::mutex> lock(_mutex);
+
+ sound_handler::unplugInputStream(id);
}
} // gnash.sound namespace
diff --git a/libsound/mkit/sound_handler_mkit.h b/libsound/mkit/sound_handler_mkit.h
index 9cad2ac..3e6b3ee 100644
--- a/libsound/mkit/sound_handler_mkit.h
+++ b/libsound/mkit/sound_handler_mkit.h
@@ -43,15 +43,19 @@ namespace sound {
/// Mkit media kit based sound_handler
class Mkit_sound_handler : public sound_handler
{
- std::unique_ptr<BSoundPlayer> _soundplayer;
+ BSoundPlayer* _soundplayer;
/// play buffer handler function
static void FillNextBuffer(void *cookie, void *buffer, size_t size,
const media_raw_audio_format &format);
- /// @throw SoundException on error
+ /// Initialize audio card
+ void initAudio();
+
void openAudio();
+ void closeAudio();
+
bool _audioopen;
/// Mutex for making sure threads doesn't mess things up
@@ -62,18 +66,24 @@ public:
~Mkit_sound_handler();
+ virtual int createStreamingSound(const media::SoundInfo& sinfo);
+
// See dox in sound_handler.h
- virtual int create_sound(std::unique_ptr<SimpleBuffer> data, std::unique_ptr<media::SoundInfo> sinfo);
+ virtual int create_sound(std::unique_ptr<SimpleBuffer> data,
+ const media::SoundInfo& sinfo);
// See dox in sound_handler.h
// overridden to serialize access to the data buffer slot
- virtual StreamBlockId addSoundBlock(unsigned char* data,
- unsigned int data_bytes,
- unsigned int sample_count,
- int streamId);
+ virtual StreamBlockId addSoundBlock(SimpleBuffer buf,
+ size_t sample_count, int seekSamples, int streamId);
// See dox in sound_handler.h
- virtual void stop_sound(int sound_handle);
+ virtual void stopEventSound(int sound_handle);
+
+ // See dox in sound_handler.h
+ virtual void stopAllEventSounds();
+
+ virtual void stopStreamingSound(int sound_handle);
// See dox in sound_handler.h
virtual void delete_sound(int sound_handle);
@@ -108,9 +118,12 @@ public:
virtual unsigned int tell(int sound_handle);
// See dox in sound_handler.h
- // Overridden to unpause SDL audio
+ // Overridden to unpause audio
void plugInputStream(std::unique_ptr<InputStream> in);
+ // Overidden to provide thread safety.
+ void unplugInputStream(InputStream* id);
+
// See dox in sound_handler.h
void fetchSamples(std::int16_t* to, unsigned int nSamples);
};
--
2.30.2
From 302c97222d4dd5931eca83c650c40a596a6e321f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 28 Sep 2021 13:22:04 +1000
Subject: Add missing file
diff --git a/gui/haiku/adipe.h b/gui/haiku/adipe.h
new file mode 100644
index 0000000..f46eb50
--- /dev/null
+++ b/gui/haiku/adipe.h
@@ -0,0 +1,15 @@
+#ifndef __ADIPE_H_
+#define __ADIPE_H_
+
+
+#define QQ_LVL 6
+
+#define QQ(x) do { \
+ if ( (x) <= QQ_LVL ) \
+ fprintf(stderr,"QQ %s \t%d \t%s\n", \
+ __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__); \
+ } while(0)
+
+#endif
+
--
2.30.2
From 66b485571ce9e44ab91e7ec6859a37f8aae3ea83 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 28 Sep 2021 16:43:18 +1000
Subject: Fix application signature
diff --git a/gui/haiku/haiku.cpp b/gui/haiku/haiku.cpp
index 2c70f08..fda1771 100644
--- a/gui/haiku/haiku.cpp
+++ b/gui/haiku/haiku.cpp
@@ -129,7 +129,7 @@ class BeApp : public BApplication
int32 _mousemovedx, _mousemovedy;
public:
BeApp(HaikuGui *gui)
- : BApplication("application/gnash-player"),
+ : BApplication("application/x-vnd.gnash-player"),
_gui(gui), _win(NULL),
_pulse_tid(-1),
_start_t(time(NULL)),
--
2.30.2