#include <HxImageSeq.h>
Public Methods | |
| HxImageSeq () | |
| Constructor. More... | |
| HxImageSeq (HxString filename, int bufSize=0) | |
| Construct sequence from given file. More... | |
| HxImageSeq (const HxImageSeq &rhs) | |
| Copy constructor. More... | |
| virtual | ~HxImageSeq () |
| Destructor. More... | |
| HxImageSeq & | operator= (const HxImageSeq &rhs) |
| Assignment operator. More... | |
| int | ident () const |
| The identity of the sequence. More... | |
| int | isNull () const |
| Indicates wether this is a valid sequence. More... | |
| int | frameWidth () const |
| The frame width. More... | |
| int | frameHeight () const |
| The frame height. More... | |
| int | frameDepth () const |
| The frame depth. More... | |
| int | nrFrames () const |
| The number of frames. More... | |
| HxImageRep | getFrame (int nr) const |
| Get the specified frame as HxImageRep. More... | |
| void | getRgb2d (int nr, int *pixels, HxString displayMode) const |
| Display the specified frame in the given buffer in ARGB format using the given displayMode. More... | |
| void | getRgbPixels2d (int nr, int *pixels, HxString displayMode, int resWidth=-1, int resHeight=-1, HxGeoIntType gi=NEAREST) const |
| Display the specified frame in the given buffer in ARGB format using the given displayMode at the given resolution. More... | |
| HxImageSeqIter | begin () |
| An iterator pointing to the first frame. More... | |
| HxImageSeqIter | end () |
| An iterator pointing beyond the last frame. More... | |
| int | writeFile (std::vector< int > frameList, HxString filename, int format) |
| Write the frame from the list to the given file in the given format. More... | |
| STD_OSTREAM & | put (STD_OSTREAM &os) const |
| Put some information on the given stream. More... | |
Static Public Methods | |
| void | setUseMDC (int flag) |
| Indicate whether the MDC library should be used to decode mpeg files (when it is available :-). More... | |
Static Public Attributes | |
| const int | MPEG_F = 1 |
| const int | MIR_F = 2 |
| const int | AVI_F = 3 |
Friends | |
| class | HxImageSeqIter |
Supported types:
|
|
Constructor.
00031 : _pointee(0)
00032 {
00033 }
|
|
||||||||||||
|
Construct sequence from given file. bufSize: the size of the internal buffer. The buffer stores frames converted to HxImageRep's for later references. In the current implementation only contiguous frames are kept. The default is no buffering.
00035 : _pointee(0)
00036 {
00037 #ifndef __GNUC__
00038 int pos = filename.rfind(".");
00039 if (pos >=0 ) {
00040 HxString ext = filename.substr(pos);
00041 for (HxString::iterator i = ext.begin(); i!= ext.end(); i++)
00042 *i = toupper(*i);
00043 if (ext.compare(".MIR")==0)
00044 _pointee = new HxImageSeqMir(filename, bufSize);
00045 else {
00046 HxImageSeqData* seq;
00047 if (_useMDC)
00048 seq = new HxImageSeqMDC(filename, bufSize);
00049 else
00050 seq = new HxImageSeqDXMedia(filename, bufSize);
00051 if(seq->valid())
00052 _pointee = seq;
00053 else
00054 delete seq;
00055 }
00056 } else {
00057 HxEnvironment::instance()->errorStream()
00058 << "No extension found in " << filename << STD_ENDL;
00059 HxEnvironment::instance()->flush();
00060 }
00061 #else
00062 HxImageSeqMDC* seq = new HxImageSeqMDC(filename, bufSize);
00063 if(seq->valid())
00064 _pointee = seq;
00065 else
00066 delete seq;
00067 #endif
00068 }
|
|
|
Copy constructor.
00076 : _pointee(rhs.pointee()) 00077 { 00078 } |
|
|
Destructor.
00081 {
00082 }
|
|
|
Indicate whether the MDC library should be used to decode mpeg files (when it is available :-). Default is false.
00072 {
00073 _useMDC = flag;
00074 }
|
|
|
Assignment operator.
00086 {
00087 _pointee = rhs._pointee;
00088 return *this;
00089 }
|
|
|
The identity of the sequence.
00099 {
00100 return pointee() ? pointee()->ident() : 0;
00101 }
|
|
|
Indicates wether this is a valid sequence.
00093 {
00094 return !int(_pointee);
00095 }
|
|
|
The frame width.
00105 {
00106 return pointee() ? pointee()->frameWidth() : 0;
00107 }
|
|
|
The frame height.
00111 {
00112 return pointee() ? pointee()->frameHeight() : 0;
00113 }
|
|
|
The frame depth.
00117 {
00118 return pointee() ? pointee()->frameDepth() : 0;
00119 }
|
|
|
The number of frames.
00123 {
00124 return pointee() ? pointee()->nrFrames() : 0;
00125 }
|
|
|
Get the specified frame as HxImageRep.
00129 {
00130 return pointee() ? pointee()->getFrame(nr) : HxImageRep();
00131 }
|
|
||||||||||||||||
|
Display the specified frame in the given buffer in ARGB format using the given displayMode. The pixels buffer has to be allocated by the class user and should have sufficient size.
00135 {
00136 if (!pointee()) return;
00137
00138 pointee()->getRgb2d(nr, pixels, displayMode);
00139 }
|
|
||||||||||||||||||||||||||||
|
Display the specified frame in the given buffer in ARGB format using the given displayMode at the given resolution. The pixels buffer has to be allocated by the class user and should have sufficient size.
00144 {
00145 if (!pointee()) return;
00146
00147 pointee()->getRgbPixels2d(nr, pixels, displayMode, resWidth, resHeight, gi);
00148 }
|
|
|
An iterator pointing to the first frame.
00152 {
00153 return HxImageSeqIter(this, 0);
00154 }
|
|
|
An iterator pointing beyond the last frame.
00158 {
00159 return HxImageSeqIter(this, pointee()->nrFrames());
00160 }
|
|
||||||||||||||||
|
Write the frame from the list to the given file in the given format. Currently, only MIR format is implemented.
00164 {
00165
00166 #ifndef __GNUC__
00167
00168 if (format==MIR_F) {
00169 Header_Type* header = new Header_Type;
00170 strcpy(header->id,"MIR");
00171 header->width = frameWidth();
00172 header->height = frameHeight();
00173 header->depth = frameDepth();
00174 header->no_of_frames = frameList.size();
00175
00176 FILE *fp = fopen(filename.c_str(),"w+b");
00177 if (!fp) {
00178 HxEnvironment::instance()->errorStream()
00179 << "Cannot open file for writing:" << filename << STD_ENDL;
00180 HxEnvironment::instance()->flush();
00181 return -1;
00182 }
00183
00184 int* buf = new int[header->width * header->height];
00185 int block_size = header->width * header->height * sizeof(int);
00186
00187 fwrite(header,sizeof(Header_Type),1,fp);
00188
00189 for (int i=0; i<frameList.size(); i++) {
00190 HxImageRep im = pointee()->frame2HxImageRep(frameList[i]);
00191 im.getRgbPixels2d(buf,"Direct");
00192 fwrite(buf, block_size, 1, fp);
00193 }
00194 fclose(fp);
00195
00196 delete buf;
00197
00198 return 0;
00199 }
00200 else {
00201 HxEnvironment::instance()->errorStream()
00202 << "Writefile for this format not implemented yet" << STD_ENDL;
00203 HxEnvironment::instance()->flush();
00204 return -1;
00205 }
00206
00207 #else
00208
00209 HxEnvironment::instance()->errorStream()
00210 << "No non DX codec" << STD_ENDL;
00211 HxEnvironment::instance()->flush();
00212 return -1;
00213
00214 // __GNUC__
00215 #endif
00216 }
|
|
|
Put some information on the given stream.
00220 {
00221 os << "Number of Frames: " << nrFrames()
00222 << ", frame sizes : " << frameWidth() << " x " << frameHeight()
00223 << STD_ENDL;
00224 return os;
00225 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001