Methods Summary |
---|
public boolean | buildTrack(int trackID, int numTracks)Top level routine to build a single track.
return false;
|
protected javax.media.control.FrameRateControl | frameRateControl()
return null;
|
public java.lang.Object | getControl(java.lang.String type)
Class cls;
try {
// cls = Class.forName(type);
cls = BasicPlugIn.getClassForName(type);
} catch (ClassNotFoundException e) {
return null;
}
Object cs[] = getControls();
for (int i = 0; i < cs.length; i++) {
if (cls.isInstance(cs[i]))
return cs[i];
}
return null;
|
public java.awt.Component | getControlComponent()
return null;
|
public java.lang.Object[] | getControls()
if (engine.getState() < Controller.Realized)
throw (new NotRealizedError(realizeErr));
InputConnector ic;
OutputConnector oc = firstOC;
Module m;
PlugIn p = null;
Control controls[];
Vector cv = new Vector();
Control c;
Object cs[];
int i, size;
while (oc != null && (ic = oc.getInputConnector()) != null) {
m = ic.getModule();
cs = m.getControls();
if (cs != null) {
for (i = 0; i < cs.length; i++) {
cv.addElement(cs[i]);
}
}
oc = m.getOutputConnector(null);
}
size = cv.size();
controls = new Control[size];
for (i = 0; i < size; i++)
controls[i] = (Control)cv.elementAt(i);
return controls;
|
public javax.media.Format | getFormat()
return track.getFormat();
|
public javax.media.Format | getOriginalFormat()
return track.getFormat();
|
public javax.media.Format[] | getSupportedFormats()
return new Format[] {track.getFormat()};
|
public boolean | isCustomized()
return false;
|
public boolean | isEnabled()
return track.isEnabled();
|
public boolean | isTimeBase()Returns true if this track holds the master time base.
return false;
|
public void | prError()
Log.error(" Unable to handle format: " + getOriginalFormat());
Log.write("\n");
|
public boolean | prefetchTrack()Prefetch the modules for this track.
BasicModule bm;
for (int j = 0; j < modules.size(); j++) {
bm = (BasicModule)modules.elementAt(j);
if (!bm.doPrefetch()) {
setEnabled(false);
prefetchFailed = true;
if (bm instanceof BasicRendererModule)
rendererFailed = true;
return false;
}
}
// If it failed to prefetch before but now it's alright again,
// we'll re-enable the track.
if (prefetchFailed) {
setEnabled(true);
prefetchFailed = false;
rendererFailed = false;
}
return true;
|
protected com.sun.media.controls.ProgressControl | progressControl()
return null;
|
public void | setCodecChain(javax.media.Codec[] codec)
if (engine.getState() > engine.Configured)
throw new NotConfiguredError(connectErr);
if (codec.length < 1)
throw new UnsupportedPlugInException("No codec specified in the array.");
|
public void | setEnabled(boolean enabled)
track.setEnabled(enabled);
|
public javax.media.Format | setFormat(javax.media.Format format)
if (format != null && format.matches(getFormat()))
return getFormat();
return null;
|
public void | setRenderer(javax.media.Renderer renderer)
if (engine.getState() > engine.Configured)
throw new NotConfiguredError(connectErr);
|
public void | startTrack()Start the modules for this track.
for (int j = 0; j < modules.size(); j++) {
((BasicModule)modules.elementAt(j)).doStart();
}
|
public void | stopTrack()Start the modules for this track.
for (int j = 0; j < modules.size(); j++) {
((BasicModule)modules.elementAt(j)).doStop();
}
|
public void | updateFormat()Update the format per track on the progress control.
if (!track.isEnabled())
return;
ProgressControl pc;
if ((pc = progressControl()) == null)
return;
StringControl sc;
if (track.getFormat() instanceof AudioFormat) {
String channel = "";
AudioFormat afmt = (AudioFormat)track.getFormat();
sc = pc.getAudioCodec();
sc.setValue(afmt.getEncoding());
sc = pc.getAudioProperties();
if (afmt.getChannels() == 1)
channel = JMFI18N.getResource("mediaengine.mono");
else
channel = JMFI18N.getResource("mediaengine.stereo");
sc.setValue(afmt.getSampleRate()/1000.0 +
JMFI18N.getResource("mediaengine.khz") + ", " +
afmt.getSampleSizeInBits() +
JMFI18N.getResource("mediaengine.-bit") + ", " +
channel);
}
if (track.getFormat() instanceof VideoFormat) {
VideoFormat vfmt = (VideoFormat)track.getFormat();
sc = pc.getVideoCodec();
sc.setValue(vfmt.getEncoding());
sc = pc.getVideoProperties();
if (vfmt.getSize() != null)
sc.setValue(vfmt.getSize().width + " X " + vfmt.getSize().height);
}
|
public void | updateRates(long now)Update the frame rate per track on the progress control. // so now - lastStatsTime will not be 0.
FrameRateControl prc;
if ((prc = frameRateControl()) == null)
return;
if (!track.isEnabled() ||
!(track.getFormat() instanceof VideoFormat) ||
(rendererModule == null && muxModule == null))
return;
float rate, avg;
if (now == lastStatsTime)
rate = lastFrameRate;
else {
int framesPlayed;
if (rendererModule != null)
framesPlayed = rendererModule.getFramesPlayed();
else
framesPlayed = muxModule.getFramesPlayed();
rate = (float)((float)framesPlayed /
(now - lastStatsTime) * 1000.0f);
}
avg = (float)((int)(((lastFrameRate + rate)/2) * 10))/10.f;
prc.setFrameRate(avg);
lastFrameRate = rate;
lastStatsTime = now;
if (rendererModule != null)
rendererModule.resetFramesPlayed();
else
muxModule.resetFramesPlayed();
|