aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2014-11-14 12:47:54 +0100
committerMaZderMind2014-11-14 12:47:54 +0100
commit3963871e8f6901c1477d22d534d6e130dbf61822 (patch)
treee7f59d726edc19bb2291596f6c3ea78f51adf7df
parentbdb6996709369e56b0bae93525fe60a0fdb5124c (diff)
match stream names, urls and bitrates
see https://c3voc.de/wiki/31c3:cdn and https://c3voc.de/wiki/intern:31c3:cdn
Diffstat (limited to '')
-rw-r--r--.htaccess18
-rw-r--r--lib/config.php17
-rw-r--r--lib/helper.php28
-rw-r--r--room.php8
-rw-r--r--template/assemblies/switcher/audio.phtml2
-rw-r--r--template/assemblies/switcher/miniroom-audio.phtml2
-rw-r--r--template/assemblies/switcher/miniroom-video.phtml31
-rw-r--r--template/assemblies/switcher/party.phtml2
-rw-r--r--template/assemblies/switcher/video.phtml34
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 @@
<h3>Directlinks</h3>
<ul>
- <? foreach(array('mp3', 'ogg', 'opus') as $iter): ?>
+ <? foreach(array('mp3', 'opus') as $iter): ?>
<li>
<span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
<a href="<?=h(link_stream('audio', $room, $iter))?>">
diff --git a/template/assemblies/switcher/miniroom-audio.phtml b/template/assemblies/switcher/miniroom-audio.phtml
index f96fb71..2de9169 100644
--- a/template/assemblies/switcher/miniroom-audio.phtml
+++ b/template/assemblies/switcher/miniroom-audio.phtml
@@ -1,6 +1,6 @@
<h3>Directlinks</h3>
<ul>
- <? foreach(array('mp3', 'ogg', 'opus') as $iter): ?>
+ <? foreach(array('mp3', 'opus') as $iter): ?>
<li>
<span class="label filetype"><?=h(strtoupper($iter))?></span>
<a href="<?=h(link_stream('audio', $room, $iter))?>">
diff --git a/template/assemblies/switcher/miniroom-video.phtml b/template/assemblies/switcher/miniroom-video.phtml
index b03561e..ace02bc 100644
--- a/template/assemblies/switcher/miniroom-video.phtml
+++ b/template/assemblies/switcher/miniroom-video.phtml
@@ -1,37 +1,16 @@
-<h3>Formats</h3>
+<h3>Directlinks</h3>
<ul>
- <? foreach(array('hq', 'lq') as $iter): ?>
+<? foreach(array('rtmp', 'hls') as $protocol): ?>
<li>
- <span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
- <a href="<?=h(link_player($room, $iter))?>">
+ <span class="label filetype" title="<?=h(format_text('sd'))?>"><?=h($protocol)?></span>
+ <a href="<?=h(link_stream($protocol, $room, 'sd'))?>">
<span class="fa fa-video-camera"></span>
live video-podcast
</a>
</li>
- <? endforeach ?>
-</ul>
-
-<hr />
-
-<? foreach(array('rtmp', 'hls') as $protocol): ?>
- <h3>Directlinks (<?=h(strtoupper($protocol))?>)</h3>
- <ul>
- <? foreach(array('hq', 'lq') as $iter): ?>
- <li>
- <span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
- <a href="<?=h(link_stream($protocol, $room, $iter))?>">
- <span class="fa fa-video-camera"></span>
- live video-podcast
- </a>
- </li>
- <? endforeach ?>
- </ul>
<? endforeach ?>
-
-<h3>Directlinks (WebM)</h3>
-<ul>
<li>
- <span class="label filetype" title="<?=h(format_text('webm'))?>">HQ</span>
+ <span class="label filetype" title="<?=h(format_text('webm'))?>">WebM</span>
<a href="<?=h(link_stream('webm', $room, 'webm'))?>">
<span class="fa fa-video-camera"></span>
live video-podcast
diff --git a/template/assemblies/switcher/party.phtml b/template/assemblies/switcher/party.phtml
index 6507450..9a60556 100644
--- a/template/assemblies/switcher/party.phtml
+++ b/template/assemblies/switcher/party.phtml
@@ -1,6 +1,6 @@
<h3>Directlinks</h3>
<ul>
- <? foreach(array('mp3', 'ogg', 'opus') as $iter): ?>
+ <? foreach(array('mp3', 'opus') as $iter): ?>
<li>
<span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
<a href="<?=h(link_stream('audio', $room, $iter))?>">
diff --git a/template/assemblies/switcher/video.phtml b/template/assemblies/switcher/video.phtml
index 7cbb2af..598f533 100644
--- a/template/assemblies/switcher/video.phtml
+++ b/template/assemblies/switcher/video.phtml
@@ -1,6 +1,6 @@
<h3>Formats</h3>
<ul>
- <? foreach(array('hd', 'hq', 'lq') as $iter): ?>
+ <? foreach(array('hd', 'sd') as $iter): ?>
<li>
<span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
<a href="<?=h(link_player($room, $iter))?>">
@@ -20,7 +20,13 @@
<? foreach(array('rtmp', 'hls') as $protocol): ?>
<h3>Directlinks (<?=h(strtoupper($protocol))?>)</h3>
<ul>
- <? foreach(array('hd', 'hq', 'lq') as $iter): ?>
+ <?
+ if($protocol == 'hls')
+ $formats = array('auto', 'hd', 'sd');
+ else
+ $formats = array('hd', 'sd');
+ ?>
+ <? foreach($formats as $iter): ?>
<li>
<span class="label filetype" title="<?=h(format_text($iter))?>"><?=h(strtoupper($iter))?></span>
<a href="<?=h(link_stream($protocol, $room, $iter))?>">
@@ -38,15 +44,17 @@
<h3>Directlinks (WebM)</h3>
<ul>
- <li>
- <span class="label filetype" title="<?=h(format_text('webm'))?>">HQ</span>
- <a href="<?=h(link_stream('webm', $room, 'webm'))?>">
- <span class="fa fa-flag-o"></span>
- native
- </a>
- <a href="<?=h(link_stream('webm', $room, 'webm', true))?>">
- <span class="fa fa-flag"></span>
- translated
- </a>
- </li>
+ <? foreach(array('hd', 'sd') as $iter): ?>
+ <li>
+ <span class="label filetype" title="<?=h(format_text('webm'))?>"><?=h(strtoupper($iter))?></span>
+ <a href="<?=h(link_stream('webm', $room, $iter))?>">
+ <span class="fa fa-flag-o"></span>
+ native
+ </a>
+ <a href="<?=h(link_stream('webm', $room, $iter, true))?>">
+ <span class="fa fa-flag"></span>
+ translated
+ </a>
+ </li>
+ <? endforeach ?>
</ul>