From 3963871e8f6901c1477d22d534d6e130dbf61822 Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 14 Nov 2014 12:47:54 +0100 Subject: match stream names, urls and bitrates see https://c3voc.de/wiki/31c3:cdn and https://c3voc.de/wiki/intern:31c3:cdn --- .htaccess | 18 ++++++------ lib/config.php | 17 +++++------- lib/helper.php | 28 +++++++++++++++---- room.php | 8 +----- template/assemblies/switcher/audio.phtml | 2 +- template/assemblies/switcher/miniroom-audio.phtml | 2 +- template/assemblies/switcher/miniroom-video.phtml | 31 ++++----------------- template/assemblies/switcher/party.phtml | 2 +- template/assemblies/switcher/video.phtml | 34 ++++++++++++++--------- 9 files changed, 68 insertions(+), 74 deletions(-) diff --git a/.htaccess b/.htaccess index 149eb10..14e9703 100644 --- a/.htaccess +++ b/.htaccess @@ -8,24 +8,24 @@ RewriteCond %{REQUEST_FILENAME} !-l # / -> index.php - room/streams list DirectoryIndex index.php -# /room/ -> room.php - native av-player in hq (with format switcher included) -RewriteRule ^(saal1|saal2|saalg|saal6)/?$ room.php?room=$1&format=hq&language=native [L] +# /room/ -> room.php - native av-player in sd (with format switcher included) +RewriteRule ^(saal1|saal2|saalg|saal6)/?$ room.php?room=$1&format=sd&language=native [L] -# /room/translated -> room.php - translated av-player in hq (with format switcher included) -RewriteRule ^(saal1|saal2|saalg|saal6)/translated/?$ room.php?room=$1&format=hq&language=translated [L] +# /room/translated -> room.php - translated av-player in sd (with format switcher included) +RewriteRule ^(saal1|saal2|saalg|saal6)/translated/?$ room.php?room=$1&format=sd&language=translated [L] # /room/format/ -> room.php - native av-player in $format (with format switcher included) -RewriteRule ^(saal1|saal2|saalg|saal6)/(hd|lq|audio|slides)/?$ room.php?room=$1&format=$2&language=native [L] +RewriteRule ^(saal1|saal2|saalg|saal6)/(hd|audio|slides)/?$ room.php?room=$1&format=$2&language=native [L] # /room/format/translated -> room.php - translated av-player in $format (with format switcher included) -RewriteRule ^(saal1|saal2|saalg|saal6)/(hd|lq|audio|slides)/translated/?$ room.php?room=$1&format=$2&language=translated [L] +RewriteRule ^(saal1|saal2|saalg|saal6)/(hd|audio|slides)/translated/?$ room.php?room=$1&format=$2&language=translated [L] -# /miniroom/ -> room.php - native av-player in hq -RewriteRule ^(sendezentrum)/?$ room.php?room=$1&format=hq&language=native [L] +# /miniroom/ -> room.php - native av-player in sd +RewriteRule ^(sendezentrum)/?$ room.php?room=$1&format=sd&language=native [L] # /miniroom/format/ -> room.php - native av-player in $format (no hd, no slides) -RewriteRule ^(sendezentrum)/(lq|audio)/?$ room.php?room=$1&format=$2&language=native [L] +RewriteRule ^(sendezentrum)/(audio)/?$ room.php?room=$1&format=$2&language=native [L] # /party/ -> player.php - simple audio-player for party diff --git a/lib/config.php b/lib/config.php index 9ef612d..c5bed0c 100644 --- a/lib/config.php +++ b/lib/config.php @@ -23,21 +23,18 @@ $GLOBALS['CONFIG']['ROOMS'] = array( ); $GLOBALS['CONFIG']['FORMATS'] = array( - 'hd' => 'FullHD', - 'hq' => 'High Quality', - 'lq' => 'Low Quality', + 'hd' => 'FullHD Video', + 'sd' => 'SD Video', 'audio' => 'Audio', 'slides' => 'Slide-Images', ); $GLOBALS['CONFIG']['FORMAT_TEXT'] = array( - 'hd' => '1920x1080, h264+aac, 5 MBit/s', - 'hq' => '1024x576, h264+aac, 1 MBit/s', - 'lq' => '640x360, h264+aac, 0.5 MBit/s', - 'webm' => '1024x576 vp8+vorbis in webm, zzz MBit/s', - 'mp3' => 'MP3, 192 kBit/s', - 'ogg' => 'OGG Vorbis, xxx kBit/s', - 'opus' => 'Opus (RFC 6716), yyy kBit/s', + 'hd' => '1920x1080, h264+aac, 3 MBit/s', + 'sd' => '1024x576, h264+aac, 1 MBit/s', + 'webm' => '1024x576 vp8+vorbis in webm, 1 MBit/s', + 'mp3' => 'MP3, 128 kBit/s', + 'opus' => 'Opus (RFC 6716), 96 kBit/s', ); // various room-name nappings diff --git a/lib/helper.php b/lib/helper.php index 450b3e9..a09b3ea 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -14,7 +14,7 @@ function link_room($room) function link_player($room, $format, $translated = false) { - $isDefaultFormat = in_array($format, array('hq', 'video')); + $isDefaultFormat = in_array($format, array('sd', 'video')); return rawurlencode($room).'/'.($isDefaultFormat ? '' : rawurlencode($format).'/').($translated ? 'translated/' : ''); } @@ -25,24 +25,40 @@ function link_stream($protocol, $room, $format, $translated = false) switch ($protocol) { case 'rtmp': - return 'rtmp://'.($format == 'hd' ? 'rtmp' : 'rtmp-sd').'.stream.c3voc.de:1935/stream/'.rawurlencode($room).'_'.rawurlencode($language).'_'.rawurlencode($format); + return 'rtmp://rtmp.stream.c3voc.de:1935/stream/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'_'.rawurlencode($format); case 'hls': - return 'http://hls.stream.c3voc.de/hls/'.rawurlencode($room).'_'.rawurlencode($language).'_'.rawurlencode($format).'.m3u8'; + return 'http://hls.stream.c3voc.de/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).($format == 'auto' ? '' : '_'.rawurlencode($format)).'.m3u8'; case 'webm': - return 'http://webm.stream.c3voc.de:8000/'.rawurlencode($room).'_'.rawurlencode($language).'.'.rawurlencode($format); + return 'http://webm.stream.c3voc.de:8000/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'_'.rawurlencode($format).'.webm'; case 'audio': - return 'http://audio.stream.c3voc.de:8000/'.rawurlencode($room).'_'.rawurlencode($language).'.'.rawurlencode($format); + if(in_array($room, array('lounge', 'ambient'))) + return 'http://audio.stream.c3voc.de:8000/'.rawurlencode(streamname($room)).'.'.rawurlencode($format); + else + return 'http://audio.stream.c3voc.de:8000/'.rawurlencode(streamname($room)).'_'.rawurlencode($language).'.'.rawurlencode($format); case 'slide': - return 'http://www.stream.c3voc.de/slides/'.rawurlencode($room).'/current.png'; + return 'http://www.stream.c3voc.de/slides/'.rawurlencode(streamname($room)).'/current.png'; } return '#'; } +function streamname($room) +{ + switch($room) + { + case 'saal1': return 's1'; + case 'saal2': return 's2'; + case 'saalg': return 's3'; + case 'saal6': return 's4'; + case 'sendezentrum': return 's5'; + default: return $room; + } +} + function irc_channel($room) { return '31C3-hall-'.strtoupper(substr($room, 4, 1)); diff --git a/room.php b/room.php index c297610..478484b 100644 --- a/room.php +++ b/room.php @@ -21,17 +21,11 @@ switch($format) { $height = 1080; break; - case 'hq': + case 'sd': $type = 'video'; $width = 1024; $height = 576; break; - - case 'lq': - $type = 'video'; - $width = 640; - $height = 360; - break; } echo $tpl->render(array( diff --git a/template/assemblies/switcher/audio.phtml b/template/assemblies/switcher/audio.phtml index 4d48777..fb12e60 100644 --- a/template/assemblies/switcher/audio.phtml +++ b/template/assemblies/switcher/audio.phtml @@ -17,7 +17,7 @@

Directlinks