本文整理汇总了C++中UsageEnvironment::setResultMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ UsageEnvironment::setResultMsg方法的具体用法?C++ UsageEnvironment::setResultMsg怎么用?C++ UsageEnvironment::setResultMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UsageEnvironment
的用法示例。
在下文中一共展示了UsageEnvironment::setResultMsg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenInputFifo
int OpenInputFifo(UsageEnvironment& env, char const* fileName) {
int fid=open(fileName,O_RDONLY|O_NONBLOCK,0);
if (fid < 1) {
env.setResultMsg("unable to open file \"",fileName, "\"");
}
return fid;
}
示例2: fEnviron
Medium::Medium(UsageEnvironment& env)
: fEnviron(env), fNextTask(NULL) {
// First generate a name for the new medium:
MediaLookupTable::ourMedia(env)->generateNewName(fMediumName, mediumNameMaxLen);
env.setResultMsg(fMediumName);
// Then add it to our table:
MediaLookupTable::ourMedia(env)->addNew(this, fMediumName);
}
示例3: lookupByName
Boolean Medium::lookupByName(UsageEnvironment& env, char const* mediumName,
Medium*& resultMedium) {
resultMedium = MediaLookupTable::ourMedia(env)->lookup(mediumName);
if (resultMedium == NULL) {
env.setResultMsg("Medium ", mediumName, " does not exist");
return False;
}
return True;
}
示例4: lookupByName
Boolean DarwinInjector::lookupByName(UsageEnvironment& env, char const* name,
DarwinInjector*& result) {
result = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, name, medium)) return False;
if (!medium->isDarwinInjector()) {
env.setResultMsg(name, " is not a 'Darwin injector'");
return False;
}
result = (DarwinInjector*)medium;
return True;
}
示例5: lookupByName
Boolean RTPSink::lookupByName(UsageEnvironment& env, char const* sinkName,
RTPSink*& resultSink) {
resultSink = NULL; // unless we succeed
MediaSink* sink;
if (!MediaSink::lookupByName(env, sinkName, sink)) return False;
if (!sink->isRTPSink()) {
env.setResultMsg(sinkName, " is not a RTP sink");
return False;
}
resultSink = (RTPSink*)sink;
return True;
}
示例6: lookupByName
Boolean FramedSource::lookupByName(UsageEnvironment& env, char const* sourceName,
FramedSource*& resultSource) {
resultSource = NULL; // unless we succeed
MediaSource* source;
if (!MediaSource::lookupByName(env, sourceName, source)) return False;
if (!source->isFramedSource()) {
env.setResultMsg(sourceName, " is not a framed source");
return False;
}
resultSource = (FramedSource*)source;
return True;
}
示例7: lookupByName
Boolean MediaSink::lookupByName(UsageEnvironment& env, char const* sinkName,
MediaSink*& resultSink) {
resultSink = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, sinkName, medium)) return False;
if (!medium->isSink()) {
env.setResultMsg(sinkName, " is not a media sink");
return False;
}
resultSink = (MediaSink*)medium;
return True;
}
示例8: output
Boolean Groupsock::output(UsageEnvironment& env, u_int8_t ttlToSend,
unsigned char* buffer, unsigned bufferSize,
DirectedNetInterface* interfaceNotToFwdBackTo) {
do {
// First, do the datagram send, to each destination:
Boolean writeSuccess = True;
for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
int res = 0;
if (!(res = write(dests->fGroupEId.groupAddress().s_addr, dests->fPort, ttlToSend,
buffer, bufferSize))) {
if (-1 == res)
{
fprintf(stderr, "errno = %d, errorsrting = %s\n", strerror(errno));
}
writeSuccess = False;
break;
}
}
if (!writeSuccess) break;
statsOutgoing.countPacket(bufferSize);
statsGroupOutgoing.countPacket(bufferSize);
// Then, forward to our members:
int numMembers = 0;
if (!members().IsEmpty()) {
numMembers =
outputToAllMembersExcept(interfaceNotToFwdBackTo,
ttlToSend, buffer, bufferSize,
ourIPAddress(env));
if (numMembers < 0) break;
}
if (DebugLevel >= 3) {
env << *this << ": wrote " << bufferSize << " bytes, ttl "
<< (unsigned)ttlToSend;
if (numMembers > 0) {
env << "; relayed to " << numMembers << " members";
}
env << "\n";
}
return True;
} while (0);
if (DebugLevel >= 0) { // this is a fatal error
env.setResultMsg("Groupsock write failed: ", env.getResultMsg());
}
return False;
}
示例9: lookupByName
Boolean RTCPInstance::lookupByName(UsageEnvironment& env,
char const* instanceName,
RTCPInstance*& resultInstance) {
resultInstance = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, instanceName, medium)) return False;
if (!medium->isRTCPInstance()) {
env.setResultMsg(instanceName, " is not a RTCP instance");
return False;
}
resultInstance = (RTCPInstance*)medium;
return True;
}
示例10: lookupByName
Boolean RTSPServer::lookupByName(UsageEnvironment& env,
char const* name,
RTSPServer*& resultServer) {
resultServer = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, name, medium)) return False;
if (!medium->isRTSPServer()) {
env.setResultMsg(name, " is not a RTSP server");
return False;
}
resultServer = (RTSPServer*)medium;
return True;
}
示例11: lookupByName
Boolean MediaSession::lookupByName(UsageEnvironment& env,
char const* instanceName,
MediaSession*& resultSession) {
resultSession = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, instanceName, medium)) return False;
if (!medium->isMediaSession()) {
env.setResultMsg(instanceName, " is not a 'MediaSession' object");
return False;
}
resultSession = (MediaSession*)medium;
return True;
}
示例12: lookupByName
Boolean MediaSource::lookupByName(UsageEnvironment& env,
char const* sourceName,
MediaSource*& resultSource) {
resultSource = NULL; // unless we succeed
Medium* medium;
if (!Medium::lookupByName(env, sourceName, medium)) return False;
if (!medium->isSource()) {
env.setResultMsg(sourceName, " is not a media source");
return False;
}
resultSource = (MediaSource*)medium;
return True;
}
示例13: output
Boolean Groupsock::output(UsageEnvironment& env, unsigned char* buffer, unsigned bufferSize,
DirectedNetInterface* interfaceNotToFwdBackTo) {
do {
// First, do the datagram send, to each destination:
Boolean writeSuccess = True;
for (destRecord* dests = fDests; dests != NULL; dests = dests->fNext) {
if (!write(dests->fGroupEId.groupAddress().s_addr, dests->fGroupEId.portNum(), dests->fGroupEId.ttl(),
buffer, bufferSize)) {
writeSuccess = False;
break;
}
}
if (!writeSuccess) break;
statsOutgoing.countPacket(bufferSize);
statsGroupOutgoing.countPacket(bufferSize);
// Then, forward to our members:
int numMembers = 0;
if (!members().IsEmpty()) {
numMembers =
outputToAllMembersExcept(interfaceNotToFwdBackTo,
ttl(), buffer, bufferSize,
ourIPAddress(env));
if (numMembers < 0) break;
}
if (DebugLevel >= 3) {
env << *this << ": wrote " << bufferSize << " bytes, ttl " << (unsigned)ttl();
if (numMembers > 0) {
env << "; relayed to " << numMembers << " members";
}
env << "\n";
}
return True;
} while (0);
if (DebugLevel >= 0) { // this is a fatal error
UsageEnvironment::MsgString msg = strDup(env.getResultMsg());
env.setResultMsg("Groupsock write failed: ", msg);
delete[] (char*)msg;
}
return False;
}
示例14: AudioInputDevice
WAVAudioFileSource::WAVAudioFileSource(UsageEnvironment& env, FILE* fid)
: AudioInputDevice(env, 0, 0, 0, 0)/* set the real parameters later */,
fFid(fid), fFidIsSeekable(False), fLastPlayTime(0), fHaveStartedReading(False), fWAVHeaderSize(0), fFileSize(0),
fScaleFactor(1), fLimitNumBytesToStream(False), fNumBytesToStream(0), fAudioFormat(WA_UNKNOWN) {
// Check the WAV file header for validity.
// Note: The following web pages contain info about the WAV format:
// http://www.ringthis.com/dev/wave_format.htm
// http://www.lightlink.com/tjweber/StripWav/Canon.html
// http://www.onicos.com/staff/iz/formats/wav.html
Boolean success = False; // until we learn otherwise
do {
// RIFF Chunk:
if (nextc != 'R' || nextc != 'I' || nextc != 'F' || nextc != 'F') break;
if (!skipBytes(fid, 4)) break;
if (nextc != 'W' || nextc != 'A' || nextc != 'V' || nextc != 'E') break;
// Skip over any chunk that's not a FORMAT ('fmt ') chunk:
u_int32_t tmp;
if (!get4Bytes(fid, tmp)) break;
while (tmp != 0x20746d66/*'fmt ', little-endian*/) {
// Skip this chunk:
u_int32_t chunkLength;
if (!get4Bytes(fid, chunkLength)) break;
if (!skipBytes(fid, chunkLength)) break;
if (!get4Bytes(fid, tmp)) break;
}
// FORMAT Chunk (the 4-byte header code has already been parsed):
unsigned formatLength;
if (!get4Bytes(fid, formatLength)) break;
unsigned short audioFormat;
if (!get2Bytes(fid, audioFormat)) break;
fAudioFormat = (unsigned char)audioFormat;
if (fAudioFormat != WA_PCM && fAudioFormat != WA_PCMA && fAudioFormat != WA_PCMU && fAudioFormat != WA_IMA_ADPCM) {
// It's a format that we don't (yet) understand
env.setResultMsg("Audio format is not one that we handle (PCM/PCMU/PCMA or IMA ADPCM)");
break;
}
unsigned short numChannels;
if (!get2Bytes(fid, numChannels)) break;
fNumChannels = (unsigned char)numChannels;
if (fNumChannels < 1 || fNumChannels > 2) { // invalid # channels
char errMsg[100];
sprintf(errMsg, "Bad # channels: %d", fNumChannels);
env.setResultMsg(errMsg);
break;
}
if (!get4Bytes(fid, fSamplingFrequency)) break;
if (fSamplingFrequency == 0) {
env.setResultMsg("Bad sampling frequency: 0");
break;
}
if (!skipBytes(fid, 6)) break; // "nAvgBytesPerSec" (4 bytes) + "nBlockAlign" (2 bytes)
unsigned short bitsPerSample;
if (!get2Bytes(fid, bitsPerSample)) break;
fBitsPerSample = (unsigned char)bitsPerSample;
if (fBitsPerSample == 0) {
env.setResultMsg("Bad bits-per-sample: 0");
break;
}
if (!skipBytes(fid, formatLength - 16)) break;
// FACT chunk (optional):
int c = nextc;
if (c == 'f') {
if (nextc != 'a' || nextc != 'c' || nextc != 't') break;
unsigned factLength;
if (!get4Bytes(fid, factLength)) break;
if (!skipBytes(fid, factLength)) break;
c = nextc;
}
// EYRE chunk (optional):
if (c == 'e') {
if (nextc != 'y' || nextc != 'r' || nextc != 'e') break;
unsigned eyreLength;
if (!get4Bytes(fid, eyreLength)) break;
if (!skipBytes(fid, eyreLength)) break;
c = nextc;
}
// DATA Chunk:
if (c != 'd' || nextc != 'a' || nextc != 't' || nextc != 'a') break;
if (!skipBytes(fid, 4)) break;
// The header is good; the remaining data are the sample bytes.
fWAVHeaderSize = (unsigned)TellFile64(fid);
success = True;
} while (0);
if (!success) {
env.setResultMsg("Bad WAV file format");
// Set "fBitsPerSample" to zero, to indicate failure:
fBitsPerSample = 0;
return;
}
fPlayTimePerSample = 1e6/(double)fSamplingFrequency;
//.........这里部分代码省略.........
示例15: ourIPAddress
netAddressBits ourIPAddress(UsageEnvironment& env) {
static netAddressBits ourAddress = 0;
int sock = -1;
struct in_addr testAddr;
if (ourAddress == 0) {
// We need to find our source address
struct sockaddr_in fromAddr;
fromAddr.sin_addr.s_addr = 0;
// Get our address by sending a (0-TTL) multicast packet,
// receiving it, and looking at the source address used.
// (This is kinda bogus, but it provides the best guarantee
// that other nodes will think our address is the same as we do.)
do {
loopbackWorks = 0; // until we learn otherwise
testAddr.s_addr = our_inet_addr("228.67.43.91"); // arbitrary
Port testPort(15947); // ditto
sock = setupDatagramSocket(env, testPort);
if (sock < 0) break;
if (!socketJoinGroup(env, sock, testAddr.s_addr)) break;
unsigned char testString[] = "hostIdTest";
unsigned testStringLength = sizeof testString;
if (!writeSocket(env, sock, testAddr, testPort, 0,
testString, testStringLength)) break;
unsigned char readBuffer[20];
struct timeval timeout;
timeout.tv_sec = 5;
timeout.tv_usec = 0;
int bytesRead = readSocket(env, sock,
readBuffer, sizeof readBuffer,
fromAddr, &timeout);
if (bytesRead == 0 // timeout occurred
|| bytesRead != (int)testStringLength
|| strncmp((char*)readBuffer, (char*)testString,
testStringLength) != 0) {
break;
}
loopbackWorks = 1;
} while (0);
if (!loopbackWorks) do {
// We couldn't find our address using multicast loopback
// so try instead to look it up directly.
char hostname[100];
hostname[0] = '\0';
#ifndef CRIS
gethostname(hostname, sizeof hostname);
#endif
if (hostname[0] == '\0') {
env.setResultErrMsg("initial gethostname() failed");
break;
}
#if defined(VXWORKS)
#include <hostLib.h>
if (ERROR == (ourAddress = hostGetByName( hostname ))) break;
#else
struct hostent* hstent
= (struct hostent*)gethostbyname(hostname);
if (hstent == NULL || hstent->h_length != 4) {
env.setResultErrMsg("initial gethostbyname() failed");
break;
}
// Take the first address that's not bad
// (This code, like many others, won't handle IPv6)
netAddressBits addr = 0;
for (unsigned i = 0; ; ++i) {
char* addrPtr = hstent->h_addr_list[i];
if (addrPtr == NULL) break;
netAddressBits a = *(netAddressBits*)addrPtr;
if (!badAddress(a)) {
addr = a;
break;
}
}
if (addr != 0) {
fromAddr.sin_addr.s_addr = addr;
} else {
env.setResultMsg("no address");
break;
}
} while (0);
// Make sure we have a good address:
netAddressBits from = fromAddr.sin_addr.s_addr;
if (badAddress(from)) {
char tmp[100];
sprintf(tmp,
"This computer has an invalid IP address: 0x%x",
(netAddressBits)(ntohl(from)));
env.setResultMsg(tmp);
//.........这里部分代码省略.........