Go to the documentation of this file.00001 #ifndef OFUCUTILS_H_
00002 #define OFUCUTILS_H_
00003
00004 #include "ofConstants.h"
00005
00006 #ifdef TARGET_LINUX
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <unistd.h>
00011 #include <unicap.h>
00012 #include <unistd.h>
00013 #include <string.h>
00014 #include <pthread.h>
00015
00016 struct AVPicture;
00017
00018
00019 #define MAX_DEVICES 64
00020 #define MAX_FORMATS 64
00021 #define MAX_PROPERTIES 64
00022 #define VIDEOGRABBER_RESIZE_FLAGS SWS_X
00023
00024 class ofUCUtils{
00025
00026 public:
00027 ofUCUtils();
00028 virtual ~ofUCUtils();
00029
00030 void set_format (int w, int h);
00031 bool open_device (int d);
00032 void start_capture(void);
00033 void queryUC_imageProperties(void);
00034 bool getFrameUC(unsigned char ** _pixels);
00035 void listUCDevices();
00036 void close_unicap();
00037 char * device_identifier(void);
00038 void new_frame (unicap_data_buffer_t * buffer);
00039
00040 bool verbose;
00041
00042 private:
00043 bool bUCFrameNew;
00044 unsigned char * pixels;
00045 bool deviceReady;
00046
00047 unicap_device_t device;
00048 unicap_format_t format;
00049 unicap_handle_t handle;
00050
00051 AVPicture * src;
00052 AVPicture * dst;
00053 int src_pix_fmt;
00054 int d_width, d_height;
00055 struct SwsContext * toRGB_convert_ctx;
00056
00057 bool doConversion;
00058
00059 pthread_mutex_t capture_mutex;
00060 void lock_buffer();
00061 void unlock_buffer();
00062 };
00063
00064 #endif
00065
00066 #endif