Refactoring the code
git-svn-id: http://php-reader.googlecode.com/svn/trunk@140 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ require_once("ID3/Object.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -128,7 +129,7 @@ final class ID3_ExtendedHeader extends ID3_Object
|
||||
|
||||
/* ID3v2.4.0 ExtendedHeader */
|
||||
else {
|
||||
$this->_size = $this->decodeSynchsafe32($this->_size);
|
||||
$this->_size = $this->_decodeSynchsafe32($this->_size);
|
||||
$this->_reader->skip(1);
|
||||
$this->_flags = $this->_reader->readInt8();
|
||||
if ($this->hasFlag(self::UPDATE))
|
||||
@@ -137,7 +138,7 @@ final class ID3_ExtendedHeader extends ID3_Object
|
||||
$this->_reader->skip(1);
|
||||
$this->_crc =
|
||||
Transform::fromInt8($this->_reader->read(1)) * (0xfffffff + 1) +
|
||||
decodeSynchsafe32(Transform::fromUInt32BE($this->_reader->read(4)));
|
||||
_decodeSynchsafe32(Transform::fromUInt32BE($this->_reader->read(4)));
|
||||
}
|
||||
if ($this->hasFlag(self::RESTRICTED)) {
|
||||
$this->_reader->skip(1);
|
||||
@@ -294,7 +295,7 @@ final class ID3_ExtendedHeader extends ID3_Object
|
||||
public function setPadding($padding) { return $this->_padding = $padding; }
|
||||
|
||||
/**
|
||||
* Returns the header raw data.
|
||||
* Returns the header data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -310,12 +311,12 @@ final class ID3_ExtendedHeader extends ID3_Object
|
||||
|
||||
/* ID3v2.4.0 ExtendedHeader */
|
||||
else {
|
||||
return Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) .
|
||||
return Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size)) .
|
||||
Transform::toInt8(1) . Transform::toInt8($this->_flags) .
|
||||
($this->hasFlag(self::UPDATE) ? "\0" : "") .
|
||||
($this->hasFlag(self::CRC32) ? Transform::toInt8(5) .
|
||||
Transform::toInt8($this->_crc & 0xf0000000 >> 28 & 0xf /*eq >>> 28*/) .
|
||||
Transform::toUInt32BE($this->encodeSynchsafe32($this->_crc)) : "") .
|
||||
Transform::toUInt32BE($this->_encodeSynchsafe32($this->_crc)) : "") .
|
||||
($this->hasFlag(self::RESTRICTED) ?
|
||||
Transform::toInt8(1) . Transform::toInt8($this->_restrictions) : "");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ require_once("ID3/Object.php");
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
class ID3_Frame extends ID3_Object
|
||||
abstract class ID3_Frame extends ID3_Object
|
||||
{
|
||||
/**
|
||||
* This flag tells the tag parser what to do with this frame if it is unknown
|
||||
@@ -171,13 +171,14 @@ class ID3_Frame extends ID3_Object
|
||||
|
||||
/* ID3v2.4.0 size and flags */
|
||||
else {
|
||||
$this->_size = $this->decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
$this->_size =
|
||||
$this->_decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
$this->_flags = $this->_reader->readUInt16BE();
|
||||
}
|
||||
|
||||
$dataLength = $this->_size;
|
||||
if ($this->hasFlag(self::DATA_LENGTH_INDICATOR)) {
|
||||
$dataLength = $this->decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
$dataLength = $this->_decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
$this->_size -= 4;
|
||||
}
|
||||
$this->_data = $this->_reader->read($this->_size);
|
||||
@@ -185,7 +186,7 @@ class ID3_Frame extends ID3_Object
|
||||
|
||||
if ($this->hasFlag(self::UNSYNCHRONISATION) ||
|
||||
$this->getOption("unsynchronisation", false) === true)
|
||||
$this->_data = $this->decodeUnsynchronisation($this->_data);
|
||||
$this->_data = $this->_decodeUnsynchronisation($this->_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +222,10 @@ class ID3_Frame extends ID3_Object
|
||||
* @param integer $flag The flag to query.
|
||||
* @return boolean
|
||||
*/
|
||||
public final function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
|
||||
public final function hasFlag($flag)
|
||||
{
|
||||
return ($this->_flags & $flag) == $flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame flags byte.
|
||||
@@ -238,18 +242,14 @@ class ID3_Frame extends ID3_Object
|
||||
public final function setFlags($flags) { $this->_flags = $flags; }
|
||||
|
||||
/**
|
||||
* Sets the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @param string $data
|
||||
* @return string
|
||||
*/
|
||||
protected function setData($data)
|
||||
{
|
||||
$this->_data = $data;
|
||||
$this->_size = strlen($data);
|
||||
}
|
||||
abstract protected function _getData();
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame data with the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -276,14 +276,16 @@ class ID3_Frame extends ID3_Object
|
||||
else
|
||||
$flags = $this->_flags;
|
||||
|
||||
$size = $this->_size;
|
||||
if ($this->getOption("version", 4) < 4)
|
||||
$data = $this->_data;
|
||||
else {
|
||||
$data = $this->encodeUnsynchronisation($this->_data);
|
||||
if ($this->getOption("version", 4) < 4) {
|
||||
$data = $this->_data = $this->_getData();
|
||||
$size = $this->_size = strlen($data);
|
||||
} else {
|
||||
$data = $this->_data = $this->_getData();
|
||||
$size = $this->_size = strlen($data);
|
||||
$data = $this->_encodeUnsynchronisation($data);
|
||||
if (($dataLength = strlen($data)) != $size) {
|
||||
$size = 4 + $dataLength;
|
||||
$data = Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) .
|
||||
$data = Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size)) .
|
||||
$data;
|
||||
$flags |= self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION;
|
||||
$this->setOption("unsynchronisation", true);
|
||||
@@ -291,7 +293,7 @@ class ID3_Frame extends ID3_Object
|
||||
$flags &= ~(self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION);
|
||||
}
|
||||
return Transform::toString8(substr($this->_identifier, 0, 4), 4) .
|
||||
Transform::toUInt32BE($this->encodeSynchsafe32($size)) .
|
||||
Transform::toUInt32BE($this->_encodeSynchsafe32($size)) .
|
||||
Transform::toUInt16BE($flags) . $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -54,7 +55,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -85,7 +86,7 @@ final class ID3_Frame_AENC extends ID3_Frame
|
||||
if ($reader === null)
|
||||
return;
|
||||
|
||||
list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2);
|
||||
list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
|
||||
$this->_previewStart = Transform::fromUInt16BE(substr($this->_data, 0, 2));
|
||||
$this->_previewLength = Transform::fromUInt16BE(substr($this->_data, 2, 2));
|
||||
$this->_encryptionInfo = substr($this->_data, 4);
|
||||
@@ -157,15 +158,14 @@ final class ID3_Frame_AENC extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
($this->_owner . "\0" . Transform::toUInt16BE($this->_previewStart) .
|
||||
Transform::toUInt16BE($this->_previewLength) . $this->_encryptionInfo);
|
||||
return parent::__toString();
|
||||
return
|
||||
$this->_owner . "\0" . Transform::toUInt16BE($this->_previewStart) .
|
||||
Transform::toUInt16BE($this->_previewLength) . $this->_encryptionInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -57,7 +58,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -121,26 +122,26 @@ final class ID3_Frame_APIC extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_description, $this->_imageData) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list ($this->_description, $this->_imageData) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list ($this->_description, $this->_imageData) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
($this->_description, "utf-8");
|
||||
break;
|
||||
default:
|
||||
list ($this->_description, $this->_imageData) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
($this->_description, "iso-8859-1");
|
||||
}
|
||||
|
||||
@@ -248,11 +249,11 @@ final class ID3_Frame_APIC extends ID3_Frame
|
||||
public function getImageSize() { return $this->_imageSize; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0" .
|
||||
Transform::toUInt8($this->_imageType);
|
||||
@@ -270,7 +271,6 @@ final class ID3_Frame_APIC extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_description . "\0";
|
||||
}
|
||||
parent::setData($data . $this->_imageData);
|
||||
return parent::__toString();
|
||||
return $data . $this->_imageData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @since ID3v2.4.0
|
||||
@@ -54,7 +55,7 @@ require_once("ID3/Frame.php");
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @since ID3v2.4.0
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -46,7 +47,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -66,7 +67,7 @@ abstract class ID3_Frame_AbstractLink extends ID3_Frame
|
||||
parent::__construct($reader, $options);
|
||||
|
||||
if ($reader !== null)
|
||||
$this->_link = implode($this->explodeString8($this->_data, 1), "");
|
||||
$this->_link = implode($this->_explodeString8($this->_data, 1), "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,13 +85,12 @@ abstract class ID3_Frame_AbstractLink extends ID3_Frame
|
||||
public function setLink($link) { $this->_link = $link; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData($this->_link);
|
||||
return parent::__toString();
|
||||
return $this->_link;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -47,7 +48,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -87,22 +88,22 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
$this->_data = substr($this->_data, 1);
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString16(Transform::fromString16($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString16(Transform::fromString16($this->_data)),
|
||||
"utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString16(Transform::fromString16BE($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString16(Transform::fromString16BE($this->_data)),
|
||||
"utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString8(Transform::fromString8($this->_data)), "utf-8");
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString8(Transform::fromString8($this->_data)), "utf-8");
|
||||
break;
|
||||
default:
|
||||
$this->_text = $this->convertString
|
||||
($this->explodeString8(Transform::fromString8($this->_data)),
|
||||
$this->_text = $this->_convertString
|
||||
($this->_explodeString8(Transform::fromString8($this->_data)),
|
||||
"iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -161,11 +162,11 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding);
|
||||
switch ($this->_encoding) {
|
||||
@@ -184,7 +185,6 @@ abstract class ID3_Frame_AbstractText extends ID3_Frame
|
||||
default:
|
||||
$data .= implode("\0", $this->_text);
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -54,7 +55,7 @@ require_once("ID3/Exception.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -97,34 +98,34 @@ final class ID3_Frame_COMM extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16($this->_text), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16BE($this->_text), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_text), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_text), "iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -227,11 +228,11 @@ final class ID3_Frame_COMM extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_language;
|
||||
switch ($this->_encoding) {
|
||||
@@ -249,7 +250,6 @@ final class ID3_Frame_COMM extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_description . "\0" . $this->_text;
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -121,46 +122,46 @@ final class ID3_Frame_COMR extends ID3_Frame
|
||||
|
||||
$encoding = Transform::fromUInt8($this->_data[0]);
|
||||
list($pricing, $this->_data) =
|
||||
$this->explodeString8(substr($this->_data, 1), 2);
|
||||
$this->_explodeString8(substr($this->_data, 1), 2);
|
||||
$this->_currency = substr($pricing, 0, 3);
|
||||
$this->_price = substr($pricing, 3);
|
||||
$this->_date = substr($this->_data, 0, 8);
|
||||
list($this->_contact, $this->_data) =
|
||||
$this->explodeString8(substr($this->_data, 8), 2);
|
||||
$this->_explodeString8(substr($this->_data, 8), 2);
|
||||
$this->_delivery = Transform::fromUInt8($this->_data[0]);
|
||||
$this->_data = substr($this->_data, 1);
|
||||
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_seller, $this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 3);
|
||||
$this->_seller = $this->convertString
|
||||
$this->_explodeString16($this->_data, 3);
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString16($this->_seller), "utf-16");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list ($this->_seller, $this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 3);
|
||||
$this->_seller = $this->convertString
|
||||
$this->_explodeString16($this->_data, 3);
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString16BE($this->_seller), "utf-16be");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list ($this->_seller, $this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 3);
|
||||
$this->_seller = $this->convertString
|
||||
$this->_explodeString8($this->_data, 3);
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString8($this->_seller), "utf-8");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list ($this->_seller, $this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 3);
|
||||
$this->_seller = $this->convertString
|
||||
$this->_explodeString8($this->_data, 3);
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString8($this->_seller), "iso-8859-1");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
}
|
||||
|
||||
@@ -168,7 +169,7 @@ final class ID3_Frame_COMR extends ID3_Frame
|
||||
return;
|
||||
|
||||
list($this->_mimeType, $this->_imageData) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
|
||||
$this->_imageSize = strlen($this->_imageData);
|
||||
}
|
||||
@@ -368,11 +369,11 @@ final class ID3_Frame_COMR extends ID3_Frame
|
||||
public function getImageSize() { return $this->_imageSize; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_currency .
|
||||
$this->_price . "\0" . $this->_date . $this->_contact . "\0" .
|
||||
@@ -392,9 +393,8 @@ final class ID3_Frame_COMR extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_seller . "\0" . $this->_description . "\0";
|
||||
}
|
||||
parent::setData
|
||||
($data . ($this->_mimeType ?
|
||||
$this->_mimeType . "\0" . $this->_imageData : ""));
|
||||
return parent::__toString();
|
||||
return
|
||||
$data . ($this->_mimeType ?
|
||||
$this->_mimeType . "\0" . $this->_imageData : "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -63,7 +64,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -91,7 +92,7 @@ final class ID3_Frame_ENCR extends ID3_Frame
|
||||
if ($reader === null)
|
||||
return;
|
||||
|
||||
list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2);
|
||||
list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
|
||||
$this->_method = Transform::fromInt8($this->_data[0]);
|
||||
$this->_encryptionData = substr($this->_data, 1);
|
||||
}
|
||||
@@ -142,15 +143,14 @@ final class ID3_Frame_ENCR extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
parent::setData
|
||||
($this->_owner . "\0" . Transform::toInt8($this->_method) .
|
||||
$this->_encryptionData);
|
||||
return parent::__toString();
|
||||
return
|
||||
$this->_owner . "\0" . Transform::toInt8($this->_method) .
|
||||
$this->_encryptionData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @since ID3v2.4.0
|
||||
@@ -50,7 +51,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @since ID3v2.4.0
|
||||
@@ -94,7 +95,7 @@ final class ID3_Frame_EQU2 extends ID3_Frame
|
||||
|
||||
$this->_interpolation = Transform::fromInt8($this->_data[0]);
|
||||
list ($this->_device, $this->_data) =
|
||||
$this->explodeString8(substr($this->_data, 1), 2);
|
||||
$this->_explodeString8(substr($this->_data, 1), 2);
|
||||
|
||||
for ($i = 0; $i < strlen($this->_data); $i += 4)
|
||||
$this->_adjustments
|
||||
@@ -177,17 +178,16 @@ final class ID3_Frame_EQU2 extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toInt8($this->_interpolation) . $this->_device . "\0";
|
||||
foreach ($this->_adjustments as $frequency => $adjustment)
|
||||
$data .= Transform::toUInt16BE($frequency * 2) .
|
||||
Transform::toInt16BE($adjustment * 512);
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -49,7 +50,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -123,18 +124,17 @@ final class ID3_Frame_EQUA extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toInt8(16);
|
||||
foreach ($this->_adjustments as $frequency => $adjustment)
|
||||
$data .= Transform::toUInt16BE
|
||||
($adjustment > 0 ? $frequency | 0x8000 : $frequency & ~0x8000) .
|
||||
Transform::toUInt16BE(abs($adjustment));
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -58,7 +59,7 @@ require_once("ID3/Timing.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -153,16 +154,15 @@ final class ID3_Frame_ETCO extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_format);
|
||||
foreach ($this->_events as $timestamp => $type)
|
||||
$data .= Transform::toUInt8($type) . Transform::toUInt32BE($timestamp);
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -93,34 +94,34 @@ final class ID3_Frame_GEOB extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_filename, $this->_description, $this->_objectData) =
|
||||
$this->explodeString16($this->_data, 3);
|
||||
$this->_filename = $this->convertString
|
||||
$this->_explodeString16($this->_data, 3);
|
||||
$this->_filename = $this->_convertString
|
||||
(Transform::fromString16($this->_filename), "utf-16");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list ($this->_filename, $this->_description, $this->_objectData) =
|
||||
$this->explodeString16($this->_data, 3);
|
||||
$this->_filename = $this->convertString
|
||||
$this->_explodeString16($this->_data, 3);
|
||||
$this->_filename = $this->_convertString
|
||||
(Transform::fromString16BE($this->_filename), "utf-16be");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list ($this->_filename, $this->_description, $this->_objectData) =
|
||||
$this->explodeString8($this->_data, 3);
|
||||
$this->_filename = $this->convertString
|
||||
$this->_explodeString8($this->_data, 3);
|
||||
$this->_filename = $this->_convertString
|
||||
(Transform::fromString8($this->_filename), "utf-8");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list ($this->_filename, $this->_description, $this->_objectData) =
|
||||
$this->explodeString8($this->_data, 3);
|
||||
$this->_filename = $this->convertString
|
||||
$this->_explodeString8($this->_data, 3);
|
||||
$this->_filename = $this->_convertString
|
||||
(Transform::fromString8($this->_filename), "iso-8859-1");
|
||||
$this->_description = $this->convertString
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -225,11 +226,11 @@ final class ID3_Frame_GEOB extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0";
|
||||
switch ($this->_encoding) {
|
||||
@@ -247,7 +248,6 @@ final class ID3_Frame_GEOB extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_filename . "\0" . $this->_description . "\0";
|
||||
}
|
||||
$this->setData($data . $this->_objectData);
|
||||
return parent::__toString();
|
||||
return $data . $this->_objectData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -62,7 +63,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -90,7 +91,7 @@ final class ID3_Frame_GRID extends ID3_Frame
|
||||
if ($reader === null)
|
||||
return;
|
||||
|
||||
list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2);
|
||||
list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
|
||||
$this->_group = Transform::fromUInt8($this->_data[0]);
|
||||
$this->_groupData = substr($this->_data, 1);
|
||||
}
|
||||
@@ -138,15 +139,14 @@ final class ID3_Frame_GRID extends ID3_Frame
|
||||
public function setGroupData($groupData) { $this->_groupData = $groupData; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
parent::setData
|
||||
($this->_owner . "\0" . Transform::toUInt8($this->_group) .
|
||||
$this->_groupData);
|
||||
return parent::__toString();
|
||||
return
|
||||
$this->_owner . "\0" . Transform::toUInt8($this->_group) .
|
||||
$this->_groupData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -50,7 +51,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -84,22 +85,22 @@ final class ID3_Frame_IPLS extends ID3_Frame
|
||||
$order = Transform::MACHINE_ENDIAN_ORDER;
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
$data = $this->explodeString16($data);
|
||||
$data = $this->_explodeString16($data);
|
||||
foreach ($data as &$str)
|
||||
$str = $this->convertString
|
||||
$str = $this->_convertString
|
||||
(Transform::fromString16($str, $order), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
$data = $this->explodeString16($data);
|
||||
$data = $this->_explodeString16($data);
|
||||
foreach ($data as &$str)
|
||||
$str = $this->convertString
|
||||
$str = $this->_convertString
|
||||
(Transform::fromString16BE($str), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
$data = $this->convertString($this->explodeString8($data), "utf-8");
|
||||
$data = $this->_convertString($this->_explodeString8($data), "utf-8");
|
||||
break;
|
||||
default:
|
||||
$data = $this->convertString($this->explodeString8($data), "iso-8859-1");
|
||||
$data = $this->_convertString($this->_explodeString8($data), "iso-8859-1");
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($data) - 1; $i += 2)
|
||||
@@ -161,11 +162,11 @@ final class ID3_Frame_IPLS extends ID3_Frame
|
||||
public function setPeople($people) { $this->_people = $people; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding);
|
||||
$order = $this->_encoding == self::UTF16 ?
|
||||
@@ -186,7 +187,6 @@ final class ID3_Frame_IPLS extends ID3_Frame
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -80,7 +81,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -110,7 +111,7 @@ final class ID3_Frame_LINK extends ID3_Frame
|
||||
|
||||
$this->_target = substr($this->_data, 0, 4);
|
||||
list($this->_url, $this->_qualifier) =
|
||||
$this->explodeString8(substr($this->_data, 4), 2);
|
||||
$this->_explodeString8(substr($this->_data, 4), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,15 +160,14 @@ final class ID3_Frame_LINK extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
(Transform::toString8(substr($this->_target, 0, 4), 4) .
|
||||
$this->_url . "\0" . $this->_qualifier);
|
||||
return parent::__toString();
|
||||
return
|
||||
Transform::toString8(substr($this->_target, 0, 4), 4) .
|
||||
$this->_url . "\0" . $this->_qualifier;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -56,7 +57,7 @@ require_once("ID3/Frame.php");
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -74,5 +75,12 @@ final class ID3_Frame_MCDI extends ID3_Frame
|
||||
*
|
||||
* @param string $data The CD TOC binary dump string.
|
||||
*/
|
||||
public function setData($data) { parent::setData($data); }
|
||||
public function setData($data) { $this->_data = $data; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getData() { return $this->_data; }
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -63,7 +64,7 @@ require_once("ID3/Frame.php");
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -90,7 +91,7 @@ final class ID3_Frame_OWNE extends ID3_Frame
|
||||
|
||||
$encoding = Transform::fromUInt8($this->_data[0]);
|
||||
list($tmp, $this->_data) =
|
||||
$this->explodeString8(substr($this->_data, 1), 2);
|
||||
$this->_explodeString8(substr($this->_data, 1), 2);
|
||||
$this->_currency = substr($tmp, 0, 3);
|
||||
$this->_price = substr($tmp, 3);
|
||||
$this->_date = substr($this->_data, 0, 8);
|
||||
@@ -98,19 +99,19 @@ final class ID3_Frame_OWNE extends ID3_Frame
|
||||
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
$this->_seller = $this->convertString
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString16($this->_data), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
$this->_seller = $this->convertString
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString16BE($this->_data), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
$this->_seller = $this->convertString
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString8($this->_data), "utf-8");
|
||||
break;
|
||||
default:
|
||||
$this->_seller = $this->convertString
|
||||
$this->_seller = $this->_convertString
|
||||
(Transform::fromString8($this->_data), "iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -212,11 +213,11 @@ final class ID3_Frame_OWNE extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_currency .
|
||||
$this->_price . "\0" . $this->_date;
|
||||
@@ -233,7 +234,6 @@ final class ID3_Frame_OWNE extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_seller;
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -96,16 +97,15 @@ final class ID3_Frame_PCNT extends ID3_Frame
|
||||
public function setCounter($counter) { $this->_counter = $counter; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
($this->_counter > 4294967295 ?
|
||||
return
|
||||
$this->_counter > 4294967295 ?
|
||||
Transform::toInt64BE($this->_counter) : // UInt64
|
||||
Transform::toUInt32BE($this->_counter));
|
||||
return parent::__toString();
|
||||
Transform::toUInt32BE($this->_counter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -59,7 +60,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -87,7 +88,7 @@ final class ID3_Frame_POPM extends ID3_Frame
|
||||
if ($reader === null)
|
||||
return;
|
||||
|
||||
list($this->_owner, $this->_data) = $this->explodeString8($this->_data, 2);
|
||||
list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
|
||||
$this->_rating = Transform::fromUInt8($this->_data[0]);
|
||||
$this->_data = substr($this->_data, 1);
|
||||
|
||||
@@ -145,17 +146,16 @@ final class ID3_Frame_POPM extends ID3_Frame
|
||||
public function setCounter($counter) { $this->_counter = $counter; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
($this->_owner . "\0" . Transform::toInt8($this->_rating) .
|
||||
return
|
||||
$this->_owner . "\0" . Transform::toInt8($this->_rating) .
|
||||
($this->_counter > 0xffffffff ?
|
||||
Transform::toInt64BE($this->_counter) :
|
||||
($this->_counter > 0 ? Transform::toUInt32BE($this->_counter) : 0)));
|
||||
return parent::__toString();
|
||||
($this->_counter > 0 ? Transform::toUInt32BE($this->_counter) : 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -50,7 +51,7 @@ require_once("ID3/Timing.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -118,15 +119,14 @@ final class ID3_Frame_POSS extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
(Transform::toUInt8($this->_format) .
|
||||
Transform::toUInt32BE($this->_position));
|
||||
return parent::__toString();
|
||||
return
|
||||
Transform::toUInt8($this->_format) .
|
||||
Transform::toUInt32BE($this->_position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ final class ID3_Frame_PRIV extends ID3_Frame
|
||||
return;
|
||||
|
||||
list($this->_owner, $this->_privateData) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,13 +115,12 @@ final class ID3_Frame_PRIV extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
parent::setData($this->_owner . "\0" . $this->_privateData);
|
||||
return parent::__toString();
|
||||
return $this->_owner . "\0" . $this->_privateData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -67,7 +68,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -166,16 +167,15 @@ final class ID3_Frame_RBUF extends ID3_Frame
|
||||
public function setOffset($offset) { $this->_offset = $offset; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
(substr(Transform::toUInt32BE($this->_bufferSize), 1, 3) .
|
||||
return
|
||||
substr(Transform::toUInt32BE($this->_bufferSize), 1, 3) .
|
||||
Transform::toInt8($this->_infoFlags) .
|
||||
Transform::toInt32BE($this->_offset));
|
||||
return parent::__toString();
|
||||
Transform::toInt32BE($this->_offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @since ID3v2.4.0
|
||||
@@ -58,7 +59,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @since ID3v2.4.0
|
||||
@@ -117,7 +118,7 @@ final class ID3_Frame_RVA2 extends ID3_Frame
|
||||
return;
|
||||
|
||||
list ($this->_device, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
|
||||
for ($i = $j = 0; $i < 9; $i++) {
|
||||
$this->_adjustments[$i] = array
|
||||
@@ -188,11 +189,11 @@ final class ID3_Frame_RVA2 extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = $this->_device . "\0";
|
||||
foreach ($this->_adjustments as $channel) {
|
||||
@@ -211,7 +212,6 @@ final class ID3_Frame_RVA2 extends ID3_Frame
|
||||
$data .= Transform::toInt8(64) .
|
||||
Transform::toInt64BE($channel[self::peakVolume]); // UInt64
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -54,7 +55,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @deprecated ID3v2.3.0
|
||||
@@ -197,11 +198,11 @@ final class ID3_Frame_RVAD extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$flags = 0;
|
||||
if ($this->_adjustments[self::right] > 0)
|
||||
@@ -246,7 +247,6 @@ final class ID3_Frame_RVAD extends ID3_Frame
|
||||
Transform::toUInt16BE(abs($this->_adjustments[self::bass])) .
|
||||
Transform::toUInt16BE(abs($this->_adjustments[self::peakBass]));
|
||||
}
|
||||
$this->setData(Transform::toInt8($flags) . $data);
|
||||
return parent::__toString();
|
||||
return Transform::toInt8($flags) . $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -60,7 +61,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -292,14 +293,14 @@ final class ID3_Frame_RVRB extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData
|
||||
(Transform::toUInt16BE($this->_reverbLeft) .
|
||||
return
|
||||
Transform::toUInt16BE($this->_reverbLeft) .
|
||||
Transform::toUInt16BE($this->_reverbRight) .
|
||||
Transform::toUInt8($this->_reverbBouncesLeft) .
|
||||
Transform::toUInt8($this->_reverbBouncesRight) .
|
||||
@@ -308,7 +309,6 @@ final class ID3_Frame_RVRB extends ID3_Frame
|
||||
Transform::toUInt8($this->_reverbFeedbackRtoR) .
|
||||
Transform::toUInt8($this->_reverbFeedbackRtoL) .
|
||||
Transform::toUInt8($this->_premixLtoR) .
|
||||
Transform::toUInt8($this->_premixRtoL));
|
||||
return parent::__toString();
|
||||
Transform::toUInt8($this->_premixRtoL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @since ID3v2.4.0
|
||||
@@ -48,7 +49,7 @@ require_once("ID3/Frame.php");
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @since ID3v2.4.0
|
||||
@@ -92,13 +93,12 @@ final class ID3_Frame_SEEK extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData(Transform::toInt32BE($this->_minOffset));
|
||||
return parent::__toString();
|
||||
return Transform::toInt32BE($this->_minOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
* @since ID3v2.4.0
|
||||
@@ -51,7 +52,7 @@ require_once("ID3/Frame.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
* @since ID3v2.4.0
|
||||
@@ -110,13 +111,12 @@ final class ID3_Frame_SIGN extends ID3_Frame
|
||||
public function setSignature($signature) { $this->_signature = $signature; }
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$this->setData(Transform::toUInt8($this->_group) . $this->_signature);
|
||||
return parent::__toString();
|
||||
return Transform::toUInt8($this->_group) . $this->_signature;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -55,7 +56,7 @@ require_once("ID3/Timing.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -115,26 +116,26 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list($this->_description, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
}
|
||||
|
||||
@@ -142,26 +143,26 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString16($syllable), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString16BE($syllable), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString8($syllable), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list($syllable, $this->_data) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$syllable = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$syllable = $this->_convertString
|
||||
(Transform::fromString8($syllable), "iso-8859-1");
|
||||
}
|
||||
$this->_events[Transform::fromUInt32BE(substr($this->_data, 0, 4))] =
|
||||
@@ -299,11 +300,11 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_language .
|
||||
Transform::toUInt8($this->_format) . Transform::toUInt8($this->_type);
|
||||
@@ -338,7 +339,6 @@ final class ID3_Frame_SYLT extends ID3_Frame
|
||||
}
|
||||
$data .= Transform::toUInt32BE($timestamp);
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -62,7 +63,7 @@ require_once("ID3/Timing.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -141,11 +142,11 @@ final class ID3_Frame_SYTC extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_format);
|
||||
foreach ($this->_events as $timestamp => $tempo) {
|
||||
@@ -155,7 +156,6 @@ final class ID3_Frame_SYTC extends ID3_Frame
|
||||
$data .= Transform::toUInt8($tempo);
|
||||
$data .= Transform::toUInt32BE($timestamp);
|
||||
}
|
||||
parent::setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ require_once("ID3/Frame/AbstractText.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -83,28 +84,28 @@ final class ID3_Frame_TXXX extends ID3_Frame_AbstractText
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(array(Transform::fromString16($this->_text)), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(array(Transform::fromString16BE($this->_text)), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($this->_description, $this->_text) = $this->convertString
|
||||
($this->explodeString8($this->_data, 2), "utf-8");
|
||||
list($this->_description, $this->_text) = $this->_convertString
|
||||
($this->_explodeString8($this->_data, 2), "utf-8");
|
||||
$this->_text = array($this->_text);
|
||||
break;
|
||||
default:
|
||||
list($this->_description, $this->_text) = $this->convertString
|
||||
($this->explodeString8($this->_data, 2), "iso-8859-1");
|
||||
list($this->_description, $this->_text) = $this->_convertString
|
||||
($this->_explodeString8($this->_data, 2), "iso-8859-1");
|
||||
$this->_text = array($this->_text);
|
||||
}
|
||||
}
|
||||
@@ -130,11 +131,11 @@ final class ID3_Frame_TXXX extends ID3_Frame_AbstractText
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding);
|
||||
switch ($this->_encoding) {
|
||||
@@ -152,8 +153,7 @@ final class ID3_Frame_TXXX extends ID3_Frame_AbstractText
|
||||
default:
|
||||
$data .= $this->_description . "\0" . $this->_text[0];
|
||||
}
|
||||
$this->setData($data);
|
||||
return ID3_Frame::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -52,7 +53,7 @@ require_once("ID3/Language.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -91,19 +92,19 @@ final class ID3_Frame_USER extends ID3_Frame
|
||||
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16($this->_data), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16BE($this->_data), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_data), "utf-8");
|
||||
break;
|
||||
default:
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_data), "iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -180,11 +181,11 @@ final class ID3_Frame_USER extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_language;
|
||||
switch ($this->_encoding) {
|
||||
@@ -200,7 +201,6 @@ final class ID3_Frame_USER extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_text;
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ require_once("ID3/Language.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -94,34 +95,34 @@ final class ID3_Frame_USLT extends ID3_Frame
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16($this->_text), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString16BE($this->_text), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "utf-8");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_text), "utf-8");
|
||||
break;
|
||||
default:
|
||||
list ($this->_description, $this->_text) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString8($this->_description), "iso-8859-1");
|
||||
$this->_text = $this->convertString
|
||||
$this->_text = $this->_convertString
|
||||
(Transform::fromString8($this->_text), "iso-8859-1");
|
||||
}
|
||||
}
|
||||
@@ -224,11 +225,11 @@ final class ID3_Frame_USLT extends ID3_Frame
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding) . $this->_language;
|
||||
switch ($this->_encoding) {
|
||||
@@ -246,7 +247,6 @@ final class ID3_Frame_USLT extends ID3_Frame
|
||||
default:
|
||||
$data .= $this->_description . "\0" . $this->_text;
|
||||
}
|
||||
$this->setData($data);
|
||||
return parent::__toString();
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
60
src/ID3/Frame/Unknown.php
Normal file
60
src/ID3/Frame/Unknown.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2009 The PHP Reader Project Workgroup. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither the name of the project workgroup nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**#@+ @ignore */
|
||||
require_once("ID3/Frame.php");
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* This class represents a frame that is not known to the library.
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
final class ID3_Frame_Unknown extends ID3_Frame
|
||||
{
|
||||
/**
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _getData() { return $this->_data; }
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ require_once("ID3/Encoding.php");
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @author Ryan Butterfield <buttza@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -85,28 +86,28 @@ final class ID3_Frame_WXXX extends ID3_Frame_AbstractLink
|
||||
switch ($encoding) {
|
||||
case self::UTF16:
|
||||
list($this->_description, $this->_link) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16($this->_description), "utf-16");
|
||||
break;
|
||||
case self::UTF16BE:
|
||||
list($this->_description, $this->_link) =
|
||||
$this->explodeString16($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString16($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
(Transform::fromString16BE($this->_description), "utf-16be");
|
||||
break;
|
||||
case self::UTF8:
|
||||
list($this->_description, $this->_link) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString($this->_description, "utf-8");
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString($this->_description, "utf-8");
|
||||
break;
|
||||
default:
|
||||
list($this->_description, $this->_link) =
|
||||
$this->explodeString8($this->_data, 2);
|
||||
$this->_description = $this->convertString
|
||||
$this->_explodeString8($this->_data, 2);
|
||||
$this->_description = $this->_convertString
|
||||
($this->_description, "iso-8859-1");
|
||||
}
|
||||
$this->_link = implode($this->explodeString8($this->_link, 1), "");
|
||||
$this->_link = implode($this->_explodeString8($this->_link, 1), "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,11 +157,11 @@ final class ID3_Frame_WXXX extends ID3_Frame_AbstractLink
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the frame raw data.
|
||||
* Returns the frame raw data without the header.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
protected function _getData()
|
||||
{
|
||||
$data = Transform::toUInt8($this->_encoding);
|
||||
switch ($this->_encoding) {
|
||||
@@ -177,7 +178,6 @@ final class ID3_Frame_WXXX extends ID3_Frame_AbstractLink
|
||||
default:
|
||||
$data .= $this->_description . "\0";
|
||||
}
|
||||
$this->setData($data . $this->_link);
|
||||
return ID3_Frame::__toString();
|
||||
return $data . $this->_link;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -30,7 +31,7 @@
|
||||
*
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
@@ -46,7 +47,7 @@ require_once("ID3/Object.php");
|
||||
* @package php-reader
|
||||
* @subpackage ID3
|
||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||
* @version $Rev$
|
||||
*/
|
||||
@@ -97,7 +98,7 @@ final class ID3_Header extends ID3_Object
|
||||
$this->_version = $options["version"] =
|
||||
$this->_reader->readInt8() + $this->_reader->readInt8() / 10;
|
||||
$this->_flags = $this->_reader->readInt8();
|
||||
$this->_size = $this->decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
$this->_size = $this->_decodeSynchsafe32($this->_reader->readUInt32BE());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +160,7 @@ final class ID3_Header extends ID3_Object
|
||||
public function setSize($size) { $this->_size = $size; }
|
||||
|
||||
/**
|
||||
* Returns the header/footer raw data without the identifier.
|
||||
* Returns the header/footer data without the identifier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -168,6 +169,6 @@ final class ID3_Header extends ID3_Object
|
||||
return Transform::toInt8(floor($this->_version)) .
|
||||
Transform::toInt8(($this->_version - floor($this->_version)) * 10) .
|
||||
Transform::toInt8($this->_flags) .
|
||||
Transform::toUInt32BE($this->encodeSynchsafe32($this->_size));
|
||||
Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
/**
|
||||
* PHP Reader Library
|
||||
*
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights reserved.
|
||||
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -149,7 +150,7 @@ abstract class ID3_Object
|
||||
* @param integer $val The integer to encode.
|
||||
* @return integer
|
||||
*/
|
||||
protected final function encodeSynchsafe32($val)
|
||||
protected final function _encodeSynchsafe32($val)
|
||||
{
|
||||
return ($val & 0x7f) | ($val & 0x3f80) << 1 |
|
||||
($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3;
|
||||
@@ -161,7 +162,7 @@ abstract class ID3_Object
|
||||
* @param integer $val The integer to decode
|
||||
* @return integer
|
||||
*/
|
||||
protected final function decodeSynchsafe32($val)
|
||||
protected final function _decodeSynchsafe32($val)
|
||||
{
|
||||
return ($val & 0x7f) | ($val & 0x7f00) >> 1 |
|
||||
($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;
|
||||
@@ -180,7 +181,7 @@ abstract class ID3_Object
|
||||
* @param string $data The input data.
|
||||
* @return string
|
||||
*/
|
||||
protected final function encodeUnsynchronisation(&$data)
|
||||
protected final function _encodeUnsynchronisation(&$data)
|
||||
{
|
||||
$result = "";
|
||||
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
||||
@@ -195,11 +196,11 @@ abstract class ID3_Object
|
||||
/**
|
||||
* Reverses the unsynchronisation scheme from the given data string.
|
||||
*
|
||||
* @see encodeUnsynchronisation
|
||||
* @see _encodeUnsynchronisation
|
||||
* @param string $data The input data.
|
||||
* @return string
|
||||
*/
|
||||
protected final function decodeUnsynchronisation(&$data)
|
||||
protected final function _decodeUnsynchronisation(&$data)
|
||||
{
|
||||
$result = "";
|
||||
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
||||
@@ -217,7 +218,7 @@ abstract class ID3_Object
|
||||
* @param string $value The input string.
|
||||
* @return Array
|
||||
*/
|
||||
protected final function explodeString16($value, $limit = null)
|
||||
protected final function _explodeString16($value, $limit = null)
|
||||
{
|
||||
$i = 0;
|
||||
$array = array();
|
||||
@@ -244,7 +245,7 @@ abstract class ID3_Object
|
||||
* @param string $value The input string.
|
||||
* @return Array
|
||||
*/
|
||||
protected final function explodeString8($value, $limit = null)
|
||||
protected final function _explodeString8($value, $limit = null)
|
||||
{
|
||||
return preg_split("/\\x00/", $value, $limit);
|
||||
}
|
||||
@@ -256,7 +257,7 @@ abstract class ID3_Object
|
||||
* @param string|Array $string
|
||||
* @param string $encoding
|
||||
*/
|
||||
protected final function convertString($string, $encoding)
|
||||
protected final function _convertString($string, $encoding)
|
||||
{
|
||||
$target = $this->getOption("encoding", ID3_Encoding::UTF8);
|
||||
switch ($target) {
|
||||
@@ -286,4 +287,11 @@ abstract class ID3_Object
|
||||
$string = iconv($encoding, $target, $string);
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the object data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function __toString();
|
||||
}
|
||||
|
||||
@@ -184,8 +184,10 @@ final class ID3v2
|
||||
require_once($filename);
|
||||
if (class_exists($classname = "ID3_Frame_" . $identifier))
|
||||
$frame = new $classname($this->_reader, $options);
|
||||
else
|
||||
$frame = new ID3_Frame($this->_reader, $options);
|
||||
else {
|
||||
require_once("ID3/Frame/Unknown.php");
|
||||
$frame = new ID3_Frame_Unknown($this->_reader, $options);
|
||||
}
|
||||
|
||||
if (!isset($this->_frames[$frame->getIdentifier()]))
|
||||
$this->_frames[$frame->getIdentifier()] = array();
|
||||
@@ -246,6 +248,7 @@ final class ID3v2
|
||||
* Returns <var>true</var> if one ore more frames are present,
|
||||
* <var>false</var> otherwise.
|
||||
*
|
||||
* @param string $identifier The frame name.
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasFrame($identifier)
|
||||
@@ -271,8 +274,9 @@ final class ID3v2
|
||||
*
|
||||
* Please note that one may also use the shorthand $obj->identifier to access
|
||||
* the first frame with the identifier given. Wildcards cannot be used with
|
||||
* the shorthand.
|
||||
* the shorthand method.
|
||||
*
|
||||
* @param string $identifier The frame name.
|
||||
* @return Array
|
||||
*/
|
||||
public function getFramesByIdentifier($identifier)
|
||||
@@ -287,6 +291,27 @@ final class ID3v2
|
||||
return $matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any frames matching the given object identifier.
|
||||
*
|
||||
* The identifier may contain wildcard characters "*" and "?". The asterisk
|
||||
* matches against zero or more characters, and the question mark matches any
|
||||
* single character.
|
||||
*
|
||||
* One may also use the shorthand unset($obj->identifier) to achieve the same
|
||||
* result. Wildcards cannot be used with the shorthand method.
|
||||
*
|
||||
* @param string $identifier The frame name.
|
||||
*/
|
||||
public final function removeFramesByIdentifier($identifier)
|
||||
{
|
||||
$searchPattern = "/^" .
|
||||
str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i";
|
||||
foreach ($this->_frames as $identifier => $frames)
|
||||
if (preg_match($searchPattern, $identifier))
|
||||
unset($this->_frames[$identifier]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new frame to the tag and returns it.
|
||||
*
|
||||
@@ -301,6 +326,19 @@ final class ID3v2
|
||||
return $this->_frames[$frame->getIdentifier()][] = $frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given frame from the tag.
|
||||
*
|
||||
* @param ID3_Frame $frame The frame to remove.
|
||||
*/
|
||||
public function removeFrame($frame)
|
||||
{
|
||||
if (!$this->hasFrame($frame->getIdentifier()))
|
||||
foreach ($this->_frames[$frame->getIdentifier()] as $key => $value)
|
||||
if ($frame === $value)
|
||||
unset($this->_frames[$frame->getIdentifier()][$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether there is a footer present in the tag. Returns
|
||||
* <var>true</var> if the footer is present, <var>false</var> otherwise.
|
||||
|
||||
Reference in New Issue
Block a user