00001 #ifndef __videomanag_h
00002 #define __videomanag_h
00003
00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017
00018 #ifdef HAVE_LIBPTHREAD
00019 extern "C"{
00020 #include <pthread.h>
00021 }
00022 #include <stl.h>
00023 #include "Video.h"
00024
00025 #define MAX_VIDMANG_MAP 10
00026 #define MIN_BUFFERS 4
00027
00028 template <class XV_GRABBER>
00029 class VideoManager: public XV_GRABBER
00030 {
00031 int act_grabbed;
00032 int next_queued;
00033 int frame_number;
00034
00035
00036 deque <int> free_buffer;
00037 deque <int> ready_buffer;
00038
00039 int *lock_count;
00040 int last_buffer;
00041 int buffer_map[MAX_VIDMANG_MAP];
00042
00043
00044 pthread_t grab_child;
00045
00046 pthread_cond_t free_message,frame_message;
00047
00048 pthread_mutex_t free_flag,frame_flag;
00049 public:
00050 VideoManager(const char *dev_name,
00051 const char *parm_string=NULL);
00052 ~VideoManager(void);
00053 int initiate_acquire(int current);
00054 int wait_for_completion(int buffer);
00055 int lock_buffer(int buffer_number);
00056 int release_buffer(int buffer_number);
00057 void create_thread(void);
00058 void *acquisition_task(void *);
00059 };
00060
00061 #endif
00062 #endif