本文整理汇总了C++中read_frame函数的典型用法代码示例。如果您正苦于以下问题:C++ read_frame函数的具体用法?C++ read_frame怎么用?C++ read_frame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了read_frame函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: show_camera
static gboolean show_camera(gpointer data)
{
read_frame();
if(pixmap) {
g_object_unref(pixmap); // ref count minus one
}
pixmap = gdk_pixmap_new (image_face->window, preview_width, preview_height, -1);
unsigned char *buf2 = (unsigned char *) malloc (sizeof(unsigned char) * width * height * 3);
Pyuv422torgb24((unsigned char*)framebuffer, buf2, width, height);
GdkPixbuf *rgbBuf = gdk_pixbuf_new_from_data(buf2,
GDK_COLORSPACE_RGB,
FALSE, 8,
width, height,
width * 3,
NULL, NULL);
if(rgbBuf != NULL) {
GdkPixbuf* buf = gdk_pixbuf_scale_simple(rgbBuf,
preview_width,
preview_height,
GDK_INTERP_BILINEAR);
gdk_draw_pixbuf(pixmap,
image_face->style->white_gc,
buf,
0, 0, 0, 0,
preview_width, preview_height,
GDK_RGB_DITHER_NONE, 0, 0);
gdk_draw_drawable(image_face->window,
image_face->style->white_gc,
pixmap,
0, 0, 0, 0,
preview_width, preview_height);
g_object_unref(buf);
g_object_unref(rgbBuf);
}
gtk_widget_show(image_face);
free(buf2);
return TRUE;
}
开发者ID:ShiHong-Zhang,项目名称:lmts-gtk,代码行数:48,代码来源:webcam.c
示例2: control
static int control(sh_audio_t *sh,int cmd,void* arg, ...){
mad_decoder_t *this = sh->context;
// various optional functions you MAY implement:
switch(cmd){
case ADCTRL_RESYNC_STREAM:
this->have_frame=0;
mad_synth_init (&this->synth);
mad_stream_init (&this->stream);
mad_frame_init (&this->frame);
return CONTROL_TRUE;
case ADCTRL_SKIP_FRAME:
this->have_frame=read_frame(sh);
return CONTROL_TRUE;
}
return CONTROL_UNKNOWN;
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:16,代码来源:ad_libmad.c
示例3: process
static gboolean
process (GeglOperation *operation,
GeglBuffer *output,
const GeglRectangle *result,
gint level)
{
GeglProperties *o = GEGL_PROPERTIES (operation);
Priv *p = (Priv*)o->user_data;
static gboolean inited = FALSE;
if (!inited && o->fps != 0)
{
inited= TRUE;
g_timeout_add (1000/o->fps, update, operation);
}
{
fd_set fds;
struct timeval tv;
FD_ZERO (&fds);
FD_SET (p->fd, &fds);
tv.tv_sec = 2;
tv.tv_usec = 0;
switch (select (p->fd + 1, &fds, NULL, NULL, &tv))
{
case -1:
if (errno == EINTR)
{
g_warning ("select");
return FALSE;
}
break;
case 0:
g_warning ("select timeout");
return FALSE;
break;
default:
read_frame (operation, output);
}
}
return TRUE;
}
开发者ID:jonnor,项目名称:gegl,代码行数:47,代码来源:v4l2.c
示例4: mainloop
static void mainloop(void)
{
SDL_Event event;
for (;;)
{
while (SDL_PollEvent(&event))
if (event.type == SDL_QUIT)
return;
for (;;)
{
fd_set fds;
struct timeval tv;
int r;
FD_ZERO(&fds);
FD_SET(fd, &fds);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
r = select(fd + 1, &fds, NULL, NULL, &tv);
if (-1 == r)
{
if (EINTR == errno)
continue;
errno_exit("select");
}
if (0 == r)
{
fprintf(stderr, "select timeout\n");
exit(EXIT_FAILURE);
}
if (read_frame())
break;
/* EAGAIN - continue select loop. */
}
}
}
开发者ID:bensenq,项目名称:v4l-examples,代码行数:47,代码来源:sdlvideoviewer.c
示例5: initialize
BC_Bitmap::BC_Bitmap(BC_WindowBase *parent_window, unsigned char *png_data)
{
// Decompress data into a temporary vframe
VFrame frame;
frame.read_png(png_data);
// Initialize the bitmap
initialize(parent_window,
frame.get_w(),
frame.get_h(),
parent_window->get_color_model(),
0);
// Copy the vframe to the bitmap
read_frame(&frame, 0, 0, w, h);
}
开发者ID:petterreinholdtsen,项目名称:cinelerra-cv,代码行数:17,代码来源:bcbitmap.C
示例6: id3v24_read_image
static gboolean id3v24_read_image (VFSFile * handle, void * * image_data, gint *
image_size)
{
gint version, header_size, data_size, footer_size, parsed;
gboolean syncsafe;
gint64 offset;
gboolean found = FALSE;
if (! read_header (handle, & version, & syncsafe, & offset, & header_size,
& data_size, & footer_size))
return FALSE;
for (parsed = 0; parsed < data_size && ! found; )
{
gint frame_size, size, type;
gchar key[5];
guchar * data;
gchar * mime, * desc;
if (! read_frame (handle, data_size - parsed, version, syncsafe,
& frame_size, key, & data, & size))
break;
if (! strcmp (key, "APIC") && parse_apic (data, size, & mime, & type,
& desc, image_data, image_size))
{
g_free (mime);
g_free (desc);
if (type == 3) /* album cover */
found = TRUE;
else if (type == 0) /* iTunes */
found = TRUE;
else if (*image_data != NULL)
{
g_free(*image_data);
*image_data = NULL;
}
}
g_free (data);
parsed += frame_size;
}
return found;
}
开发者ID:gnu-andrew,项目名称:audacious.old,代码行数:46,代码来源:id3v24.c
示例7: player_debug_message
void CQTByteStreamBase::check_for_end_of_frame (void)
{
if (m_byte_on >= m_this_frame_size) {
uint32_t next_frame;
next_frame = m_frame_in_buffer + 1;
#if 0
player_debug_message("%s - next frame %d",
m_name,
next_frame);
#endif
if (next_frame >= m_frames_max) {
m_eof = 1;
} else {
read_frame(next_frame);
}
}
}
开发者ID:HunterChen,项目名称:mpeg4ip,代码行数:17,代码来源:qtime_bytestream.cpp
示例8: renderframe
static int
renderframe(int i, playback_t *play)
{
if( i < 0 )
return 0;
if (fseek(play->fp, i * play->total_frame_size, SEEK_SET) == 0) {
if (play->frame.image) {
free(play->frame.image);
play->frame.image = NULL;
}
read_frame( &(play->frame), play->fp );
return 1;
} else {
return 0;
}
}
开发者ID:amyphan,项目名称:firefly-mv,代码行数:17,代码来源:play.c
示例9: mainloop
static void mainloop (void) {
unsigned int count;
count = G_frames;
while (G_frames == 0 || count-- > 0) {
for (;;) {
fd_set fds;
struct timeval tv;
int r;
FD_ZERO (&fds);
FD_SET (fd, &fds);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
r = select (fd + 1, &fds, NULL, NULL, &tv);
if (-1 == r) {
if (EINTR == errno)
continue;
errno_exit ("select");
}
if (0 == r) {
//char msg[256];
if (G_paused)
continue;
fprintf (stderr, "select timeout\n");
//ioctl (fd, S2253_VIDIOC_DEBUG, msg);
//fprintf (stderr, "debug: %s\n", msg);
exit (EXIT_FAILURE);
}
if (read_frame ())
break;
/* EAGAIN - continue select loop. */
}
}
}
开发者ID:matrix207,项目名称:webcamera,代码行数:45,代码来源:camera.c
示例10: main
int main(int argc,char **argv)
{
rfbScreenInfoPtr s;
double t1, t2;
double timeout;
int nread;
if (argc == 2)
v4l2str = argv[1];
printf("Using dev %s\n", v4l2str);
if (argc == 3)
v4l2fps = atoi(argv[2]);
printf("Using fps %d\n", v4l2fps);
if (open_v4l2() != 0)
exit(EXIT_FAILURE);
if (init_v4l2() != 0)
exit(EXIT_FAILURE);
if (alloc_mem() != 0)
exit(EXIT_FAILURE);
s = rfbGetScreen(&argc, argv, v4l2width, v4l2height, 8, 3, v4l2Bpp);
s->desktopName = "v4l2tovnc";
s->frameBuffer = (char *) v4l2buf;
s->serverFormat.blueShift = 0;
s->serverFormat.greenShift = 8;
s->serverFormat.redShift = 16;
timeout = 1.0 / v4l2fps;
rfbInitServer(s);
t1 = timestamp();
while (rfbIsActive(s)) {
t2 = timestamp();
if ((t2 - t1) >= timeout) {
nread = read_frame();
if (nread < 0)
break;
rfbMarkRectAsModified(s, 0, 0, v4l2width, v4l2height);
t1 = timestamp();
}
rfbProcessEvents(s, -1);
}
close_v4l2();
return 0;
}
开发者ID:ihadzic,项目名称:vcrtcm-doc,代码行数:45,代码来源:v4l2tovnc.c
示例11: capture
void capture(int *fd, camera_buffer *cam_bufs, void **img, int camera_count, int isSelect)
{
int i;
void *ptr;
for (i=0;i<camera_count;i++){
for (;;) {
fd_set fds;
struct timeval tv;
int r;
FD_ZERO (&fds);
FD_SET (fd[i], &fds);
/* Timeout. */
tv.tv_sec = 0;
tv.tv_usec = 1000000;
if (isSelect==1)
{
r = select (fd[i] + 1, &fds, NULL, NULL, &tv);
if (-1 == r)
{
if (EINTR == errno)
continue;
errno_exit (__FILE__,__LINE__,"select");
}
if (0 == r)
{
fprintf (stderr, "select timeout\n");
exit (EXIT_FAILURE);
}
}
ptr=read_frame(fd[i],&cam_bufs[i]);
if (ptr){
img[i]=ptr;
break;
}
/* EAGAIN - continue select loop. */
}
}
}
开发者ID:eugenelet,项目名称:Dodgeball,代码行数:45,代码来源:camera.c
示例12: read_raw_socket
/*
* Reading raw socket.
*/
static int read_raw_socket(void)
{
char buffer[BUFSIZE + 1] = { };
int len;
len = read(rawfd, buffer, BUFSIZE);
if (len < 0) {
perror("read()");
return -1;
}
char output[BUFSIZE + 1] = { };
// getting data from raw socket, creating readable string
// and sending it to all clients
if (read_frame(buffer, output, strtoul(port.c_str(), NULL, 10)) > 0)
send_data(output);
return 1;
}
开发者ID:jmikulka,项目名称:psniff,代码行数:21,代码来源:monitor.cpp
示例13: stream_seek_frame
static int stream_seek_frame(mpg123_handle *fr, off_t newframe)
{
debug2("seek_frame to %"OFF_P" (from %"OFF_P")", (off_p)newframe, (off_p)fr->num);
/* Seekable streams can go backwards and jump forwards.
Non-seekable streams still can go forward, just not jump. */
if((fr->rdat.flags & READER_SEEKABLE) || (newframe >= fr->num))
{
off_t preframe; /* a leading frame we jump to */
off_t seek_to; /* the byte offset we want to reach */
off_t to_skip; /* bytes to skip to get there (can be negative) */
/*
now seek to nearest leading index position and read from there until newframe is reached.
We use skip_bytes, which handles seekable and non-seekable streams
(the latter only for positive offset, which we ensured before entering here).
*/
seek_to = frame_index_find(fr, newframe, &preframe);
/* No need to seek to index position if we are closer already.
But I am picky about fr->num == newframe, play safe by reading the frame again.
If you think that's stupid, don't call a seek to the current frame. */
if(fr->num >= newframe || fr->num < preframe)
{
to_skip = seek_to - fr->rd->tell(fr);
if(fr->rd->skip_bytes(fr, to_skip) != seek_to)
return READER_ERROR;
debug2("going to %lu; just got %lu", (long unsigned)newframe, (long unsigned)preframe);
fr->num = preframe-1; /* Watch out! I am going to read preframe... fr->num should indicate the frame before! */
}
while(fr->num < newframe)
{
/* try to be non-fatal now... frameNum only gets advanced on success anyway */
if(!read_frame(fr)) break;
}
/* Now the wanted frame should be ready for decoding. */
debug1("arrived at %lu", (long unsigned)fr->num);
return MPG123_OK;
}
else
{
fr->err = MPG123_NO_SEEK;
return READER_ERROR; /* invalid, no seek happened */
}
}
开发者ID:Moteesh,项目名称:reactos,代码行数:44,代码来源:readers.c
示例14: FD_ZERO
bool Camera::GetBuffer(unsigned char *image){
fd_set fds;
struct timeval tv;
int r;
FD_ZERO(&fds);
FD_SET(fd, &fds);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
r = select(fd + 1, &fds, NULL, NULL, &tv);
if (-1 == r) {
errno_exit("select");
}
if (0 == r) {
fprintf(stderr, "select timeout\n");
exit(EXIT_FAILURE);
}
read_frame(image);
}
开发者ID:ashiontang,项目名称:TQ210,代码行数:19,代码来源:camera.cpp
示例15: while
//return a captured image - from wait_and_read_devices
void ImgCap_V4L2::grabImageToFile() {
/*
1. wait on both devices
2. read the device that was ready first
3. wait on the second device
4. read the second device
*/
fd_set fds;
while(true) {
struct timeval tv;
int r;
FD_ZERO(&fds);
//cn/im: adds a file descriptor to a file descriptor set
FD_SET(r_fd, &fds);
tv.tv_sec = 1;
tv.tv_usec = 0;
r = select(r_fd+1, &fds, NULL, NULL, &tv);
//cn/im: select() is a socket function which monitors a list of file descriptors for readability,so here we have (point to array of file descriptors, number of file descriptors checked, don't check for writeable, no files are checked for exceptions thrown, and a timeout value)
//these check to see if a camera is connected, if one isn't after one second it throws a connection timeout
if (-1 == r) {
if (EINTR == errno)
continue;
std::cerr << "select" << std::endl;
//errno_exit ("select");
}
if (0 == r) {
std::cerr<< "Master select timeout" << std::endl;
exit (EXIT_FAILURE);
}
break;
}
wait_for_device(&r_fd, "right");
read_frame(&r_fd, &r_buf);
save_frames();
}
开发者ID:ccorn90,项目名称:skysphere,代码行数:44,代码来源:ImgCap_V4L2.cpp
示例16: mp4f_message
void CMp4ByteStream::check_for_end_of_frame (void)
{
if (m_byte_on >= m_this_frame_size) {
uint32_t next_frame;
next_frame = m_frame_in_buffer + 1;
#if 0
mp4f_message(LOG_DEBUG, "%s - next frame %d",
m_name,
next_frame);
#endif
if (next_frame >= m_frames_max + 1) {
m_eof = true;
mp4f_message(LOG_DEBUG, "%s last frame %u %u",
m_name, next_frame, m_frames_max);
} else {
read_frame(next_frame, NULL);
}
}
}
开发者ID:dazzle-multimedia,项目名称:mpeg4ip,代码行数:19,代码来源:mp4_bytestream.cpp
示例17: read_frame
bool CAviVideoByteStream::start_next_frame (uint8_t **buffer,
uint32_t *buflen,
frame_timestamp_t *ts,
void **ud)
{
double ftime;
read_frame(m_frame_on);
ftime = (double)m_frame_on;
ftime *= 1000.0;
ftime /= m_frame_rate;
ts->msec_timestamp = (uint64_t)ftime;
ts->timestamp_is_pts = false;
*buffer = m_buffer;
*buflen = m_this_frame_size;
m_frame_on++;
if (m_frame_on > m_frames_max) m_eof = 1;
return (true);
}
开发者ID:HunterChen,项目名称:mpeg4ip,代码行数:19,代码来源:avi_bytestream.cpp
示例18: mainloop
static void mainloop(void)
{
unsigned int count;
if (frame_count == 0) {
infinit_count = 1;
}
count = frame_count;
while (infinit_count || count-- > 0) {
// printf("%u\n", count);
for (;; ) {
fd_set fds;
struct timeval tv;
int r;
FD_ZERO(&fds);
FD_SET(fd, &fds);
/* Timeout. */
tv.tv_sec = 2;
tv.tv_usec = 0;
r = select(fd + 1, &fds, NULL, NULL, &tv);
if (-1 == r) {
if (EINTR == errno)
continue;
errno_exit("select");
}
if (0 == r) {
fprintf(stderr, "select timeout\n");
exit(EXIT_FAILURE);
}
if (read_frame())
break;
/* EAGAIN - continue select loop. */
}
}
}
开发者ID:DeLaGuardo,项目名称:bonecam,代码行数:42,代码来源:capture.c
示例19: stream_seek_frame
static int stream_seek_frame( mpg123_handle_t *fr, mpg_off_t newframe )
{
// seekable streams can go backwards and jump forwards.
// non-seekable streams still can go forward, just not jump.
if(( fr->rdat.flags & READER_SEEKABLE ) || ( newframe >= fr->num ))
{
mpg_off_t preframe; // a leading frame we jump to
mpg_off_t seek_to; // the byte offset we want to reach
mpg_off_t to_skip; // bytes to skip to get there (can be negative)
// now seek to nearest leading index position and read from there until newframe is reached.
// we use skip_bytes, which handles seekable and non-seekable streams
// (the latter only for positive offset, which we ensured before entering here).
seek_to = frame_index_find( fr, newframe, &preframe );
// no need to seek to index position if we are closer already.
// but I am picky about fr->num == newframe, play safe by reading the frame again.
// if you think that's stupid, don't call a seek to the current frame.
if( fr->num >= newframe || fr->num < preframe )
{
to_skip = seek_to - fr->rd->tell( fr );
if( fr->rd->skip_bytes( fr, to_skip ) != seek_to )
return MPG123_ERR;
fr->num = preframe - 1; // watch out! I am going to read preframe... fr->num should indicate the frame before!
}
while( fr->num < newframe )
{
// try to be non-fatal now... frameNum only gets advanced on success anyway
if( !read_frame( fr )) break;
}
// now the wanted frame should be ready for decoding.
return MPG123_OK;
}
else
{
fr->err = MPG123_NO_SEEK;
return MPG123_ERR; // invalid, no seek happened
}
}
开发者ID:jeefo,项目名称:xash3d,代码行数:42,代码来源:reader.c
示例20: llopen
/////////////////////////////////LLOPEN
int llopen(char *port, int status){
struct termios newtio;
link_layer.fd = open(port, O_RDWR | O_NOCTTY );
bzero(&newtio, sizeof(newtio));
newtio.c_cflag = program.baudrate | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 0;
tcflush(link_layer.fd, TCIOFLUSH);
if ( tcsetattr(link_layer.fd,TCSANOW,&newtio) == -1) {
perror("tcsetattr");
exit(-1);
}
sleep(2);
if(read_frame(link_layer.fd,status) == -1)
return -1;
sleep(2);
tcflush(link_layer.fd, TCIOFLUSH);
return 0;
}
开发者ID:yolonhese,项目名称:RCOM,代码行数:43,代码来源:link_layer.c
注:本文中的read_frame函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论