locator = device.getLocator(); format = createFormat(viewSize); converter = new BufferToImage(format);
Format format = new RGBFormat(); MediaLocator cameraLocator = null; // get device list Vector deviceList = CaptureDeviceManager.getDeviceList(format); // if devices available if(deviceList != null && deviceList.size() > 0) { // pick first CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.get(0); cameraLocator = device.getLocator(); }
/** * Gets the <tt>MediaLocator</tt> which specifies the playback device to be * used by this <tt>Renderer</tt>. * * @return the <tt>MediaLocator</tt> which specifies the playback device to * be used by this <tt>Renderer</tt> */ public MediaLocator getLocator() { MediaLocator locator = this.locator; if ((locator == null) && (audioSystem != null)) { CaptureDeviceInfo device = audioSystem.getSelectedDevice(dataFlow); if (device != null) locator = device.getLocator(); } return locator; }
/** * Returns a human-readable representation of a specific * <tt>CaptureDevice</tt> in the form of a <tt>String</tt> value. * * @param captureDevice the <tt>CaptureDevice</tt> to get a human-readable * representation of * @return a <tt>String</tt> value which gives a human-readable * representation of the specified <tt>captureDevice</tt> */ private static String toString(CaptureDevice captureDevice) { StringBuffer str = new StringBuffer(); str.append("CaptureDevice with hashCode "); str.append(captureDevice.hashCode()); str.append(" and captureDeviceInfo "); CaptureDeviceInfo captureDeviceInfo = captureDevice.getCaptureDeviceInfo(); MediaLocator mediaLocator = null; if (captureDeviceInfo != null) { mediaLocator = captureDeviceInfo.getLocator(); } str.append((mediaLocator == null) ? captureDeviceInfo : mediaLocator); return str.toString(); }
CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator("vfw://0"), null); MediaLocator camDeviceMediaLocator = webcamInfooo.getLocator(); DataSource source = Manager.createDataSource(camDeviceMediaLocator); Processor mediaProcessor = Manager.createRealizedProcessor(new ProcessorModel(source, FORMATS, CONTENT_DESCRIPTOR)); //MediaLocator outputMediaLocator = new MediaLocator("rtp://" + addr.getHostAddress() + ":" + PORT + "/video"); MediaLocator outputMediaLocator = new MediaLocator("rtp://192.168.1.6:20000/video"); DataSink dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(), outputMediaLocator);
MediaLocator locator = deviceListIter.next().getLocator();
/** * Gets the protocol of the <tt>MediaLocator</tt> of the * <tt>CaptureDeviceInfo</tt> represented by this instance. * * @return the protocol of the <tt>MediaLocator</tt> of the * <tt>CaptureDeviceInfo</tt> represented by this instance */ public String getCaptureDeviceInfoLocatorProtocol() { CaptureDeviceInfo cdi = getCaptureDeviceInfo(); if (cdi != null) { MediaLocator locator = cdi.getLocator(); if (locator != null) return locator.getProtocol(); } return null; }
return null; MediaLocator locator = cdi.getLocator();
Player player = Manager.createRealizedPlayer(deviceInfo.getLocator()); player.start();
captureDeviceInfo.getLocator(), captureDeviceInfo.getFormats(), uid,
/** * Checks whether the playback and notification configuration share the same * device. * * @return are audio out and notifications using the same device. */ public boolean audioOutAndNotificationsShareSameDevice() { AudioSystem audioSystem = getDeviceConfiguration().getAudioSystem(); CaptureDeviceInfo notify = audioSystem.getSelectedDevice(AudioSystem.DataFlow.NOTIFY); CaptureDeviceInfo playback = audioSystem.getSelectedDevice(AudioSystem.DataFlow.PLAYBACK); if (notify == null) return (playback == null); else { if (playback == null) return false; else return notify.getLocator().equals(playback.getLocator()); } }
|| device.getLocator().getProtocol().equals( audioSystem.getLocatorProtocol()))
/** * Gets the <tt>CaptureDeviceInfo</tt> of a specific <tt>CaptureDevice</tt> * by locating its registration in JMF using its <tt>MediaLocator</tt>. * * @param captureDevice the <tt>CaptureDevice</tt> to gets the * <tt>CaptureDeviceInfo</tt> of * @return the <tt>CaptureDeviceInfo</tt> of the specified * <tt>CaptureDevice</tt> as registered in JMF */ public static CaptureDeviceInfo getCaptureDeviceInfo( DataSource captureDevice) { /* * TODO The implemented search for the CaptureDeviceInfo of this * CaptureDevice by looking for its MediaLocator is inefficient. */ @SuppressWarnings("unchecked") Vector<CaptureDeviceInfo> captureDeviceInfos = CaptureDeviceManager.getDeviceList(null); MediaLocator locator = captureDevice.getLocator(); for (CaptureDeviceInfo captureDeviceInfo : captureDeviceInfos) if (captureDeviceInfo.getLocator().toString().equals( locator.toString())) return captureDeviceInfo; return null; }
locator = device.getLocator();
= DeviceSystem.LOCATOR_PROTOCOL_IMGSTREAMING .equalsIgnoreCase( cdi.getLocator().getProtocol()) ? MediaUseCase.DESKTOP : MediaUseCase.CALL;
MediaLocator locator = device.getLocator();
String strDevName = "your Media MRL"; CaptureDeviceInfo devInfo = CaptureDeviceManager.getDevice(strDevName); MediaLocator ml = devInfo.getLocator(); DataSource ds; Processor p; try{ ds = Manager.createDataSource( ml); p = Manager.createProcessor(ds); p.configure(); while(p.getState() != p.Configured); p.setContentDescriptor(null); TrackControl[] controls = p.getTrackControls(); controls[0].setFormat(new VideoFormat( VideoFormat.YUV ));//Specify the Video format of the video specified in the MRL Codec codec[]= { new comp311.jmf.effect.GreyEffect() };//class GrayEffect is a implementation of javax.media.Effect (the link for the class given below) controls[0].setCodecChain(codec); p.realize(); while(p.getState() != p.Realized); p.prefetch(); while(p.getState() != p.Prefetched); video = p.getVisualComponent(); if ( video != null ) {System.out.println("Prefetched2"); pnlVideo.add( video, BorderLayout.CENTER );//pnlVideo is a JPanel p.start(); } }catch(Exception e){}
= captureDeviceInfo.getLocator()) != null) && !DeviceSystem.LOCATOR_PROTOCOL_IMGSTREAMING
= (CaptureDevice) Manager.createDataSource( captureDeviceInfo.getLocator());
= Manager.createDataSource(captureDeviceInfo.getLocator());