Skip to content

Commit

Permalink
Fix forced transcoding. FS#163
Browse files Browse the repository at this point in the history
  • Loading branch information
flowerysong committed Apr 21, 2011
1 parent 04d77b1 commit 073ea58
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
37 changes: 24 additions & 13 deletions lib/class/song.class.php
Expand Up @@ -972,28 +972,39 @@ public function native_stream() {
if ($this->_transcoded) { return false; }

$conf_var = 'transcode_' . $this->type;
$conf_type = 'transcode_' . $this->type . '_target';
$conf_cmd = 'transcode_cmd_' . $this->type;

if (Config::get($conf_var)) {
$this->_transcoded = true;
$this->transcoded_from = $this->type;
$this->_transcode_cmd = Config::get($conf_cmd);

$this->format_type(Config::get($conf_type));
if ($this->type == $this->transcoded_from) {
$this->_resampled = true;
}

debug_event('transcode', 'Transcoding from ' .
$this->transcoded_from . ' to ' . $this->type, 5);
$this->set_transcode();
return false;
}

return true;

} // end native_stream

/**
* set_transcode
*
* We want to transcode, set up the variables correctly
*/
public function set_transcode() {
if ($this->_transcoded) { return; }

$conf_type = 'transcode_' . $this->type . '_target';
$conf_cmd = 'transcode_cmd_' . $this->type;

$this->_transcoded = true;
$this->transcoded_from = $this->type;
$this->_transcode_cmd = Config::get($conf_cmd);
$this->format_type(Config::get($conf_type));
if ($this->type == $this->transcoded_from) {
$this->_resampled = true;
}

debug_event('transcode', 'Transcoding from ' .
$this->transcoded_from . ' to ' . $this->type, 5);
}

/**
* stream_cmd
*
Expand Down
1 change: 1 addition & 0 deletions play/index.php
Expand Up @@ -316,6 +316,7 @@
'Decided to transcode. Transcode:' . Config::get('transcode') .
' Native Stream: ' . ($media->native_stream() ? 'true' : 'false') .
' Remote: ' . ($remote ? 'true' : 'false'), 5);
$media->set_transcode();
$fp = Stream::start_transcode($media, $media_name, $start);
$media_name = $media->f_artist_full . " - " . $media->title . "." . $media->type;
$transcoded = true;
Expand Down

0 comments on commit 073ea58

Please sign in to comment.