程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> 關於C語言 >> 從USB攝像頭接收YUV幀 SDL播放

從USB攝像頭接收YUV幀 SDL播放

編輯:關於C語言

SDL學習教程:http://lazyfoo.net/SDL_tutorials/index.php

代碼下載:http://download.csdn.net/download/jinchaoqi/6953321

代碼:

     main.c

#include <stdio.h><stdlib.h><.h><sys/types.h><sys/stat.h><sys/ioctl.h><sys/time.h><unistd.h><fcntl.h><errno.h><sys/mman.h><linux/videodev2.h><linux/fb.h><pthread.h><libavcodec/avcodec.h><libavformat/avformat.h><libswscale/swscale.h><SDL/SDL.h><SDL/SDL_thread.h>

 PRINT                 printf("LINE: %d\n",__LINE__)


 main( argc,  ** n =  *p =* status =*bmp =*screen = SwsContext *sws_ctx =(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |= SDL_SetVideoMode(WIDTH, HEIGHT, , = SDL_SetVideoMode(WIDTH, HEIGHT, , 
    
      (!== (unsigned  *) bmp->pixels[= = ==((i = ; i < ; i++
* HEIGHT* &(video_enqueue(i) <  -&(  

 

gather_picture.h:

 

 GATHER_PICTURE_H

 VIDEO_DEV    "/dev/video0"    
 WIDTH            640
 HEIGHT           480

 frame_buf{  
         length[ * start[ video_getframe( video_enqueue(

 

gather_picture.c:

 

#include <stdio.h><stdlib.h><.h><sys/types.h><sys/stat.h><sys/ioctl.h><fcntl.h><errno.h><sys/mman.h><linux/videodev2.h>

 g_videofd = -;        

 v4l2_buffer buf;              
 video_enqueue(=(ioctl(g_videofd, VIDIOC_QBUF, &buf) <  - 
 v4l2_capability cap ;
     v4l2_fmtdesc stfmt; 
     v4l2_format  fmt;   
    g_videofd =(g_videofd == - -
    (ioctl(g_videofd, VIDIOC_QUERYCAP, &cap) <  - ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == ((cap.capabilities & V4L2_CAP_STREAMING) ==
    memset(&stfmt, , = =(ioctl(g_videofd, VIDIOC_ENUM_FMT, &stfmt) != -, stfmt.index++

    memset(&fmt,  ,=====&(fmt.fmt.pix.height !=  - 
 v4l2_requestbuffers reqbuf;
    
     i = 
    reqbuf.count = ;
     reqbuf.type ==(ioctl(g_videofd, VIDIOC_REQBUFS, &reqbuf)==- -
     (i = ; i < reqbuf.count; i++=== (ioctl (g_videofd, VIDIOC_QUERYBUF, &buf) == - -== mmap(NULL, buf.length, PROT_READ |(frame_buf.start[i] ==-
 
 v4l2_buf_type type =(ioctl(g_videofd, VIDIOC_STREAMON, &type) <  - 
 v4l2_buf_type type =(ioctl(g_videofd, VIDIOC_STREAMOFF, &type) <  - 
 video_getframe(=(ioctl(g_videofd, VIDIOC_DQBUF, &buf) <  - 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved