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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 #ifndef _PVIDFILE
00059 #define _PVIDFILE
00060
00061 #ifdef P_USE_PRAGMA
00062 #pragma interface
00063 #endif
00064
00065 #include <ptlib.h>
00066
00067 #if P_VIDEO
00068 #if P_VIDFILE
00069
00070 #include <ptlib/videoio.h>
00071
00072
00076 class PVideoFile : public PVideoFrameInfo
00077 {
00078 PCLASSINFO(PVideoFile, PVideoFrameInfo);
00079 protected:
00080 PVideoFile();
00081
00082 public:
00083 virtual BOOL SetFrameSize(
00084 unsigned width,
00085 unsigned height
00086 );
00087
00088 virtual BOOL Open(
00089 const PFilePath & name,
00090 PFile::OpenMode mode = PFile::ReadWrite,
00091 int opts = PFile::ModeDefault
00092 );
00093
00094 virtual BOOL IsOpen() const { return file.IsOpen(); }
00095 virtual BOOL Close() { return file.Close(); }
00096
00097 virtual BOOL WriteFrame(const void * frame);
00098 virtual BOOL ReadFrame(void * frame);
00099
00100 virtual off_t GetLength() const;
00101 virtual BOOL SetLength(
00102 off_t len
00103 );
00104
00105 virtual off_t GetPosition() const;
00106 virtual BOOL SetPosition(
00107 off_t pos,
00108 PFile::FilePositionOrigin origin = PFile::Start
00109 );
00110
00111 const PFilePath & GetFilePath() const { return file.GetFilePath(); }
00112 bool IsUnknownFrameSize() const { return unknownFrameSize; }
00113 PINDEX GetFrameBytes() const { return frameBytes; }
00114
00115 static BOOL ExtractHints(const PFilePath & fn, PVideoFrameInfo & info);
00116
00117 protected:
00118 bool unknownFrameSize;
00119 PINDEX frameBytes;
00120 off_t headerOffset;
00121 PFile file;
00122 };
00123
00129 class PYUVFile : public PVideoFile
00130 {
00131 PCLASSINFO(PYUVFile, PVideoFile);
00132 public:
00133 PYUVFile();
00134
00135 virtual BOOL Open(
00136 const PFilePath & name,
00137 PFile::OpenMode mode = PFile::ReadWrite,
00138 int opts = PFile::ModeDefault
00139 );
00140
00141 virtual BOOL WriteFrame(const void * frame);
00142 virtual BOOL ReadFrame(void * frame);
00143
00144 protected:
00145 BOOL y4mMode;
00146 };
00147
00148 #endif
00149 #endif
00150
00151 #endif // P_VIDFILE