pvidfile.h

Go to the documentation of this file.
00001 /*
00002  * pvidfile.cxx
00003  *
00004  * Video file declaration
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (C) 2004 Post Increment
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is
00023  * Craig Southeren <craigs@postincrement.com>
00024  *
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: pvidfile.h,v $
00030  * Revision 1.4  2006/10/31 04:10:40  csoutheren
00031  * Make sure PVidFileDev class is loaded, and make it work with OPAL
00032  *
00033  * Revision 1.3  2006/02/24 04:51:26  csoutheren
00034  * Fixed problem with using CIF from video files
00035  * Added support for video files in y4m format
00036  *
00037  * Revision 1.2  2006/02/20 06:49:45  csoutheren
00038  * Added video file and video file input device code
00039  *
00040  * Revision 1.1  2006/02/20 06:17:28  csoutheren
00041  * Added ability to read video from a file
00042  *
00043  */
00044 
00045 #ifndef _PVIDFILE
00046 #define _PVIDFILE
00047 
00048 #ifdef P_USE_PRAGMA
00049 #pragma interface
00050 #endif
00051 
00052 #include <ptlib.h>
00053 
00054 #if P_VIDFILE
00055 
00059 class PVideoFile : public PFile
00060 {
00061   PCLASSINFO(PVideoFile, PFile);
00062   public:
00063     PVideoFile();
00064 
00065     PVideoFile(
00066       PINDEX width,
00067       PINDEX height,
00068       OpenMode mode,          
00069       int opts = ModeDefault  
00070     );
00071 
00078     PVideoFile(
00079       PINDEX width,
00080       PINDEX height,
00081       const PFilePath & name,    
00082       OpenMode mode = ReadWrite, 
00083       int opts = ModeDefault     
00084     );
00085 
00086     virtual PINDEX GetWidth() const    { return yuvWidth; }
00087     virtual PINDEX GetHeight() const   { return yuvHeight; }
00088 
00089     virtual void SetWidth(PINDEX v);
00090     virtual void SetHeight(PINDEX v);
00091 
00092     virtual BOOL WriteFrame(const void * frame) = 0;
00093     virtual BOOL ReadFrame(void * frame) = 0;
00094 
00095     BOOL ExtractSizeHint(PFilePath & fn);
00096     static BOOL ExtractSizeHint(PFilePath & fn, PINDEX & width, PINDEX & height);
00097 
00098   protected:
00099     PINDEX yuvWidth, yuvHeight, yuvSize;
00100 };
00101 
00107 class PYUVFile : public PVideoFile
00108 {
00109   PCLASSINFO(PYUVFile, PVideoFile);
00110   public:
00111     PYUVFile();
00112 
00113     PYUVFile(
00114       PINDEX width,
00115       PINDEX height,
00116       OpenMode mode,          
00117       int opts = ModeDefault  
00118     );
00119 
00126     PYUVFile(
00127       PINDEX width,
00128       PINDEX height,
00129       const PFilePath & name,    
00130       OpenMode mode = ReadWrite, 
00131       int opts = ModeDefault     
00132     );
00133 
00134     virtual BOOL Open(
00135       OpenMode mode = ReadWrite,  // Mode in which to open the file.
00136       int opts = ModeDefault      // Options for open operation.
00137     );
00138     virtual BOOL Open(
00139       const PFilePath & name,    // Name of file to open.
00140       OpenMode mode = ReadWrite, // Mode in which to open the file.
00141       int opts = ModeDefault     // #OpenOptions enum# for open operation.
00142     );
00143 
00144     virtual off_t GetLength() const;
00145       
00146     virtual BOOL SetLength(
00147       off_t len   // New length of file.
00148     );
00149 
00150     virtual BOOL SetPosition(
00151       off_t pos,                         
00152       FilePositionOrigin origin = Start  
00153     );
00154 
00155     virtual off_t GetPosition() const;
00156 
00157     virtual BOOL WriteFrame(const void * frame);
00158     virtual BOOL ReadFrame(void * frame);
00159 
00160   protected:
00161     void Construct();
00162     PINDEX offset;
00163     BOOL y4mMode;
00164 };
00165 
00166 #endif
00167 
00168 #endif // P_VIDFILE

Generated on Fri Feb 29 13:37:10 2008 for PWLib by  doxygen 1.5.5