Search in sources :

Example 1 with MovieAtom

use of cbit.vcell.export.gloworm.atoms.MovieAtom in project vcell by virtualcell.

the class MediaMethods method writeMovie.

/**
 * This method was created in VisualAge.
 * @param out OutputStream
 */
public static final void writeMovie(File file, MediaMovie movie, boolean isDataFile) throws DataFormatException, IOException {
    // create and write out data atom
    MediaChunk[] chunksToBeWritten = movie.getSelfreferencedChunks();
    MediaData mdat = new MediaData(chunksToBeWritten);
    mdat.writeData(file, isDataFile);
    // create and write out movie atom
    TrackAtom[] traks = new TrackAtom[movie.getTracks().length];
    for (int i = 0; i < movie.getTracks().length; i++) traks[i] = MediaMethods.makeTrackAtom(movie, i);
    MovieHeader mvhd = new MovieHeader(movie.getTimeScale(), movie.getDuration(), movie.getNumberOfTracks());
    UserData userData = new UserData(movie.getUserDataEntries());
    MovieAtom moov = new MovieAtom(mvhd, traks, userData);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    DataOutputStream dout = new DataOutputStream(bout);
    moov.writeData(dout);
    bout.close();
    // byte[] moovBytes = bout.toByteArray();
    RandomAccessFile fw = new RandomAccessFile(file, "rw");
    fw.seek(file.length());
    fw.write(bout.toByteArray());
    fw.close();
}
Also used : MediaData(cbit.vcell.export.gloworm.atoms.MediaData) MovieAtom(cbit.vcell.export.gloworm.atoms.MovieAtom) RandomAccessFile(java.io.RandomAccessFile) TrackAtom(cbit.vcell.export.gloworm.atoms.TrackAtom) UserData(cbit.vcell.export.gloworm.atoms.UserData) DataOutputStream(java.io.DataOutputStream) MovieHeader(cbit.vcell.export.gloworm.atoms.MovieHeader) ByteArrayOutputStream(java.io.ByteArrayOutputStream)

Example 2 with MovieAtom

use of cbit.vcell.export.gloworm.atoms.MovieAtom in project vcell by virtualcell.

the class MediaMethods method writeMovie.

/**
 * This method was created in VisualAge.
 * @param out OutputStream
 */
public static final void writeMovie(DataOutputStream dataOutputStream, MediaMovie movie) throws DataFormatException {
    // create and write out data atom
    MediaChunk[] chunksToBeWritten = movie.getSelfreferencedChunks();
    MediaData mdat = new MediaData(chunksToBeWritten);
    mdat.writeData(dataOutputStream);
    // create and write out movie atom
    TrackAtom[] traks = new TrackAtom[movie.getTracks().length];
    for (int i = 0; i < movie.getTracks().length; i++) traks[i] = MediaMethods.makeTrackAtom(movie, i);
    MovieHeader mvhd = new MovieHeader(movie.getTimeScale(), movie.getDuration(), movie.getNumberOfTracks());
    UserData userData = new UserData(movie.getUserDataEntries());
    MovieAtom moov = new MovieAtom(mvhd, traks, userData);
    moov.writeData(dataOutputStream);
}
Also used : MediaData(cbit.vcell.export.gloworm.atoms.MediaData) MovieAtom(cbit.vcell.export.gloworm.atoms.MovieAtom) TrackAtom(cbit.vcell.export.gloworm.atoms.TrackAtom) UserData(cbit.vcell.export.gloworm.atoms.UserData) MovieHeader(cbit.vcell.export.gloworm.atoms.MovieHeader)

Aggregations

MediaData (cbit.vcell.export.gloworm.atoms.MediaData)2 MovieAtom (cbit.vcell.export.gloworm.atoms.MovieAtom)2 MovieHeader (cbit.vcell.export.gloworm.atoms.MovieHeader)2 TrackAtom (cbit.vcell.export.gloworm.atoms.TrackAtom)2 UserData (cbit.vcell.export.gloworm.atoms.UserData)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutputStream (java.io.DataOutputStream)1 RandomAccessFile (java.io.RandomAccessFile)1