Search code examples
javaandroidmp4parser

Mp4parser: how to get matrix values for further use?


I want to get the double values out of the mp4parser Matrix, for use in some formulas. Is there any method/utility for this? I am using the last version for gradle, i.e. 1.1.9.


Solution

  • I found a solution. If there's a simpler one, please post it. If a is a mp4parser Matrix, then here is how to get in m the double values:

    ByteBuffer bb = ByteBuffer.allocate(36);
    a.getContent(bb);
    bb.position(0);
    double [] m = {
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint0230(bb),
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint0230(bb),
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint1616(bb),
        IsoTypeReader.readFixedPoint0230(bb)};