Search in sources :

Example 1 with EditList

use of cbit.vcell.export.gloworm.atoms.EditList 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 !");
}
Also used : MediaHeader(cbit.vcell.export.gloworm.atoms.MediaHeader) BaseMediaHeader(cbit.vcell.export.gloworm.atoms.BaseMediaHeader) MediaInformation(cbit.vcell.export.gloworm.atoms.MediaInformation) BaseMediaInformation(cbit.vcell.export.gloworm.atoms.BaseMediaInformation) VideoMediaInformation(cbit.vcell.export.gloworm.atoms.VideoMediaInformation) MediaAtom(cbit.vcell.export.gloworm.atoms.MediaAtom) TrackHeader(cbit.vcell.export.gloworm.atoms.TrackHeader) HandlerReference(cbit.vcell.export.gloworm.atoms.HandlerReference) DataFormatException(java.util.zip.DataFormatException) EditAtom(cbit.vcell.export.gloworm.atoms.EditAtom) TrackAtom(cbit.vcell.export.gloworm.atoms.TrackAtom) EditList(cbit.vcell.export.gloworm.atoms.EditList) TrackReference(cbit.vcell.export.gloworm.atoms.TrackReference)

Aggregations

BaseMediaHeader (cbit.vcell.export.gloworm.atoms.BaseMediaHeader)1 BaseMediaInformation (cbit.vcell.export.gloworm.atoms.BaseMediaInformation)1 EditAtom (cbit.vcell.export.gloworm.atoms.EditAtom)1 EditList (cbit.vcell.export.gloworm.atoms.EditList)1 HandlerReference (cbit.vcell.export.gloworm.atoms.HandlerReference)1 MediaAtom (cbit.vcell.export.gloworm.atoms.MediaAtom)1 MediaHeader (cbit.vcell.export.gloworm.atoms.MediaHeader)1 MediaInformation (cbit.vcell.export.gloworm.atoms.MediaInformation)1 TrackAtom (cbit.vcell.export.gloworm.atoms.TrackAtom)1 TrackHeader (cbit.vcell.export.gloworm.atoms.TrackHeader)1 TrackReference (cbit.vcell.export.gloworm.atoms.TrackReference)1 VideoMediaInformation (cbit.vcell.export.gloworm.atoms.VideoMediaInformation)1 DataFormatException (java.util.zip.DataFormatException)1