Adds user interface to control the H.264 encoder's use of Periodic Intra Refresh and maximum interval between keyframes.

cusax-fix
Lyubomir Marinov 13 years ago
parent c335965f2b
commit 328f9b587c

@ -1418,14 +1418,16 @@ impl.neomedia.configform.AUDIO=Audio
impl.neomedia.configform.VIDEO=Video
impl.neomedia.configform.H264=H.264
impl.neomedia.configform.H264.defaultIntraRefresh=Periodic Intra Refresh
impl.neomedia.configform.H264.defaultProfile=Default profile to encode into:
impl.neomedia.configform.H264.defaultProfile.baseline=Baseline
impl.neomedia.configform.H264.defaultProfile.main=Main
impl.neomedia.configform.H264.defaultProfile.high=High
impl.neomedia.configform.H264.preset=Encoder Preset
impl.neomedia.configform.H264.defaultProfile.main=Main
impl.neomedia.configform.H264.keyint=Maximum interval between key frames
impl.neomedia.configform.H264.preferredKeyFrameRequester=Preferred method to request key frames:
impl.neomedia.configform.H264.preferredKeyFrameRequester.rtcp=RTCP
impl.neomedia.configform.H264.preferredKeyFrameRequester.signaling=Signaling
impl.neomedia.configform.H264.preset=Encoder Preset
# The callrecordingconfig plugin was never really committed into trunk and its
# ConfigurationForm was actually put in the neomedia bundle.

