package org.farng.mp3.id3;
import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectNumberHashMap;
import org.farng.mp3.object.ObjectNumberVariableLength;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* <h3>4.21. Position synchronisation frame</h3>
* <p/>
* <p> This frame delivers information to the listener of how far into the<br> audio stream he
* picked up; in effect, it states the time offset from<br> the first frame in the stream. The frame layout
* is:</p>
* <p/>
* <p> <Head for 'Position synchronisation', ID: "POSS"><br>
* <p/>
* Time stamp format $xx<br>
* Position
* $xx (xx ...)</p>
* <p/>
* <p> Where time stamp format is:</p>
* <p/>
* <p> $01 Absolute time, 32 bit sized, using MPEG frames as unit<br>
* $02 Absolute time, 32 bit sized, using milliseconds as unit</p>
* <p/>
* <p> and position is where in the audio the listener starts to receive,<br> i.e. the
* beginning of the next frame. If this frame is used in the<br>
* <p/>
* beginning of a file the value is always 0. There may only be one<br> "POSS" frame
* in each tag.<br> </p>
*
* @author Eric Farng
* @version $Revision: 1.4 $
*/
public class FrameBodyPOSS extends AbstractID3v2FrameBody {
/**
* Creates a new FrameBodyPOSS object.
*/
public FrameBodyPOSS() {
super();
}
/**
* Creates a new FrameBodyPOSS object.
*/
public FrameBodyPOSS(final FrameBodyPOSS body) {
super(body);
}
/**
* Creates a new FrameBodyPOSS object.
*/
public FrameBodyPOSS(final byte timeStampFormat, final long position) {
setObject(ObjectNumberHashMap.TIME_STAMP_FORMAT, new Byte(timeStampFormat));
setObject("Position", new Long(position));
}
/**
* Creates a new FrameBodyPOSS object.
*/
public FrameBodyPOSS(final RandomAccessFile file) throws IOException, InvalidTagException {
this.read(file);
}
public String getIdentifier() {
return "POSS";
}
protected void setupObjectList() {
appendToObjectList(new ObjectNumberHashMap(ObjectNumberHashMap.TIME_STAMP_FORMAT, 1));
appendToObjectList(new ObjectNumberVariableLength("Position", 1));
}
}