本文整理汇总了Java中javax.media.Processor.configure方法的典型用法代码示例。如果您正苦于以下问题:Java Processor.configure方法的具体用法?Java Processor.configure怎么用?Java Processor.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.Processor
的用法示例。
在下文中一共展示了Processor.configure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
}
示例6: 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;
}
示例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: test
import javax.media.Processor; //导入方法依赖的package包/类
private static void test(File file, AviVideoFormat format) throws IOException, NoProcessorException, NoDataSinkException {
System.out.println("* Writing " + file);
DataSource source = new ImageDataSource(format);
Processor p = Manager.createProcessor(source);
Handler h = new Handler();
p.addControllerListener(h);
p.configure();
if (!h.waitForState(p, Processor.Configured)) {
throw new IOException("Could not configure processor.");
}
p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.MSVIDEO));
TrackControl trackControls[] = p.getTrackControls();
javax.media.Format formats[] = trackControls[0].getSupportedFormats();
if (formats == null || formats.length <= 0) {
throw new UnsupportedOperationException("No output formats available.");
}
String encoding = format.getEncoding();
javax.media.Format selectedFormat = null;
for (javax.media.Format f : formats) {
if (f.getEncoding().equals(encoding)) {
selectedFormat = f;
break;
}
}
if (selectedFormat == null) {
throw new UnsupportedOperationException("No output format selected.");
}
trackControls[0].setFormat(selectedFormat);
p.realize();
if (!h.waitForState(p, Processor.Realized)) {
throw new IOException("Could not realize processor.");
}
MediaLocator ml = new MediaLocator(file.toURI().toURL());
DataSink sink = Manager.createDataSink(p.getDataOutput(), ml);
sink.addDataSinkListener(h);
sink.open();
try {
sink.start();
p.start();
if (!h.waitForEndOfMedia()) {
throw new IOException("Processor reported an error.");
}
p.stop();
sink.stop();
/*
if (!h.waitForFileDone()) {
throw new IOException("DataSink reported an error.");
}*/
} finally {
p.close();
sink.close();
}
}