summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-11-26 22:24:43 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-11-26 22:24:43 +0000
commit37e167b1a82f89bbb1c1a892d655eaa56c201de5 (patch)
treea1fb8af9391f27573094a46b46ad05bd97262af3 /lib
parentb8fe75626cdd4fe526f31de959f3ab5888c1671a (diff)
downloadampache-37e167b1a82f89bbb1c1a892d655eaa56c201de5.tar.gz
ampache-37e167b1a82f89bbb1c1a892d655eaa56c201de5.tar.bz2
ampache-37e167b1a82f89bbb1c1a892d655eaa56c201de5.zip
new m4a streaming mojo
Diffstat (limited to 'lib')
-rw-r--r--lib/class/song.class.php39
-rw-r--r--lib/stream.lib.php2
2 files changed, 40 insertions, 1 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 0ef69bbd..b104a4e2 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -674,6 +674,45 @@ class Song {
return stripslashes($matches[1]);
} // get_info_from_filename
+
+ /*!
+ @function native_stream
+ @discussion returns true if the $song->type streams ok, false if it must be transcoded to stream
+ */
+ function native_stream() {
+ $return = true;
+
+ switch ($this->type) {
+ //TODO: fill out these cases once we have it working for m4a
+ case "m4a":
+ $return = false;
+ break;
+ default:
+ break;
+ } // end switch
+
+ return $return;
+ } // end native_stream
+
+ /*!
+ @function stream_cmd
+ @discussion test if the song type streams natively and if not returns a transcoding command from the config
+ */
+ function stream_cmd() {
+ $return = NULL;
+ if (!$this->native_stream()) {
+ switch ($this->type) {
+ case "m4a":
+ $return = "stream_cmd_m4a";
+ break;
+ default:
+ $return = "downsample_cmd";
+ break;
+ } // end switch
+ } // end if not native_stream
+
+ return $return;
+ } // end stream_cmd
} //end of song class
diff --git a/lib/stream.lib.php b/lib/stream.lib.php
index 18b4562f..50e9f22f 100644
--- a/lib/stream.lib.php
+++ b/lib/stream.lib.php
@@ -236,7 +236,7 @@ function start_downsample($song,$now_playing_id=0,$song_name=0) {
/* Replace Variables */
- $downsample_command = conf('downsample_cmd');
+ $downsample_command = conf($song->stream_cmd());
$downsample_command = str_replace("%FILE%",$song->file,$downsample_command);
$downsample_command = str_replace("%OFFSET%",$offset,$downsample_command);
$downsample_command = str_replace("%EOF%",$eof,$downsample_command);