本文整理汇总了Java中javax.media.Processor类的典型用法代码示例。如果您正苦于以下问题:Java Processor类的具体用法?Java Processor怎么用?Java Processor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Processor类属于javax.media包,在下文中一共展示了Processor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import javax.media.Processor; //导入依赖的package包/类
public boolean configure(int timeOutMillis) {
long startTime = System.currentTimeMillis();
synchronized (this) {
if (player instanceof Processor)
((Processor)player).configure();
else
return false;
while (!configured && !failed) {
try {
wait(timeOutMillis);
} catch (InterruptedException ie) {
}
if (System.currentTimeMillis() - startTime > timeOutMillis)
break;
}
}
return configured;
}
示例2: createDataSink
import javax.media.Processor; //导入依赖的package包/类
/**
* Create the DataSink.
*/
DataSink createDataSink(Processor p, MediaLocator outML) {
DataSource ds;
if ((ds = p.getDataOutput()) == null) {
System.err.println("Something is really wrong: the processor does not have an output DataSource");
return null;
}
DataSink dsink;
try {
System.err.println("- create DataSink for: " + outML);
dsink = Manager.createDataSink(ds, outML);
dsink.open();
} catch (Exception e) {
System.err.println("Cannot create the DataSink: " + e);
return null;
}
return dsink;
}
示例3: waitForState
import javax.media.Processor; //导入依赖的package包/类
/****************************************************************
* Boring methods of SuperGlueDataSource
****************************************************************/
private synchronized boolean waitForState(Processor p, int state) {
StateListener sl = new StateListener();
p.addControllerListener(sl);
failed = false;
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
}
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
}
}
}
p.removeControllerListener(sl);
return !failed;
}
示例4: waitForState
import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
StateListener sl = new StateListener();
p.addControllerListener(sl);
failed = false;
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
}
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
}
}
}
p.removeControllerListener(sl);
return !failed;
}
示例5: controllerUpdate
import javax.media.Processor; //导入依赖的package包/类
/**
* Controller Listener.
*/
public void controllerUpdate(ControllerEvent evt) {
if (evt instanceof ConfigureCompleteEvent
|| evt instanceof RealizeCompleteEvent
|| evt instanceof PrefetchCompleteEvent) {
synchronized (waitSync) {
stateTransitionOK = true;
waitSync.notifyAll();
}
} else if (evt instanceof ResourceUnavailableEvent) {
synchronized (waitSync) {
stateTransitionOK = false;
waitSync.notifyAll();
}
} else if (evt instanceof EndOfMediaEvent) {
processor.setMediaTime(Processor.RESET);
processor.start();
//processor.close();
//System.exit(0);
}
}
示例6: waitForState
import javax.media.Processor; //导入依赖的package包/类
/**
* Block until the processor has transitioned to the given state.
* Return false if the transition failed.
*/
boolean waitForState(Processor p, int state) {
synchronized (waitSync) {
try {
while (p.getState() < state && stateTransitionOK)
waitSync.wait();
} catch (Exception e) {}
}
return stateTransitionOK;
}
示例7: waitForState
import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
}
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
}
}
}
if (failed)
return false;
else
return true;
}
示例8: waitForState
import javax.media.Processor; //导入依赖的package包/类
/**
* Blocks until the processor has transitioned to the given state. Return false
* if the transition failed.
*/
private boolean waitForState(Processor p, int state) throws InterruptedException
{
synchronized (waitSync)
{
while (p.getState() < state && stateTransitionOK)
{
waitSync.wait();
}
}
return stateTransitionOK;
}
示例9: waitForState
import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
}
else if (state == Processor.Realized) {
p.realize();
}
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
}
catch (InterruptedException ie) {
return false;
}
}
}
return !failed;
}
示例10: process
import javax.media.Processor; //导入依赖的package包/类
public void process(String recordingFile, String movieFile) throws Exception {
MediaLocator mediaLocator = new MediaLocator(new File(movieFile).toURI()
.toURL());
PlayerDataSource playerDataSource = new PlayerDataSource(recordingFile);
Processor processor = Manager.createProcessor(playerDataSource);
processor.addControllerListener(this);
processor.configure();
if (!waitForState(processor, Processor.Configured)) {
System.err.println("Failed to configure the processor.");
return;
}
processor.setContentDescriptor(new ContentDescriptor(
FileTypeDescriptor.QUICKTIME));
TrackControl trackControl[] = processor.getTrackControls();
Format format[] = trackControl[0].getSupportedFormats();
trackControl[0].setFormat(format[0]);
processor.realize();
if (!waitForState(processor, Processor.Realized)) {
System.err.println("Failed to realize the processor.");
return;
}
DataSource dataSource = processor.getDataOutput();
DataSink dataSink = Manager.createDataSink(dataSource, mediaLocator);
dataSink.open();
processor.start();
dataSink.start();
waitForFileDone();
dataSink.close();
processor.removeControllerListener(this);
}
示例11: waitForState
import javax.media.Processor; //导入依赖的package包/类
boolean waitForState(Processor p, int state) {
synchronized (waitSync) {
try {
while (p.getState() < state && stateTransitionOK)
waitSync.wait();
} catch (Exception e) {
}
}
return stateTransitionOK;
}
示例12: waitForState
import javax.media.Processor; //导入依赖的package包/类
protected synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
}
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
}
}
}
if (failed)
return false;
else
return true;
}
示例13: waitForState
import javax.media.Processor; //导入依赖的package包/类
public boolean waitForState(Processor p, int state) {
synchronized (waitSync) {
try {
while (p.getState() < state) {
waitSync.wait();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return p.getState() == state;
}
示例14: waitForState
import javax.media.Processor; //导入依赖的package包/类
private synchronized boolean waitForState(Processor p, int state) {
p.addControllerListener(new StateListener());
failed = false;
// Call the required method on the processor
if (state == Processor.Configured) {
p.configure();
} else if (state == Processor.Realized) {
p.realize();
}
// Wait until we get an event that confirms the
// success of the method, or a failure event.
// See StateListener inner class
while (p.getState() < state && !failed) {
synchronized (getStateLock()) {
try {
getStateLock().wait();
} catch (InterruptedException ie) {
return false;
}
}
}
if (failed)
return false;
else
return true;
}
示例15: actionPerformed
import javax.media.Processor; //导入依赖的package包/类
public void actionPerformed(ActionEvent ae) {
String mediaFile1 = vcPanel1.getMediaFile();
String mediaFile2 = vcPanel2.getMediaFile();
Time beginTime1 = vcPanel1.getBeginTime();
Time beginTime2 = vcPanel2.getBeginTime();
Time endTime1 = vcPanel1.getEndTime();
Time endTime2 = vcPanel2.getEndTime();
String sDuration = (String) cbDuration.getSelectedItem();
long duration = (long) Integer.parseInt(sDuration) * 1000000000L;
vcPanel3.setURL(null);
if (mediaFile1 == null || mediaFile2 == null ||
beginTime1 == null || beginTime2 == null ||
endTime1 == null || endTime2 == null)
return;
vcPanel1.stop();
vcPanel2.stop();
SuperGlueDataSource sgds = new SuperGlueDataSource(
new String [] { mediaFile1, mediaFile2 },
new Time [] { beginTime1, beginTime2 },
new Time [] { endTime1, endTime2 },
new Time [] { new Time(duration), new Time(duration) },
new String[] { (String) cbEffect.getSelectedItem() },
new String[0],
new Dimension(160, 120));
buttonGo.setEnabled(false);
try {
sgds.connect();
sgds.setProgressListener(this);
Processor p = Manager.createProcessor(sgds);
boolean success = waitForState(p, Processor.Configured);
if (!success) {
System.err.println("Error configuring output processor");
buttonGo.setEnabled(true);
return;
}
p.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.QUICKTIME));
success = waitForState(p, Processor.Realized);
if (!success) {
System.err.println("Could not realize output processor");
buttonGo.setEnabled(true);
}
DataSource ds = p.getDataOutput();
doSave(p, ds);
} catch (Exception ex) {
buttonGo.setEnabled(true);
System.err.println("Exception creating processor: " + ex);
}
}