本文整理汇总了C++中ERR_PRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ ERR_PRINT函数的具体用法?C++ ERR_PRINT怎么用?C++ ERR_PRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ERR_PRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ERR_PRINT
/*
* make frame object from vp8 binary data.
* @param prev_frame ref for prev analyzed vp8 frame.
* @param data vp8 data
* @param data_size vp8 data size
* @param non_copy_mode true:hold pointer. false:copy data.
* @param pts pts for vp8 frame.
* @param timebase timebase for pts.
* @return vp8 frame
*/
ttLibC_Vp8 *ttLibC_Vp8_getFrame(ttLibC_Vp8 *prev_frame, uint8_t *data, size_t data_size, bool non_copy_mode, uint64_t pts, uint32_t timebase) {
if(data_size <= 0x0A) {
ERR_PRINT("data size is too small for analyze.");
return NULL;
}
bool isKey = ttLibC_Vp8_isKey(data, data_size);
uint32_t width = ttLibC_Vp8_getWidth(prev_frame, data, data_size);
uint32_t height = ttLibC_Vp8_getHeight(prev_frame, data, data_size);
if(width == 0 || height == 0) {
return NULL;
}
return ttLibC_Vp8_make(prev_frame, isKey ? videoType_key : videoType_inner, width, height, data, data_size, non_copy_mode, pts, timebase);
}
示例2: ttLibC_DynamicBuffer_markAsRead
bool ttLibC_DynamicBuffer_markAsRead(ttLibC_DynamicBuffer *buffer, size_t read_size) {
ttLibC_DynamicBuffer_ *buffer_ = (ttLibC_DynamicBuffer_ *)buffer;
if(buffer_ == NULL) {
return false;
}
if(buffer_->read_pos + read_size > buffer_->target_size) {
ERR_PRINT("read_size is bigger than target_size, overflowed.");
buffer_->inherit_super.error = ttLibC_updateError(Target_On_Util, Error_InvalidOperation);
return false;
}
buffer_->read_pos += read_size;
return true;
}
示例3: call
bool NativeScriptInstance::refcount_decremented() {
Variant::CallError err;
Variant ret = call("_refcount_decremented", NULL, 0, err);
if (err.error != Variant::CallError::CALL_OK && err.error != Variant::CallError::CALL_ERROR_INVALID_METHOD) {
ERR_PRINT("Failed to invoke _refcount_decremented - should not happen");
return true; // assume we can destroy the object
}
if (err.error == Variant::CallError::CALL_ERROR_INVALID_METHOD) {
// the method does not exist, default is true
return true;
}
return ret;
}
示例4: ERR_PRINT
bool StrUtilTest::DoReplace(const char* sTestData, const char* sTestResult, const char* sOldKey, const char* sNewKey)
{
char sBuf[64] = {0};
if (StringUtil::Replace(sTestData, sBuf, sizeof(sBuf), sOldKey, sNewKey) == false) {
ERR_PRINT("Replace string failed!\n");
return false;
}
DBG_PRINT("Replace result: %s\n", sBuf);
if (strcmp(sTestResult, sBuf) != 0) {
return false;
}
return true;
}
示例5: ERR_FAIL_COND_V
const void *PoolAllocator::get(ID p_mem) const {
if (!needs_locking) {
const Entry *e=get_entry(p_mem);
ERR_FAIL_COND_V(!e,NULL);
return &pool[e->pos];
}
mt_lock();
const Entry *e=get_entry(p_mem);
if (!e) {
mt_unlock();
ERR_FAIL_COND_V(!e,NULL);
}
if (e->lock==0) {
mt_unlock();
ERR_PRINT( "e->lock == 0" );
return NULL;
}
if (e->pos<0 || (int)e->pos>=pool_size) {
mt_unlock();
ERR_PRINT("e->pos<0 || e->pos>=pool_size");
return NULL;
}
const void *ptr=&pool[e->pos];
mt_unlock();
return ptr;
}
示例6: ttLibC_malloc
/*
* make openal play device.
* @param buffer_num number for queue buffers.
*/
ttLibC_AlDevice *ttLibC_AlDevice_make(uint32_t buffer_num) {
ttLibC_AlDevice_ *device = ttLibC_malloc(sizeof(ttLibC_AlDevice_));
if(device == NULL) {
ERR_PRINT("failed to allocate memory for alDevice.");
return NULL;
}
device->device = alcOpenDevice(NULL);
if(device->device == NULL) {
ERR_PRINT("failed to open ALCdevice.");
ttLibC_free(device);
return NULL;
}
device->context = alcCreateContext(device->device, NULL);
if(device->context == NULL) {
ERR_PRINT("failed to create ALCcontext.");
alcCloseDevice(device->device);
ttLibC_free(device);
return NULL;
}
alcMakeContextCurrent(device->context);
alGenSources(1, &device->source);
device->inherit_super.buffer_num = buffer_num;
device->buffers = ttLibC_malloc(sizeof(ALuint) * device->inherit_super.buffer_num);
if(device->buffers == NULL) {
ERR_PRINT("failed to allocate memory for buffers");
alDeleteSources(1, &device->source);
alcMakeContextCurrent(NULL);
alcDestroyContext(device->context);
alcCloseDevice(device->device);
ttLibC_free(device);
return NULL;
}
for(uint32_t i = 0;i < device->inherit_super.buffer_num;++ i) {
device->buffers[i] = 0;
}
return (ttLibC_AlDevice *)device;
}
示例7: ERR_FAIL_COND_V
Error StreamPeerWinsock::connect(const IP_Address& p_host, uint16_t p_port) {
ERR_FAIL_COND_V( p_host.host == 0, ERR_INVALID_PARAMETER);
if ((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {
ERR_PRINT("Socket creation failed!");
disconnect();
//perror("socket");
return FAILED;
};
unsigned long par = 1;
if (ioctlsocket(sockfd, FIONBIO, &par)) {
perror("setting non-block mode");
disconnect();
return FAILED;
};
struct sockaddr_in their_addr;
set_addr_in(their_addr, p_host, p_port);
if (::connect(sockfd, (struct sockaddr *)&their_addr,sizeof(struct sockaddr)) == SOCKET_ERROR) {
if (WSAGetLastError() != WSAEWOULDBLOCK) {
ERR_PRINT("Connection to remote host failed!");
disconnect();
return FAILED;
};
status = STATUS_CONNECTING;
} else {
status = STATUS_CONNECTED;
};
peer_host = p_host;
peer_port = p_port;
return OK;
};
示例8: ERR_PRINT
bool NetworkUtil::GetInterfaceMAC(const char* sIfName, unsigned char* sMAC, unsigned int* uMACLen)
{
struct ifreq ifr;
int sockfd;
int nRet;
bool bRet;
bRet = SocketUtil::Socket(AF_INET, SOCK_DGRAM, 0, &sockfd);
if (bRet == false) {
ERR_PRINT("SocketUtil::Socket() error!\n");
return false;
}
bzero(&ifr, sizeof(ifr));
strncpy(ifr.ifr_name, sIfName, sizeof(ifr.ifr_name));
nRet = ioctl(sockfd, SIOCGIFHWADDR, &ifr);
if (nRet < 0) {
nRet = errno;
ERR_PRINT("%s\n",strerror(nRet));
return false;
}
bRet = SocketUtil::Close(sockfd);
if (bRet == false) {
ERR_PRINT("SocketUtil::Close() error!\n");
return false;
}
if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) {
ERR_PRINT("Invalid family (%d)!\n", ifr.ifr_hwaddr.sa_family);
return false;
}
memcpy(sMAC, &(ifr.ifr_hwaddr.sa_data), MAX_ADDR_LEN - 1);
*uMACLen = MAX_ADDR_LEN - 1;
return true;
}
示例9: encode_variant
void ScriptDebuggerRemote::_put_variable(const String &p_name, const Variant &p_variable) {
packet_peer_stream->put_var(p_name);
int len = 0;
Error err = encode_variant(p_variable, NULL, len);
if (err != OK)
ERR_PRINT("Failed to encode variant");
if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
packet_peer_stream->put_var(Variant());
} else {
packet_peer_stream->put_var(p_variable);
}
}
示例10: ttLibC_Yuv420_close
/*
* close frame
* @param frame
*/
void ttLibC_Yuv420_close(ttLibC_Yuv420 **frame) {
ttLibC_Yuv420 *target = (*frame);
if(target == NULL) {
return;
}
if(target->inherit_super.inherit_super.type != frameType_yuv420) {
ERR_PRINT("found non yuv420 frame in yuv420_close.");
}
if(!target->inherit_super.inherit_super.is_non_copy) {
ttLibC_free(target->inherit_super.inherit_super.data);
}
ttLibC_free(target);
*frame = NULL;
}
示例11: ttLibC_Vp9_isKey
/*
* check if the vp9 binary is key frame.
* @param data vp9 data
* @param data_size vp9 data size
* @return true: key frame false:inter frame
*/
bool ttLibC_Vp9_isKey(void *data, size_t data_size) {
ttLibC_ByteReader *reader = ttLibC_ByteReader_make(data, data_size, ByteUtilType_default);
ttLibC_ByteReader_bit(reader, 2);
ttLibC_ByteReader_bit(reader, 1);
ttLibC_ByteReader_bit(reader, 1);
uint32_t ref_flag = ttLibC_ByteReader_bit(reader, 1);
if(ref_flag == 1) {
ERR_PRINT("ref func is not implemented yet.");
ttLibC_ByteReader_bit(reader, 3);
}
uint32_t key_frame_flag = ttLibC_ByteReader_bit(reader, 1);
ttLibC_ByteReader_close(&reader);
return (key_frame_flag == 0);
}
示例12: mt_lock
void PoolAllocator::unlock(ID p_mem) {
if (!needs_locking)
return;
mt_lock();
Entry *e = get_entry(p_mem);
if (e->lock == 0) {
mt_unlock();
ERR_PRINT("e->lock == 0");
return;
}
e->lock--;
mt_unlock();
}
示例13: ERR_PRINT
IP_Address IP_Unix::_resolve_hostname(const String& p_hostname) {
struct hostent *he;
if ((he=gethostbyname(p_hostname.utf8().get_data())) == NULL) { // get the host info
ERR_PRINT("gethostbyname failed!");
return IP_Address();
}
IP_Address ip;
ip.host= *((unsigned long*)he->h_addr);
return ip;
}
示例14: lock
void AudioDriverCoreAudio::capture_finish() {
if (input_unit) {
lock();
AURenderCallbackStruct callback;
zeromem(&callback, sizeof(AURenderCallbackStruct));
OSStatus result = AudioUnitSetProperty(input_unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &callback, sizeof(callback));
if (result != noErr) {
ERR_PRINT("AudioUnitSetProperty failed");
}
result = AudioUnitUninitialize(input_unit);
if (result != noErr) {
ERR_PRINT("AudioUnitUninitialize failed");
}
#ifdef OSX_ENABLED
AudioObjectPropertyAddress prop;
prop.mSelector = kAudioHardwarePropertyDefaultInputDevice;
prop.mScope = kAudioObjectPropertyScopeGlobal;
prop.mElement = kAudioObjectPropertyElementMaster;
result = AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop, &input_device_address_cb, this);
if (result != noErr) {
ERR_PRINT("AudioObjectRemovePropertyListener failed");
}
#endif
result = AudioComponentInstanceDispose(input_unit);
if (result != noErr) {
ERR_PRINT("AudioComponentInstanceDispose failed");
}
input_unit = NULL;
unlock();
}
}
示例15: ttLibC_Video_close
/*
* close frame
* @param frame
*/
void ttLibC_Video_close(ttLibC_Video **frame) {
ttLibC_Video *target = *frame;
if(target == NULL) {
return;
}
switch(target->inherit_super.type) {
case frameType_bgr:
ttLibC_Bgr_close((ttLibC_Bgr **)frame);
break;
case frameType_flv1:
ttLibC_Flv1_close((ttLibC_Flv1 **)frame);
break;
case frameType_h264:
ttLibC_H264_close((ttLibC_H264 **)frame);
break;
case frameType_jpeg:
ttLibC_Jpeg_close((ttLibC_Jpeg **)frame);
break;
case frameType_yuv420:
ttLibC_Yuv420_close((ttLibC_Yuv420 **)frame);
break;
case frameType_vp6:
ttLibC_Vp6_close((ttLibC_Vp6 **)frame);
break;
case frameType_vp8:
ttLibC_Vp8_close((ttLibC_Vp8 **)frame);
break;
case frameType_vp9:
ttLibC_Vp9_close((ttLibC_Vp9 **)frame);
break;
case frameType_wmv1:
ttLibC_Wmv1_close((ttLibC_Wmv1 **)frame);
break;
case frameType_wmv2:
ttLibC_Wmv2_close((ttLibC_Wmv2 **)frame);
break;
case frameType_theora:
ttLibC_Theora_close((ttLibC_Theora **)frame);
break;
case frameType_h265:
{
ttLibC_Video_close_(frame);
}
break;
default:
ERR_PRINT("unknown type:%d", target->inherit_super.type);
break;
}
}