diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaManager.java index ac80f39a6..738d0ca4e 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaManager.java @@ -61,4 +61,5 @@ public abstract class JingleMediaManager { * @return */ public abstract JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local); -} \ No newline at end of file + + } \ No newline at end of file diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaSession.java index 0bc631c0d..a905f3403 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/media/JingleMediaSession.java @@ -23,11 +23,11 @@ import org.jivesoftware.smackx.jingle.nat.TransportCandidate; /** * Public Abstract Class provides a clear interface between Media Session and Jingle API. - * + *
* When a Jingle Session is fully stablished, we will have a Payload Type and two transport candidates defined for it. * Smack Jingle API donīt implement Media Transmit and Receive methods. * But provides an interface to let the user implements it using another API. For instance: JMF. - * + * * The Class that implements this one, must have the support to transmit and receive the jmf. * This interface let the user choose his own jmf API. * @@ -41,19 +41,23 @@ public abstract class JingleMediaSession { private TransportCandidate local; // Remote Transport details private TransportCandidate remote; + // Media Locator + private String mediaLocator; /** * Creates a new JingleMediaSession Instance to handle Media methods. * - * @param payloadType Payload Type of the transmittion - * @param remote Remote accepted Transport Candidate - * @param local Local accepted Transport Candidate + * @param payloadType Payload Type of the transmittion + * @param remote Remote accepted Transport Candidate + * @param local Local accepted Transport Candidate + * @param mediaLocator Media Locator of the capture device */ public JingleMediaSession(PayloadType payloadType, TransportCandidate remote, - TransportCandidate local) { + TransportCandidate local, String mediaLocator) { this.local = local; this.remote = remote; this.payloadType = payloadType; + this.mediaLocator = mediaLocator; } /** @@ -83,6 +87,24 @@ public abstract class JingleMediaSession { return remote; } + /** + * Return the media locator or null if not defined + * + * @return media locator + */ + public String getMediaLocator() { + return mediaLocator; + } + + /** + * Set the media locator + * + * @param mediaLocator media locator or null to use default + */ + public void setMediaLocator(String mediaLocator) { + this.mediaLocator = mediaLocator; + } + /** * Initialize the RTP Channel preparing to transmit and receive. */ @@ -101,6 +123,7 @@ public abstract class JingleMediaSession { /** * Set transmit activity. If the active is true, the instance should trasmit. * If it is set to false, the instance should pause transmit. + * * @param active */ public abstract void setTrasmit(boolean active); diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioMediaSession.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioMediaSession.java index 1aa05db7b..ce765e53c 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioMediaSession.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/AudioMediaSession.java @@ -41,19 +41,6 @@ import java.net.ServerSocket; public class AudioMediaSession extends JingleMediaSession { private AudioChannel audioChannel; - private String locator = "dsound://"; - - /** - * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates - * - * @param payloadType Payload of the jmf - * @param remote The remote information. The candidate that the jmf will be sent to. - * @param local The local information. The candidate that will receive the jmf - */ - public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote, - final TransportCandidate local) { - this(payloadType, remote, local, "dsound://"); - } /** * Creates a org.jivesoftware.jingleaudio.jmf.AudioMediaSession with defined payload type, remote and local candidates @@ -65,9 +52,7 @@ public class AudioMediaSession extends JingleMediaSession { */ public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, String locator) { - super(payloadType, remote, local); - if (locator != null && !locator.equals("")) - this.locator = locator; + super(payloadType, remote, local, locator==null?"dsound://":locator); initialize(); } @@ -97,7 +82,7 @@ public class AudioMediaSession extends JingleMediaSession { remotePort = this.getRemote().getPort(); } - audioChannel = new AudioChannel(new MediaLocator(locator), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType())); + audioChannel = new AudioChannel(new MediaLocator(this.getMediaLocator()), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType())); } /** diff --git a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/JmfMediaManager.java b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/JmfMediaManager.java index 5ac6c91fe..d730dc542 100644 --- a/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/JmfMediaManager.java +++ b/jingle/extension/source/org/jivesoftware/smackx/jingle/mediaimpl/jmf/JmfMediaManager.java @@ -41,6 +41,7 @@ import java.util.ArrayList; public class JmfMediaManager extends JingleMediaManager { private List