{
// if( getState() < Prefetched ) {
// code borrowed from AbstractPlayer. TODO: once each track has its own controller, there will be no need for this to be calculated here.
Time duration = null;
//Time d = getSource().getDuration();
//if (duration != null && duration.getNanoseconds() != Duration.DURATION_UNKNOWN.getNanoseconds()
final Track[] tracks = filterGraph.getTracks();
for (int i = 0; i < tracks.length; ++i)
{
try
{
if (!tracks[i].isEnabled())
continue;
Time d = tracks[i].getDuration();
logger.fine("Track " + i + " has duration of " + toString(d));
if (duration == null)
{
duration = d;
continue;
}
if (d == DURATION_UNKNOWN ) {
duration = d;
break;
}
if( duration != DURATION_UNBOUNDED &&
( d == DURATION_UNBOUNDED ||
d.getNanoseconds() >
duration.getNanoseconds() ) )
{
duration = d;
}
}