Methods Summary |
---|
protected boolean | audioEnabled()
return audioEnabled;
|
protected void | completeRealize()
state = Realized;
super.completeRealize();
|
protected java.awt.Component | createVisualContainer(java.util.Vector visuals)
Boolean hint = (Boolean) Manager.getHint(Manager.LIGHTWEIGHT_RENDERER);
if (container == null) {
if (hint == null || hint.booleanValue() == false) {
container = new HeavyPanel(visuals);
} else {
container = new LightPanel(visuals);
}
container.setLayout( new FlowLayout() );
container.setBackground(Color.black);
for (int i = 0; i < visuals.size(); i++) {
Component c = (Component)visuals.elementAt(i);
container.add(c);
c.setSize(c.getPreferredSize());
}
}
return container;
|
protected void | doClose()
closed = true;
synchronized (realizedSync) {
realizedSync.notify();
}
stop();
super.doClose();
|
protected void | doDeallocate()
synchronized (realizedSync) {
realizedSync.notify();
}
|
protected boolean | doRealize()
super.doRealize();
MediaLocator ml = null;
try {
players = new Player[locators.size()];
realized = new boolean[locators.size()];
for (int i = 0; i < locators.size(); i++) {
ml = (MediaLocator)locators.elementAt(i);
players[i] = Manager.createPlayer(ml);
players[i].addControllerListener(listener);
realized[i] = false;
players[i].realize();
}
} catch (Exception e) {
Log.error(sessionError + ml);
processError = sessionError + ml;
return false;
}
// dont realize this meta player until our player is realized
try{
synchronized (realizedSync) {
while (!playersRealized && !isInterrupted() && !closed)
realizedSync.wait();
}
} catch (Exception e) {}
// If realize is being interrupted, return failure from realize.
if (closed || isInterrupted()) {
resetInterrupt();
processError = "Realize interrupted";
return false;
}
try {
master = players[0];
for (int i = 1; i < players.length; i++) {
master.addController(players[i]);
}
} catch (IncompatibleTimeBaseException e) {
processError = "AddController failed";
return false;
}
manageController(master);
return true;
|
protected void | doStart()
super.doStart();
|
protected void | doStop()
super.doStop();
|
protected javax.media.TimeBase | getMasterTimeBase()
return master.getTimeBase();
|
public java.awt.Component | getVisualComponent()
Vector visuals = new Vector(1);
for( int i = 0; i < players.length; i++) {
Component comp= players[i].getVisualComponent();
if( comp != null) {
visuals.addElement( comp);
}
}
if( visuals.size() == 0) {
return null;
} else if( visuals.size() == 1) {
return (Component) visuals.elementAt( 0);
} else {
return createVisualContainer( visuals);
}
|
private void | invalidateComp()
controlComp = null;
controls = null;
|
private void | sendMyEvent(javax.media.ControllerEvent e)
super.sendEvent(e);
|
public void | setSource(javax.media.protocol.DataSource source)
super.setSource(source);
if (!(source instanceof PullDataSource))
throw new IncompatibleSourceException();
PullSourceStream pss[] = ((PullDataSource)source).getStreams();
if (pss.length != 1)
throw new IncompatibleSourceException();
source.start();
int len = (int)pss[0].getContentLength();
if (len == SourceStream.LENGTH_UNKNOWN)
throw new IncompatibleSourceException();
byte barray[] = new byte[len];
String content;
try {
len = pss[0].read(barray, 0, len);
content = new String(barray);
} catch (Exception e) {
throw new IncompatibleSourceException();
}
char ch;
int start = 0, idx;
int size = content.length();
String str;
String relPath = null;
ch = content.charAt(start);
while (start < size) {
while (ch == ' " || ch == '\n") {
start++;
if (start >= size)
break;
ch = content.charAt(start);
}
if (start >= size)
break;
idx = start;
do {
idx++;
if (idx >= size)
break;
ch = content.charAt(idx);
} while (ch != '\n");
str = content.substring(start, idx);
if (str.indexOf(':") == -1) {
// Probably didn't specify a protocol or
// absolute path here.
// We'll assume it's relative path and use
// the first part of the media locator to
// generate the name.
if (relPath == null) {
MediaLocator loc = source.getLocator();
if (loc == null)
throw new IncompatibleSourceException();
relPath = loc.toString();
int i = relPath.lastIndexOf('/");
if (i < 0)
i = relPath.lastIndexOf(File.separator);
relPath = relPath.substring(0, i + 1);
}
str = relPath + str;
}
locators.addElement(new MediaLocator(str));
start = idx;
}
if (locators.size() < 1)
throw new IncompatibleSourceException();
|
public void | updateStats()
for (int i = 0; i < players.length; i++) {
if (players[i] != null)
((BasicPlayer)players[i]).updateStats();
}
|
protected boolean | videoEnabled()
return videoEnabled;
|