Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * fileloader.h - A camera which obtains its images from a single image 00004 * file or from several image files in a directory 00005 * 00006 * Generated: Tue Mar 2 12:26:44 2005 00007 * Copyright 2005 Tim Niemueller [www.niemueller.de] 00008 * 2008 Daniel Beck 00009 * 00010 ****************************************************************************/ 00011 00012 /* This program is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. A runtime exception applies to 00016 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU Library General Public License for more details. 00022 * 00023 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00024 */ 00025 00026 #ifndef __FIREVISION_CAMS_FILELOADER_H_ 00027 #define __FIREVISION_CAMS_FILELOADER_H_ 00028 00029 #include <cams/camera.h> 00030 #include <dirent.h> 00031 00032 namespace firevision { 00033 #if 0 /* just to make Emacs auto-indent happy */ 00034 } 00035 #endif 00036 00037 class CameraArgumentParser; 00038 00039 class FileLoader : public Camera 00040 { 00041 #if defined(__GLIBC__) || defined(__FreeBSD__) 00042 friend int file_select(const struct dirent*); 00043 #else 00044 friend int file_select(struct dirent*); 00045 #endif 00046 00047 public: 00048 00049 FileLoader(const char *filename); 00050 FileLoader(colorspace_t cspace, const char* filename, unsigned int width, unsigned int height); 00051 FileLoader(const CameraArgumentParser *cap); 00052 ~FileLoader(); 00053 00054 virtual void open(); 00055 virtual void start(); 00056 virtual void stop(); 00057 virtual void close(); 00058 virtual void capture(); 00059 virtual void flush(); 00060 00061 virtual bool ready(); 00062 00063 virtual void print_info(); 00064 00065 virtual unsigned char * buffer(); 00066 virtual unsigned int buffer_size(); 00067 virtual void dispose_buffer(); 00068 00069 virtual unsigned int pixel_width(); 00070 virtual unsigned int pixel_height(); 00071 virtual colorspace_t colorspace(); 00072 00073 virtual void set_image_number(unsigned int n); 00074 00075 void set_colorspace(colorspace_t c); 00076 void set_pixel_width(unsigned int w); 00077 void set_pixel_height(unsigned int h); 00078 00079 private: 00080 void read_file(); 00081 00082 bool started; 00083 bool opened; 00084 unsigned char* file_buffer; 00085 int _buffer_size; 00086 unsigned int width; 00087 unsigned int height; 00088 colorspace_t cspace; 00089 char *filename; 00090 char *dirname; 00091 static char *extension; 00092 int num_files; 00093 int cur_file; 00094 struct dirent **file_list; 00095 }; 00096 00097 } // end namespace firevision 00098 00099 #endif