Minor fixes
git-svn-id: http://php-reader.googlecode.com/svn/trunk@126 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -59,6 +59,7 @@ require_once("MPEG/ABS/Frame.php");
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev: 1 $
|
||||
* @todo Implement validation routines
|
||||
*/
|
||||
final class MPEG_ABS extends MPEG_ABS_Object
|
||||
{
|
||||
@@ -356,8 +357,7 @@ final class MPEG_ABS extends MPEG_ABS_Object
|
||||
*/
|
||||
public function getFrames()
|
||||
{
|
||||
if ($this->getOption("readmode", "lazy") == "lazy" &&
|
||||
$this->_frames === false) {
|
||||
if ($this->getOption("readmode", "lazy") == "lazy") {
|
||||
$this->_readFrames();
|
||||
}
|
||||
return $this->_frames;
|
||||
@@ -376,6 +376,7 @@ final class MPEG_ABS extends MPEG_ABS_Object
|
||||
$this->_reader->setOffset($this->_lastFrameOffset);
|
||||
|
||||
for ($i = 0; $this->_reader->getOffset() < $this->_bytes; $i++) {
|
||||
$options = $this->getOptions();
|
||||
$frame = new MPEG_ABS_Frame($this->_reader, $options);
|
||||
|
||||
$this->_cumulativePlayDuration +=
|
||||
@@ -383,6 +384,8 @@ final class MPEG_ABS extends MPEG_ABS_Object
|
||||
$this->_cumulativeBitrate += $frame->getBitrate();
|
||||
$this->_frames[] = $frame;
|
||||
|
||||
if ($limit === false)
|
||||
$this->_lastFrameOffset = $this->_reader->getOffset();
|
||||
if ($limit !== false && ($i + 1) == $limit) {
|
||||
$this->_lastFrameOffset = $this->_reader->getOffset();
|
||||
break;
|
||||
|
||||
@@ -259,19 +259,18 @@ class MPEG_ABS_Frame extends MPEG_ABS_Object
|
||||
$this->_copyright = Twiddling::testBit($header, 3);
|
||||
$this->_original = Twiddling::testBit($header, 2);
|
||||
$this->_emphasis = Twiddling::getValue($header, 0, 1);
|
||||
|
||||
|
||||
$this->_length = (int)
|
||||
((self::$coefficients[$this->_frequencyType][$this->_layer] *
|
||||
($this->_bitrate * 1000) / $this->_samplingFrequency) +
|
||||
($this->_padding ? 1 : 0)) * self::$slotsizes[$this->_layer];
|
||||
$this->_samples = self::$samples[$this->_frequencyType][$this->_layer];
|
||||
|
||||
if ($this->getOption("readmode", "lazy") == "lazy")
|
||||
$this->_reader->skip($this->_length - 4);
|
||||
else { // full
|
||||
if ($this->getOption("readmode", "lazy") == "full") {
|
||||
$this->_readCrc();
|
||||
$this->_readData();
|
||||
}
|
||||
$this->_reader->skip($this->_length - 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -473,7 +472,7 @@ class MPEG_ABS_Frame extends MPEG_ABS_Object
|
||||
if ($this->hasRedundancy()) {
|
||||
$offset = $this->_reader->getOffset();
|
||||
$this->_reader->setOffset($this->_offset + 4);
|
||||
$this->_crc = $reader->readUInt16BE();
|
||||
$this->_crc = $this->_reader->readUInt16BE();
|
||||
$this->_reader->setOffset($offset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user