本文整理汇总了Java中javax.media.NoProcessorException类的典型用法代码示例。如果您正苦于以下问题:Java NoProcessorException类的具体用法?Java NoProcessorException怎么用?Java NoProcessorException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NoProcessorException类属于javax.media包,在下文中一共展示了NoProcessorException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSession
import javax.media.NoProcessorException; //导入依赖的package包/类
/**
* Create a Session using Speex Codec
*
* @param localhost localHost
* @param localPort localPort
* @param remoteHost remoteHost
* @param remotePort remotePort
* @param eventHandler eventHandler
* @param quality quality
* @param secure secure
* @param micOn micOn
* @return MediaSession
* @throws NoProcessorException
* @throws UnsupportedFormatException
* @throws IOException
* @throws GeneralSecurityException
*/
public static MediaSession createSession(String localhost, int localPort, String remoteHost, int remotePort, MediaSessionListener eventHandler, int quality, boolean secure, boolean micOn) throws NoProcessorException, UnsupportedFormatException, IOException, GeneralSecurityException {
SpeexFormat.setFramesPerPacket(1);
/**
* The master key. Hardcoded for now.
*/
byte[] masterKey = new byte[]{(byte) 0xE1, (byte) 0xF9, 0x7A, 0x0D, 0x3E, 0x01, (byte) 0x8B, (byte) 0xE0, (byte) 0xD6, 0x4F, (byte) 0xA3, 0x2C, 0x06, (byte) 0xDE, 0x41, 0x39};
/**
* The master salt. Hardcoded for now.
*/
byte[] masterSalt = new byte[]{0x0E, (byte) 0xC6, 0x75, (byte) 0xAD, 0x49, (byte) 0x8A, (byte) 0xFE, (byte) 0xEB, (byte) 0xB6, (byte) 0x96, 0x0B, 0x3A, (byte) 0xAB, (byte) 0xE6};
DatagramSocket[] localPorts = MediaSession.getLocalPorts(InetAddress.getByName(localhost), localPort);
MediaSession session = MediaSession.createInstance(remoteHost, remotePort, localPorts, quality, secure, masterKey, masterSalt);
session.setListener(eventHandler);
session.setSourceDescription(new SourceDescription[]{new SourceDescription(SourceDescription.SOURCE_DESC_NAME, "Superman", 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_EMAIL, "[email protected]", 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_LOC, InetAddress.getByName(localhost) + " Port " + session.getLocalDataPort(), 1, false), new SourceDescription(SourceDescription.SOURCE_DESC_TOOL, "JFCOM CDCIE Audio Chat", 1, false)});
return session;
}
示例2: startConversation
import javax.media.NoProcessorException; //导入依赖的package包/类
void startConversation(Message response, Transaction clientTransaction)
throws SipException, SdpParseException, SdpException, IOException,
NoDataSourceException, NoProcessorException, InterruptedException,
NotConfiguredError, NotRealizedError, NoDataSinkException,
InvalidSessionAddressException, UnknownHostException {
super.startConversation(response, clientTransaction);
DialogicAudioMessage message = (DialogicAudioMessage) messages.elementAt(0);
transmitter.playSound("file:///" + message.getWaveFile());
}
示例3: startConversation
import javax.media.NoProcessorException; //导入依赖的package包/类
void startConversation(Message response,
Transaction clientTransaction) throws SipException,
SdpParseException, SdpException, IOException,
NoDataSourceException, NoProcessorException, InterruptedException,
NotConfiguredError, NotRealizedError, NoDataSinkException,
InvalidSessionAddressException, UnknownHostException {
super.startConversation(response, clientTransaction);
dtmfThread = new DTMFThread(this, transmitter);
transmitter.addControllerListener(this);
transmitter.playSound ("file://"+diaMessage.getWaveFilename());
}
示例4: startConversation
import javax.media.NoProcessorException; //导入依赖的package包/类
void startConversation(Message response,
Transaction clientTransaction) throws SipException,
SdpParseException, SdpException, IOException,
NoDataSourceException, NoProcessorException, InterruptedException,
NotConfiguredError, NotRealizedError, NoDataSinkException,
InvalidSessionAddressException, UnknownHostException {
System.out.println("Starting conversation");
String sdpData = new String(response.getRawContent());
SdpFactory sdpFactory = new SdpFactory();
SessionDescription sessionDescription = sdpFactory
.createSessionDescription(sdpData);
Vector mediaDescriptions = sessionDescription
.getMediaDescriptions(true);
for (int mdNum = 0; mdNum < mediaDescriptions.size(); mdNum++) {
MediaDescription mediaDescription = (MediaDescription) mediaDescriptions
.elementAt(mdNum);
Media media = mediaDescription.getMedia();
String proto = media.getProtocol();
String type = media.getMediaType();
int port = media.getMediaPort();
Vector formats = media.getMediaFormats(true);
if (formats.size() < 1) {
BrokerFactory.getLoggingBroker().logWarn(
"In SIP outbound call: No audio formats");
}
int sdpFormat = SdpConstants.PCMU;
try {
sdpFormat = Integer.parseInt((String) formats.elementAt(0));
} catch (NumberFormatException nfExc) {
nfExc.printStackTrace();
}
startReceiver(localMediaPort);
transmitter = new RtpTransmitter(remoteHost, port, sdpFormat);
}
}
示例5: test
import javax.media.NoProcessorException; //导入依赖的package包/类
private static void test(File file, AviVideoFormat format) throws IOException, NoProcessorException, NoDataSinkException {
System.out.println("* Writing " + file);
DataSource source = new ImageDataSource(format);
Processor p = Manager.createProcessor(source);
Handler h = new Handler();
p.addControllerListener(h);
p.configure();
if (!h.waitForState(p, Processor.Configured)) {
throw new IOException("Could not configure processor.");
}
p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.MSVIDEO));
TrackControl trackControls[] = p.getTrackControls();
javax.media.Format formats[] = trackControls[0].getSupportedFormats();
if (formats == null || formats.length <= 0) {
throw new UnsupportedOperationException("No output formats available.");
}
String encoding = format.getEncoding();
javax.media.Format selectedFormat = null;
for (javax.media.Format f : formats) {
if (f.getEncoding().equals(encoding)) {
selectedFormat = f;
break;
}
}
if (selectedFormat == null) {
throw new UnsupportedOperationException("No output format selected.");
}
trackControls[0].setFormat(selectedFormat);
p.realize();
if (!h.waitForState(p, Processor.Realized)) {
throw new IOException("Could not realize processor.");
}
MediaLocator ml = new MediaLocator(file.toURI().toURL());
DataSink sink = Manager.createDataSink(p.getDataOutput(), ml);
sink.addDataSinkListener(h);
sink.open();
try {
sink.start();
p.start();
if (!h.waitForEndOfMedia()) {
throw new IOException("Processor reported an error.");
}
p.stop();
sink.stop();
/*
if (!h.waitForFileDone()) {
throw new IOException("DataSink reported an error.");
}*/
} finally {
p.close();
sink.close();
}
}
示例6: startConversation
import javax.media.NoProcessorException; //导入依赖的package包/类
/**
* @param response
* @param clientTransaction
* @throws SipException
* @throws SdpParseException
* @throws SdpException
* @throws IOException
* @throws NoDataSourceException
* @throws NoProcessorException
* @throws InterruptedException
* @throws NotConfiguredError
* @throws NotRealizedError
* @throws NoDataSinkException
* @throws InvalidSessionAddressException
* @throws UnknownHostException
*/
void startConversation(Message response,
Transaction clientTransaction) throws SipException,
SdpParseException, SdpException, IOException,
NoDataSourceException, NoProcessorException, InterruptedException,
NotConfiguredError, NotRealizedError, NoDataSinkException,
InvalidSessionAddressException, UnknownHostException {
System.out.println("Starting conversation");
String sdpData = new String(response.getRawContent());
SdpFactory sdpFactory = new SdpFactory();
SessionDescription sessionDescription = sdpFactory
.createSessionDescription(sdpData);
Vector mediaDescriptions = sessionDescription
.getMediaDescriptions(true);
BrokerFactory.getLoggingBroker().logDebug("We have "+mediaDescriptions.size()+" media descriptions");
for (int mdNum = 0; mdNum < mediaDescriptions.size(); mdNum++) {
MediaDescription mediaDescription = (MediaDescription) mediaDescriptions
.elementAt(mdNum);
Media media = mediaDescription.getMedia();
String proto = media.getProtocol();
String type = media.getMediaType();
int port = media.getMediaPort();
Vector formats = media.getMediaFormats(true);
if (formats.size() < 1) {
BrokerFactory.getLoggingBroker().logWarn(
"In SIP outbound call: No audio formats");
}
int sdpFormat = SdpConstants.PCMU;
try {
sdpFormat = Integer.parseInt((String) formats.elementAt(0));
} catch (NumberFormatException nfExc) {
nfExc.printStackTrace();
}
transmitter = new RtpTransmitter(remoteHost, port, sdpFormat);
startReceiver(remoteHost, port);
BrokerFactory.getLoggingBroker().logDebug("Starting transmitter");
transmitter = new RtpTransmitter(remoteHost, port, sdpFormat);
BrokerFactory.getLoggingBroker().logDebug("transmitter="+transmitter);
}
}