diff --git a/3rdparty/mmu_man/onlinedemo/haiku.php b/3rdparty/mmu_man/onlinedemo/haiku.php index 6de891a5e5..74eb6809ff 100755 --- a/3rdparty/mmu_man/onlinedemo/haiku.php +++ b/3rdparty/mmu_man/onlinedemo/haiku.php @@ -5,6 +5,10 @@ * Copyright 2007, Francois Revol, revol@free.fr. */ +// parts inspired by the Free Live OS Zoo +// http://www.oszoo.org/wiki/index.php/Free_Live_OS_Zoo + + // relative path to the vnc java applet jar // you must *copy* (apache doesn't seem to like symlinks) it there. @@ -32,6 +36,9 @@ define("APPLET_HEIGHT", "768"); // vnc protocol base port. define("VNCPORTBASE", 5900); +// base port for audio streams +define("AUDIOPORTBASE", 8080); + // timeout before the demo session is killed, as argument to /bin/sleep define("SESSION_TIMEOUT", "20m"); @@ -199,6 +206,11 @@ function qemu_slot() return $_SESSION[QEMU_IDX_VAR]; } +function audio_port() +{ + return AUDIOPORTBASE + qemu_slot(); +} + function vnc_display() { return qemu_slot(); @@ -284,7 +296,8 @@ function probe_keymap() if (in_keymaps($lang)) { $vnckeymap = $lang; - dbg("Detected keymap '" . $vnckeymap . "' from browser headers."); + dbg("Detected keymap '" . $vnckeymap . + "' from browser headers."); return; } } @@ -346,10 +359,15 @@ function output_options_form() echo "\n\n"; echo "Sound"; + echo ">Sound"; + if ($enable_sound) + echo ""; + echo ""; echo "\n\n"; /* @@ -373,7 +391,8 @@ function output_options_form() echo "\n"; echo "\n"; - out("NOTE: You will need a Java-enabled browser to display the VNC Applet needed by this demo."); + out("NOTE: You will need a Java-enabled browser to display the VNC " . + "Applet needed by this demo."); out("You can however use instead an external VNC viewer."); @@ -410,7 +429,11 @@ function start_qemu() return $idx; } $pidfile = make_qemu_pidfile_name($idx); - $cmd = QEMU_BIN . " " . QEMU_ARGS . " -k " . $vnckeymap . " -vnc " . QEMU_VNC_PREFIX . vnc_display() . " -pidfile " . $pidfile . " " . QEMU_IMAGE_PATH; + $cmd = QEMU_BIN . " " . QEMU_ARGS . + " -k " . $vnckeymap . + " -vnc " . QEMU_VNC_PREFIX . vnc_display() . + " -pidfile " . $pidfile . + " " . QEMU_IMAGE_PATH; if (file_exists($pidfile)) unlink($pidfile); @@ -431,7 +454,10 @@ function start_qemu() dbg("Started QEMU."); $sessfile = make_qemu_sessionfile_name($idx); - $cmd = "(sleep " . SESSION_TIMEOUT . "; kill -9 `cat " . $pidfile . "`; rm " . $pidfile . " " . $sessfile . ") &"; + $cmd = "(PID=`cat " . $pidfile . "`; " . + "sleep " . SESSION_TIMEOUT . "; " . + "kill -9 \$PID && " . + "rm " . $pidfile . " " . $sessfile . ") &"; $process = proc_open($cmd, $descriptorspec, $wkpipes); sleep(1); @@ -469,15 +495,34 @@ function stop_qemu() function output_vnc_info() { - out("You can use an external VNC client, click " . - "here " . - "or enter " . vnc_addr_display() . " in your " . - "VNC viewer.
"); + out("You can use an external VNC client at " . + "" . + "vnc://" . vnc_addr_display() . " " . + "or enter " . vnc_addr_display() . " in your " . + "VNC viewer.
"); echo "
\n"; } -function output_applet_code() +function output_audio_player_code($external_only=false) +{ + if (true) + return; + + $port = audio_port(); + $url = "http://" . $_SERVER['HTTP_HOST'] . ":$port/"; + $icy = "icy://" . $_SERVER['HTTP_HOST'] . ":$port/"; + if (!$external_only) { + echo ""; + } + out("You can use an external audio play at " . + "$url or $icy."); +} + +function output_applet_code($external_only=false) { $w = APPLET_WIDTH; $h = APPLET_HEIGHT; @@ -485,6 +530,8 @@ function output_applet_code() $vncjpath = VNCJAVA_PATH; $jar = VNCJAR; $class = VNCCLASS; + if ($external_only) + return; echo ""; echo "
"; echo "Available displays: " . +out("
Available displays: " . available_qemu_slots() . "/" . total_qemu_slots() . "
"); @@ -547,6 +594,7 @@ if (is_my_session_valid()) { if ($qemuidx >= 0 && !$do_kill) { output_kill_form(); + output_audio_player_code(); output_vnc_info(); output_applet_code(); } else {