Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

/home/slang/XVision2/src/Devices/VideoManager.h

00001 #ifndef __videomanag_h
00002 #define __videomanag_h
00003 
00004 /*                                                      -*-c++-*-
00005     Copyright (C) 2000 Gregory D. Hager and Darius Burschka (JHU
00006     Lab for Computational Interaction with Physical Systems (CIPS))
00007 
00008 Permission is granted to any individual or institution to use, copy,
00009 modify, and distribute this software, provided that this complete
00010 copyright and permission notice is maintained, intact, in all copies and
00011 supporting documentation.  Authors of papers that describe software
00012 systems using this software package are asked to acknowledge such use by
00013 a brief statement in the paper.
00014 
00015 We provide this software "as is" without express or implied warranty.
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   // handling of invalid buffers
00036   deque   <int>     free_buffer;
00037   deque   <int>     ready_buffer;
00038 
00039   int            *lock_count;      // count of lock commands 
00040   int            last_buffer;
00041   int            buffer_map[MAX_VIDMANG_MAP];     // mapping user and physical
00042 
00043   // pthread structures
00044   pthread_t       grab_child;           // reference to the acquis. thr.
00045   // messages about status changes in buffers
00046   pthread_cond_t  free_message,frame_message;
00047   // mutex for messages and for frame buffers
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 *); // for internal use
00059 };
00060 
00061 #endif
00062 #endif

Generated at Thu Mar 29 22:37:28 2001 for XVision by doxygen1.2.0 written by Dimitri van Heesch, © 1997-2000