这篇教程C++ zprintf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ zprintf函数的具体用法?C++ zprintf怎么用?C++ zprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zprintf函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: v4l2_reset_cropstatic inline int v4l2_reset_crop (zbar_video_t *vdo){ /* check cropping */ struct v4l2_cropcap ccap; memset(&ccap, 0, sizeof(ccap)); ccap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(ioctl(vdo->fd, VIDIOC_CROPCAP, &ccap) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "querying crop support (VIDIOC_CROPCAP)")); zprintf(1, "crop bounds: %d x %d @ (%d, %d)/n", ccap.bounds.width, ccap.bounds.height, ccap.bounds.left, ccap.bounds.top); zprintf(1, "current crop win: %d x %d @ (%d, %d) aspect %d / %d/n", ccap.defrect.width, ccap.defrect.height, ccap.defrect.left, ccap.defrect.top, ccap.pixelaspect.numerator, ccap.pixelaspect.denominator); if(!vdo->width || !vdo->height) { vdo->width = ccap.defrect.width; vdo->height = ccap.defrect.height; } /* reset crop parameters */ struct v4l2_crop crop; memset(&crop, 0, sizeof(crop)); crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; crop.c = ccap.defrect; if(ioctl(vdo->fd, VIDIOC_S_CROP, &crop) < 0 && errno != EINVAL) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "setting default crop window (VIDIOC_S_CROP)")); return(0);}
开发者ID:newpouy,项目名称:uosdroid,代码行数:33,
示例2: wht_printf_scaled_bidirvoid wht_printf_scaled_bidir(const struct wht *w1, unsigned int b1, const struct wht *w2, unsigned int b2, zfile f) { int64_t s[4]; uint64_t n = b1 + b2; if (n == 0) { return; /* there was no data, so there is no WHT to print */ } /* combine each direction */ s[0] = w1->spectrum[0] + w2->spectrum[0]; s[1] = w1->spectrum[1] + w2->spectrum[1]; s[2] = w1->spectrum[2] + w2->spectrum[2]; s[3] = w1->spectrum[3] + w2->spectrum[3]; zprintf(f, ",/"wht/":[%.5g,%.5g,%.5g,%.5g]", (float) s[0] / n, (float) s[1] / n, (float) s[2] / n, (float) s[3] / n);#if 0 zprintf(f, ",/"RAW1/":[%d,%d,%d,%d]", w1->spectrum[0], w1->spectrum[1], w1->spectrum[2], w1->spectrum[3]); zprintf(f, ",/"RAW2/":[%d,%d,%d,%d]", w1->spectrum[0], w1->spectrum[1], w1->spectrum[2], w1->spectrum[3]);#endif }
开发者ID:CornSoiliml,项目名称:joy,代码行数:34,
示例3: _zbar_video_openint _zbar_video_open (zbar_video_t *vdo, const char *dev){ vdo->fd = open(dev, O_RDWR); if(vdo->fd < 0) return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "opening video device '%s'", dev)); zprintf(1, "opened camera device %s (fd=%d)/n", dev, vdo->fd); int rc = -1;#ifdef HAVE_LINUX_VIDEODEV2_H if(vdo->intf != VIDEO_V4L1) rc = _zbar_v4l2_probe(vdo); if(rc)#else zprintf(1, "WARNING: not compiled with v4l2 support, trying v4l1/n");#endif rc = _zbar_v4l1_probe(vdo); if(rc && vdo->fd >= 0) { close(vdo->fd); vdo->fd = -1; } return(rc);}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:25,
示例4: slicevoid slice(){ slice_vertical_position = getbits(8); zprintf(3, "/nslice_start_code = 0x000001%02X/n", slice_vertical_position); if (vertical_size > 2800) { slice_vertical_position_extension = getbits(3); zprintf(3, " slice_vertical_position_extension = %d/n", slice_vertical_position_extension); mb_row = (slice_vertical_position_extension << 7) + slice_vertical_position - 1; } else mb_row = slice_vertical_position - 1; previous_macroblock_address = (mb_row * mb_width) - 1; if (sequence_scalable_extension_present == 1) if (scalable_mode == DATA_PARTITIONING) zprintf(3, " priority_breakpoint = %d/n", getbits(7)); zprintf(3, " quantiser_scale_code = %d/n", getbits(5)); if (nextbits(1) == 1) { zprintf(3, " intra_slice_flag = %d/n", get1bit()); zprintf(3, " intra_slice = %d/n", get1bit()); zprintf(3, " reserve_bits = %d/n", getbits(7)); while (nextbits(1) == 1) { zprintf(3, " extra_bit_slice = %d/n", get1bit()); zprintf(3, " extra_information_slice = %d/n", getbits(8)); } } zprintf(3, " extra_bit_slice = %d/n", get1bit());// do// macroblock();// while (nextbits(23) != 0); next_start_code();}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:35,
示例5: cmd_add_cidint cmd_add_cid(proc_add_cid_t rec) { uint16_t addr=rec.token.addr; if( addr < GP_START_TICKET_BOUND ) { addr=devices[rec.dev].bound_token; } uint64_t cid2=db_get_cid_by_a(addr); if ( cid2 != 0 && cid2 != rec.token.cid ) { zprintf(3, "Conflict in db was: 0x%016llX, new: 0x%016llX for addr: 0x%04x/n", cid2, rec.token.cid, addr); return 0; } gp_token_rec_t t2; memset(&t2, 0, sizeof(gp_token_rec_t)); int2bin(t2.cid, rec.token.cid, 6, devices[rec.dev].cid_revert); t2.attr=rec.token.attr; t2.schedule_mask=rec.token.schedule_mask; // t2.attr=0; t2.schedule_mask=0xFF; t2.schedule_mask=1; zprintf(7,"Writing cid: 0x%012llX, dev=%d, addr=0x%04X, mask=0x%02X/n", rec.token.cid, rec.dev, addr, rec.token.schedule_mask); ad_set_token(AD_Q_SECOND, rec.dev, addr, &t2, 1); if( addr >= devices[rec.dev].bound_token ) { devices[rec.dev].bound_token = addr + sizeof(gp_token_rec_t); gp_cfg.max_bound_token=MAX(gp_cfg.max_bound_token,devices[rec.dev].bound_token); ad_set_token_bound(AD_Q_SECOND, rec.dev, devices[rec.dev].bound_token); } return 1;}
开发者ID:eusafe,项目名称:libgate,代码行数:31,
示例6: video_init_imagesstatic inline int video_init_images (zbar_video_t *vdo){ int i; assert(vdo->datalen); if(vdo->iomode != VIDEO_MMAP) { assert(!vdo->buf); vdo->buflen = vdo->num_images * vdo->datalen; vdo->buf = calloc(1, vdo->buflen); if(!vdo->buf) return(err_capture(vdo, SEV_FATAL, ZBAR_ERR_NOMEM, __func__, "unable to allocate image buffers")); zprintf(1, "pre-allocated %d %s buffers size=0x%lx/n", vdo->num_images, (vdo->iomode == VIDEO_READWRITE) ? "READ" : "USERPTR", vdo->buflen); } for(i = 0; i < vdo->num_images; i++) { zbar_image_t *img = vdo->images[i]; img->format = vdo->format; zbar_image_set_size(img, vdo->width, vdo->height); if(vdo->iomode != VIDEO_MMAP) { unsigned long offset = i * vdo->datalen; img->datalen = vdo->datalen; img->data = (uint8_t*)vdo->buf + offset; zprintf(2, " [%02d] @%08lx/n", i, offset); } } return(0);}
开发者ID:0359xiaodong,项目名称:OpenAtlas,代码行数:28,
示例7: v4l2_set_formatstatic int v4l2_set_format (zbar_video_t *vdo, uint32_t fmt){ struct v4l2_format vfmt; struct v4l2_pix_format *vpix = &vfmt.fmt.pix; memset(&vfmt, 0, sizeof(vfmt)); vfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vpix->width = vdo->width; vpix->height = vdo->height; vpix->pixelformat = fmt; vpix->field = V4L2_FIELD_NONE; int rc = 0; if((rc = ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt)) < 0) { /* several broken drivers return an error if we request * no interlacing (NB v4l2 spec violation) * ...try again with an interlaced request */ zprintf(1, "VIDIOC_S_FMT returned %d(%d), trying interlaced.../n", rc, errno); /* FIXME this might be _ANY once we can de-interlace */ vpix->field = V4L2_FIELD_INTERLACED; if(ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt) < 0) return(err_capture_int(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "setting format %x (VIDIOC_S_FMT)", fmt)); zprintf(0, "WARNING: broken driver returned error when non-interlaced" " format requested/n"); } struct v4l2_format newfmt; struct v4l2_pix_format *newpix = &newfmt.fmt.pix; memset(&newfmt, 0, sizeof(newfmt)); newfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if(ioctl(vdo->fd, VIDIOC_G_FMT, &newfmt) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "querying format (VIDIOC_G_FMT)")); if(newpix->field != V4L2_FIELD_NONE) err_capture(vdo, SEV_WARNING, ZBAR_ERR_INVALID, __func__, "video driver only supports interlaced format," " vertical scanning may not work"); if(newpix->pixelformat != fmt /* FIXME bpl/bpp checks? */) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "video driver can't provide compatible format")); vdo->format = fmt; vdo->width = newpix->width; vdo->height = newpix->height; vdo->datalen = newpix->sizeimage; zprintf(1, "set new format: %.4s(%08x) %u x %u (0x%lx)/n", (char*)&vdo->format, vdo->format, vdo->width, vdo->height, vdo->datalen); return(0);}
开发者ID:newpouy,项目名称:uosdroid,代码行数:59,
示例8: _zbar_v4l2_probeint _zbar_v4l2_probe (zbar_video_t *vdo){ /* check capabilities */ struct v4l2_capability vcap; memset(&vcap, 0, sizeof(vcap)); if(ioctl(vdo->fd, VIDIOC_QUERYCAP, &vcap) < 0) return(err_capture(vdo, SEV_WARNING, ZBAR_ERR_UNSUPPORTED, __func__, "video4linux version 2 not supported (VIDIOC_QUERYCAP)")); zprintf(1, "%.32s on %.32s driver %.16s (version %u.%u.%u)/n", vcap.card, (vcap.bus_info[0]) ? (char*)vcap.bus_info : "<unknown>", vcap.driver, (vcap.version >> 16) & 0xff, (vcap.version >> 8) & 0xff, vcap.version & 0xff); zprintf(1, " capabilities:%s%s%s%s/n", (vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE) ? " CAPTURE" : "", (vcap.capabilities & V4L2_CAP_VIDEO_OVERLAY) ? " OVERLAY" : "", (vcap.capabilities & V4L2_CAP_READWRITE) ? " READWRITE" : "", (vcap.capabilities & V4L2_CAP_STREAMING) ? " STREAMING" : ""); if(!(vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE) || !(vcap.capabilities & (V4L2_CAP_READWRITE | V4L2_CAP_STREAMING))) return(err_capture(vdo, SEV_WARNING, ZBAR_ERR_UNSUPPORTED, __func__, "v4l2 device does not support usable CAPTURE")); if(v4l2_reset_crop(vdo)) /* ignoring errors (driver cropping support questionable) */; if(!vdo->width || !vdo->height) { /* fallback to large size, driver reduces to max available */ vdo->width = 640 * 64; vdo->height = 480 * 64; } if(v4l2_probe_formats(vdo)) return(-1); /* FIXME report error and fallback to readwrite? (if supported...) */ if(vdo->iomode != VIDEO_READWRITE && (vcap.capabilities & V4L2_CAP_STREAMING) && v4l2_probe_iomode(vdo)) return(-1); if(!vdo->iomode) vdo->iomode = VIDEO_READWRITE; zprintf(1, "using I/O mode: %s/n", (vdo->iomode == VIDEO_READWRITE) ? "READWRITE" : (vdo->iomode == VIDEO_MMAP) ? "MMAP" : (vdo->iomode == VIDEO_USERPTR) ? "USERPTR" : "<UNKNOWN>"); vdo->intf = VIDEO_V4L2; vdo->init = v4l2_init; vdo->cleanup = v4l2_cleanup; vdo->start = v4l2_start; vdo->stop = v4l2_stop; vdo->nq = v4l2_nq; vdo->dq = v4l2_dq; return(0);}
开发者ID:newpouy,项目名称:uosdroid,代码行数:59,
示例9: test_hexvoid test_hex(void){ zprintf("%%8x %8x</n", 0xabc); zprintf("%%08x %08x</n", 0xabc); zprintf("%%-8x %-8x</n", 0xabc); zprintf("%%8X %8X</n", 0xabc); zprintf("%%8p %8p</n", 0xabc);}
开发者ID:fs495,项目名称:avr,代码行数:8,
示例10: test_stringvoid test_string(void){ zprintf("<%c>/n", 'a'); zprintf("<%s>/n", "abcde"); zprintf("<%2s>/n", "abcde"); zprintf("<%10s>/n", "abcde"); zprintf("<%-10s>/n", "abcde");}
开发者ID:fs495,项目名称:avr,代码行数:8,
示例11: picture_temporal_scalable_extensionvoid picture_temporal_scalable_extension(){ zprintf(1, " picture_temporal_scalable_extension_id = %01X/n", getbits(4)); zprintf(2, " reference_select_code = %d/n", getbits(2)); zprintf(2, " forward_temporal_reference = %d/n", getbits(10)); zprintf(2, " marker bit = %d/n", get1bit()); zprintf(2, " backward_temporal_reference = %d/n", getbits(10)); next_start_code();}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:9,
示例12: zbar_image_writeint zbar_image_write (const zbar_image_t *img, const char *filebase){ int len = strlen(filebase) + 16; char *filename = (char *)malloc(len); int n = 0, rc = 0; FILE *f; zimg_hdr_t hdr; strcpy(filename, filebase); if((img->format & 0xff) >= ' ') n = snprintf(filename, len, "%s.%.4s.zimg", filebase, (char*)&img->format); else n = snprintf(filename, len, "%s.%08" PRIx32 ".zimg", filebase, img->format); assert(n < len - 1); filename[len - 1] = '/0'; zprintf(1, "dumping %.4s(%08" PRIx32 ") image to %s/n", (char*)&img->format, img->format, filename); f = fopen(filename, "w"); if(!f) {#ifdef HAVE_ERRNO_H rc = errno; zprintf(1, "ERROR opening %s: %s/n", filename, strerror(rc));#else rc = 1;#endif goto error; } hdr.magic = 0x676d697a; hdr.format = img->format; hdr.width = img->width; hdr.height = img->height; hdr.size = img->datalen; if(fwrite(&hdr, sizeof(hdr), 1, f) != 1 || fwrite(img->data, 1, img->datalen, f) != img->datalen) {#ifdef HAVE_ERRNO_H rc = errno; zprintf(1, "ERROR writing %s: %s/n", filename, strerror(rc));#else rc = 1;#endif fclose(f); goto error; } rc = fclose(f);error: free(filename); return(rc);}
开发者ID:UNIVERSAL-IT-SYSTEMS,项目名称:lib-zbar,代码行数:56,
示例13: cb_push_new_cid_defaultint cb_push_new_cid_default (proc_add_cid_t rec) { zprintf(4, "dev: %u, subdev: %u, ev: 0x%02x, cid: 0x%016llX/n", rec.dev, rec.subdev, rec.ev, rec.token.cid ); zprintf(8,"Writing cid in all devs/n"); rec.token.schedule_mask=0xFF; rec.token.attr=0; return cmd_add_cid_to_all(rec);}
开发者ID:eusafe,项目名称:libgate,代码行数:10,
示例14: expand_format_stringstatic voidexpand_format_string(int error, const char *fmt, char *buf, int buf_chars){ const char *from; /* pointer into fmt */ char *to; /* pointer into buf */ char *errmsg; /* expansion for %m */ char *trunc_msg = "Truncated NFS error message: "; zoneid_t zoneid = getzoneid(); /* * Copy the given format string into the result buffer, expanding * %m as we go. If the result buffer is too short, complain and * truncate the message. (We don't expect this to ever happen, * though.) */ for (from = fmt, to = buf; *from; from++) { if (to >= buf + buf_chars - 1) { zprintf(zoneid, trunc_msg); break; } if (*from == '%' && *(from+1) == 'm') { errmsg = nfs_strerror(error); /* * If there's an error message and room to display * it, copy it in. If there's no message or not * enough room, try just printing an error number. * (We assume that the error value is in a * reasonable range.) If there's no room for * anything, bail out. */ if (errmsg != NULL && strlen(buf) + strlen(errmsg) < buf_chars) { (void) strcpy(to, errmsg); to += strlen(errmsg); } else if (strlen(buf) + strlen("error XXX") < buf_chars) { (void) sprintf(to, "error %d", error); /* * Don't try to guess how many characters * were laid down. */ to = buf + strlen(buf); } else { zprintf(zoneid, trunc_msg); break; } from++; } else { *to++ = *from; } } *to = '/0';}
开发者ID:andreiw,项目名称:polaris,代码行数:54,
示例15: vfw_set_formatstatic int vfw_set_format (zbar_video_t *vdo, uint32_t fmt){ const zbar_format_def_t *fmtdef = _zbar_format_lookup(fmt); if(!fmtdef->format) return(err_capture_int(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "unsupported vfw format: %x", fmt)); BITMAPINFOHEADER *bih = vdo->state->bih; assert(bih); bih->biWidth = vdo->width; bih->biHeight = vdo->height; switch(fmtdef->group) { case ZBAR_FMT_GRAY: bih->biBitCount = 8; break; case ZBAR_FMT_YUV_PLANAR: case ZBAR_FMT_YUV_PACKED: case ZBAR_FMT_YUV_NV: bih->biBitCount = 8 + (16 >> (fmtdef->p.yuv.xsub2 + fmtdef->p.yuv.ysub2)); break; case ZBAR_FMT_RGB_PACKED: bih->biBitCount = fmtdef->p.rgb.bpp * 8; break; default: bih->biBitCount = 0; } bih->biClrUsed = bih->biClrImportant = 0; bih->biCompression = fmt; zprintf(8, "seting format: %.4s(%08x) " BIH_FMT "/n", (char*)&fmt, fmt, BIH_FIELDS(bih)); if(!capSetVideoFormat(vdo->state->hwnd, bih, vdo->state->bi_size)) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "setting video format")); if(!capGetVideoFormat(vdo->state->hwnd, bih, vdo->state->bi_size)) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "getting video format")); if(bih->biCompression != fmt) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "video format set ignored")); vdo->format = fmt; vdo->width = bih->biWidth; vdo->height = bih->biHeight; vdo->datalen = bih->biSizeImage; zprintf(4, "set new format: %.4s(%08x) " BIH_FMT "/n", (char*)&fmt, fmt, BIH_FIELDS(bih)); return(0);}
开发者ID:0359xiaodong,项目名称:OpenAtlas,代码行数:54,
示例16: zprintf_nbytesvoid zprintf_nbytes(zfile f, char *s, size_t len) { char tmp[1024]; if (len > 1024) { zprintf(f, "error: string longer than fixed buffer (length: %zu)/n", len); return; } memcpy(tmp, s, len); tmp[len] = 0; zprintf(f, "%s", tmp); }
开发者ID:CornSoiliml,项目名称:joy,代码行数:12,
示例17: dump_statsstatic inline void dump_stats (const zbar_image_scanner_t *iscn){ zprintf(1, "symbol sets allocated = %-4d/n", iscn->stat_syms_new); zprintf(1, " scanner syms in use = %-4d/trecycled = %-4d/n", iscn->stat_iscn_syms_inuse, iscn->stat_iscn_syms_recycle); zprintf(1, " image syms in use = %-4d/trecycled = %-4d/n", iscn->stat_img_syms_inuse, iscn->stat_img_syms_recycle); zprintf(1, "symbols allocated = %-4d/n", iscn->stat_sym_new); int i; for(i = 0; i < RECYCLE_BUCKETS; i++) zprintf(1, " recycled[%d] = %-4d/n", i, iscn->stat_sym_recycle[i]);}
开发者ID:mrdeveloperdude,项目名称:OctoMY,代码行数:13,
示例18: v4l2_mmap_buffersstatic int v4l2_mmap_buffers (zbar_video_t *vdo){ struct v4l2_requestbuffers rb; memset(&rb, 0, sizeof(rb)); rb.count = vdo->num_images; rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; rb.memory = V4L2_MEMORY_MMAP; if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "requesting video frame buffers (VIDIOC_REQBUFS)")); zprintf(1, "mapping %u buffers (of %d requested)/n", rb.count, vdo->num_images); if(!rb.count) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__, "driver returned 0 buffers")); if(vdo->num_images > rb.count) vdo->num_images = rb.count; struct v4l2_buffer vbuf; memset(&vbuf, 0, sizeof(vbuf)); vbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vbuf.memory = V4L2_MEMORY_MMAP; int i; for(i = 0; i < vdo->num_images; i++) { vbuf.index = i; if(ioctl(vdo->fd, VIDIOC_QUERYBUF, &vbuf) < 0) /* FIXME cleanup */ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "querying video buffer (VIDIOC_QUERYBUF)")); if(vbuf.length < vdo->datalen) fprintf(stderr, "WARNING: insufficient v4l2 video buffer size:/n" "/tvbuf[%d].length=%x datalen=%lx image=%d x %d %.4s(%08x)/n", i, vbuf.length, vdo->datalen, vdo->width, vdo->height, (char*)&vdo->format, vdo->format); zbar_image_t *img = vdo->images[i]; img->datalen = vbuf.length; img->data = mmap(NULL, vbuf.length, PROT_READ | PROT_WRITE, MAP_SHARED, vdo->fd, vbuf.m.offset); if(img->data == MAP_FAILED) /* FIXME cleanup */ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "mapping video frame buffers")); zprintf(2, " buf[%d] 0x%lx bytes @%p/n", i, img->datalen, img->data); } return(0);}
开发者ID:newpouy,项目名称:uosdroid,代码行数:50,
示例19: zprintf_anon_nbytesvoid zprintf_anon_nbytes(zfile f, char *s, size_t len) { char tmp[1024]; unsigned int i; if (len > 1024) { zprintf(f, "error: string longer than fixed buffer (length: %zu)/n", len); return; } for (i=0; i<len; i++) { tmp[i] = '*'; } tmp[len] = 0; zprintf(f, "%s", tmp); }
开发者ID:CornSoiliml,项目名称:joy,代码行数:15,
示例20: zbar_image_write int zbar_image_write (const zbar_image_t *img, const char *filebase) { int len = strlen(filebase) + 16; char *filename = (char*)malloc((size_t)len); strcpy_s(filename, len, filebase); int n = 0; if(*(char*)&img->format >= ' ') n = snprintf(filename, len, "%s.%.4s.zimg", filebase, (char*)&img->format); else n = snprintf(filename, len, "%s.%08" PRIx32 ".zimg", filebase, img->format); assert(n < len); filename[len] = '/0'; zprintf(1, "dumping %.4s(%08" PRIx32 ") image to %s/n", (char*)&img->format, img->format, filename); FILE *f; errno_t ferr = fopen_s(&f, filename, "w"); if(ferr) { int rc = errno; //zprintf(1, "ERROR opening %s: %s/n", filename, strerror(rc)); zprintf(1, "ERROR opening %s./n", filename); free(filename); return(rc); } zimg_hdr_t hdr; hdr.magic = 0x676d697a; hdr.format = img->format; hdr.width = img->width; hdr.height = img->height; hdr.size = img->datalen; if(fwrite(&hdr, sizeof(hdr), 1, f) != 1 || fwrite(img->data, 1, img->datalen, f) != img->datalen) { int rc = errno; //zprintf(1, "ERROR writing %s: %s/n", filename, strerror(rc)); zprintf(1, "ERROR writing %s./n", filename); fclose(f); free(filename); return(rc); } free(filename); return(fclose(f)); }
开发者ID:rescbr,项目名称:libybar,代码行数:48,
示例21: v4l1_probe_formatsstatic inline int v4l1_probe_formats (zbar_video_t *vdo){ struct video_picture vpic; memset(&vpic, 0, sizeof(vpic)); if(ioctl(vdo->fd, VIDIOCGPICT, &vpic) < 0) return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__, "querying format (VIDIOCGPICT)")); vdo->format = 0; if(vpic.palette <= VIDEO_PALETTE_YUV410P) vdo->format = v4l1_formats[vpic.palette].format; zprintf(1, "current format: %.4s(%08x) depth=%d palette=%d/n", (char*)&vdo->format, vdo->format, vpic.depth, vpic.palette); vdo->formats = calloc(16, sizeof(uint32_t)); if(!vdo->formats) return(err_capture(vdo, SEV_FATAL, ZBAR_ERR_NOMEM, __func__, "allocating format list")); int num_formats = 0; zprintf(2, "probing supported formats:/n"); int i; for(i = 1; i <= VIDEO_PALETTE_YUV410P; i++) { if(!v4l1_formats[i].format) continue; vpic.depth = v4l1_formats[i].bpp; vpic.palette = i; if(ioctl(vdo->fd, VIDIOCSPICT, &vpic) < 0) { zprintf(2, " [%02d] %.4s...no (set fails)/n", i, (char*)&v4l1_formats[i].format); continue; } if(ioctl(vdo->fd, VIDIOCGPICT, &vpic) < 0 || vpic.palette != i) { zprintf(2, " [%02d] %.4s...no (set ignored)/n", i, (char*)&v4l1_formats[i].format); continue; } zprintf(2, " [%02d] %.4s...yes/n", i, (char*)&v4l1_formats[i].format); vdo->formats[num_formats++] = v4l1_formats[i].format; } vdo->formats = realloc(vdo->formats, (num_formats + 1) * sizeof(uint32_t)); assert(vdo->formats); return(v4l1_set_format(vdo, vdo->format));}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:48,
示例22: zbar_video_openint zbar_video_open (zbar_video_t *vdo, const char *dev){ char *ldev = NULL; int rc; zbar_video_enable(vdo, 0); video_lock(vdo); if(vdo->intf != VIDEO_INVALID) { if(vdo->cleanup) { vdo->cleanup(vdo); vdo->cleanup = NULL; } zprintf(1, "closed camera (fd=%d)/n", vdo->fd); vdo->intf = VIDEO_INVALID; } video_unlock(vdo); if(!dev) return(0); if((unsigned char)dev[0] < 0x10) { /* default linux device, overloaded for other platforms */ int id = dev[0]; dev = ldev = strdup("/dev/video0"); ldev[10] = '0' + id; } rc = _zbar_video_open(vdo, dev); if(ldev) free(ldev); return(rc);}
开发者ID:0359xiaodong,项目名称:OpenAtlas,代码行数:33,
示例23: cmd_add_tocken_to_allint cmd_add_tocken_to_all(ad_token_rec_t in_rec) { int gp_dst; proc_add_cid_t rec2; // printf("TEST1: rec. cid: 0x%016llX, schedule_mask: 0x%04x/n",in_rec.cid, in_rec.schedule_mask); db_token_rec_t* rec=db_get_token_by_c(in_rec.cid); if( rec == 0) { rec2.token.cid=in_rec.cid; rec2.token.attr=in_rec.attr; rec2.token.schedule_mask=in_rec.schedule_mask; rec2.token.addr=gp_cfg.max_bound_token; if( db_add_token(&rec2.token) == 0){ zprintf(3, "Fail saved rec. cid: 0x%016llX, addr: 0x%04x/n",rec2.token.cid, rec2.token.addr); } } else { memcpy(&rec2.token, rec, sizeof(db_token_rec_t)); rec2.token.attr=in_rec.attr; rec2.token.schedule_mask=in_rec.schedule_mask; } // printf("TEST2: rec. cid: 0x%016llX, addr: 0x%04x/n",rec2.token.cid, rec2.token.addr); for(gp_dst=1;gp_dst<=gp_cfg.max_dev_n;gp_dst++) { if( devices[gp_dst].activ == 1 ) { rec2.dev=gp_dst; if( cmd_add_cid(rec2) == 0 ) return 0; } } return 1;}
开发者ID:eusafe,项目名称:libgate,代码行数:30,
示例24: extension_datavoid extension_data(int i){ while (nextbits(8) == EXTENSION_START_CODE) { zprintf(1, "/nextension_start_code = 0x000001%02X/n", getbits(8)); if (i == 0) { if (nextbits(4) == SEQUENCE_DISPLAY_EXTENSION_ID) sequence_display_extension(); if (nextbits(4) == SEQUENCE_SCALABLE_EXTENSION_ID) sequence_scalable_extension(); } if (i == 2) { if (nextbits(4) == QUANT_MATRIX_EXTENSION_ID) quant_matrix_extension(); if (nextbits(4) == PICTURE_DISPLAY_EXTENSION_ID) picture_display_extension(); if (nextbits(4) == PICTURE_SPATIAL_SCALABLE_EXTENSION_ID) picture_spatial_scalable_extension(); if (nextbits(4) == PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID) picture_temporal_scalable_extension(); } }}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:25,
示例25: proc_input_threadstatic ZTHREAD proc_input_thread (void *arg){ zbar_processor_t *proc = arg; zbar_thread_t *thread = &proc->input_thread; int rc; _zbar_mutex_lock(&proc->mutex); thread->running = 1; _zbar_event_trigger(&thread->activity); zprintf(4, "spawned input thread/n"); rc = 0; while(thread->started && rc >= 0) { _zbar_mutex_unlock(&proc->mutex); rc = _zbar_processor_input_wait(proc, &thread->notify, -1); _zbar_mutex_lock(&proc->mutex); } _zbar_mutex_unlock(&proc->mutex); _zbar_processor_close(proc); _zbar_mutex_lock(&proc->mutex); thread->running = 0; _zbar_event_trigger(&thread->activity); _zbar_mutex_unlock(&proc->mutex); return(0);}
开发者ID:lamhx393,项目名称:zbar-redux,代码行数:27,
示例26: group_of_pictures_headervoid group_of_pictures_header(){ zprintf(1, "/ngroup_start_code = 0x000001%02X/n", getbits(8)); zprintf(2, " drop_frame_flag = %d/n", get1bit()); zprintf(2, " time_code_hours = %d/n", getbits(5)); zprintf(2, " time_code_minutes = %d/n", getbits(6)); zprintf(2, " marker_bit = %d/n", get1bit()); zprintf(2, " time_code_seconds = %d/n", getbits(6)); zprintf(2, " time_code_pictures = %d/n", getbits(6)); zprintf(2, " closed_gop = %d/n", get1bit()); zprintf(2, " broken_link = %d/n", get1bit()); next_start_code();}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:13,
示例27: picture_spatial_scalable_extensionvoid picture_spatial_scalable_extension(){ zprintf(1, " picture_spatial_scalable_extension_id = %01X/n", getbits(4)); zprintf(2, " lower_layer_temporal_reference = %d/n", getbits(10)); zprintf(2, " marker bit = %d/n", get1bit()); zprintf(2, " lower_layer_horizontal_offset = %d/n", getbits(15)); zprintf(2, " marker bit = %d/n", get1bit()); zprintf(2, " lower_layer_vertical_offset = %d/n", getbits(15)); zprintf(2, " spatial_temporal_weight_code_table_index = %d/n", getbits(2)); zprintf(2, " lower_layer_progressive_frame = %d/n", get1bit()); zprintf(2, " lower_layer_deinterlaced_field_select = %d/n", get1bit()); next_start_code();}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:13,
示例28: vfw_probe_formatstatic int vfw_probe_format (zbar_video_t *vdo, uint32_t fmt){ const zbar_format_def_t *fmtdef = _zbar_format_lookup(fmt); if(!fmtdef) return(0); zprintf(4, " trying %.4s(%08x).../n", (char*)&fmt, fmt); BITMAPINFOHEADER *bih = vdo->state->bih; bih->biWidth = vdo->width; bih->biHeight = vdo->height; switch(fmtdef->group) { case ZBAR_FMT_GRAY: bih->biBitCount = 8; break; case ZBAR_FMT_YUV_PLANAR: case ZBAR_FMT_YUV_PACKED: case ZBAR_FMT_YUV_NV: bih->biBitCount = 8 + (16 >> (fmtdef->p.yuv.xsub2 + fmtdef->p.yuv.ysub2)); break; case ZBAR_FMT_RGB_PACKED: bih->biBitCount = fmtdef->p.rgb.bpp * 8; break; default: bih->biBitCount = 0; } bih->biCompression = fmt; if(!capSetVideoFormat(vdo->state->hwnd, bih, vdo->state->bi_size)) { zprintf(4, "/tno (set fails)/n"); return(0); } if(!capGetVideoFormat(vdo->state->hwnd, bih, vdo->state->bi_size)) return(0/*FIXME error...*/); zprintf(6, "/tactual: " BIH_FMT "/n", BIH_FIELDS(bih)); if(bih->biCompression != fmt) { zprintf(4, "/tno (set ignored)/n"); return(0); } zprintf(4, "/tyes/n"); return(1);}
开发者ID:0359xiaodong,项目名称:OpenAtlas,代码行数:46,
示例29: error_checkvoid error_check(){ if (protection == 0) { crc_check = getbits(16); zprintf(1, " CRC = %d/n", crc_check); }}
开发者ID:AquaSoftGmbH,项目名称:mjpeg,代码行数:8,
示例30: maxrepint maxrep(unsigned int i){ struct section *tmpsection; unsigned int j; unsigned int count=1; addr_size prev=0; addr_size mostval=0; unsigned int maxcount=0;//printf("--------- i: %u/n", i); for(j=i*num_samples;j<(i+1)*num_samples;j++){//printf("j: %u /naslrtab[j]: 0x%016lx/nprev: 0x%016lx/ncount: %u/nmaxcount: %u/nmostval: 0x%016lx/n/n",j,aslrtab[j], prev, count, maxcount, mostval); if(aslrtab[j]==prev){ count++; }else{ prev=aslrtab[j]; count=1; } if(count>maxcount){ maxcount=count; mostval=aslrtab[j]; } } // find matching section in liked list tmpsection = zfirst; // careful, not zfirst_aslr while (tmpsection->next != 0x00) { if((addr_size)tmpsection->num==i) break; tmpsection = tmpsection->next; } // flag its probability tmpsection->proba=maxcount; tmpsection->probableval=mostval; // display results#ifdef __x86_64__ zprintf("[section:%03d] %s/n most probable address:0x%016lx, proba%s%03d/%d/n", i,tmpsection->name,mostval,(maxcount == (unsigned int)num_samples) ? "=" : "<",maxcount,num_samples);#else zprintf("[section:%03d] %s/n most probable address:0x%08x, proba%s%03d/%d/n", i,tmpsection->name,mostval,(maxcount == (unsigned int)num_samples) ? "=" : "<",maxcount,num_samples);#endif return 0;}
开发者ID:SabunMacTavish,项目名称:pmcma,代码行数:45,
注:本文中的zprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zscal_函数代码示例 C++ zpool_close函数代码示例 |