diff --git a/src/net/java/sip/communicator/impl/neomedia/codec/audio/speex/JNIEncoder.java b/src/net/java/sip/communicator/impl/neomedia/codec/audio/speex/JNIEncoder.java
index 3804bfee0..ccde3bf9e 100644
--- a/src/net/java/sip/communicator/impl/neomedia/codec/audio/speex/JNIEncoder.java
+++ b/src/net/java/sip/communicator/impl/neomedia/codec/audio/speex/JNIEncoder.java
@@ -370,10 +370,10 @@ else if (inputLength < this.frameSize)
}
/**
- * Get the matching output formats for a specific format.
+ * Get the output formats matching a specific input format.
*
- * @param inputFormat input format
- * @return array for formats matching input format
+ * @param inputFormat the input format to get the matching output formats of
+ * @return the output formats matching the specified input format
* @see AbstractCodecExt#getMatchingOutputFormats(Format)
*/
@Override
diff --git a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/AbstractBufferCaptureDevice.java b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/AbstractBufferCaptureDevice.java
index a60083d09..822118638 100644
--- a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/AbstractBufferCaptureDevice.java
+++ b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/protocol/AbstractBufferCaptureDevice.java
@@ -764,8 +764,7 @@ public synchronized void start()
if (!started)
{
if (!connected)
- throw new IOException(
- getClass().getSimpleName() + " not connected");
+ throw new IOException(getClass().getName() + " not connected");
doStart();
started = true;
diff --git a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/AbstractRenderer.java b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/AbstractRenderer.java
new file mode 100644
index 000000000..6223945e7
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/AbstractRenderer.java
@@ -0,0 +1,69 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.neomedia.jmfext.media.renderer;
+
+import javax.media.*;
+
+import net.java.sip.communicator.impl.neomedia.control.*;
+
+/**
+ * Provides an abstract base implementation of Renderer in order to
+ * facilitate extenders
+ *
+ * @author Lyubomir Marinov
+ *
+ * @param the type of Format of the media data processed
+ * as input by AbstractRenderer
+ */
+public abstract class AbstractRenderer
+ extends ControlsAdapter
+ implements Renderer
+{
+ /**
+ * The Format of the media data processed as input by this
+ * Renderer.
+ */
+ protected InputFormatT inputFormat;
+
+ /**
+ * Resets the state of this PlugIn.
+ */
+ public void reset()
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ * Sets the Format of the media data to be rendered by this
+ * Renderer.
+ *
+ * @param format the Format of the media data to be rendered by
+ * this Renderer
+ * @return null if the specified format is not compatible
+ * with this Renderer; otherwise, the Format which has
+ * been successfully set
+ */
+ @SuppressWarnings("unchecked")
+ public Format setInputFormat(Format format)
+ {
+ Format matchingFormat = null;
+
+ for (Format supportedInputFormat : getSupportedInputFormats())
+ {
+ if (supportedInputFormat.matches(format))
+ {
+ matchingFormat = supportedInputFormat.intersects(format);
+ break;
+ }
+ }
+ if (matchingFormat == null)
+ return null;
+
+ inputFormat = (InputFormatT) matchingFormat;
+ return inputFormat;
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/audio/PortAudioRenderer.java b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/audio/PortAudioRenderer.java
index 543c07b76..fb40f6f32 100644
--- a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/audio/PortAudioRenderer.java
+++ b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/audio/PortAudioRenderer.java
@@ -12,8 +12,8 @@
import javax.media.format.*;
import net.java.sip.communicator.impl.neomedia.*;
-import net.java.sip.communicator.impl.neomedia.control.*;
import net.java.sip.communicator.impl.neomedia.jmfext.media.protocol.portaudio.*;
+import net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.*;
import net.java.sip.communicator.impl.neomedia.portaudio.*;
import net.java.sip.communicator.util.*;
@@ -24,8 +24,7 @@
* @author Lyubomir Marinov
*/
public class PortAudioRenderer
- extends ControlsAdapter
- implements Renderer
+ extends AbstractRenderer
{
/**
* The Logger used by the PortAudioRenderer class and its
@@ -116,12 +115,6 @@ public class PortAudioRenderer
*/
private int framesPerBuffer;
- /**
- * The JMF Format in which this PortAudioRenderer is
- * currently configured to read the audio data to be rendered.
- */
- private AudioFormat inputFormat;
-
/**
* The MediaLocator which specifies the device index of the
* PortAudio device used by this instance for rendering.
@@ -167,13 +160,18 @@ public PortAudioRenderer()
/**
* Initializes a new PortAudioRenderer instance.
- * @param enableVolumeControl whether we enable volume control or not.
+ *
+ * @param enableVolumeControl true to enable volume control;
+ * false, otherwise
*/
public PortAudioRenderer(boolean enableVolumeControl)
{
if(enableVolumeControl)
- this.gainControl = (GainControl)NeomediaActivator
- .getMediaServiceImpl().getOutputVolumeControl();
+ this.gainControl
+ = (GainControl)
+ NeomediaActivator
+ .getMediaServiceImpl()
+ .getOutputVolumeControl();
}
/**
@@ -207,6 +205,19 @@ public synchronized void close()
}
}
+ /**
+ * Implements {@link javax.media.Controls#getControls()}. Gets the controls
+ * available for the owner of this instance. The current implementation
+ * returns an empty array because it has no available controls.
+ *
+ * @return an array of Objects which represent the controls
+ * available for the owner of this instance
+ */
+ public Object[] getControls()
+ {
+ return new Object[] { gainControl };
+ }
+
/**
* Gets the MediaLocator which specifies the device index of the
* PortAudio device used by this instance for rendering.
@@ -533,13 +544,6 @@ private void process(byte[] buffer, int offset, int length)
}
}
- /**
- * Resets this PlugIn.
- */
- public void reset()
- {
- }
-
/**
* Sets the MediaLocator which specifies the device index of the
* PortAudio device to be used by PortAudioRenderer instances which
@@ -564,35 +568,6 @@ else if (PortAudioRenderer.defaultLocator.equals(defaultLocator))
PortAudioRenderer.defaultLocator = defaultLocator;
}
- /**
- * Sets the JMF Format of the audio data to be rendered by this
- * Renderer.
- *
- * @param format the JMF Format of the audio data to be redered by
- * this instance
- * @return null if the specified format is not compatible
- * with this Renderer; otherwise, the JMF Format which has
- * been successfully set
- */
- public Format setInputFormat(Format format)
- {
- Format matchingFormat = null;
-
- for (Format supportedInputFormat : getSupportedInputFormats())
- {
- if (supportedInputFormat.matches(format))
- {
- matchingFormat = supportedInputFormat.intersects(format);
- break;
- }
- }
- if (matchingFormat == null)
- return null;
-
- inputFormat = (AudioFormat) matchingFormat;
- return inputFormat;
- }
-
/**
* Sets the MediaLocator which specifies the device index of the
* PortAudio device to be used by this instance for rendering.
@@ -671,17 +646,4 @@ public synchronized void stop()
}
}
}
-
- /**
- * Implements {@link javax.media.Controls#getControls()}. Gets the controls
- * available for the owner of this instance. The current implementation
- * returns an empty array because it has no available controls.
- *
- * @return an array of Objects which represent the controls
- * available for the owner of this instance
- */
- public Object[] getControls()
- {
- return new Object[]{gainControl};
- }
}
diff --git a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
index f11298af1..a363bd6ef 100644
--- a/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
+++ b/src/net/java/sip/communicator/impl/neomedia/jmfext/media/renderer/video/JAWTRenderer.java
@@ -14,7 +14,7 @@
import javax.media.renderer.*;
import javax.swing.*;
-import net.java.sip.communicator.impl.neomedia.control.*;
+import net.java.sip.communicator.impl.neomedia.jmfext.media.renderer.*;
import net.java.sip.communicator.util.*;
/**
@@ -24,7 +24,7 @@
* @author Lyubomir Marinov
*/
public class JAWTRenderer
- extends ControlsAdapter
+ extends AbstractRenderer
implements VideoRenderer
{
/**
@@ -110,12 +110,6 @@ public class JAWTRenderer
*/
private long handle = 0;
- /**
- * The VideoFormat of the input processed by this
- * Renderer.
- */
- private VideoFormat inputFormat;
-
/**
* The last known height of the input processed by this
* JAWTRenderer.
@@ -497,14 +491,6 @@ static native void processLightweightComponentEvent(
static native void removeNotifyLightweightComponent(
long handle, Component component);
- /**
- * Resets the state of this PlugIn.
- */
- public void reset()
- {
- // TODO Auto-generated method stub
- }
-
/**
* Sets the region in the component of this VideoRenderer where the
* video is to be rendered.
@@ -547,22 +533,10 @@ public boolean setComponent(Component component)
* Renderer. Typically, it is the supported input Format
* which most closely matches the specified Format.
*/
+ @Override
public Format setInputFormat(Format format)
{
- Format matchingFormat = null;
-
- for (Format supportedInputFormat : getSupportedInputFormats())
- {
- if (supportedInputFormat.matches(format))
- {
- matchingFormat = supportedInputFormat.intersects(format);
- break;
- }
- }
- if (matchingFormat == null)
- return null;
-
- inputFormat = (VideoFormat) format;
+ super.setInputFormat(format);
/*
* Know the width and height of the input because we'll be depicting it