Advertisement
Guest User

Pablo

a guest
Sep 25th, 2008
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include <ffmpeg/avcodec.h>
  2. #include <ffmpeg/avformat.h>
  3. #include <stdio.h>
  4.  
  5.  
  6. int main() {
  7.     AVFormatContext *pFormatCtx = NULL;
  8.     AVFormatParameters formatParams ;
  9.     AVInputFormat *iformat = NULL;
  10.     av_register_all();
  11.     formatParams.standard = NULL;
  12.     formatParams.width = 320;
  13.     formatParams.height = 280;
  14.     iformat = av_find_input_format("video4linux");
  15.     if (iformat == NULL) {
  16.         printf("No format found\n");
  17.         return -2;
  18.     }
  19.     printf("%d\n",av_open_input_file(&pFormatCtx,"/dev/video0", iformat, 0, &formatParams));
  20.     if (av_open_input_file(&pFormatCtx,"/dev/video0", iformat, 0, &formatParams) != 0) {
  21.         printf("Error");
  22.         return -2;
  23.     }
  24.     int i;
  25.     if(av_find_stream_info(pFormatCtx)<0)
  26.         return -1; // Couldn't find stream information
  27.     dump_format(pFormatCtx, 0, "/dev/video0", 0);
  28.     av_close_input_file(pFormatCtx);
  29.     return 0;
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement