Methods Summary |
---|
public void | addTrack(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 long | gcd(long a, long b)
if (b == 0) {
return a;
}
return gcd(b, a % b);
|
public long | getNextTrackId()
long nextTrackId = 0;
for (Track track : tracks) {
nextTrackId = nextTrackId < track.getTrackMetaData().getTrackId() ? track.getTrackMetaData().getTrackId() : nextTrackId;
}
return ++nextTrackId;
|
public long | getTimescale()
long timescale = this.getTracks().iterator().next().getTrackMetaData().getTimescale();
for (Track track : this.getTracks()) {
timescale = gcd(track.getTrackMetaData().getTimescale(), timescale);
}
return timescale;
|
public Track | getTrackByTrackId(long trackId)
for (Track track : tracks) {
if (track.getTrackMetaData().getTrackId() == trackId) {
return track;
}
}
return null;
|
public java.util.List | getTracks()
return tracks;
|
public void | setTracks(java.util.List tracks)
this.tracks = tracks;
|
public java.lang.String | toString()
String s = "Movie{ ";
for (Track track : tracks) {
s += "track_" + track.getTrackMetaData().getTrackId() + " (" + track.getHandler() + ") ";
}
s += '}";
return s;
|