Methods Summary |
---|
boolean | connectMux()Connect the multiplexer.
/**
* The target Mux has already been determined. We'll just
* hook it up.
*/
BasicTrackControl tcs[] = new BasicTrackControl[trackControls.length];
int total = 0;
Multiplexer mux = (Multiplexer)targetMux.plugin;
for (int i = 0; i < trackControls.length; i++) {
if (trackControls[i].isEnabled()) {
tcs[total++] = trackControls[i];
}
}
try {
mux.setContentDescriptor(outputContentDes);
} catch (Exception e) {
Log.comment("Failed to set the output content descriptor on the multiplexer.");
return false;
}
boolean failed = false;
if (mux.setNumTracks(targetMuxFormats.length) != targetMuxFormats.length) {
Log.comment("Failed to set number of tracks on the multiplexer.");
return false;
}
for (int mf = 0; mf < targetMuxFormats.length; mf++) {
if (targetMuxFormats[mf] == null ||
mux.setInputFormat(targetMuxFormats[mf], mf) == null) {
Log.comment("Failed to set input format on the multiplexer.");
failed = true;
break;
}
}
if (failed)
return false;
if (SimpleGraphBuilder.inspector != null && !SimpleGraphBuilder.inspector.verify(mux, targetMuxFormats))
return false;
//Log.comment("Found multiplexer: " + mux);
InputConnector ic;
BasicMuxModule bmm = new BasicMuxModule(mux, targetMuxFormats);
if (DEBUG) bmm.setJMD(jmd);
String name;
// Make the connections.
for (int j = 0; j < targetMuxFormats.length; j++) {
ic = bmm.getInputConnector(BasicMuxModule.ConnectorNamePrefix + j);
if (ic == null) {
// Something is terribly wrong.
Log.comment("BasicMuxModule: connector mismatched.");
return false;
}
ic.setFormat(targetMuxFormats[j]);
tcs[j].lastOC.setProtocol(ic.getProtocol());
tcs[j].lastOC.connectTo(ic, targetMuxFormats[j]);
}
if (!bmm.doRealize()) {
//Log.comment("Failed to open the multiplexer.");
return false;
}
bmm.setModuleListener(this);
bmm.setController(this);
modules.addElement(bmm);
sinks.addElement(bmm);
muxModule = bmm;
return true;
|
protected boolean | doConfigure()Configuring the engine.
if (!doConfigure1())
return false;
// The indices to the connector names, tracks, and track controls
// should all correspond to each other.
String names[] = source.getOutputConnectorNames();
trackControls = new BasicTrackControl[tracks.length];
for (int i = 0; i < tracks.length; i++) {
trackControls[i] = new ProcTControl(this, tracks[i],
source.getOutputConnector(names[i]));
}
if (!doConfigure2())
return false;
// By default a Processor generates RAW output.
outputContentDes = new ContentDescriptor(ContentDescriptor.RAW);
// The parser disables the hint tracks by default. We'll
// re-enable them.
reenableHintTracks();
return true;
|
protected synchronized boolean | doPrefetch()The stub function to perform the steps to prefetch the controller.
if (prefetched)
return true;
if (!doPrefetch1())
return false;
// Fail if the mux module cannot be prefetched.
if (muxModule != null && !muxModule.doPrefetch()) {
Log.error(prefetchError);
Log.error(" Cannot prefetch the multiplexer: " +
muxModule.getMultiplexer() + "\n");
return false;
}
return doPrefetch2();
|
protected synchronized boolean | doRealize()
// Reset the target multiplexers
targetMuxes = null;
if (!super.doRealize1())
return false;
// Connect the tracks to a multiplexer, if there's one.
if (targetMux != null && !connectMux()) {
Log.error(realizeError);
Log.error(" Cannot connect the multiplexer\n");
player.processError = genericProcessorError;
return false;
}
if (!super.doRealize2())
return false;
return true;
|
protected synchronized void | doStart()Start immediately.
Invoked from start(tbt) when the scheduled start time is reached.
Use the public start(tbt) method for the public interface.
Override this to implement subclass behavior.
if (started) return;
doStart1();
if (muxModule != null)
muxModule.doStart();
doStart2();
|
protected synchronized void | doStop()Invoked from stop().
Override this to implement subclass behavior.
if (!started) return;
doStop1();
if (muxModule != null)
muxModule.doStop();
doStop2();
|
protected com.sun.media.BasicSinkModule | findMasterSink()Search and update the master time base.
// Obtain a master time base from one of its SinkModules.
if (muxModule != null && muxModule.getClock() != null) {
return muxModule;
}
return super.findMasterSink();
|
protected long | getBitRate()Report the output bit rate if a mux is used.
if (muxModule != null)
return muxModule.getBitsWritten();
else
return source.getBitsRead();
|
public javax.media.protocol.ContentDescriptor | getContentDescriptor()Return the output content-type.
if (getState() < Configured)
throwError(new NotConfiguredError("getContentDescriptor " +
NOT_CONFIGURED_ERROR));
return outputContentDes;
|
public javax.media.protocol.DataSource | getDataOutput()Return the output DataSource of the Processor.
if (getState() < Controller.Realized)
throwError(new NotRealizedError("getDataOutput " +
NOT_REALIZED_ERROR));
if (muxModule != null)
return muxModule.getDataOutput();
else
return null;
|
com.sun.media.BasicMuxModule | getMuxModule()
return muxModule;
|
protected javax.media.PlugIn | getPlugIn(com.sun.media.BasicModule m)Get the plugin from a module. For debugging.
if (m instanceof BasicMuxModule)
return ((BasicMuxModule)m).getMultiplexer();
return super.getPlugIn(m);
|
public javax.media.protocol.ContentDescriptor[] | getSupportedContentDescriptors()Return all the content-types which this Processor's output supports.
if (getState() < Configured)
throwError(new NotConfiguredError("getSupportedContentDescriptors " +
NOT_CONFIGURED_ERROR));
Vector names = PlugInManager.getPlugInList(null,
null, PlugInManager.MULTIPLEXER);
Vector fmts = new Vector();
Format fs[];
int i, j, k;
boolean duplicate;
for (i = 0; i < names.size(); i++) {
fs = PlugInManager.getSupportedOutputFormats(
(String)names.elementAt(i),
PlugInManager.MULTIPLEXER);
if (fs == null)
continue;
for (j = 0; j < fs.length; j++) {
if (!(fs[j] instanceof ContentDescriptor))
continue;
duplicate = false;
for (k = 0; k < fmts.size(); k++) {
if (fmts.elementAt(k).equals(fs[j])) {
duplicate = true;
break;
}
}
if (!duplicate)
fmts.addElement(fs[j]);
}
}
ContentDescriptor cds[] = new ContentDescriptor[fmts.size()];
for (i = 0; i < fmts.size(); i++)
cds[i] = (ContentDescriptor)fmts.elementAt(i);
return cds;
|
public javax.media.control.TrackControl[] | getTrackControls()Get the track controls.
if (getState() < Configured)
throwError(new NotConfiguredError("getTrackControls " + NOT_CONFIGURED_ERROR));
return trackControls;
|
boolean | isRTPFormat(javax.media.Format fmt)Return true if the given format is RTP related.
return fmt != null && fmt.getEncoding() != null &&
fmt.getEncoding().endsWith("rtp") ||
fmt.getEncoding().endsWith("RTP");
|
void | reenableHintTracks()
for (int i = 0; i < trackControls.length; i++) {
if (isRTPFormat(trackControls[i].getOriginalFormat())) {
trackControls[i].setEnabled(true);
break;
}
}
|
protected void | resetBitRate()
if (muxModule != null)
muxModule.resetBitsWritten();
else
source.resetBitsRead();
|
public javax.media.protocol.ContentDescriptor | setContentDescriptor(javax.media.protocol.ContentDescriptor ocd)Set the output content-type.
if (getState() < Configured)
throwError(new NotConfiguredError("setContentDescriptor " +
NOT_CONFIGURED_ERROR));
if (getState() > Configured)
return null;
if (ocd != null) {
Vector cnames = PlugInManager.getPlugInList(null,
ocd, PlugInManager.MULTIPLEXER);
if (cnames == null || cnames.size() == 0)
return null;
}
outputContentDes = ocd;
return outputContentDes;
|