SjByteVector ID3v2_AttachedPictureFrame::renderFields() const
{
	SjByteVector data;

	data.append((unsigned char)(m_textEncoding));
	data.appendString(m_mimeType, SJ_LATIN1);
	data.append(textDelimiter(SJ_LATIN1));
	data.append((unsigned char)(m_type));
	data.appendString(m_description, m_textEncoding);
	data.append(textDelimiter(m_textEncoding));
	data.append(m_data);

	return data;
}
示例#2
0
void ID3v2_Tag::setTextFrame(const wxString &id, const wxString &value)
{
	if(value.IsEmpty()) {
		removeFrames(id);
		return;
	}

	//if(!d->frameListMap[id].isEmpty())
	//  d->frameListMap[id].front()->setText(value);
	ID3v2_FrameList* it = frameList(id);
	if( it )
	{
		ID3v2_FrameList::Node* l = it->GetFirst();
		if( l )
		{
			l->GetData()->setText(value);
		}
	}
	else
	{
		const SjStringType encoding = m_factory->defaultTextEncoding();

		SjByteVector idBv;
		idBv.appendString(id, SJ_LATIN1);
		ID3v2_TextIdentificationFrame *f = new ID3v2_TextIdentificationFrame(idBv, encoding);

		addFrame(f);
		f->setText(value);
	}
}
SjByteVector ID3v2_TextIdentificationFrame::renderFields() const
{
	SjByteVector v;

	if(m_fieldList.GetCount() > 0) {

		v.append((unsigned char)(m_textEncoding));

		/*for(StringList::Iterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {

		  // Since the field list is null delimited, if this is not the first
		  // element in the list, append the appropriate delimiter for this
		  // encoding.

		  if(it != d->fieldList.begin())
		    v.append(textDelimiter(d->textEncoding));

		  v.append((*it).data(d->textEncoding));
		}*/
		int i, iCount = m_fieldList.GetCount();
		for( i = 0; i < iCount; i++ )
		{
			if( i )
				v.append(textDelimiter(m_textEncoding));

			v.appendString(m_fieldList.Item(i), m_textEncoding);
		}
	}

	return v;
}
SjByteVector ID3v2_UniqueFileIdentifierFrame::renderFields() const
{
	SjByteVector data;

	data.appendString(m_owner, SJ_LATIN1);
	data.append((unsigned char)(0));
	data.append(m_identifier);

	return data;
}
SjByteVector ID3v2_PopularimeterFrame::renderFields() const
{
	SjByteVector data;

	data.appendString(m_email, SJ_LATIN1);
	data.append(textDelimiter(SJ_LATIN1));
	data.append((unsigned char)m_rating255);
	data.append(SjByteVector::fromUint((SjUint)m_counter));

	return data;
}
SjByteVector ID3v2_CommentsFrame::renderFields() const
{
	SjByteVector v;

	v.append((unsigned char)(m_textEncoding));

	//v.append(d->language.size() == 3 ? d->language : "   ");
	if( m_language.size() == 3 )
	{
		v.append(m_language);
	}
	else
	{
		v.append((unsigned char*)"   ");
	}

	v.appendString(m_description, m_textEncoding);
	v.append(textDelimiter(m_textEncoding));
	v.appendString(m_text, m_textEncoding);

	return v;
}
示例#7
0
SjByteVector APE_Item::render() const
{
	SjByteVector data;
	SjUint flags = ((m_readOnly) ? 1 : 0) | (m_type << 1);
	SjByteVector value;

	if(isEmpty())
		return data;

	if(m_type != APE_ItemBinary)
	{
		int i, iCount = m_stringList.GetCount();
		if( iCount>0 )
		{
			value.appendString(m_stringList.Item(0), SJ_UTF8);
			for( i = 1; i < iCount; i++ )
			{
				value.append((unsigned char)'\0');
				value.appendString(m_stringList.Item(i), SJ_UTF8);
			}
		}

		// there should be no need to set back m_binary
	}
	else
	{
		value.append(m_binary);
	}

	data.append(SjByteVector::fromUint(value.size(), false));
	data.append(SjByteVector::fromUint(flags, false));
	data.appendString(m_key, SJ_UTF8);
	data.append(SjByteVector((unsigned char)'\0'));
	data.append(value);

	return data;
}