Add write support for ID3v2 frames

git-svn-id: http://php-reader.googlecode.com/svn/trunk@65 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2008-04-02 15:22:46 +00:00
parent 458335dc9f
commit ad6a722bae
88 changed files with 1857 additions and 337 deletions

View File

@@ -53,7 +53,7 @@ require_once("ID3/Frame.php");
* The group symbol contains a value that associates the frame with this group
* throughout the whole tag, in the range $80-F0. All other values are reserved.
* The group symbol may optionally be followed by some group specific data, e.g.
* a digital signature. There may be several "GRID" frames in a tag but only one
* a digital signature. There may be several GRID frames in a tag but only one
* containing the same symbol and only one containing the same owner identifier.
* The group symbol must be used somewhere in the tag. See
* {@link ID3_Frame#GROUPING_IDENTITY} for more information.
@@ -73,18 +73,24 @@ final class ID3_Frame_GRID extends ID3_Frame
/** @var integer */
private $_group;
/** @var string */
private $_groupData;
/**
* Constructs the class with given parameters and parses object related data.
*
* @param Reader $reader The reader object.
*/
public function __construct($reader)
public function __construct($reader = null)
{
parent::__construct($reader);
if ($reader === null)
return;
list($this->_id, $this->_data) = preg_split("/\\x00/", $this->_data, 2);
$this->_group = substr($this->_data, 0, 1);
$this->_data = substr($this->_data, 1);
$this->_group = Transform::fromInt8($this->_data[0]);
$this->_groupData = substr($this->_data, 1);
}
/**
@@ -94,6 +100,13 @@ final class ID3_Frame_GRID extends ID3_Frame
*/
public function getIdentifier() { return $this->_id; }
/**
* Sets the owner identifier string.
*
* @param string $id The owner identifier string.
*/
public function setIdentifier($id) { $this->_id = $id; }
/**
* Returns the group symbol.
*
@@ -101,10 +114,37 @@ final class ID3_Frame_GRID extends ID3_Frame
*/
public function getGroup() { return $this->_group; }
/**
* Sets the group symbol.
*
* @param integer $group The group symbol.
*/
public function setGroup($group) { $this->_group = $group; }
/**
* Returns the group dependent data.
*
* @return string
*/
public function getData() { return $this->_data; }
public function getData() { return $this->_groupData; }
/**
* Sets the group dependent data.
*
* @param string $groupData The data.
*/
public function setData($groupData) { $this->_groupData = $groupData; }
/**
* Returns the frame raw data.
*
* @return string
*/
public function __toString()
{
parent::setData
($this->_id . "\0" . Transform::toInt8($this->_group) .
$this->_groupData);
return parent::__toString();
}
}