00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00035 #ifndef IO_AVI_H
00036 #define IO_AVI_H
00037
00038
00039
00040 #include <color.h>
00041 #include <cstdio>
00042
00043
00044 namespace IO
00045 {
00047 void readAVIFrame(const char* filename,
00048 color<unsigned char>* &frame,
00049 unsigned int &frame_width,
00050 unsigned int &frame_height,
00051 unsigned int frame_nb);
00052
00054 void readAVI(const char* filename,
00055 color<unsigned char>* &image,
00056 unsigned int &frame_width,
00057 unsigned int &frame_height,
00058 unsigned int &nb_frames);
00059
00061 class AVI
00062 {
00063 public:
00065 AVI(const char* filename=0);
00066 ~AVI();
00067
00069 void open(const char* filename);
00070
00072 void close();
00073
00075 unsigned int getNbFrames();
00076
00078 void getFrameSize(unsigned int &width, unsigned int &height);
00079
00081 void read(color<unsigned char>* &image, unsigned int frame);
00082
00084 void read(color<unsigned char>* &image);
00085
00087 void read(color<unsigned char>* &image, unsigned int start, unsigned int end);
00088
00089 private:
00090 void readHeader();
00091
00092 struct header {
00093 unsigned int time_delay;
00094 unsigned int avi_data_rate;
00095 unsigned int padding;
00096 unsigned int parameter_flags;
00097 unsigned int number_frames;
00098 unsigned int number_preview_frames;
00099 unsigned int number_streams;
00100 unsigned int buffer_size;
00101 unsigned int width;
00102 unsigned int height;
00103 unsigned int time_scale;
00104 unsigned int data_rate;
00105 unsigned int starting_time;
00106 unsigned int avi_size;
00107 } m_header;
00108
00109 FILE* m_fd;
00110 };
00111 };
00112
00113
00114 #endif