summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-06-24 00:25:33 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-06-24 00:25:33 +0000
commit8e6cd377be0a7f4a569c54316bdb882a714e2c7c (patch)
tree610ffe6303d907aea37ce4f766a3cc70b6248b0c /lib
parent51f91c7b345cc90e742333976fa464d316a41283 (diff)
downloadampache-8e6cd377be0a7f4a569c54316bdb882a714e2c7c.tar.gz
ampache-8e6cd377be0a7f4a569c54316bdb882a714e2c7c.tar.bz2
ampache-8e6cd377be0a7f4a569c54316bdb882a714e2c7c.zip
tweaked transcode stuff so that it acutally changes the file name and mime type semi-correctly
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.lib.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/stream.lib.php b/lib/stream.lib.php
index 9b99d752..852df28a 100644
--- a/lib/stream.lib.php
+++ b/lib/stream.lib.php
@@ -133,6 +133,18 @@ function check_lock_songs($song_id) {
*/
function start_downsample($song,$now_playing_id=0,$song_name=0) {
+ /**
+ * Extra check, for now hardcode it to mp3 but if
+ * we are transcoding we need to fix the mime type
+ * and let the user define what file type it's switching
+ * to.
+ */
+ if (!$song->native_stream()) {
+ $song->mime = 'audio/mpeg';
+ $song_name = $song->f_artist_full . " - " . $song->title . ".mp3";
+ }
+
+
/* Check to see if bitrates are set if so let's go ahead and optomize! */
$max_bitrate = conf('max_bit_rate');
$min_bitrate = conf('min_bit_rate');
@@ -216,6 +228,7 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) {
$sample_ratio = $sample_rate/($song->bitrate/1000);
}
+
header("Content-Length: " . $sample_ratio*$song->size);
$browser->downloadHeaders($song_name, $song->mime, false,$sample_ratio*$song->size);