Exemplo n.º 1
0
ID3v2_Tag::~ID3v2_Tag()
{
	if( m_extendedHeader) delete m_extendedHeader;
	if( m_footer ) delete m_footer;

	// delete all frame list contents, the frame list itself is destroyed automatically
	ID3v2_FrameList::Node* node = m_frameList.GetFirst();
	for( ; node; node = node->GetNext() )
	{
		delete node->GetData();
	}

	// delete all frame hash values, the hash itself is destroyed automatically
	SjHashIterator iterator;
	ID3v2_FrameList* frameList;
	wxString frameId;
	while( (frameList=(ID3v2_FrameList*)m_frameListMap.Iterate(iterator, frameId)) )
	{
		delete frameList;
	}
}
Exemplo n.º 2
0
SjByteVector ID3v2_Tag::render()
{
	// We need to render the "tag data" first so that we have to correct size to
	// render in the tag's header.  The "tag data" -- everything that is included
	// in ID3v2::Header::tagSize() -- includes the extended header, frames and
	// padding, but does not include the tag's header or footer.

	SjByteVector tagData;

	// TODO: Render the extended header.

	// Loop through the frames rendering them and adding them to the tagData.

	//for(FrameList::Iterator it = d->frameList.begin(); it != d->frameList.end(); it++)
	for ( ID3v2_FrameList::Node *node = m_frameList.GetFirst(); node; node = node->GetNext() )
	{
		ID3v2_Frame* it = node->GetData();
		if(!it->header()->tagAlterPreservation())
			tagData.append(it->render());
	}

	// Compute the amount of padding, and append that to tagData.

	SjUint paddingSize = 0;
	SjUint originalSize = m_header.tagSize();

	if(tagData.size() < originalSize)
		paddingSize = originalSize - tagData.size();
	else
		paddingSize = 1024;

	tagData.append(SjByteVector(paddingSize, char(0)));

	// Set the tag size.
	m_header.setTagSize(tagData.size());

	// TODO: This should eventually include d->footer->render().
	return m_header.render() + tagData;
}
Exemplo n.º 3
0
ID3v2_UserTextIdentificationFrame *find(ID3v2_Tag *tag, const wxString &description) // static
{
	const ID3v2_FrameList* l = tag->frameList(wxT("TXXX"));

	/*for(FrameList::Iterator it = l.begin(); it != l.end(); ++it) {
	  UserTextIdentificationFrame *f = dynamic_cast<UserTextIdentificationFrame *>(*it);
	  if(f && f->description() == description)
	    return f;
	}
	*/
	if( l )
	{
		for ( ID3v2_FrameList::Node *node = l->GetFirst(); node; node = node->GetNext() )
		{
			ID3v2_UserTextIdentificationFrame *f = (ID3v2_UserTextIdentificationFrame*)node->GetData();
			if( f && f->description() == description )
				return f;
		}
	}

	return 0;
}