Search in sources :

Example 1 with CaptureDeviceInfo2

use of org.jitsi.impl.neomedia.device.CaptureDeviceInfo2 in project Spark by igniterealtime.

the class MediaPreferencePanel method setPlaybackDevice.

public void setPlaybackDevice(String device) {
    AudioSystem audioSystem = ((MediaServiceImpl) LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem();
    for (CaptureDeviceInfo2 infoCaptureDevice : vectorPlaybackDevices) {
        if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
            playbackDevice.setSelectedItem(infoCaptureDevice.getName());
            audioSystem.setDevice(DataFlow.PLAYBACK, infoCaptureDevice, true);
            audioSystem.setDevice(DataFlow.NOTIFY, infoCaptureDevice, true);
        }
    }
}
Also used : CaptureDeviceInfo2(org.jitsi.impl.neomedia.device.CaptureDeviceInfo2) AudioSystem(org.jitsi.impl.neomedia.device.AudioSystem)

Example 2 with CaptureDeviceInfo2

use of org.jitsi.impl.neomedia.device.CaptureDeviceInfo2 in project Spark by igniterealtime.

the class MediaPreferencePanel method setAudioDevice.

public void setAudioDevice(String device) {
    AudioSystem audioSystem = ((MediaServiceImpl) LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem();
    for (CaptureDeviceInfo2 infoCaptureDevice : vectorAudioDevices) {
        System.out.println(device);
        if (infoCaptureDevice.getLocator().toExternalForm().equals(device)) {
            audioDevice.setSelectedIndex(vectorAudioDevices.indexOf(infoCaptureDevice));
            audioSystem.setDevice(DataFlow.CAPTURE, infoCaptureDevice, true);
        }
    }
}
Also used : CaptureDeviceInfo2(org.jitsi.impl.neomedia.device.CaptureDeviceInfo2) AudioSystem(org.jitsi.impl.neomedia.device.AudioSystem)

Example 3 with CaptureDeviceInfo2

use of org.jitsi.impl.neomedia.device.CaptureDeviceInfo2 in project Spark by igniterealtime.

the class MediaPreferencePanel method scanDevices.

@SuppressWarnings("unchecked")
public void scanDevices() {
    // Remove all Items
    audioDevice.removeAllItems();
    videoDevice.removeAllItems();
    playbackDevice.removeAllItems();
    audioSystem.removeAllItems();
    vectorPlaybackDevices.removeAllElements();
    vectorAudioSystem.removeAllElements();
    // FMJ
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_LOCATION, Spark.getUserHome());
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_NAME, ".");
    System.setProperty(ConfigurationService.PNAME_SC_CACHE_DIR_LOCATION, Spark.getUserHome());
    System.setProperty(ConfigurationService.PNAME_SC_LOG_DIR_LOCATION, Spark.getUserHome());
    LibJitsi.start();
    MediaType[] mediaTypes = MediaType.values();
    MediaService mediaService = LibJitsi.getMediaService();
    for (MediaType mediaType : mediaTypes) {
        System.err.println("================================");
        System.err.println("MediaType: " + mediaType);
        System.out.println(mediaService);
        MediaDevice device = mediaService.getDefaultDevice(mediaType, MediaUseCase.CALL);
        if (device != null) {
            System.out.println(device.getDirection());
        }
        System.err.println("Device: " + device);
        System.err.println("================================");
    }
    vectorAudioDevices = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.LINEAR));
    for (CaptureDeviceInfo infoCaptureDevice : vectorAudioDevices) {
        String protocol = infoCaptureDevice.getLocator().getProtocol();
        audioDevice.addItem("[" + protocol + "]" + convertSysString(infoCaptureDevice.getName()));
    }
    vectorVideoDevices = CaptureDeviceManager.getDeviceList(new AVFrameFormat());
    for (CaptureDeviceInfo infoCaptureDevice : vectorVideoDevices) {
        videoDevice.addItem(convertSysString(infoCaptureDevice.getName()));
    }
    vectorVideoDevices.add(null);
    videoDevice.addItem("<None>");
    AudioSystem mediaAudioSystem = ((MediaServiceImpl) LibJitsi.getMediaService()).getDeviceConfiguration().getAudioSystem();
    for (AudioSystem system : AudioSystem.getAudioSystems()) {
        System.out.println(system);
        vectorAudioSystem.add(system);
        audioSystem.addItem(system);
    }
    for (CaptureDeviceInfo2 device : mediaAudioSystem.getDevices(DataFlow.PLAYBACK)) {
        playbackDevice.addItem(convertSysString(device.getName()));
        vectorPlaybackDevices.add(device);
    }
}
Also used : CaptureDeviceInfo(javax.media.CaptureDeviceInfo) CaptureDeviceInfo2(org.jitsi.impl.neomedia.device.CaptureDeviceInfo2) MediaService(org.jitsi.service.neomedia.MediaService) AVFrameFormat(org.jitsi.impl.neomedia.codec.video.AVFrameFormat) AudioSystem(org.jitsi.impl.neomedia.device.AudioSystem) MediaType(org.jitsi.service.neomedia.MediaType) MediaDevice(org.jitsi.service.neomedia.device.MediaDevice) AudioFormat(javax.media.format.AudioFormat)

Aggregations

AudioSystem (org.jitsi.impl.neomedia.device.AudioSystem)3 CaptureDeviceInfo2 (org.jitsi.impl.neomedia.device.CaptureDeviceInfo2)3 CaptureDeviceInfo (javax.media.CaptureDeviceInfo)1 AudioFormat (javax.media.format.AudioFormat)1 AVFrameFormat (org.jitsi.impl.neomedia.codec.video.AVFrameFormat)1 MediaService (org.jitsi.service.neomedia.MediaService)1 MediaType (org.jitsi.service.neomedia.MediaType)1 MediaDevice (org.jitsi.service.neomedia.device.MediaDevice)1