mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 13:11:08 +01:00
Jingle Media Manager for Multiple Media Managers.
JIngle Media Manager Refactoring. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7361 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
18c14f70d4
commit
945561242a
8 changed files with 180 additions and 242 deletions
|
|
@ -28,6 +28,8 @@ import org.jivesoftware.jingleaudio.JMFInit;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Implements a jingleMediaManager using JMF based API.
|
||||
|
|
@ -38,6 +40,8 @@ import java.io.IOException;
|
|||
*/
|
||||
public class JmfMediaManager extends JingleMediaManager {
|
||||
|
||||
private List<PayloadType> payloads = new ArrayList<PayloadType>();
|
||||
|
||||
/**
|
||||
* Creates a Media Manager instance
|
||||
*/
|
||||
|
|
@ -62,8 +66,25 @@ public class JmfMediaManager extends JingleMediaManager {
|
|||
* Setup API supported Payloads
|
||||
*/
|
||||
private void setupPayloads() {
|
||||
this.addPayloadType(new PayloadType.Audio(3, "gsm"));
|
||||
this.addPayloadType(new PayloadType.Audio(4, "g723"));
|
||||
payloads.add(new PayloadType.Audio(3, "gsm"));
|
||||
payloads.add(new PayloadType.Audio(4, "g723"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all supported Payloads for this Manager
|
||||
*
|
||||
* @return The Payload List
|
||||
*/
|
||||
public List<PayloadType> getPayloads() {
|
||||
return payloads;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred Payload Type
|
||||
*/
|
||||
public PayloadType getPreferredPayloadType() {
|
||||
//TODO a better way to choose the preferred Payload
|
||||
return payloads.size() > 0 ? payloads.get(0) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -71,47 +92,40 @@ public class JmfMediaManager extends JingleMediaManager {
|
|||
* devices are properly detected and initialized by JMF.
|
||||
*/
|
||||
public static void setupJMF() {
|
||||
try {
|
||||
// .jmf is the place where we store the jmf.properties file used
|
||||
// by JMF. if the directory does not exist or it does not contain
|
||||
// a jmf.properties file. or if the jmf.properties file has 0 length
|
||||
// then this is the first time we're running and should continue to
|
||||
// with JMFInit
|
||||
String homeDir = System.getProperty("user.home");
|
||||
File jmfDir = new File(homeDir, ".jmf");
|
||||
String classpath = System.getProperty("java.class.path");
|
||||
classpath += System.getProperty("path.separator")
|
||||
+ jmfDir.getAbsolutePath();
|
||||
System.setProperty("java.class.path", classpath);
|
||||
|
||||
// .jmf is the place where we store the jmf.properties file used
|
||||
// by JMF. if the directory does not exist or it does not contain
|
||||
// a jmf.properties file. or if the jmf.properties file has 0 length
|
||||
// then this is the first time we're running and should continue to
|
||||
// with JMFInit
|
||||
String homeDir = System.getProperty("user.home");
|
||||
File jmfDir = new File(homeDir, ".jmf");
|
||||
String classpath = System.getProperty("java.class.path");
|
||||
classpath += System.getProperty("path.separator")
|
||||
+ jmfDir.getAbsolutePath();
|
||||
System.setProperty("java.class.path", classpath);
|
||||
if (!jmfDir.exists())
|
||||
jmfDir.mkdir();
|
||||
|
||||
if (!jmfDir.exists())
|
||||
jmfDir.mkdir();
|
||||
File jmfProperties = new File(jmfDir, "jmf.properties");
|
||||
|
||||
File jmfProperties = new File(jmfDir, "jmf.properties");
|
||||
|
||||
if (!jmfProperties.exists()) {
|
||||
try {
|
||||
jmfProperties.createNewFile();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
System.out.println("Failed to create jmf.properties");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
if (!jmfProperties.exists()) {
|
||||
try {
|
||||
jmfProperties.createNewFile();
|
||||
}
|
||||
catch (IOException ex) {
|
||||
System.out.println("Failed to create jmf.properties");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
// if we're running on linux checkout that libjmutil.so is where it
|
||||
// should be and put it there.
|
||||
runLinuxPreInstall();
|
||||
|
||||
//if (jmfProperties.length() == 0) {
|
||||
JMFInit init = new JMFInit(null, false);
|
||||
//}
|
||||
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
// if we're running on linux checkout that libjmutil.so is where it
|
||||
// should be and put it there.
|
||||
runLinuxPreInstall();
|
||||
|
||||
//if (jmfProperties.length() == 0) {
|
||||
new JMFInit(null, false);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue