XSDL: added PulseAudio support

This commit is contained in:
Sergii Pylypenko
2015-10-20 01:38:44 +03:00
parent 9f798adf6a
commit 7183f1c9c7
6 changed files with 82 additions and 55 deletions

View File

@@ -7,10 +7,10 @@ AppName="XServer XSDL"
AppFullName=x.org.server
# Application version code (integer)
AppVersionCode=11134
AppVersionCode=11135
# Application user-visible version name (string)
AppVersionName="1.11.34"
AppVersionName="1.11.35"
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu

View File

@@ -4,6 +4,14 @@ CURDIR=`pwd`
PACKAGE_NAME=`grep AppFullName AndroidAppSettings.cfg | sed 's/.*=//'`
[ -e pulseaudio/android-build.sh ] && {
[ -e pulseaudio/$1/install/bin/pulseaudio ] || {
cd pulseaudio
./android-build.sh || exit 1
cd ..
} || exit 1
} || exit 1
../setEnvironment-$1.sh sh -c '\
$CC $CFLAGS -c main.c -o main-'"$1.o" || exit 1
../setEnvironment-$1.sh sh -c '\
@@ -70,21 +78,34 @@ hw/kdrive/linux/.libs/liblinux.a \
rm -rf $CURDIR/tmp-$1
mkdir -p $CURDIR/tmp-$1
cd $CURDIR/tmp-$1
cp $CURDIR/xserver/data/busybox-$1 ./busybox
#cp $CURDIR/pulseaudio/pulseaudio-$1 ./pulseaudio
cp $CURDIR/ssh ./
cp $CURDIR/sshpass ./
cp -f $CURDIR/xserver/data/busybox-$1 ./busybox
cp -f $CURDIR/ssh ./
cp -f $CURDIR/sshpass ./
mkdir -p usr/bin
# Executables linked with NDK, which crash on Lollipop.
for f in xhost xkbcomp xli xsel; do cp $CURDIR/xserver/android/$1/$f ./usr/bin/$f ; done
for f in xhost xkbcomp xli xsel; do cp -f $CURDIR/xserver/android/$1/$f ./usr/bin/$f ; done
# Statically-linked prebuilt executables, generated using Debian chroot.
# There are no executables for old ARMv5, so we'll use NDK executables instead for that arch.
#for f in xhost xkbcomp xli xsel; do cp $CURDIR/xserver/data/$f-$1 ./usr/bin/$f ; done
rm -f ../AndroidData/binaries-$1.zip
zip -r ../AndroidData/binaries-$1.zip .
# Executables linked with NDK with -pie, which crash on pre-Lollipop.
for f in xhost xkbcomp xli xsel; do rm ./usr/bin/$f ; cp $CURDIR/xserver/android/$1/pie/$f ./usr/bin/$f ; done
for f in xhost xkbcomp xli xsel; do rm ./usr/bin/$f ; cp -f $CURDIR/xserver/android/$1/pie/$f ./usr/bin/$f ; done
cp $CURDIR/xserver/data/busybox-$1-pie ./busybox
# PulseAudio - PIE only
mkdir -p pulse
cp -f $CURDIR/pulseaudio/$1/install/bin/pulseaudio pulse/
cp -f $CURDIR/pulseaudio/$1/install/lib/libpulse.so.0.18.2 pulse/libpulse.so.0
#ln -sf libpulse.so.0.18.2 pulse/libpulse.so.0
#ln -sf libpulse.so.0.18.2 pulse/libpulse.so
cp -f $CURDIR/pulseaudio/$1/install/lib/libpulsecore-7.0.so pulse/
cp -f $CURDIR/pulseaudio/$1/install/lib/pulseaudio/libpulsecommon-7.0.so pulse/
for F in $CURDIR/pulseaudio/$1/install/lib/pulse-7.0/modules/*.so; do
cp -f $F pulse/
done
cp -f $CURDIR/pulseaudio/android-pulseaudio.conf pulse/pulseaudio.conf
rm -f ../AndroidData/binaries-$1-pie.zip
zip -r ../AndroidData/binaries-$1-pie.zip .

View File

@@ -684,11 +684,11 @@ void XSDL_showConfigMenu(int * resolutionW, int * displayW, int * resolutionH, i
void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, int resolutionH)
{
int sd, addr, ifc_num, i;
struct ifconf ifc;
struct ifreq ifr[20];
SDL_Surface * surf;
int y = resolutionH * 1 / 3;
char msg[128];
struct ifconf ifc;
struct ifreq ifr[20];
SDL_Surface * surf;
int y = resolutionH * 1 / 3;
char msg[128];
if (resolutionH > resolutionW)
resolutionH = resolutionW;
@@ -708,50 +708,53 @@ void XSDL_generateBackground(const char * port, int showHelp, int resolutionW, i
renderStringScaled("Launch these commands on your Linux PC:", 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 30 / VID_Y;
sd = socket(PF_INET, SOCK_DGRAM, 0);
if (sd > 0)
{
ifc.ifc_len = sizeof(ifr);
ifc.ifc_ifcu.ifcu_buf = (caddr_t)ifr;
sd = socket(PF_INET, SOCK_DGRAM, 0);
if (sd > 0)
{
ifc.ifc_len = sizeof(ifr);
ifc.ifc_ifcu.ifcu_buf = (caddr_t)ifr;
if (ioctl(sd, SIOCGIFCONF, &ifc) == 0)
{
ifc_num = ifc.ifc_len / sizeof(struct ifreq);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "%d network interfaces found", ifc_num);
if (ioctl(sd, SIOCGIFCONF, &ifc) == 0)
{
ifc_num = ifc.ifc_len / sizeof(struct ifreq);
__android_log_print(ANDROID_LOG_INFO, "XSDL", "%d network interfaces found", ifc_num);
for (i = 0; i < ifc_num; ++i)
{
int addr = 0;
char saddr[32];
if (ifr[i].ifr_addr.sa_family != AF_INET)
continue;
for (i = 0; i < ifc_num; ++i)
{
int addr = 0;
char saddr[32];
if (ifr[i].ifr_addr.sa_family != AF_INET)
continue;
if (ioctl(sd, SIOCGIFADDR, &ifr[i]) == 0)
addr = ((struct sockaddr_in *)(&ifr[i].ifr_addr))->sin_addr.s_addr;
if (addr == 0)
continue;
sprintf (saddr, "%d.%d.%d.%d", (addr & 0xFF), (addr >> 8 & 0xFF), (addr >> 16 & 0xFF), (addr >> 24 & 0xFF));
__android_log_print(ANDROID_LOG_INFO, "XSDL", "interface: %s address: %s\n", ifr[i].ifr_name, saddr);
if (strcmp(saddr, "127.0.0.1") == 0)
continue;
sprintf (msg, "env DISPLAY=%s%s metacity &", saddr, port);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "env DISPLAY=%s%s gimp", saddr, port);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 20 / VID_Y;
}
}
if (ioctl(sd, SIOCGIFADDR, &ifr[i]) == 0)
addr = ((struct sockaddr_in *)(&ifr[i].ifr_addr))->sin_addr.s_addr;
if (addr == 0)
continue;
sprintf (saddr, "%d.%d.%d.%d", (addr & 0xFF), (addr >> 8 & 0xFF), (addr >> 16 & 0xFF), (addr >> 24 & 0xFF));
__android_log_print(ANDROID_LOG_INFO, "XSDL", "interface: %s address: %s\n", ifr[i].ifr_name, saddr);
if (strcmp(saddr, "127.0.0.1") == 0)
continue;
sprintf (msg, "export DISPLAY=%s%s", saddr, port);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "export PULSE_SERVER=tcp:%s:4712", saddr);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "metacity & gimp");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 20 / VID_Y;
}
}
close(sd);
}
close(sd);
}
y += resolutionH * 10 / VID_Y;
sprintf (msg, "To tunnel X over SSH, forward port %d", atoi(port+1) + 6000);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "in your SSH client");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 10 / VID_Y;
sprintf (msg, "To tunnel X over SSH, forward port %d", atoi(port+1) + 6000);
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
y += resolutionH * 15 / VID_Y;
sprintf (msg, "in your SSH client");
renderStringScaled(msg, 12 * resolutionH / VID_Y, resolutionW/2, y, 255, 255, 255, surf);
SDL_SaveBMP(surf, "background.bmp");
SDL_FreeSurface(surf);

View File

@@ -100,11 +100,14 @@ int main( int argc, char* argv[] )
if (getenv("SDL_RESTART_PARAMS") && getenv("SDL_RESTART_PARAMS")[0])
strcpy(port, getenv("SDL_RESTART_PARAMS"));
sprintf(fontpath, "%s/img/usr/share/fonts/X11/misc,"
snprintf(fontpath, sizeof(fontpath),
"%s/img/usr/share/fonts/X11/misc,"
"%s/img/usr/share/fonts/X11/Type1,"
"%s/img/usr/share/fonts/X11/100dpi,"
"%s/img/usr/share/fonts/X11/75dpi,"
"%s/img/usr/share/fonts/X11/cyrillic",
"%s/usr/share/fonts",
getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR"),
getenv("SECURE_STORAGE_DIR"),