use of cbit.vcell.export.gloworm.atoms.SampleToChunk 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");
}
}
Aggregations