Search in sources :

Example 1 with VideoMediaInformation

use of cbit.vcell.export.gloworm.atoms.VideoMediaInformation 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");
    }
}
Also used : DataInformation(cbit.vcell.export.gloworm.atoms.DataInformation) VideoMediaInformation(cbit.vcell.export.gloworm.atoms.VideoMediaInformation) SampleTable(cbit.vcell.export.gloworm.atoms.SampleTable) TimeToSample(cbit.vcell.export.gloworm.atoms.TimeToSample) SampleTableDescription(cbit.vcell.export.gloworm.atoms.SampleTableDescription) BaseMediaInfo(cbit.vcell.export.gloworm.atoms.BaseMediaInfo) ChunkOffset(cbit.vcell.export.gloworm.atoms.ChunkOffset) BaseMediaInformation(cbit.vcell.export.gloworm.atoms.BaseMediaInformation) SampleToChunk(cbit.vcell.export.gloworm.atoms.SampleToChunk) SampleSize(cbit.vcell.export.gloworm.atoms.SampleSize) HandlerReference(cbit.vcell.export.gloworm.atoms.HandlerReference) DataFormatException(java.util.zip.DataFormatException) VideoMediaInformationHeader(cbit.vcell.export.gloworm.atoms.VideoMediaInformationHeader) SyncSample(cbit.vcell.export.gloworm.atoms.SyncSample) BaseMediaHeader(cbit.vcell.export.gloworm.atoms.BaseMediaHeader) DataReferenceEntry(cbit.vcell.export.gloworm.atoms.DataReferenceEntry) DataReference(cbit.vcell.export.gloworm.atoms.DataReference)

Aggregations

BaseMediaHeader (cbit.vcell.export.gloworm.atoms.BaseMediaHeader)1 BaseMediaInfo (cbit.vcell.export.gloworm.atoms.BaseMediaInfo)1 BaseMediaInformation (cbit.vcell.export.gloworm.atoms.BaseMediaInformation)1 ChunkOffset (cbit.vcell.export.gloworm.atoms.ChunkOffset)1 DataInformation (cbit.vcell.export.gloworm.atoms.DataInformation)1 DataReference (cbit.vcell.export.gloworm.atoms.DataReference)1 DataReferenceEntry (cbit.vcell.export.gloworm.atoms.DataReferenceEntry)1 HandlerReference (cbit.vcell.export.gloworm.atoms.HandlerReference)1 SampleSize (cbit.vcell.export.gloworm.atoms.SampleSize)1 SampleTable (cbit.vcell.export.gloworm.atoms.SampleTable)1 SampleTableDescription (cbit.vcell.export.gloworm.atoms.SampleTableDescription)1 SampleToChunk (cbit.vcell.export.gloworm.atoms.SampleToChunk)1 SyncSample (cbit.vcell.export.gloworm.atoms.SyncSample)1 TimeToSample (cbit.vcell.export.gloworm.atoms.TimeToSample)1 VideoMediaInformation (cbit.vcell.export.gloworm.atoms.VideoMediaInformation)1 VideoMediaInformationHeader (cbit.vcell.export.gloworm.atoms.VideoMediaInformationHeader)1 DataFormatException (java.util.zip.DataFormatException)1