本文整理汇总了C++中RX_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ RX_ERROR函数的具体用法?C++ RX_ERROR怎么用?C++ RX_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RX_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rx_create_shader
bool GPUImage_UYVY422::setupShader(const char* VS, const char* FS) {
prog = rx_create_shader(VS, FS, vert_id, frag_id);
glBindAttribLocation(prog, 0, "a_pos");
glBindAttribLocation(prog, 1, "a_tex");
glLinkProgram(prog);
glUseProgram(prog);
u_tex = glGetUniformLocation(prog, "u_tex");
if(u_tex < 0) {
RX_ERROR("Error while trying to get the u_tex uniform; not used?");
return false;
}
u_pm = glGetUniformLocation(prog, "u_pm");
if(u_pm < 0) {
RX_ERROR("Error while trying to get the u_pm uniform; not used?");
return false;
}
u_mm = glGetUniformLocation(prog, "u_mm");
if(u_mm < 0) {
RX_ERROR("Error while trying to get the u_mm uniform; not used?");
return false;
}
glUniform1i(u_tex, 0);
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:29,代码来源:GPUImage_UYVY422.cpp
示例2: on_loaded
static void on_loaded(mos::ImageTask* img, void* user) {
if (0 == img->nbytes) {
RX_ERROR("The laoded image has no bytes?");
return;
}
if (NULL == pixels) {
pixels = (unsigned char*)malloc(img->nbytes);
loaded_bytes = img->nbytes;
}
else {
if (img->nbytes > loaded_bytes) {
unsigned char* tmp = (unsigned char*)realloc(pixels, img->nbytes);
if (tmp == NULL) {
RX_ERROR("Cannot realloc");
return;
}
pixels = tmp;
loaded_bytes = img->nbytes;
}
}
if (img->width != tex_width || img->height != tex_height) {
must_recreate = true;
tex_width = img->width;
tex_height = img->height;
tex_channels = img->channels;
}
memcpy(pixels, img->pixels, img->nbytes);
must_update = true;
}
开发者ID:HellicarAndLewis,项目名称:Mosaic,代码行数:34,代码来源:test_image_loader.cpp
示例3: RX_ERROR
bool YouTubeUploadStart::parse() {
if(!http_body.size()) {
RX_ERROR("The received response is empty; cannot parse result of upload start action");
return false;
}
if(http_code == 0) {
RX_ERROR("We can only start parsing the http result when we got a valid http status code. make sure that you called start() before trying to parse the result");
return false;
}
else if(http_code == 200) {
RX_VERBOSE("Need to parse/handle 200 in upload start");
}
else if(http_code >= 400) {
std::vector<YouTubeError> errors;
if(!youtube_parse_errors(http_body, errors)) {
RX_ERROR("Cannot parse the error json in the upload start");
return false;
}
for(std::vector<YouTubeError>::iterator it = errors.begin(); it != errors.end(); ++it) {
(*it).print();
}
}
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:28,代码来源:YouTubeUploadStart.cpp
示例4: RX_ERROR
bool VideoCaptureDirectShow2::closeDevice() {
if(!media_control) {
RX_ERROR("Cannot close the device because it's not setup or is already closed");
return false;
}
HRESULT hr = media_control->StopWhenReady();
if(FAILED(hr)) {
RX_ERROR("Failed to stop the capture stream");
return false;
}
safeReleaseDirectShow(&null_renderer_filter);
safeReleaseDirectShow(&device_filter);
safeReleaseDirectShow(&sample_grabber);
safeReleaseDirectShow(&sample_grabber_filter);
safeReleaseDirectShow(&media_control);
safeReleaseDirectShow(&media_event);
safeReleaseDirectShow(&capture_graph_builder);
safeReleaseDirectShow(&graph_builder);
if(capture_cb) {
delete capture_cb;
capture_cb = NULL;
}
RX_VERBOSE("%p, %p, %p, %p", null_renderer_filter, device_filter, sample_grabber, sample_grabber_filter);
RX_VERBOSE("%p, %p, %p, %p", media_control, media_event, graph_builder, capture_graph_builder);
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:31,代码来源:VideoCaptureDirectShow.cpp
示例5: RX_ERROR
bool AVEncoderSettings::validateAudio() {
if(!useAudio()) {
return true;
}
if(audio_codec != AV_CODEC_ID_MP3) {
RX_ERROR(ERR_AV_INVALID_AUDIO_CODEC_ID);
return false;
}
if(!sample_rate) {
RX_ERROR(ERR_AV_INVALID_SAMPLE_RATE);
return false;
}
if(num_channels != 1) {
RX_ERROR(ERR_AV_INVALID_NUM_CHANNELS);
return false;
}
if(!audio_bit_rate) {
RX_ERROR(ERR_AV_INVALID_AUDIO_BIT_RATE);
return false;
}
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:27,代码来源:AVTypes.cpp
示例6: uv_tcp_init
bool HTTPConnection::connect(httpconnection_event_callback eventCB, /* gets called when a socket event occurs */
void* eventUser) /* gets passed into eventCB */
{
int r = uv_tcp_init(loop, sock);
if(r) {
RX_ERROR("Cannot init socket");
return false;
}
cb_event = eventCB;
cb_event_user = eventUser;
struct addrinfo hints;
hints.ai_family = PF_INET;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = 0;
RX_VERBOSE("Connecting to: %s", host.c_str());
r = uv_getaddrinfo(loop, &resolver_req, httpconnection_on_resolved,
host.c_str(), port.c_str(), &hints);
if(r) {
RX_ERROR("cannot uv_tcp_init(): %s", uv_strerror(uv_last_error(loop)));
return false;
}
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:31,代码来源:HTTPConnection.cpp
示例7: RX_ERROR
bool MP3Writer::end() {
if(!is_setup) {
RX_ERROR(MP3_WRERR_NOT_SETUP);
return false;
}
if(!is_started) {
RX_ERROR(MP3_WRERR_NOT_STARTED);
return false;
}
int written = lame_encode_flush(lame_flags, (unsigned char*)mp3_buffer, MP3_WRITER_BUFFER_SIZE);
if(written < 0) {
RX_ERROR(MP3_WRERR_CANNOT_FLUSH);
}
else if(config.cb_data) {
config.cb_data((const char*)mp3_buffer, written, config.user);
}
lame_close(lame_flags);
config.cb_close(config.user);
lame_flags = NULL;
is_started = false;
return true;
}
开发者ID:roxlu,项目名称:roxlu,代码行数:28,代码来源:MP3Writer.cpp
示例8: httpconnection_on_connect
void httpconnection_on_connect(uv_connect_t* req, int status) {
HTTPConnection* c = static_cast<HTTPConnection*>(req->data);
if(status == -1) {
RX_ERROR("> cannot connect: %s:", uv_strerror(uv_last_error(c->loop)));
RX_ERROR("@ todo should be `delete` the connection here?");
return;
}
int r = uv_read_start((uv_stream_t*)c->sock, httpconnection_on_alloc, httpconnection_on_read);
if(r) {
RX_ERROR("> uv_read_start() failed: %s", uv_strerror(uv_last_error(c->loop)));
RX_ERROR("@ todo should be `delete` the connection here?");
return;
}
if(c->ssl) {
SSL_set_connect_state(c->ssl);
SSL_do_handshake(c->ssl);
c->buffer->update();
}
// trigger the output buffer
c->buffer->flushOutputBuffer();
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:25,代码来源:HTTPConnection.cpp
示例9: httpconnection_on_read
void httpconnection_on_read(uv_stream_t* handle, ssize_t nread, uv_buf_t buf) {
HTTPConnection* c = static_cast<HTTPConnection*>(handle->data);
if(nread < 0) {
int r = uv_read_stop(handle);
if(r) {
RX_ERROR("> error uv_read_stop: %s", uv_strerror(uv_last_error(handle->loop)));
}
if(buf.base) {
delete buf.base;
buf.base = NULL;
}
uv_err_t err = uv_last_error(handle->loop);
if(err.code != UV_EOF) {
RX_ERROR("> disconnected from server but not correctly: %s",uv_strerror(uv_last_error(handle->loop))) ;
}
r = uv_shutdown(&c->shutdown_req, handle, httpconnection_on_shutdown);
if(r) {
RX_ERROR("> error shutting down client: %s", uv_strerror(uv_last_error(handle->loop)));
RX_ERROR("@ todo should be `delete` the connection here?");
}
return;
}
c->addToInputBuffer(buf.base, nread);
if(buf.base) {
delete[] buf.base;
buf.base = NULL;
}
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:35,代码来源:HTTPConnection.cpp
示例10: on_font_load_clicked
static void on_font_load_clicked(int id, void* user) {
KankerApp* app = static_cast<KankerApp*>(user);
if (NULL == app) {
RX_ERROR("error: cannot cast to KankerApp* in on_file_selected().");
return;
}
std::vector<std::string> files;
if (0 != app->getFontFiles(files)) {
RX_ERROR("error: cannot load font, file not found.");
return;
}
if (app->selected_font_dx >= files.size()) {
RX_ERROR("error: selected font dx is too big: %d, files.size() = %lu.", app->selected_font_dx, files.size());
return;
}
std::string filepath = rx_to_data_path("fonts/" +files[app->selected_font_dx]);
if (!rx_file_exists(filepath)) {
RX_ERROR("error: cannot load file; file seems to be removed?");
return;
}
if (0 != app->kanker_font.load(filepath)) {
RX_ERROR("error: font failed to load: %s\n", filepath.c_str());
return;
}
app->font_filename = files[app->selected_font_dx];
app->switchState(KSTATE_CHAR_OVERVIEW);
}
开发者ID:roxlu,项目名称:pipslab,代码行数:34,代码来源:KankerApp.cpp
示例11: RX_ERROR
void YouTubeModel::setAccessToken(std::string atoken, uint64_t timeout) {
if(!db.insert("state").use("name", "access_token").use("value", atoken).orReplace().execute()) {
RX_ERROR("Cannot update/replace the access token");
}
if(!db.insert("state").use("name", "token_timeout").use("value", timeout).orReplace().execute()) {
RX_ERROR("Cannot update/replace the token timeout");
}
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:9,代码来源:YouTubeModel.cpp
示例12: jpeg_std_error
// decompress from memory stream
bool JPG::load(unsigned char* compressed, size_t nbytes) {
struct jpeg_error_mgr jerr;
struct jpeg_decompress_struct cinfo;
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_mem_src(&cinfo, compressed, nbytes);
int rc = jpeg_read_header(&cinfo, TRUE);
if(rc != 1) {
RX_ERROR("Error while reading the jpeg header");
return false;
}
bool need_alloc = false;
jpeg_start_decompress(&cinfo);
if(cinfo.output_width != width) {
width = cinfo.output_width;
need_alloc = true;
}
if(cinfo.output_height != height) {
height = cinfo.output_height;
need_alloc = true;
}
if(cinfo.output_components != num_channels) {
num_channels = cinfo.output_components;
need_alloc = true;
}
if(!width || !height) {
RX_ERROR("Read incorrect jpg size: %d x %d", width, height);
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return false;
}
// only allocate when the sizes or num channels change.
if(need_alloc) {
bit_depth = 8;
num_bytes = width * height * num_channels;
stride = width * num_channels;
pixels = new unsigned char[num_bytes];
}
size_t dest_row = 0;
while(cinfo.output_scanline < cinfo.output_height) {
unsigned char* buffer_array[1];
buffer_array[0] = pixels + cinfo.output_scanline * stride;
jpeg_read_scanlines(&cinfo, buffer_array, 1);
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:58,代码来源:JPG.cpp
示例13: RX_ERROR
bool VerticalBlur::setup(int w, int h) {
// CREATE SHADER
if(!shader.create(VERTICAL_BLUR_FILTER_VS, VERTICAL_BLUR_FILTER_FS)) {
RX_ERROR(ERR_GL_VBLUR_SHADER);
return false;
}
shader.bindAttribLocation("a_pos", 0);
shader.bindAttribLocation("a_tex", 1);
if(!shader.link()) {
RX_ERROR(ERR_GL_VBLUR_SHADER);
return false;
}
shader.use();
u_tex = shader.getUniformLocation("u_tex");
u_height = shader.getUniformLocation("u_height");
glUniform1f(u_height, h);
// SET BLUR VALUES
const int num_weights = 10;
char weight_uniform_name[50];
char offset_uniform_name[50];
float weights[num_weights];
float sum;
float sigma2 = blur_amount;
weights[0] = gauss(0.0f, sigma2);
sum = weights[0];
for(int i = 1; i < num_weights; ++i) {
weights[i] = gauss(i, sigma2);
sum += 2 * weights[i];
}
for(int i = 0; i < num_weights; ++i) {
sprintf(weight_uniform_name, "u_weight[%d]", i);
GLint weight_uniform_loc = glGetUniformLocation(shader.prog, weight_uniform_name);
float val = weights[i] / sum;
glUniform1f(weight_uniform_loc, val);
sprintf(offset_uniform_name, "u_pix_offset[%d]", i);
GLint offset_uniform_loc = glGetUniformLocation(shader.prog, offset_uniform_name);
glUniform1f(offset_uniform_loc, 2.5f * i);
//printf("> weight: %s, %d offset: %s, %d, value: %f\n", weight_uniform_name, weight_uniform_loc, offset_uniform_name, offset_uniform_loc, val);
}
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:53,代码来源:VerticalBlur.cpp
示例14: RX_ERROR
void InteractiveGrid::update() {
if (NULL == tracker) {
RX_ERROR("Tracker is invalid.");
return;
}
if (NULL == on_activate) {
RX_ERROR("No on_activate set so no use to execute the update function.");
return;
}
uint64_t now = rx_hrtime();
float iv_w = 1.0f / mos::config.webcam_width;
float iv_h = 1.0f / mos::config.webcam_height;
/* get the detected blobs. */
for (size_t i = 0; i < tracker->blobs.blobs.size(); ++i) {
Blob& blob = tracker->blobs.blobs[i];
#if 0
if (false == blob.matched) {
continue;
}
if (15 > blob.trail.size()) {
continue;
}
#endif
/* convert the position of the blob to a cell index. */
cv::Point& pt = blob.position;
float px = float(pt.x) * iv_w;
float py = float(pt.y) * iv_h;
int col = px * fex::config.cols;
int row = py * fex::config.rows;
int dx = row * fex::config.cols + col;
if (dx >= cells.size()) {
RX_ERROR("Not supposed to happen, but the calculated index is bigger then the total number of cells, col: %d, row: %d, dx: %d", col, row, dx);
continue;
}
InteractiveCell& cell = cells[dx];
if (0 == cell.timeout || (0 != cell.timeout && now > cell.timeout)) {
/* new cell, make active. */
//RX_VERBOSE("Activated: %d x %d, timeout: %llu", col, row, cell.timeout);
on_activate(col, row, user);
cell.timeout = now + 1e9; /* this cell can be reused after X seconds (Xe9) */
}
}
}
开发者ID:HellicarAndLewis,项目名称:Mosaic,代码行数:53,代码来源:InteractiveGrid.cpp
示例15: on_abb_load_settings_clicked
static void on_abb_load_settings_clicked(int id, void* user) {
KankerApp* app = static_cast<KankerApp*>(user);
if (NULL == app) {
RX_ERROR("Failed to cast to KankerApp");
return;
}
if (0 != app->kanker_abb.loadSettings(rx_to_data_path("abb_settings.xml"))) {
RX_ERROR("Failed to load the settings.");
}
}
开发者ID:roxlu,项目名称:pipslab,代码行数:12,代码来源:KankerApp.cpp
示例16: rx_to_data_path
bool JPG::load(std::string filename, bool datapath) {
if(datapath) {
filename = rx_to_data_path(filename);
}
struct jpeg_error_mgr jerr;
struct jpeg_decompress_struct cinfo;
FILE* fp;
JSAMPARRAY buffer;
if( (fp = fopen(filename.c_str(), "rb")) == NULL ) {
RX_ERROR(ERR_JPG_FILE_NOT_OPENED, filename.c_str());
return false;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, fp);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
stride = cinfo.output_width * cinfo.output_components;
num_channels = cinfo.output_components;
width = cinfo.output_width;
height = cinfo.output_height;
bit_depth = 8;
num_bytes = width * height * num_channels;
pixels = new unsigned char[num_bytes];
if(!pixels) {
RX_ERROR(ERR_JPG_CANNOT_ALLOC);
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(fp);
return false;
}
size_t dest_row = 0;
buffer = (*cinfo.mem->alloc_sarray)((j_common_ptr) &cinfo, JPOOL_IMAGE, stride, 1);
while(cinfo.output_scanline < cinfo.output_height) {
jpeg_read_scanlines(&cinfo, buffer, 1);
memcpy(pixels + (dest_row * stride), buffer[0], stride);
dest_row++;
}
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(fp);
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:52,代码来源:JPG.cpp
示例17: RX_ERROR
// create the request string
bool HTTPRequest::toString(std::string& result) {
// create the content string
std::string http_body;
if(!createBody(http_body)) {
RX_ERROR("Cannot create request body");
return false;
}
// create the headers.
addDefaultHTTPHeaders();
addHeader(HTTPHeader("Content-Length", http_body.size()));
// construct the request
result = getHTTPString() +"\r\n";
result += headers.join();
result += "\r\n";
#if 1
printf("%s", result.c_str());
for(size_t i = 0; i < http_body.size(); ++i) {
if(i > 40) {
break;
}
printf("%c", http_body[i]);
}
printf("\n");
for(size_t i = 0; i < http_body.size(); ++i) {
if(i > 40) {
break;
}
printf("%02X ", (unsigned char)http_body[i]);
}
printf("\n");
#endif
result += http_body;
#if 0
std::ofstream ofs(rx_to_data_path("out.raw").c_str(), std::ios::binary | std::ios::out);
if(!ofs.is_open()) {
RX_ERROR("Cannot open output file");
}
else {
ofs.write(result.c_str(), result.size());
ofs.close();
}
#endif
return true;
}
开发者ID:eighteight,项目名称:roxlu_experimental2,代码行数:53,代码来源:HTTPRequest.cpp
示例18: on_dir_change
static void on_dir_change(std::string dir, std::string filename, void* user) {
/* get a handle */
mos::ImageLoader* loader = static_cast<mos::ImageLoader*>(user);
if (NULL == loader) {
RX_ERROR("Invalid user pointer.");
return;
}
if (0 != loader->load(dir +"/" +filename)) {
RX_ERROR("Failed to load file.");
}
}
开发者ID:HellicarAndLewis,项目名称:Mosaic,代码行数:13,代码来源:test_image_loader.cpp
示例19: on_abb_send_message_to_robot_clicked
static void on_abb_send_message_to_robot_clicked(int id, void* user) {
KankerApp* app = static_cast<KankerApp*>(user);
if (NULL == app) {
RX_ERROR("Failed to cast to KankerApp");
return;
}
if (0 != app->controller.writeText(12, app->test_message)) {
RX_ERROR("Failed to write the text to the ABB.");
return;
}
}
开发者ID:roxlu,项目名称:pipslab,代码行数:13,代码来源:KankerApp.cpp
示例20: RX_ERROR
bool JPG::setPixels(unsigned char* pix, int w, int h, J_COLOR_SPACE type) {
if(!pix) {
RX_ERROR("Invalid pixels given");
return false;
}
if(!w) {
RX_ERROR("Invalid width given");
return false;
}
if(!h) {
RX_ERROR("invalid height given");
return false;
}
if(pixels) {
delete[] pixels;
pixels = NULL;
}
color_space = type;
width = w;
height = h;
switch(color_space) {
case JCS_RGB: {
num_bytes = width * height * 3;
num_channels = 3;
stride = width * 3;
bit_depth = 8;
break;
}
default: {
RX_ERROR("Unhandled color space: %d", type);
return false;
}
}
pixels = new unsigned char[num_bytes];
if(!pixels) {
RX_ERROR("Cannot allocate %ld bytes for the jpg", num_bytes);
return false;
}
memcpy((char*)pixels, (char*)pix, num_bytes);
return true;
}
开发者ID:basseyndon,项目名称:roxlu_experimental,代码行数:50,代码来源:JPG.cpp
注:本文中的RX_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论