Mp4FtypBoxpublic class Mp4FtypBox extends AbstractMp4Box Ftyp (File Type) is the first atom, can be used to help identify the mp4 container type |
Fields Summary |
---|
private String | majorBrand | private int | majorBrandVersion | private List | compatibleBrands | private static final int | MAJOR_BRAND_POS | private static final int | MAJOR_BRAND_LENGTH | private static final int | MAJOR_BRAND_VERSION_POS | private static final int | MAJOR_BRAND_VERSION_LENGTH | private static final int | COMPATIBLE_BRAND_LENGTH |
Constructors Summary |
---|
public Mp4FtypBox(Mp4BoxHeader header, ByteBuffer dataBuffer) //Can be multiple of these
this.header = header;
this.dataBuffer = dataBuffer;
|
Methods Summary |
---|
public java.util.List | getCompatibleBrands()
return compatibleBrands;
| public java.lang.String | getMajorBrand()
return majorBrand;
| public int | getMajorBrandVersion()
return majorBrandVersion;
| public void | processData()
CharsetDecoder decoder = Charset.forName("ISO-8859-1").newDecoder();
try
{
majorBrand = decoder.decode((ByteBuffer) dataBuffer.slice().limit(MAJOR_BRAND_LENGTH)).toString();
}
catch (CharacterCodingException cee)
{
//Ignore
}
dataBuffer.position(dataBuffer.position() + MAJOR_BRAND_LENGTH);
majorBrandVersion = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + MAJOR_BRAND_VERSION_LENGTH - 1));
dataBuffer.position(dataBuffer.position() + MAJOR_BRAND_VERSION_LENGTH);
while ((dataBuffer.position() < dataBuffer.limit()) && (dataBuffer.limit() - dataBuffer.position() >= COMPATIBLE_BRAND_LENGTH))
{
decoder.onMalformedInput(CodingErrorAction.REPORT);
decoder.onMalformedInput(CodingErrorAction.REPORT);
try
{
String brand = decoder.decode((ByteBuffer) dataBuffer.slice().limit(COMPATIBLE_BRAND_LENGTH)).toString();
//Sometimes just extra groups of four nulls
if (!brand.equals("\u0000\u0000\u0000\u0000"))
{
compatibleBrands.add(brand);
}
}
catch (CharacterCodingException cee)
{
//Ignore
}
dataBuffer.position(dataBuffer.position() + COMPATIBLE_BRAND_LENGTH);
}
| public java.lang.String | toString()
String info = "Major Brand:" + majorBrand + "Version:" + majorBrandVersion;
if (compatibleBrands.size() > 0)
{
info += "Compatible:";
for (String brand : compatibleBrands)
{
info += brand;
info += ",";
}
return info.substring(0, info.length() - 1);
}
return info;
|
|