use of cbit.vcell.export.gloworm.atoms.MediaHeader in project vcell by virtualcell.
the class MediaMethods method makeTrackAtom.
/**
* This method was created in VisualAge.
* @return TrackAtom
* @param movie Movie
* @param track Track
*/
private static final TrackAtom makeTrackAtom(MediaMovie movie, int trackIndex) throws DataFormatException {
if ((0 <= trackIndex) && (trackIndex < movie.getTracks().length)) {
MediaTrack track = movie.getTracks()[trackIndex];
MediaInformation minf = MediaMethods.makeMediaInformation(track);
int componentSubtype = 0;
if (track.getMediaType().equals(AtomConstants.MEDIA_TYPE_VIDEO))
componentSubtype = AtomConstants.COMPONENT_SUBTYPE_VIDEO;
if (track.getMediaType().equals(AtomConstants.MEDIA_TYPE_OBJECT))
componentSubtype = AtomConstants.COMPONENT_SUBTYPE_OBJECT;
if (track.getMediaType().equals(AtomConstants.MEDIA_TYPE_QTVR))
componentSubtype = AtomConstants.COMPONENT_SUBTYPE_QTVR;
HandlerReference mhlr = new HandlerReference("mhlr", componentSubtype);
MediaHeader mdhd = new MediaHeader(movie.getTimeScale(), track.getDuration());
MediaAtom mdia = new MediaAtom(mdhd, mhlr, minf);
TrackHeader tkhd = new TrackHeader(trackIndex + 1, track.getDuration(), track.getWidth(), track.getHeight());
Edit[] edits;
if (track.getEdits() == null)
edits = new Edit[] { new Edit(track.getDuration()) };
else
edits = track.getEdits();
EditList elst = new EditList(edits);
EditAtom edts = new EditAtom(elst);
TrackAtom trak = null;
if (movie instanceof VRMediaMovie) {
TrackReference trakRef = ((VRMediaMovie) movie).getTrackReference(trackIndex);
trak = new TrackAtom(tkhd, null, null, edts, trakRef, null, null, mdia, null);
} else {
trak = new TrackAtom(tkhd, edts, mdia);
}
return trak;
} else
throw new DataFormatException("Track index out of bounds !");
}
Aggregations