use of com.frostwire.mp4.IsoFile in project frostwire by frostwire.
the class MediaPlayer method getDurationFromM4A.
private long getDurationFromM4A(File f) {
try {
RandomAccessFile isoFile = new RandomAccessFile(f, "r");
LinkedList<com.frostwire.mp4.Box> boxes = IsoFile.head(isoFile, ByteBuffer.allocate(100 * 1024));
try {
MovieHeaderBox mvhd = com.frostwire.mp4.Box.findFirst(boxes, com.frostwire.mp4.Box.mvhd);
if (mvhd != null) {
return mvhd.duration() / mvhd.timescale();
}
} finally {
IOUtils.closeQuietly(isoFile);
}
} catch (Throwable e) {
return -1;
}
return -1;
}
Aggregations