00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef PTLIB_PVIDFILE_H
00035 #define PTLIB_PVIDFILE_H
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041 #include <ptlib.h>
00042
00043 #if P_VIDEO
00044 #if P_VIDFILE
00045
00046 #include <ptlib/videoio.h>
00047
00048
00052 class PVideoFile : public PVideoFrameInfo
00053 {
00054 PCLASSINFO(PVideoFile, PVideoFrameInfo);
00055 protected:
00056 PVideoFile();
00057
00058 public:
00059 virtual PBoolean Open(
00060 const PFilePath & name,
00061 PFile::OpenMode mode = PFile::ReadWrite,
00062 int opts = PFile::ModeDefault
00063 );
00064
00065 virtual PBoolean IsOpen() const { return m_file.IsOpen(); }
00066 virtual PBoolean Close() { return m_file.Close(); }
00067
00068 virtual PBoolean WriteFrame(const void * frame);
00069 virtual PBoolean ReadFrame(void * frame);
00070
00071 virtual off_t GetLength() const;
00072 virtual PBoolean SetLength(
00073 off_t len
00074 );
00075
00076 virtual off_t GetPosition() const;
00077 virtual PBoolean SetPosition(
00078 off_t pos,
00079 PFile::FilePositionOrigin origin = PFile::Start
00080 );
00081
00082 virtual PBoolean SetFrameSize(
00083 unsigned width,
00084 unsigned height
00085 );
00086 virtual PBoolean SetFrameRate(
00087 unsigned rate
00088 );
00089
00090 const PFilePath & GetFilePath() const { return m_file.GetFilePath(); }
00091 PINDEX GetFrameBytes() const { return m_frameBytes; }
00092
00093
00094 protected:
00095 bool m_fixedFrameSize;
00096 bool m_fixedFrameRate;
00097 PINDEX m_frameBytes;
00098 off_t m_headerOffset;
00099 PFile m_file;
00100 };
00101
00107 class PYUVFile : public PVideoFile
00108 {
00109 PCLASSINFO(PYUVFile, PVideoFile);
00110 public:
00111 PYUVFile();
00112
00113 virtual PBoolean Open(
00114 const PFilePath & name,
00115 PFile::OpenMode mode = PFile::ReadWrite,
00116 int opts = PFile::ModeDefault
00117 );
00118
00119 virtual PBoolean WriteFrame(const void * frame);
00120 virtual PBoolean ReadFrame(void * frame);
00121
00122 protected:
00123 bool m_y4mMode;
00124 };
00125
00126 PFACTORY_LOAD(PYUVFile);
00127
00128 #endif
00129 #endif
00130
00131 #endif // PTLIB_PVIDFILE_H
00132
00133
00134