FileDocCategorySizeDatePackage
MediaTimeBase.javaAPI DocJMF 2.1.1e1592Mon May 12 12:20:50 BST 2003com.sun.media

MediaTimeBase

public abstract class MediaTimeBase extends Object implements TimeBase
This is the abstract base class to create a time base out of the media time of a component. e.g., this can be used to generate a time base from an audio device with reports time ticks as samples are played. A TimeBase ticks even when the media has stopped. This class takes care of that by internally maintaining a system time base that takes over when the media has ended. A TimeBase needs to be monotonically increasing. If the media time is set or wrapped around, this class will takes care of that.

Fields Summary
long
origin
long
offset
long
time
TimeBase
systemTimeBase
Constructors Summary
public MediaTimeBase()


      
        mediaStopped();
    
Methods Summary
public abstract longgetMediaTime()

public synchronized longgetNanoseconds()

        long t;
        if (systemTimeBase != null)
    	    time = origin + systemTimeBase.getNanoseconds() - offset;
        else
    	    time = origin + getMediaTime() - offset;
        return time;
    
public javax.media.TimegetTime()

        return new Time(getNanoseconds());
    
public synchronized voidmediaStarted()

	systemTimeBase = null;
	offset = getMediaTime();
        origin = time;
    
public synchronized voidmediaStopped()

	systemTimeBase = new SystemTimeBase();
	offset = systemTimeBase.getNanoseconds();
        origin = time;