FileDocCategorySizeDatePackage
Movie.javaAPI Docmp4parser 1.0-RC-172558Wed Dec 19 20:10:37 GMT 2012com.googlecode.mp4parser.authoring

Movie

public class Movie extends Object

Fields Summary
List
tracks
Constructors Summary
Methods Summary
public voidaddTrack(Track nuTrack)

        // do some checking
        // perhaps the movie needs to get longer!
        if (getTrackByTrackId(nuTrack.getTrackMetaData().getTrackId()) != null) {
            // We already have a track with that trackId. Create a new one
            nuTrack.getTrackMetaData().setTrackId(getNextTrackId());
        }
        tracks.add(nuTrack);
    
public static longgcd(long a, long b)

        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    
public longgetNextTrackId()

        long nextTrackId = 0;
        for (Track track : tracks) {
            nextTrackId = nextTrackId < track.getTrackMetaData().getTrackId() ? track.getTrackMetaData().getTrackId() : nextTrackId;
        }
        return ++nextTrackId;
    
public longgetTimescale()

        long timescale = this.getTracks().iterator().next().getTrackMetaData().getTimescale();
        for (Track track : this.getTracks()) {
            timescale = gcd(track.getTrackMetaData().getTimescale(), timescale);
        }
        return timescale;
    
public TrackgetTrackByTrackId(long trackId)

        for (Track track : tracks) {
            if (track.getTrackMetaData().getTrackId() == trackId) {
                return track;
            }
        }
        return null;
    
public java.util.ListgetTracks()


       
        return tracks;
    
public voidsetTracks(java.util.List tracks)

        this.tracks = tracks;
    
public java.lang.StringtoString()

        String s = "Movie{ ";
        for (Track track : tracks) {
            s += "track_" + track.getTrackMetaData().getTrackId() + " (" + track.getHandler() + ") ";
        }

        s += '}";
        return s;