Search in sources :

Example 1 with ObjectMediaChunk

use of cbit.vcell.export.gloworm.quicktime.ObjectMediaChunk in project vcell by virtualcell.

the class IMGExporter method writeQTVRWorker.

public static void writeQTVRWorker(DataOutputStream dataOutputStream, VideoMediaChunk[] videoMediaChunks, int numTimePoints, int numslices, int width, int height) throws java.io.IOException, java.util.zip.DataFormatException {
    /* make the single node VR World and required chunks */
    if (numTimePoints * numslices != videoMediaChunks.length) {
        throw new DataFormatException("NumTimePoints x Numslices != VideoMediaChunk length.");
    }
    VRWorld singleObjVRWorld = VRWorld.createSingleObjectVRWorld(videoMediaChunks[0].getDuration(), numTimePoints, numslices, (float) (width / 2), (float) (height / 2));
    // reverse pan controls (set bit 3)
    singleObjVRWorld.getVRObjectSampleAtom(0).setControlSettings(singleObjVRWorld.getVRObjectSampleAtom(0).getControlSettings() | (Integer.parseInt("00001000", 2)));
    VRMediaChunk vrChunk = new VRMediaChunk(singleObjVRWorld);
    ObjectMediaChunk objChunk = new ObjectMediaChunk(singleObjVRWorld);
    /* assemble tracks and write the rest of the file */
    MediaTrack qtvrTrack = new MediaTrack(vrChunk);
    MediaTrack objectTrack = new MediaTrack(objChunk);
    MediaTrack imageTrack = new MediaTrack(videoMediaChunks);
    qtvrTrack.setWidth(imageTrack.getWidth());
    qtvrTrack.setHeight(imageTrack.getHeight());
    objectTrack.setWidth(imageTrack.getWidth());
    objectTrack.setHeight(imageTrack.getHeight());
    VRMediaMovie vrMovie = VRMediaMovie.createVRMediaMovie(qtvrTrack, objectTrack, imageTrack, null, imageTrack.getDuration(), videoMediaChunks[0].getDuration());
    MediaMethods.writeMovie(dataOutputStream, vrMovie);
}
Also used : MediaTrack(cbit.vcell.export.gloworm.quicktime.MediaTrack) DataFormatException(java.util.zip.DataFormatException) VRWorld(cbit.vcell.export.gloworm.quicktime.VRWorld) VRMediaChunk(cbit.vcell.export.gloworm.quicktime.VRMediaChunk) ObjectMediaChunk(cbit.vcell.export.gloworm.quicktime.ObjectMediaChunk) VRMediaMovie(cbit.vcell.export.gloworm.quicktime.VRMediaMovie)

Aggregations

MediaTrack (cbit.vcell.export.gloworm.quicktime.MediaTrack)1 ObjectMediaChunk (cbit.vcell.export.gloworm.quicktime.ObjectMediaChunk)1 VRMediaChunk (cbit.vcell.export.gloworm.quicktime.VRMediaChunk)1 VRMediaMovie (cbit.vcell.export.gloworm.quicktime.VRMediaMovie)1 VRWorld (cbit.vcell.export.gloworm.quicktime.VRWorld)1 DataFormatException (java.util.zip.DataFormatException)1