2007-05-02 21:55:59 +02:00
|
|
|
/**
|
2014-02-19 10:38:30 +01:00
|
|
|
*
|
2007-05-02 21:55:59 +02:00
|
|
|
* Copyright 2003-2006 Jive Software.
|
2014-02-19 10:38:30 +01:00
|
|
|
*
|
2014-02-17 18:57:38 +01:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
2007-05-02 21:55:59 +02:00
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2014-02-19 10:38:30 +01:00
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
2007-05-02 21:55:59 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2014-08-20 00:25:57 +02:00
|
|
|
package org.jivesoftware.smackx.jingleold.mediaimpl.sshare;
|
2007-05-02 21:55:59 +02:00
|
|
|
|
2014-08-20 00:25:57 +02:00
|
|
|
import org.jivesoftware.smackx.jingleold.JingleSession;
|
|
|
|
import org.jivesoftware.smackx.jingleold.media.JingleMediaManager;
|
|
|
|
import org.jivesoftware.smackx.jingleold.media.JingleMediaSession;
|
|
|
|
import org.jivesoftware.smackx.jingleold.media.PayloadType;
|
|
|
|
import org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api.ImageDecoder;
|
|
|
|
import org.jivesoftware.smackx.jingleold.mediaimpl.sshare.api.ImageEncoder;
|
|
|
|
import org.jivesoftware.smackx.jingleold.nat.JingleTransportManager;
|
|
|
|
import org.jivesoftware.smackx.jingleold.nat.TransportCandidate;
|
2007-05-02 21:55:59 +02:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a JingleMediaManager for ScreenSharing.
|
|
|
|
* It currently uses an Audio payload Type. Which needs to be fixed in the next version.
|
|
|
|
*
|
|
|
|
* @author Thiago Camargo
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class ScreenShareMediaManager extends JingleMediaManager {
|
|
|
|
|
2008-05-20 00:54:19 +02:00
|
|
|
public static final String MEDIA_NAME = "ScreenShare";
|
|
|
|
|
2007-05-02 21:55:59 +02:00
|
|
|
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
|
|
|
|
|
|
|
private ImageDecoder decoder = null;
|
|
|
|
private ImageEncoder encoder = null;
|
|
|
|
|
2008-05-20 00:54:19 +02:00
|
|
|
public ScreenShareMediaManager(JingleTransportManager transportManager) {
|
|
|
|
super(transportManager);
|
2007-05-02 21:55:59 +02:00
|
|
|
setupPayloads();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setup API supported Payloads
|
|
|
|
*/
|
|
|
|
private void setupPayloads() {
|
|
|
|
payloads.add(new PayloadType.Audio(30, "sshare"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return all supported Payloads for this Manager.
|
|
|
|
*
|
|
|
|
* @return The Payload List
|
|
|
|
*/
|
|
|
|
public List<PayloadType> getPayloads() {
|
|
|
|
return payloads;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-03-29 12:15:32 +02:00
|
|
|
* Returns a new JingleMediaSession.
|
2007-05-02 21:55:59 +02:00
|
|
|
*
|
|
|
|
* @param payloadType payloadType
|
|
|
|
* @param remote remote Candidate
|
|
|
|
* @param local local Candidate
|
|
|
|
* @return JingleMediaSession JingleMediaSession
|
|
|
|
*/
|
2007-05-08 22:31:46 +02:00
|
|
|
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
|
2007-05-02 21:55:59 +02:00
|
|
|
ScreenShareSession session = null;
|
2007-05-08 22:31:46 +02:00
|
|
|
session = new ScreenShareSession(payloadType, remote, local, "Screen", jingleSession);
|
2007-05-02 21:55:59 +02:00
|
|
|
if (encoder != null) {
|
|
|
|
session.setEncoder(encoder);
|
|
|
|
}
|
|
|
|
if (decoder != null) {
|
|
|
|
session.setDecoder(decoder);
|
|
|
|
}
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PayloadType getPreferredPayloadType() {
|
|
|
|
return super.getPreferredPayloadType();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ImageDecoder getDecoder() {
|
|
|
|
return decoder;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setDecoder(ImageDecoder decoder) {
|
|
|
|
this.decoder = decoder;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ImageEncoder getEncoder() {
|
|
|
|
return encoder;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEncoder(ImageEncoder encoder) {
|
|
|
|
this.encoder = encoder;
|
|
|
|
}
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2008-05-20 00:54:19 +02:00
|
|
|
public String getName() {
|
|
|
|
return MEDIA_NAME;
|
|
|
|
}
|
2007-05-02 21:55:59 +02:00
|
|
|
}
|