本文整理汇总了Java中javax.media.CaptureDeviceInfo类的典型用法代码示例。如果您正苦于以下问题:Java CaptureDeviceInfo类的具体用法?Java CaptureDeviceInfo怎么用?Java CaptureDeviceInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CaptureDeviceInfo类属于javax.media包,在下文中一共展示了CaptureDeviceInfo类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JmfCaptureDeviceList
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public JmfCaptureDeviceList() throws NyARRuntimeException
{
this._devices = (Vector<CaptureDeviceInfo>)(CaptureDeviceManager.getDeviceList(null).clone());
// ビデオソースのデバイスだけ残す
try {
for (int i = 0; i < this._devices.size();) {
CaptureDeviceInfo cdi =this._devices.elementAt(i);
// VideoFormatもってるかな?
if (!isCaptureDevice(cdi)) {
this._devices.remove(i);
continue;
}
i++;
}
} catch (Exception e) {
throw new NyARRuntimeException(e);
}
return;
}
示例2: deviceIdFromOrdinal
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
private String deviceIdFromOrdinal(int index) throws CaptureException
{
final List list = system.getCaptureDeviceInfoList();
if (index < 0 || index >= list.size())
return null;
com.lti.civil.CaptureDeviceInfo info = (com.lti.civil.CaptureDeviceInfo) list
.get(index);
return info.getDeviceID();
}
示例3: listDevices
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
void listDevices() {
Vector deviceInfos = CaptureDeviceManager.getDeviceList(null);
if (deviceInfos.isEmpty()) {
System.out.println("No capture devices found.");
} else {
for (Object o : deviceInfos) {
CaptureDeviceInfo info = (CaptureDeviceInfo) o;
System.out.println(info.getName() + " :");
for (Format format : info.getFormats()) {
System.out.println(String.format("\t%s", format.toString()));
}
}
}
}
示例4: isCaptureDevice
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
/**
* i_cdiがビデオキャプチャデバイスかを調べる。ようなことをする。
*
* @param i_cdi
* @return
*/
private static boolean isCaptureDevice(CaptureDeviceInfo i_cdi)
{
Format[] fms = i_cdi.getFormats();
for (int i = 0; i < fms.length; i++) {
Format f = fms[i];
if (f instanceof VideoFormat) {
return true;
}
}
return false;
}
示例5: printDeviceList
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public static void printDeviceList() {
System.out.println("List of capturing devices: ");
Vector devices = CaptureDeviceManager.getDeviceList(null);
Enumeration list = devices.elements();
while (list.hasMoreElements()) {
CaptureDeviceInfo deviceInfo =(CaptureDeviceInfo) list.nextElement();
String name = deviceInfo.getName();
Format[] fmts = deviceInfo.getFormats();
System.out.println("NAME: " +name);
for (int i = 0; i < fmts.length; i++) {
System.out.println("\t"+fmts[i]);
}
}
}
示例6: setAudioDevice
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public void setAudioDevice(String device) {
for ( CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) {
if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
audioDevice.setSelectedItem(infoCaptureDevice.getName());
}
}
}
示例7: setVideoDevice
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public void setVideoDevice(String device) {
for ( CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices) {
if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
videoDevice.setSelectedItem(infoCaptureDevice.getName());
}
}
}
示例8: logAudioDevices
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
/**
* Logs the audio devices
*/
public void logAudioDevices() {
@SuppressWarnings("unchecked")
final Vector<CaptureDeviceInfo> vectorDevices = CaptureDeviceManager.getDeviceList(null);
for (CaptureDeviceInfo infoCaptureDevice : vectorDevices) {
System.err.println(convertSysString(infoCaptureDevice.getName()));
for (Format format : infoCaptureDevice.getFormats()) {
System.err.println(" " + format);
}
}
}
示例9: getCaptureDeviceInfo
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public CaptureDeviceInfo getCaptureDeviceInfo()
{
return new CaptureDeviceInfo(deviceName, getLocator(),
getFormatControls()[0].getSupportedFormats());
}
示例10: main
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
// for (Format f : new SimpleAWTRenderer().getSupportedInputFormats())
// {
// final Format civilOutputFormat = new RGBFormat(null, -1,
// byte[].class, -1, 24, 1, 2, 3);
// System.out.println(civilOutputFormat.matches(f) + " " + f);
//
// }
PackageUtility.addContentPrefix("net.sf.fmj", false);
PackageUtility.addProtocolPrefix("net.sf.fmj", false);
PlugInUtility
.registerPlugIn("net.sf.fmj.media.renderer.video.SimpleAWTRenderer");
CaptureSystemFactory factory = DefaultCaptureSystemFactorySingleton
.instance();
CaptureSystem system = factory.createCaptureSystem();
system.init();
List list = system.getCaptureDeviceInfoList();
for (int i = 0; i < list.size(); ++i)
{
com.lti.civil.CaptureDeviceInfo civilInfo = (com.lti.civil.CaptureDeviceInfo) list
.get(i);
{
// String name, MediaLocator locator, Format[] formats
CaptureDeviceInfo jmfInfo = new CaptureDeviceInfo(
civilInfo.getDescription(), new MediaLocator("civil:"
+ civilInfo.getDeviceID()),
new Format[] { new RGBFormat() });
CaptureDeviceManager.addDevice(jmfInfo);
}
}
final java.util.Vector vectorDevices = CaptureDeviceManager
.getDeviceList(null);
if (vectorDevices == null)
{
System.out
.println("CaptureDeviceManager.getDeviceList returned null");
return;
}
if (vectorDevices.size() == 0)
{
System.out
.println("CaptureDeviceManager.getDeviceList returned empty list");
return;
}
for (int i = 0; i < vectorDevices.size(); i++)
{
CaptureDeviceInfo infoCaptureDevice = (CaptureDeviceInfo) vectorDevices
.elementAt(i);
System.out.println("CaptureDeviceInfo: ");
System.out.println(infoCaptureDevice.getName());
System.out.println(infoCaptureDevice.getLocator());
System.out.println(infoCaptureDevice.getFormats()[0]);
Player player;
try
{
player = Manager.createRealizedPlayer(infoCaptureDevice
.getLocator());
} catch (Exception e)
{
throw new CaptureException(e);
}
player.start();
}
system.dispose();
}
示例11: getDevice
import javax.media.CaptureDeviceInfo; //导入依赖的package包/类
/**
* i_index番目のキャプチャデバイスを得る。
* @param i_index
* @return
* @throws NyARRuntimeException
*/
public JmfCaptureDevice getDevice(int i_index) throws NyARRuntimeException
{
return new JmfCaptureDevice((CaptureDeviceInfo) this._devices.elementAt(i_index));
}