aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/neomedia
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/impl/neomedia')
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/AbstractDeviceConfigurationListener.java3
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/AudioDeviceConfigurationListener.java18
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/DeviceConfigurationComboBoxModel.java908
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/EncodingConfigurationTableModel.java540
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java3
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/codec/video/h264/ConfigurationPanel.java3
6 files changed, 733 insertions, 742 deletions
diff --git a/src/net/java/sip/communicator/impl/neomedia/AbstractDeviceConfigurationListener.java b/src/net/java/sip/communicator/impl/neomedia/AbstractDeviceConfigurationListener.java
index a1814e8..3c84aa2 100644
--- a/src/net/java/sip/communicator/impl/neomedia/AbstractDeviceConfigurationListener.java
+++ b/src/net/java/sip/communicator/impl/neomedia/AbstractDeviceConfigurationListener.java
@@ -187,8 +187,7 @@ public abstract class AbstractDeviceConfigurationListener
body
+ "\r\n\r\n"
+ NeomediaActivator.getResources().getI18NString(
- "impl.media.configform"
- + ".AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),
+ "impl.media.configform.AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),
null,
extras);
}
diff --git a/src/net/java/sip/communicator/impl/neomedia/AudioDeviceConfigurationListener.java b/src/net/java/sip/communicator/impl/neomedia/AudioDeviceConfigurationListener.java
index 75f1fc3..fe06f15 100644
--- a/src/net/java/sip/communicator/impl/neomedia/AudioDeviceConfigurationListener.java
+++ b/src/net/java/sip/communicator/impl/neomedia/AudioDeviceConfigurationListener.java
@@ -159,10 +159,8 @@ public class AudioDeviceConfigurationListener
capturePropertyChangeEvent.getOldValue()))
{
body.append("\r\n")
- .append(
- r.getI18NString(
- "impl.media.configform"
- + ".AUDIO_DEVICE_SELECTED_AUDIO_IN"))
+ .append(r.getI18NString(
+ "impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_IN"))
.append("\r\n\t")
.append(cdi.getName());
selectedHasChanged = true;
@@ -179,10 +177,8 @@ public class AudioDeviceConfigurationListener
playbackPropertyChangeEvent.getOldValue()))
{
body.append("\r\n")
- .append(
- r.getI18NString(
- "impl.media.configform"
- + ".AUDIO_DEVICE_SELECTED_AUDIO_OUT"))
+ .append(r.getI18NString(
+ "impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_OUT"))
.append("\r\n\t")
.append(cdi.getName());
selectedHasChanged = true;
@@ -199,10 +195,8 @@ public class AudioDeviceConfigurationListener
notifyPropertyChangeEvent.getOldValue()))
{
body.append("\r\n")
- .append(
- r.getI18NString(
- "impl.media.configform"
- + ".AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS"))
+ .append(r.getI18NString(
+ "impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS"))
.append("\r\n\t")
.append(cdi.getName());
selectedHasChanged = true;
diff --git a/src/net/java/sip/communicator/impl/neomedia/DeviceConfigurationComboBoxModel.java b/src/net/java/sip/communicator/impl/neomedia/DeviceConfigurationComboBoxModel.java
index 1c5bf93..9bacb4c 100644
--- a/src/net/java/sip/communicator/impl/neomedia/DeviceConfigurationComboBoxModel.java
+++ b/src/net/java/sip/communicator/impl/neomedia/DeviceConfigurationComboBoxModel.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,456 +15,456 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.impl.neomedia;
-
-import java.beans.*;
-import java.util.*;
-
-import javax.media.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import org.jitsi.impl.neomedia.device.*;
-import org.jitsi.service.neomedia.*;
-
-/**
- * Implements <tt>ComboBoxModel</tt> for a specific <tt>DeviceConfiguration</tt>
- * so that the latter may be displayed and manipulated in the user interface as
- * a combo box.
- *
- * @author Lyubomir Marinov
- * @author Damian Minkov
- */
-public class DeviceConfigurationComboBoxModel
- implements ComboBoxModel,
- ListModel,
- PropertyChangeListener
-{
- /**
- * Type of the model - audio.
- */
- public static final int AUDIO = 1;
-
- /**
- * Audio Capture Device.
- */
- public static final int AUDIO_CAPTURE = 3;
-
- /**
- * Audio device for notification sounds.
- */
- public static final int AUDIO_NOTIFY = 5;
-
- /**
- * Audio playback device.
- */
- public static final int AUDIO_PLAYBACK = 4;
-
- /**
- * Type of the model - video.
- */
- public static final int VIDEO = 2;
-
- private AudioSystem[] audioSystems;
-
- /**
- * The current device configuration.
- */
- private final DeviceConfiguration deviceConfiguration;
-
- /**
- * All the devices.
- */
- private CaptureDevice[] devices;
-
- /**
- * The <tt>ListDataListener</tt>s registered with this instance.
- */
- private final List<ListDataListener> listeners
- = new ArrayList<ListDataListener>();
-
- /**
- * The type of the media for this combo.
- */
- private final int type;
-
- /**
- * Creates device combobox model
- * @param parent the parent component
- * @param deviceConfiguration the current device configuration
- * @param type the device - audio/video
- */
- public DeviceConfigurationComboBoxModel(
- DeviceConfiguration deviceConfiguration,
- int type)
- {
- if (deviceConfiguration == null)
- throw new IllegalArgumentException("deviceConfiguration");
- if ((type != AUDIO)
- && (type != AUDIO_CAPTURE)
- && (type != AUDIO_NOTIFY)
- && (type != AUDIO_PLAYBACK)
- && (type != VIDEO))
- throw new IllegalArgumentException("type");
-
- this.deviceConfiguration = deviceConfiguration;
- this.type = type;
-
- if (type == AUDIO
- || type == AUDIO_CAPTURE
- || type == AUDIO_NOTIFY
- || type == AUDIO_PLAYBACK)
- {
- deviceConfiguration.addPropertyChangeListener(this);
- }
- }
-
- public void addListDataListener(ListDataListener listener)
- {
- if (listener == null)
- throw new IllegalArgumentException("listener");
-
- if (!listeners.contains(listener))
- listeners.add(listener);
- }
-
- /**
- * Change of the content.
- * @param index0 from index.
- * @param index1 to index.
- */
- protected void fireContentsChanged(int index0, int index1)
- {
- ListDataListener[] listeners
- = this.listeners.toArray(
- new ListDataListener[this.listeners.size()]);
- ListDataEvent event
- = new ListDataEvent(
- this,
- ListDataEvent.CONTENTS_CHANGED,
- index0,
- index1);
-
- for (ListDataListener listener : listeners)
- listener.contentsChanged(event);
- }
-
- private AudioSystem[] getAudioSystems()
- {
- if (type != AUDIO)
- throw new IllegalStateException("type");
-
- audioSystems = deviceConfiguration.getAvailableAudioSystems();
- return audioSystems;
- }
-
- /**
- * Extracts the devices for the current type.
- * @return the devices.
- */
- private CaptureDevice[] getDevices()
- {
- if (type == AUDIO)
- throw new IllegalStateException("type");
-
- if (devices != null)
- return devices;
-
- AudioSystem audioSystem;
- List<? extends CaptureDeviceInfo> infos = null;
-
- switch (type)
- {
- case AUDIO_CAPTURE:
- audioSystem = deviceConfiguration.getAudioSystem();
- infos = (audioSystem == null)
- ? null
- : audioSystem.getDevices(AudioSystem.DataFlow.CAPTURE);
- break;
- case AUDIO_NOTIFY:
- audioSystem = deviceConfiguration.getAudioSystem();
- infos = (audioSystem == null)
- ? null
- : audioSystem.getDevices(AudioSystem.DataFlow.NOTIFY);
- break;
- case AUDIO_PLAYBACK:
- audioSystem = deviceConfiguration.getAudioSystem();
- infos = (audioSystem == null)
- ? null
- : audioSystem.getDevices(AudioSystem.DataFlow.PLAYBACK);
- break;
- case VIDEO:
- infos = deviceConfiguration.getAvailableVideoCaptureDevices(
- MediaUseCase.CALL);
- break;
- default:
- throw new IllegalStateException("type");
- }
-
- final int deviceCount = (infos == null) ? 0 : infos.size();
- devices = new CaptureDevice[deviceCount + 1];
-
- if (deviceCount > 0)
- {
- for (int i = 0; i < deviceCount; i++)
- devices[i] = new CaptureDevice(infos.get(i));
- }
- devices[deviceCount] = new CaptureDevice(null);
-
- return devices;
- }
-
- public Object getElementAt(int index)
- {
- if (type == AUDIO)
- return getAudioSystems()[index];
- else
- return getDevices()[index];
- }
-
- /**
- * Extracts the devices selected by the configuration.
- * @return <tt>CaptureDevice</tt> selected
- */
- private CaptureDevice getSelectedDevice()
- {
- AudioSystem audioSystem;
- CaptureDeviceInfo info;
-
- switch (type)
- {
- case AUDIO_CAPTURE:
- audioSystem = deviceConfiguration.getAudioSystem();
- info = (audioSystem == null)
- ? null
- : audioSystem.getSelectedDevice(AudioSystem.DataFlow.CAPTURE);
- break;
- case AUDIO_NOTIFY:
- audioSystem = deviceConfiguration.getAudioSystem();
- info = (audioSystem == null)
- ? null
- : audioSystem.getSelectedDevice(AudioSystem.DataFlow.NOTIFY);
- break;
- case AUDIO_PLAYBACK:
- audioSystem = deviceConfiguration.getAudioSystem();
- info = (audioSystem == null)
- ? null
- : audioSystem.getSelectedDevice(AudioSystem.DataFlow.PLAYBACK);
- break;
- case VIDEO:
- info = deviceConfiguration.getVideoCaptureDevice(MediaUseCase.ANY);
- break;
- default:
- throw new IllegalStateException("type");
- }
-
- for (CaptureDevice device : getDevices())
- {
- if (device.equals(info))
- return device;
- }
- return null;
- }
-
- public Object getSelectedItem()
- {
- if (type == AUDIO)
- return deviceConfiguration.getAudioSystem();
- else
- return getSelectedDevice();
- }
-
- public int getSize()
- {
- if (type == AUDIO)
- return getAudioSystems().length;
- else
- return getDevices().length;
- }
-
- /**
- * Notifies this instance about changes in the values of the properties of
- * {@link #deviceConfiguration} so that this instance keeps itself
- * up-to-date with respect to the list of devices.
- *
- * @param ev a <tt>PropertyChangeEvent</tt> which describes the name of the
- * property whose value has changed and the old and new values of that
- * property
- */
- public void propertyChange(final PropertyChangeEvent ev)
- {
- if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(
- ev.getPropertyName()))
- {
- if (SwingUtilities.isEventDispatchThread())
- {
- audioSystems = null;
- devices = null;
- fireContentsChanged(0, getSize() - 1);
- }
- else
- {
- SwingUtilities.invokeLater(
- new Runnable()
- {
- public void run()
- {
- propertyChange(ev);
- }
- });
- }
- }
- }
-
- public void removeListDataListener(ListDataListener listener)
- {
- if (listener == null)
- throw new IllegalArgumentException("listener");
-
- listeners.remove(listener);
- }
-
- /**
- * Selects and saves the new choice.
- * @param device the device we choose.
- */
- private void setSelectedDevice(CaptureDevice device)
- {
- // We cannot clear the selection of DeviceConfiguration.
- if (device == null)
- return;
-
- CaptureDevice selectedDevice = getSelectedDevice();
-
- if (selectedDevice != device)
- {
- AudioSystem audioSystem;
-
- switch (type)
- {
- case AUDIO_CAPTURE:
- audioSystem = deviceConfiguration.getAudioSystem();
- if (audioSystem != null)
- {
- audioSystem.setDevice(
- AudioSystem.DataFlow.CAPTURE,
- ((CaptureDeviceInfo2) device.info),
- true);
- }
- break;
- case AUDIO_NOTIFY:
- audioSystem = deviceConfiguration.getAudioSystem();
- if (audioSystem != null)
- {
- audioSystem.setDevice(
- AudioSystem.DataFlow.NOTIFY,
- ((CaptureDeviceInfo2) device.info),
- true);
- }
- break;
- case AUDIO_PLAYBACK:
- audioSystem = deviceConfiguration.getAudioSystem();
- if (audioSystem != null)
- {
- audioSystem.setDevice(
- AudioSystem.DataFlow.PLAYBACK,
- ((CaptureDeviceInfo2) device.info),
- true);
- }
- break;
- case VIDEO:
- deviceConfiguration.setVideoCaptureDevice(device.info, true);
- break;
- }
-
- fireContentsChanged(-1, -1);
- }
- }
-
- public void setSelectedItem(Object item)
- {
- if (type == AUDIO)
- {
- AudioSystem audioSystem = (AudioSystem) item;
-
- if(!audioSystem.equals(deviceConfiguration.getAudioSystem()))
- {
- deviceConfiguration.setAudioSystem(audioSystem, true);
- fireContentsChanged(-1, -1);
- }
- }
- else
- setSelectedDevice((CaptureDevice) item);
- }
-
- /**
- * Encapsulates a <tt>CaptureDeviceInfo</tt> for the purposes of its display
- * in the user interface.
- */
- public static class CaptureDevice
- {
- /**
- * The encapsulated info.
- */
- public final CaptureDeviceInfo info;
-
- /**
- * Creates the wrapper.
- * @param info the info object we wrap.
- */
- public CaptureDevice(CaptureDeviceInfo info)
- {
- this.info = info;
- }
-
- /**
- * Determines whether the <tt>CaptureDeviceInfo</tt> encapsulated by
- * this instance is equal (by value) to a specific
- * <tt>CaptureDeviceInfo</tt>.
- *
- * @param cdi the <tt>CaptureDeviceInfo</tt> to be determined whether it
- * is equal (by value) to the <tt>CaptureDeviceInfo</tt> encapsulated by
- * this instance
- * @return <tt>true</tt> if the <tt>CaptureDeviceInfo</tt> encapsulated
- * by this instance is equal (by value) to the specified <tt>cdi</tt>;
- * otherwise, <tt>false</tt>
- */
- public boolean equals(CaptureDeviceInfo cdi)
- {
- return (info == null) ? (cdi == null) : info.equals(cdi);
- }
-
- /**
- * Gets a human-readable <tt>String</tt> representation of this
- * instance.
- *
- * @return a <tt>String</tt> value which is a human-readable
- * representation of this instance
- */
- @Override
- public String toString()
- {
- String s;
-
- if(info == null)
- {
- s
- = NeomediaActivator.getResources().getI18NString(
- "impl.media.configform.NO_DEVICE");
- }
- else
- {
- s = info.getName();
- if(info instanceof CaptureDeviceInfo2)
- {
- String transportType
- = ((CaptureDeviceInfo2) info).getTransportType();
-
- if(transportType != null)
- s += " (" + transportType + ")";
- }
- }
- return s;
- }
- }
-}
+package net.java.sip.communicator.impl.neomedia;
+
+import java.beans.*;
+import java.util.*;
+
+import javax.media.*;
+import javax.swing.*;
+import javax.swing.event.*;
+
+import org.jitsi.impl.neomedia.device.*;
+import org.jitsi.service.neomedia.*;
+
+/**
+ * Implements <tt>ComboBoxModel</tt> for a specific <tt>DeviceConfiguration</tt>
+ * so that the latter may be displayed and manipulated in the user interface as
+ * a combo box.
+ *
+ * @author Lyubomir Marinov
+ * @author Damian Minkov
+ */
+public class DeviceConfigurationComboBoxModel
+ implements ComboBoxModel,
+ ListModel,
+ PropertyChangeListener
+{
+ /**
+ * Type of the model - audio.
+ */
+ public static final int AUDIO = 1;
+
+ /**
+ * Audio Capture Device.
+ */
+ public static final int AUDIO_CAPTURE = 3;
+
+ /**
+ * Audio device for notification sounds.
+ */
+ public static final int AUDIO_NOTIFY = 5;
+
+ /**
+ * Audio playback device.
+ */
+ public static final int AUDIO_PLAYBACK = 4;
+
+ /**
+ * Type of the model - video.
+ */
+ public static final int VIDEO = 2;
+
+ private AudioSystem[] audioSystems;
+
+ /**
+ * The current device configuration.
+ */
+ private final DeviceConfiguration deviceConfiguration;
+
+ /**
+ * All the devices.
+ */
+ private CaptureDevice[] devices;
+
+ /**
+ * The <tt>ListDataListener</tt>s registered with this instance.
+ */
+ private final List<ListDataListener> listeners
+ = new ArrayList<ListDataListener>();
+
+ /**
+ * The type of the media for this combo.
+ */
+ private final int type;
+
+ /**
+ * Creates device combobox model
+ * @param parent the parent component
+ * @param deviceConfiguration the current device configuration
+ * @param type the device - audio/video
+ */
+ public DeviceConfigurationComboBoxModel(
+ DeviceConfiguration deviceConfiguration,
+ int type)
+ {
+ if (deviceConfiguration == null)
+ throw new IllegalArgumentException("deviceConfiguration");
+ if ((type != AUDIO)
+ && (type != AUDIO_CAPTURE)
+ && (type != AUDIO_NOTIFY)
+ && (type != AUDIO_PLAYBACK)
+ && (type != VIDEO))
+ throw new IllegalArgumentException("type");
+
+ this.deviceConfiguration = deviceConfiguration;
+ this.type = type;
+
+ if (type == AUDIO
+ || type == AUDIO_CAPTURE
+ || type == AUDIO_NOTIFY
+ || type == AUDIO_PLAYBACK)
+ {
+ deviceConfiguration.addPropertyChangeListener(this);
+ }
+ }
+
+ public void addListDataListener(ListDataListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("listener");
+
+ if (!listeners.contains(listener))
+ listeners.add(listener);
+ }
+
+ /**
+ * Change of the content.
+ * @param index0 from index.
+ * @param index1 to index.
+ */
+ protected void fireContentsChanged(int index0, int index1)
+ {
+ ListDataListener[] listeners
+ = this.listeners.toArray(
+ new ListDataListener[this.listeners.size()]);
+ ListDataEvent event
+ = new ListDataEvent(
+ this,
+ ListDataEvent.CONTENTS_CHANGED,
+ index0,
+ index1);
+
+ for (ListDataListener listener : listeners)
+ listener.contentsChanged(event);
+ }
+
+ private AudioSystem[] getAudioSystems()
+ {
+ if (type != AUDIO)
+ throw new IllegalStateException("type");
+
+ audioSystems = deviceConfiguration.getAvailableAudioSystems();
+ return audioSystems;
+ }
+
+ /**
+ * Extracts the devices for the current type.
+ * @return the devices.
+ */
+ private CaptureDevice[] getDevices()
+ {
+ if (type == AUDIO)
+ throw new IllegalStateException("type");
+
+ if (devices != null)
+ return devices;
+
+ AudioSystem audioSystem;
+ List<? extends CaptureDeviceInfo> infos = null;
+
+ switch (type)
+ {
+ case AUDIO_CAPTURE:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ infos = (audioSystem == null)
+ ? null
+ : audioSystem.getDevices(AudioSystem.DataFlow.CAPTURE);
+ break;
+ case AUDIO_NOTIFY:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ infos = (audioSystem == null)
+ ? null
+ : audioSystem.getDevices(AudioSystem.DataFlow.NOTIFY);
+ break;
+ case AUDIO_PLAYBACK:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ infos = (audioSystem == null)
+ ? null
+ : audioSystem.getDevices(AudioSystem.DataFlow.PLAYBACK);
+ break;
+ case VIDEO:
+ infos = deviceConfiguration.getAvailableVideoCaptureDevices(
+ MediaUseCase.CALL);
+ break;
+ default:
+ throw new IllegalStateException("type");
+ }
+
+ final int deviceCount = (infos == null) ? 0 : infos.size();
+ devices = new CaptureDevice[deviceCount + 1];
+
+ if (deviceCount > 0)
+ {
+ for (int i = 0; i < deviceCount; i++)
+ devices[i] = new CaptureDevice(infos.get(i));
+ }
+ devices[deviceCount] = new CaptureDevice(null);
+
+ return devices;
+ }
+
+ public Object getElementAt(int index)
+ {
+ if (type == AUDIO)
+ return getAudioSystems()[index];
+ else
+ return getDevices()[index];
+ }
+
+ /**
+ * Extracts the devices selected by the configuration.
+ * @return <tt>CaptureDevice</tt> selected
+ */
+ private CaptureDevice getSelectedDevice()
+ {
+ AudioSystem audioSystem;
+ CaptureDeviceInfo info;
+
+ switch (type)
+ {
+ case AUDIO_CAPTURE:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ info = (audioSystem == null)
+ ? null
+ : audioSystem.getSelectedDevice(AudioSystem.DataFlow.CAPTURE);
+ break;
+ case AUDIO_NOTIFY:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ info = (audioSystem == null)
+ ? null
+ : audioSystem.getSelectedDevice(AudioSystem.DataFlow.NOTIFY);
+ break;
+ case AUDIO_PLAYBACK:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ info = (audioSystem == null)
+ ? null
+ : audioSystem.getSelectedDevice(AudioSystem.DataFlow.PLAYBACK);
+ break;
+ case VIDEO:
+ info = deviceConfiguration.getVideoCaptureDevice(MediaUseCase.ANY);
+ break;
+ default:
+ throw new IllegalStateException("type");
+ }
+
+ for (CaptureDevice device : getDevices())
+ {
+ if (device.equals(info))
+ return device;
+ }
+ return null;
+ }
+
+ public Object getSelectedItem()
+ {
+ if (type == AUDIO)
+ return deviceConfiguration.getAudioSystem();
+ else
+ return getSelectedDevice();
+ }
+
+ public int getSize()
+ {
+ if (type == AUDIO)
+ return getAudioSystems().length;
+ else
+ return getDevices().length;
+ }
+
+ /**
+ * Notifies this instance about changes in the values of the properties of
+ * {@link #deviceConfiguration} so that this instance keeps itself
+ * up-to-date with respect to the list of devices.
+ *
+ * @param ev a <tt>PropertyChangeEvent</tt> which describes the name of the
+ * property whose value has changed and the old and new values of that
+ * property
+ */
+ public void propertyChange(final PropertyChangeEvent ev)
+ {
+ if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES.equals(
+ ev.getPropertyName()))
+ {
+ if (SwingUtilities.isEventDispatchThread())
+ {
+ audioSystems = null;
+ devices = null;
+ fireContentsChanged(0, getSize() - 1);
+ }
+ else
+ {
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ propertyChange(ev);
+ }
+ });
+ }
+ }
+ }
+
+ public void removeListDataListener(ListDataListener listener)
+ {
+ if (listener == null)
+ throw new IllegalArgumentException("listener");
+
+ listeners.remove(listener);
+ }
+
+ /**
+ * Selects and saves the new choice.
+ * @param device the device we choose.
+ */
+ private void setSelectedDevice(CaptureDevice device)
+ {
+ // We cannot clear the selection of DeviceConfiguration.
+ if (device == null)
+ return;
+
+ CaptureDevice selectedDevice = getSelectedDevice();
+
+ if (selectedDevice != device)
+ {
+ AudioSystem audioSystem;
+
+ switch (type)
+ {
+ case AUDIO_CAPTURE:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ if (audioSystem != null)
+ {
+ audioSystem.setDevice(
+ AudioSystem.DataFlow.CAPTURE,
+ ((CaptureDeviceInfo2) device.info),
+ true);
+ }
+ break;
+ case AUDIO_NOTIFY:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ if (audioSystem != null)
+ {
+ audioSystem.setDevice(
+ AudioSystem.DataFlow.NOTIFY,
+ ((CaptureDeviceInfo2) device.info),
+ true);
+ }
+ break;
+ case AUDIO_PLAYBACK:
+ audioSystem = deviceConfiguration.getAudioSystem();
+ if (audioSystem != null)
+ {
+ audioSystem.setDevice(
+ AudioSystem.DataFlow.PLAYBACK,
+ ((CaptureDeviceInfo2) device.info),
+ true);
+ }
+ break;
+ case VIDEO:
+ deviceConfiguration.setVideoCaptureDevice(device.info, true);
+ break;
+ }
+
+ fireContentsChanged(-1, -1);
+ }
+ }
+
+ public void setSelectedItem(Object item)
+ {
+ if (type == AUDIO)
+ {
+ AudioSystem audioSystem = (AudioSystem) item;
+
+ if(!audioSystem.equals(deviceConfiguration.getAudioSystem()))
+ {
+ deviceConfiguration.setAudioSystem(audioSystem, true);
+ fireContentsChanged(-1, -1);
+ }
+ }
+ else
+ setSelectedDevice((CaptureDevice) item);
+ }
+
+ /**
+ * Encapsulates a <tt>CaptureDeviceInfo</tt> for the purposes of its display
+ * in the user interface.
+ */
+ public static class CaptureDevice
+ {
+ /**
+ * The encapsulated info.
+ */
+ public final CaptureDeviceInfo info;
+
+ /**
+ * Creates the wrapper.
+ * @param info the info object we wrap.
+ */
+ public CaptureDevice(CaptureDeviceInfo info)
+ {
+ this.info = info;
+ }
+
+ /**
+ * Determines whether the <tt>CaptureDeviceInfo</tt> encapsulated by
+ * this instance is equal (by value) to a specific
+ * <tt>CaptureDeviceInfo</tt>.
+ *
+ * @param cdi the <tt>CaptureDeviceInfo</tt> to be determined whether it
+ * is equal (by value) to the <tt>CaptureDeviceInfo</tt> encapsulated by
+ * this instance
+ * @return <tt>true</tt> if the <tt>CaptureDeviceInfo</tt> encapsulated
+ * by this instance is equal (by value) to the specified <tt>cdi</tt>;
+ * otherwise, <tt>false</tt>
+ */
+ public boolean equals(CaptureDeviceInfo cdi)
+ {
+ return (info == null) ? (cdi == null) : info.equals(cdi);
+ }
+
+ /**
+ * Gets a human-readable <tt>String</tt> representation of this
+ * instance.
+ *
+ * @return a <tt>String</tt> value which is a human-readable
+ * representation of this instance
+ */
+ @Override
+ public String toString()
+ {
+ String s;
+
+ if(info == null)
+ {
+ s
+ = NeomediaActivator.getResources().getI18NString(
+ "impl.media.configform.NO_DEVICE");
+ }
+ else
+ {
+ s = info.getName();
+ if(info instanceof CaptureDeviceInfo2)
+ {
+ String transportType
+ = ((CaptureDeviceInfo2) info).getTransportType();
+
+ if(transportType != null)
+ s += " (" + transportType + ")";
+ }
+ }
+ return s;
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/neomedia/EncodingConfigurationTableModel.java b/src/net/java/sip/communicator/impl/neomedia/EncodingConfigurationTableModel.java
index 925184c..f8cf447 100644
--- a/src/net/java/sip/communicator/impl/neomedia/EncodingConfigurationTableModel.java
+++ b/src/net/java/sip/communicator/impl/neomedia/EncodingConfigurationTableModel.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,272 +15,272 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.impl.neomedia;
-
-import java.util.*;
-
-import javax.swing.table.*;
-
-import net.java.sip.communicator.plugin.desktoputil.*;
-
-import org.jitsi.impl.neomedia.*;
-import org.jitsi.impl.neomedia.format.*;
-import org.jitsi.service.neomedia.*;
-import org.jitsi.service.neomedia.codec.*;
-import org.jitsi.service.neomedia.format.*;
-
-/**
- * Implements {@link TableModel} for {@link EncodingConfiguration}.
- *
- * @author Lyubomir Marinov
- */
-public class EncodingConfigurationTableModel
- extends MoveableTableModel
-{
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = 0L;
-
- private final EncodingConfiguration encodingConfiguration;
-
- private MediaFormat[] encodings;
-
- private final MediaType type;
-
- /**
- * Constructor.
- *
- * @param encodingConfiguration the encoding configuration
- * @param type media type
- */
- public EncodingConfigurationTableModel(int type,
- EncodingConfiguration encodingConfiguration)
- {
- if (encodingConfiguration == null)
- throw new IllegalArgumentException("encodingConfiguration");
- this.encodingConfiguration = encodingConfiguration;
-
- switch (type)
- {
- case DeviceConfigurationComboBoxModel.AUDIO:
- this.type = MediaType.AUDIO;
- break;
- case DeviceConfigurationComboBoxModel.VIDEO:
- this.type = MediaType.VIDEO;
- break;
- default:
- throw new IllegalArgumentException("type");
- }
- }
-
- @Override
- public Class<?> getColumnClass(int columnIndex)
- {
- return
- (columnIndex == 0)
- ? Boolean.class
- : super.getColumnClass(columnIndex);
- }
-
- public int getColumnCount()
- {
- return 2;
- }
-
- private MediaFormat[] getEncodings()
- {
- if (encodings != null)
- return encodings;
-
- MediaFormat[] availableEncodings
- = encodingConfiguration.getAllEncodings(type);
- int encodingCount = availableEncodings.length;
-
- if (encodingCount < 1)
- encodings = MediaUtils.EMPTY_MEDIA_FORMATS;
- else
- {
- /*
- * The MediaFormats will be displayed by encoding (name) and clock
- * rate and EncodingConfiguration will store them that way so this
- * TableModel should better display unique encoding-clock rate
- * pairs.
- */
- HashMap<String, MediaFormat> availableEncodingSet
- = new HashMap<String, MediaFormat>();
-
- for (MediaFormat availableEncoding : availableEncodings)
- {
- availableEncodingSet.put(
- availableEncoding.getEncoding()
- + "/"
- + availableEncoding.getClockRateString(),
- availableEncoding);
- }
- availableEncodings
- = availableEncodingSet.values().toArray(
- MediaUtils.EMPTY_MEDIA_FORMATS);
- encodingCount = availableEncodings.length;
-
- encodings = new MediaFormat[encodingCount];
- System
- .arraycopy(availableEncodings, 0, encodings, 0, encodingCount);
- // Display the encodings in decreasing priority.
- Arrays
- .sort(encodings, 0, encodingCount, new Comparator<MediaFormat>()
- {
- public int compare(MediaFormat format0, MediaFormat format1)
- {
- int ret
- = encodingConfiguration.getPriority(format1)
- - encodingConfiguration.getPriority(format0);
-
- if (ret == 0)
- {
- /*
- * In the cases of equal priorities, display them
- * sorted by encoding name in increasing order.
- */
- ret
- = format0.getEncoding().compareToIgnoreCase(
- format1.getEncoding());
- if (ret == 0)
- {
- /*
- * In the cases of equal priorities and equal
- * encoding names, display them sorted by clock
- * rate in decreasing order.
- */
- ret
- = Double.compare(
- format1.getClockRate(),
- format0.getClockRate());
- }
- }
- return ret;
- }
- });
- }
- return encodings;
- }
-
- private int[] getPriorities()
- {
- MediaFormat[] encodings = getEncodings();
- final int count = encodings.length;
- int[] priorities = new int[count];
-
- for (int i = 0; i < count; i++)
- {
- int priority = encodingConfiguration.getPriority(encodings[i]);
-
- priorities[i] = (priority > 0) ? (count - i) : 0;
- }
- return priorities;
- }
-
- public int getRowCount()
- {
- return getEncodings().length;
- }
-
- public Object getValueAt(int rowIndex, int columnIndex)
- {
- MediaFormat encoding = getEncodings()[rowIndex];
-
- switch (columnIndex)
- {
- case 0:
- return (encodingConfiguration.getPriority(encoding) > 0);
- case 1:
- if (MediaType.VIDEO.equals(encoding.getMediaType())
- && (VideoMediaFormatImpl.DEFAULT_CLOCK_RATE
- == encoding.getClockRate()))
- return encoding.getEncoding();
- else
- {
- return encoding.getEncoding()
- + "/"
- + encoding.getRealUsedClockRateString();
- }
- default:
- return null;
- }
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex)
- {
- return (columnIndex == 0);
- }
-
- /**
- * Move the row.
- *
- * @param rowIndex index of the row
- * @param up true to move up, false to move down
- * @return the next row index
- */
- @Override
- public int move(int rowIndex, boolean up)
- {
- if (up)
- {
- if (rowIndex <= 0)
- throw new IllegalArgumentException("rowIndex");
-
- return move(rowIndex - 1, false) - 1;
- }
-
- if (rowIndex >= (getRowCount() - 1))
- throw new IllegalArgumentException("rowIndex");
-
- int[] priorities = getPriorities();
- final int nextRowIndex = rowIndex + 1;
-
- if (priorities[rowIndex] > 0)
- priorities[rowIndex] = priorities.length - nextRowIndex;
- if (priorities[nextRowIndex] > 0)
- priorities[nextRowIndex] = priorities.length - rowIndex;
- setPriorities(priorities);
-
- MediaFormat swap = encodings[rowIndex];
-
- encodings[rowIndex] = encodings[nextRowIndex];
- encodings[nextRowIndex] = swap;
-
- fireTableRowsUpdated(rowIndex, nextRowIndex);
- return nextRowIndex;
- }
-
- private void setPriorities(int[] priorities)
- {
- final int count = encodings.length;
-
- if (priorities.length != count)
- throw new IllegalArgumentException("priorities");
- for (int i = 0; i < count; i++)
- {
- encodingConfiguration.setPriority(encodings[i], priorities[i]);
- }
- }
-
- @Override
- public void setValueAt(Object value, int rowIndex, int columnIndex)
- {
- if ((columnIndex == 0) && (value instanceof Boolean))
- {
- int priority
- = ((Boolean) value) ? (getPriorities().length - rowIndex) : 0;
- MediaFormat encoding = encodings[rowIndex];
-
-
- // We fire the update event before setting the configuration
- // property in order to have more reactive user interface.
- fireTableCellUpdated(rowIndex, columnIndex);
-
- encodingConfiguration.setPriority(encoding, priority);
- }
- }
-}
+package net.java.sip.communicator.impl.neomedia;
+
+import java.util.*;
+
+import javax.swing.table.*;
+
+import net.java.sip.communicator.plugin.desktoputil.*;
+
+import org.jitsi.impl.neomedia.*;
+import org.jitsi.impl.neomedia.format.*;
+import org.jitsi.service.neomedia.*;
+import org.jitsi.service.neomedia.codec.*;
+import org.jitsi.service.neomedia.format.*;
+
+/**
+ * Implements {@link TableModel} for {@link EncodingConfiguration}.
+ *
+ * @author Lyubomir Marinov
+ */
+public class EncodingConfigurationTableModel
+ extends MoveableTableModel
+{
+ /**
+ * Serial version UID.
+ */
+ private static final long serialVersionUID = 0L;
+
+ private final EncodingConfiguration encodingConfiguration;
+
+ private MediaFormat[] encodings;
+
+ private final MediaType type;
+
+ /**
+ * Constructor.
+ *
+ * @param encodingConfiguration the encoding configuration
+ * @param type media type
+ */
+ public EncodingConfigurationTableModel(int type,
+ EncodingConfiguration encodingConfiguration)
+ {
+ if (encodingConfiguration == null)
+ throw new IllegalArgumentException("encodingConfiguration");
+ this.encodingConfiguration = encodingConfiguration;
+
+ switch (type)
+ {
+ case DeviceConfigurationComboBoxModel.AUDIO:
+ this.type = MediaType.AUDIO;
+ break;
+ case DeviceConfigurationComboBoxModel.VIDEO:
+ this.type = MediaType.VIDEO;
+ break;
+ default:
+ throw new IllegalArgumentException("type");
+ }
+ }
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex)
+ {
+ return
+ (columnIndex == 0)
+ ? Boolean.class
+ : super.getColumnClass(columnIndex);
+ }
+
+ public int getColumnCount()
+ {
+ return 2;
+ }
+
+ private MediaFormat[] getEncodings()
+ {
+ if (encodings != null)
+ return encodings;
+
+ MediaFormat[] availableEncodings
+ = encodingConfiguration.getAllEncodings(type);
+ int encodingCount = availableEncodings.length;
+
+ if (encodingCount < 1)
+ encodings = MediaUtils.EMPTY_MEDIA_FORMATS;
+ else
+ {
+ /*
+ * The MediaFormats will be displayed by encoding (name) and clock
+ * rate and EncodingConfiguration will store them that way so this
+ * TableModel should better display unique encoding-clock rate
+ * pairs.
+ */
+ HashMap<String, MediaFormat> availableEncodingSet
+ = new HashMap<String, MediaFormat>();
+
+ for (MediaFormat availableEncoding : availableEncodings)
+ {
+ availableEncodingSet.put(
+ availableEncoding.getEncoding()
+ + "/"
+ + availableEncoding.getClockRateString(),
+ availableEncoding);
+ }
+ availableEncodings
+ = availableEncodingSet.values().toArray(
+ MediaUtils.EMPTY_MEDIA_FORMATS);
+ encodingCount = availableEncodings.length;
+
+ encodings = new MediaFormat[encodingCount];
+ System
+ .arraycopy(availableEncodings, 0, encodings, 0, encodingCount);
+ // Display the encodings in decreasing priority.
+ Arrays
+ .sort(encodings, 0, encodingCount, new Comparator<MediaFormat>()
+ {
+ public int compare(MediaFormat format0, MediaFormat format1)
+ {
+ int ret
+ = encodingConfiguration.getPriority(format1)
+ - encodingConfiguration.getPriority(format0);
+
+ if (ret == 0)
+ {
+ /*
+ * In the cases of equal priorities, display them
+ * sorted by encoding name in increasing order.
+ */
+ ret
+ = format0.getEncoding().compareToIgnoreCase(
+ format1.getEncoding());
+ if (ret == 0)
+ {
+ /*
+ * In the cases of equal priorities and equal
+ * encoding names, display them sorted by clock
+ * rate in decreasing order.
+ */
+ ret
+ = Double.compare(
+ format1.getClockRate(),
+ format0.getClockRate());
+ }
+ }
+ return ret;
+ }
+ });
+ }
+ return encodings;
+ }
+
+ private int[] getPriorities()
+ {
+ MediaFormat[] encodings = getEncodings();
+ final int count = encodings.length;
+ int[] priorities = new int[count];
+
+ for (int i = 0; i < count; i++)
+ {
+ int priority = encodingConfiguration.getPriority(encodings[i]);
+
+ priorities[i] = (priority > 0) ? (count - i) : 0;
+ }
+ return priorities;
+ }
+
+ public int getRowCount()
+ {
+ return getEncodings().length;
+ }
+
+ public Object getValueAt(int rowIndex, int columnIndex)
+ {
+ MediaFormat encoding = getEncodings()[rowIndex];
+
+ switch (columnIndex)
+ {
+ case 0:
+ return (encodingConfiguration.getPriority(encoding) > 0);
+ case 1:
+ if (MediaType.VIDEO.equals(encoding.getMediaType())
+ && (VideoMediaFormatImpl.DEFAULT_CLOCK_RATE
+ == encoding.getClockRate()))
+ return encoding.getEncoding();
+ else
+ {
+ return encoding.getEncoding()
+ + "/"
+ + encoding.getRealUsedClockRateString();
+ }
+ default:
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex)
+ {
+ return (columnIndex == 0);
+ }
+
+ /**
+ * Move the row.
+ *
+ * @param rowIndex index of the row
+ * @param up true to move up, false to move down
+ * @return the next row index
+ */
+ @Override
+ public int move(int rowIndex, boolean up)
+ {
+ if (up)
+ {
+ if (rowIndex <= 0)
+ throw new IllegalArgumentException("rowIndex");
+
+ return move(rowIndex - 1, false) - 1;
+ }
+
+ if (rowIndex >= (getRowCount() - 1))
+ throw new IllegalArgumentException("rowIndex");
+
+ int[] priorities = getPriorities();
+ final int nextRowIndex = rowIndex + 1;
+
+ if (priorities[rowIndex] > 0)
+ priorities[rowIndex] = priorities.length - nextRowIndex;
+ if (priorities[nextRowIndex] > 0)
+ priorities[nextRowIndex] = priorities.length - rowIndex;
+ setPriorities(priorities);
+
+ MediaFormat swap = encodings[rowIndex];
+
+ encodings[rowIndex] = encodings[nextRowIndex];
+ encodings[nextRowIndex] = swap;
+
+ fireTableRowsUpdated(rowIndex, nextRowIndex);
+ return nextRowIndex;
+ }
+
+ private void setPriorities(int[] priorities)
+ {
+ final int count = encodings.length;
+
+ if (priorities.length != count)
+ throw new IllegalArgumentException("priorities");
+ for (int i = 0; i < count; i++)
+ {
+ encodingConfiguration.setPriority(encodings[i], priorities[i]);
+ }
+ }
+
+ @Override
+ public void setValueAt(Object value, int rowIndex, int columnIndex)
+ {
+ if ((columnIndex == 0) && (value instanceof Boolean))
+ {
+ int priority
+ = ((Boolean) value) ? (getPriorities().length - rowIndex) : 0;
+ MediaFormat encoding = encodings[rowIndex];
+
+
+ // We fire the update event before setting the configuration
+ // property in order to have more reactive user interface.
+ fireTableCellUpdated(rowIndex, columnIndex);
+
+ encodingConfiguration.setPriority(encoding, priority);
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java b/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java
index d561c92..00e8aac 100644
--- a/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java
+++ b/src/net/java/sip/communicator/impl/neomedia/MediaConfigurationImpl.java
@@ -1773,8 +1773,7 @@ public class MediaConfigurationImpl
{
String noAvailableAudioDevice
= NeomediaActivator.getResources().getI18NString(
- "impl.media.configform"
- + ".NO_AVAILABLE_AUDIO_DEVICE");
+ "impl.media.configform.NO_AVAILABLE_AUDIO_DEVICE");
preview = new TransparentPanel(new GridBagLayout());
preview.add(new JLabel(noAvailableAudioDevice));
diff --git a/src/net/java/sip/communicator/impl/neomedia/codec/video/h264/ConfigurationPanel.java b/src/net/java/sip/communicator/impl/neomedia/codec/video/h264/ConfigurationPanel.java
index 1381d21..a3ea318 100644
--- a/src/net/java/sip/communicator/impl/neomedia/codec/video/h264/ConfigurationPanel.java
+++ b/src/net/java/sip/communicator/impl/neomedia/codec/video/h264/ConfigurationPanel.java
@@ -150,8 +150,7 @@ public class ConfigurationPanel
JCheckBox defaultIntraRefreshCheckBox
= new SIPCommCheckBox(
r.getI18NString(
- "impl.neomedia.configform.H264"
- + ".defaultIntraRefresh"));
+ "impl.neomedia.configform.H264.defaultIntraRefresh"));
cnstrnts.gridwidth = GridBagConstraints.REMAINDER;
cnstrnts.gridx = 0;
cnstrnts.gridy = 3;