当前位置: 首页>>代码示例>>Java>>正文


Java Processor.realize方法代码示例

本文整理汇总了Java中javax.media.Processor.realize方法的典型用法代码示例。如果您正苦于以下问题:Java Processor.realize方法的具体用法?Java Processor.realize怎么用?Java Processor.realize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.media.Processor的用法示例。


在下文中一共展示了Processor.realize方法的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;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:29,代码来源:SuperGlueDataSource.java

示例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;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:24,代码来源:MiniME.java

示例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;
   }
 
开发者ID:champtar,项目名称:fmj-sourceforge-mirror,代码行数:30,代码来源:AVTransmitter.java

示例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;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:29,代码来源:AudioChannel.java

示例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);
   }
 
开发者ID:openwarrior,项目名称:java-screen-recorder,代码行数:36,代码来源:RecordingConverter.java

示例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;
}
 
开发者ID:mloobo,项目名称:Dolphin-Streaming-Server,代码行数:30,代码来源:UnicastRtp.java

示例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;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:30,代码来源:VideoChannel.java

示例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();
    }
}
 
开发者ID:sebkur,项目名称:montemedia,代码行数:54,代码来源:Main.java


注:本文中的javax.media.Processor.realize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。