FileDocCategorySizeDatePackage
OggVorbisCommentTagCreator.javaAPI DocJaudiotagger 2.0.42575Wed Mar 30 16:11:54 BST 2011org.jaudiotagger.audio.ogg

OggVorbisCommentTagCreator

public class OggVorbisCommentTagCreator extends Object
Creates an OggVorbis Comment Tag from a VorbisComment for use within an OggVorbis Container

When a Vorbis Comment is used within OggVorbis it additionally has a vorbis header and a framing bit.

Fields Summary
public static Logger
logger
public static final int
FIELD_FRAMING_BIT_LENGTH
public static final byte
FRAMING_BIT_VALID_VALUE
private org.jaudiotagger.tag.vorbiscomment.VorbisCommentCreator
creator
Constructors Summary
Methods Summary
public java.nio.ByteBufferconvert(org.jaudiotagger.tag.Tag tag)


    //Creates the ByteBuffer for the ogg tag
         
    
        ByteBuffer ogg = creator.convert(tag);
        int tagLength = ogg.capacity() + VorbisHeader.FIELD_PACKET_TYPE_LENGTH + VorbisHeader.FIELD_CAPTURE_PATTERN_LENGTH + OggVorbisCommentTagCreator.FIELD_FRAMING_BIT_LENGTH;

        ByteBuffer buf = ByteBuffer.allocate(tagLength);

        //[packet type=comment0x03]['vorbis']
        buf.put((byte) VorbisPacketType.COMMENT_HEADER.getType());
        buf.put(VorbisHeader.CAPTURE_PATTERN_AS_BYTES);

        //The actual tag
        buf.put(ogg);

        //Framing bit = 1
        buf.put(FRAMING_BIT_VALID_VALUE);

        buf.rewind();
        return buf;