@ -10,6 +10,7 @@
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.impl.neomedia.*;
import net.java.sip.communicator.plugin.desktoputil.*;
@ -20,9 +21,10 @@
import org.jitsi.service.resources.*;
/**
* Implements the H.264 configuration form (panel).
* Implements the H.264 configuration form/panel.
*
* @author Lyubomir Marinov
* @author Damian Minkov
*/
public class ConfigurationPanel
extends TransparentPanel
@ -37,114 +39,140 @@ public class ConfigurationPanel
*/
public ConfigurationPanel()
{
/* Create the UI components. */
super(new FlowLayout());
// Create the UI components.
super(new BorderLayout());
TransparentPanel contentPanel
= new TransparentPanel(new GridBagLayout());
add(contentPanel);
add(contentPanel, BorderLayout.NORTH);
ResourceManagementService resources = NeomediaActivator.getResources();
GridBagConstraints gridBagConstraints = new GridBagConstraints();
ResourceManagementService r = NeomediaActivator.getResources();
GridBagConstraints cnstrnts = new GridBagConstraints();
JLabel defaultProfileLabel
= new JLabel(
resources.getI18NString(
cnstrnts.anchor = GridBagConstraints.FIRST_LINE_START;
cnstrnts.fill = GridBagConstraints.HORIZONTAL;
Component defaultProfileLabel
= createLineWrapLabel(
r.getI18NString(
"impl.neomedia.configform.H264.defaultProfile"));
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
contentPanel.add(defaultProfileLabel, gridBagConstraints);
cnstrnts.gridx = 0;
cnstrnts.gridy = 0;
cnstrnts.weightx = 1;
contentPanel.add(defaultProfileLabel, cnstrnts);
JComboBox defaultProfileComboBox = new JComboBox();
defaultProfileComboBox.setEditable(false);
defaultProfileComboBox.addItem(
new NameValuePair(
resources.getI18NString(
r.getI18NString(
"impl.neomedia.configform.H264.defaultProfile."
+ JNIEncoder.BASELINE_PROFILE),
JNIEncoder.BASELINE_PROFILE));
defaultProfileComboBox.addItem(
new NameValuePair(
resources.getI18NString(
r.getI18NString(
"impl.neomedia.configform.H264.defaultProfile."
+ JNIEncoder.MAIN_PROFILE),
JNIEncoder.MAIN_PROFILE));
defaultProfileComboBox.addItem(
new NameValuePair(
resources.getI18NString(
r.getI18NString(
"impl.neomedia.configform.H264.defaultProfile."
+ JNIEncoder.HIGH_PROFILE),
JNIEncoder.HIGH_PROFILE));
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
contentPanel.add(defaultProfileComboBox, gridBagConstraints);
JLabel preferredKeyFrameRequesterLabel
= new JLabel(
resources.getI18NString(
cnstrnts.gridx = 1;
cnstrnts.gridy = 0;
cnstrnts.weightx = 0;
contentPanel.add(defaultProfileComboBox, cnstrnts);
Component preferredKeyFrameRequesterLabel
= createLineWrapLabel(
r.getI18NString(
"impl.neomedia.configform.H264"
+ ".preferredKeyFrameRequester"));
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
contentPanel.add(preferredKeyFrameRequesterLabel, gridBagConstraints);
cnstrnts.gridx = 0;
cnstrnts.gridy = 1;
cnstrnts.weightx = 1;
contentPanel.add(preferredKeyFrameRequesterLabel, cnstrnts);
JComboBox preferredKeyFrameRequesterComboBox = new JComboBox();
preferredKeyFrameRequesterComboBox.setEditable(false);
preferredKeyFrameRequesterComboBox.addItem(
new NameValuePair(
resources.getI18NString(
r.getI18NString(
"impl.neomedia.configform.H264"
+ ".preferredKeyFrameRequester."
+ KeyFrameControl.KeyFrameRequester.RTCP),
KeyFrameControl.KeyFrameRequester.RTCP));
preferredKeyFrameRequesterComboBox.addItem(
new NameValuePair(
resources.getI18NString(
r.getI18NString(
"impl.neomedia.configform.H264"
+ ".preferredKeyFrameRequester."
+ KeyFrameControl.KeyFrameRequester.SIGNALING),
KeyFrameControl.KeyFrameRequester.SIGNALING));
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
cnstrnts.gridx = 1;
cnstrnts.gridy = 1;
cnstrnts.weightx = 0;
contentPanel.add(
preferredKeyFrameRequesterComboBox,
gridBagConstraints);
cnstrnts);
JLabel presetLabel
= new JLabel(resources.getI18NString(
"impl.neomedia.configform.H264.preset"));
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
contentPanel.add(presetLabel, gridBagConstraints);
Component presetLabel
= createLineWrapLabel(
r.getI18NString("impl.neomedia.configform.H264.preset"));
cnstrnts.gridx = 0;
cnstrnts.gridy = 2;
cnstrnts.weightx = 1;
contentPanel.add(presetLabel, cnstrnts);
JComboBox presetComboBox = new JComboBox();
presetComboBox.setEditable(false);
for(String presetSetting : JNIEncoder.AVAILABLE_PRESETS)
{
presetComboBox.addItem(
new NameValuePair(presetSetting, presetSetting));
}
gridBagConstraints.anchor = GridBagConstraints.LINE_START;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
contentPanel.add(
presetComboBox,
gridBagConstraints);
for (String preset : JNIEncoder.AVAILABLE_PRESETS)
presetComboBox.addItem(new NameValuePair(preset, preset));
cnstrnts.gridx = 1;
cnstrnts.gridy = 2;
cnstrnts.weightx = 0;
contentPanel.add(presetComboBox, cnstrnts);
/*
* Load the values from the ConfigurationService into the UI components.
*/
ConfigurationService configuration
= NeomediaActivator.getConfigurationService();
JCheckBox defaultIntraRefreshCheckBox
= new SIPCommCheckBox(
r.getI18NString(
"impl.neomedia.configform.H264"
+ ".defaultIntraRefresh"));
cnstrnts.gridwidth = GridBagConstraints.REMAINDER;
cnstrnts.gridx = 0;
cnstrnts.gridy = 3;
cnstrnts.weightx = 1;
contentPanel.add(defaultIntraRefreshCheckBox, cnstrnts);
cnstrnts.gridwidth = 1;
Component keyintLabel
= createLineWrapLabel(
r.getI18NString("impl.neomedia.configform.H264.keyint"));
cnstrnts.gridx = 0;
cnstrnts.gridy = 4;
cnstrnts.weightx = 1;
contentPanel.add(keyintLabel, cnstrnts);
JSpinner keyintSpinner
= new JSpinner(
new SpinnerNumberModel(
JNIEncoder.DEFAULT_KEYINT,
1, JNIEncoder.X264_KEYINT_MAX_INFINITE,
JNIEncoder.DEFAULT_FRAME_RATE));
cnstrnts.gridx = 1;
cnstrnts.gridy = 4;
cnstrnts.weightx = 0;
contentPanel.add(keyintSpinner, cnstrnts);
// Load the values from the ConfigurationService into the UI components.
ConfigurationService cfg = NeomediaActivator.getConfigurationService();
setSelectedNameValuePair(
defaultProfileComboBox,
configuration.getString(
cfg.getString(
JNIEncoder.DEFAULT_PROFILE_PNAME,
JNIEncoder.DEFAULT_DEFAULT_PROFILE));
addActionListener(
@ -153,7 +181,7 @@ public ConfigurationPanel()
setSelectedNameValuePair(
preferredKeyFrameRequesterComboBox,
configuration.getString(
cfg.getString(
KeyFrameControl.KeyFrameRequester.PREFERRED_PNAME,
KeyFrameControl.KeyFrameRequester.DEFAULT_PREFERRED));
addActionListener(
@ -162,9 +190,50 @@ public ConfigurationPanel()
setSelectedNameValuePair(
presetComboBox,
configuration.getString(
JNIEncoder.PRESET_PNAME, JNIEncoder.DEFAULT_PRESET));
cfg.getString(
JNIEncoder.PRESET_PNAME,
JNIEncoder.DEFAULT_PRESET));
addActionListener(presetComboBox, JNIEncoder.PRESET_PNAME);
defaultIntraRefreshCheckBox.setSelected(
cfg.getBoolean(
JNIEncoder.DEFAULT_INTRA_REFRESH_PNAME,
JNIEncoder.DEFAULT_DEFAULT_INTRA_REFRESH));
defaultIntraRefreshCheckBox.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JCheckBox checkBox = (JCheckBox) e.getSource();
NeomediaActivator
.getConfigurationService()
.setProperty(
JNIEncoder.DEFAULT_INTRA_REFRESH_PNAME,
Boolean.toString(
checkBox.isSelected()));
}
});
keyintSpinner.setValue(
cfg.getInt(JNIEncoder.KEYINT_PNAME, JNIEncoder.DEFAULT_KEYINT));
keyintSpinner.addChangeListener(
new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
JSpinner spinner = (JSpinner) e.getSource();
SpinnerNumberModel model
= (SpinnerNumberModel) spinner.getModel();
int value = model.getNumber().intValue();
NeomediaActivator
.getConfigurationService()
.setProperty(
JNIEncoder.KEYINT_PNAME,
Integer.toString(value));
}
});
}
/**
@ -199,6 +268,28 @@ public void actionPerformed(ActionEvent e)
});
}
/**
* Initializes a new <tt>Component</tt> instance which is to display a
* specific text in the fashion of <tt>JLabel</tt> and with line wrapping.
*
* @param text the text to be displayed by the new instance
* @return a new <tt>Component</tt> instance which displays the specified
* <tt>text</tt> in the fashion of <tt>JLabel</tt> and with line wrapping
*/
private Component createLineWrapLabel(String text)
{
JTextArea textArea = new JTextArea();
textArea.setEditable(false);
textArea.setFocusable(false);
textArea.setLineWrap(true);
textArea.setOpaque(false);
textArea.setText(text);
return textArea;
}
/**
* Sets the selected item in a specific <tt>JComboBox</tt> populated with
* <tt>NameValuePair</tt>s to the one which has a specific <tt>value</tt>.
@ -209,16 +300,13 @@ public void actionPerformed(ActionEvent e)
*/
private void setSelectedNameValuePair(JComboBox comboBox, String value)
{
int itemCount = comboBox.getItemCount();
for (int itemIndex = 0; itemIndex < itemCount; itemIndex++)
for (int i = 0, count = comboBox.getItemCount(); i < count; i++)
{
NameValuePair nameValuePair
= (NameValuePair) comboBox.getItemAt(itemIndex);
NameValuePair nameValuePair = (NameValuePair) comboBox.getItemAt(i);
if (nameValuePair.value.equals(value))
{
comboBox.setSelectedIndex(itemIndex);
comboBox.setSelectedIndex(i);
break;
}
}

@ -10,7 +10,6 @@
import net.java.sip.communicator.service.protocol.*;
import org.jitsi.service.configuration.*;
import org.jivesoftware.smack.util.*;
import org.osgi.framework.*;

@ -15,9 +15,7 @@
import net.java.sip.communicator.plugin.desktoputil.wizard.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.jabber.*;
import org.jitsi.util.*;
/**
* The <tt>JabberAccountRegistrationForm</tt>.

Loading…
Cancel
Save