use of cbit.vcell.export.gloworm.atoms.HandlerReference in project vcell by virtualcell.
the class MediaMethods method makeMediaInformation.
/**
* This method was created in VisualAge.
* @return TrackAtom
* @param track Track
*/
private static final MediaInformation makeMediaInformation(MediaTrack track) throws DataFormatException {
SampleTableDescription stsd = new SampleTableDescription(track.getSampleDescriptionEntries());
TimeToSample stts = new TimeToSample(track.getSampleDurations());
SyncSample stss = new SyncSample(track.getKeyFrames());
SampleToChunk stsc = new SampleToChunk(track.getChunkIDs());
SampleSize stsz = new SampleSize(track.getSampleSizes());
ChunkOffset stco = new ChunkOffset(track.getChunkOffsets());
SampleTable stbl = new SampleTable(stsd, stts, stss, stsc, stsz, stco);
DataReferenceEntry[] entries = new DataReferenceEntry[track.getDataReferences().length];
for (int i = 0; i < track.getDataReferences().length; i++) entries[i] = new DataReferenceEntry(track.getDataReferences()[i], track.getDataReferenceTypes()[i]);
DataReference dref = new DataReference(entries);
DataInformation dinf = new DataInformation(dref);
HandlerReference dhlr = new HandlerReference("dhlr", AtomConstants.COMPONENT_SUBTYPE_FILE_ALIAS);
if (track.getMediaType().equals(AtomConstants.MEDIA_TYPE_VIDEO)) {
VideoMediaInformationHeader vmhd = new VideoMediaInformationHeader();
return new VideoMediaInformation(vmhd, dhlr, dinf, stbl);
} else if (track.getMediaType().equals(AtomConstants.MEDIA_TYPE_OBJECT) || track.getMediaType().equals(AtomConstants.MEDIA_TYPE_QTVR)) {
BaseMediaInfo gmin = new BaseMediaInfo();
BaseMediaHeader gmhd = new BaseMediaHeader(gmin);
return new BaseMediaInformation(gmhd, dhlr, dinf, stbl);
} else {
throw new DataFormatException("Unknown media type");
}
}
use of cbit.vcell.export.gloworm.atoms.HandlerReference 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