pvidfile.h
Go to the documentation of this file.
/*
* pvidfile.cxx
*
* Video file declaration
*
* Portable Windows Library
*
* Copyright (C) 2004 Post Increment
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is
* Craig Southeren <craigs@postincrement.com>
*
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 25197 $
* $Author: rjongbloed $
* $Date: 2011-02-24 21:03:12 -0600 (Thu, 24 Feb 2011) $
*/
#ifndef PTLIB_PVIDFILE_H
#define PTLIB_PVIDFILE_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib.h>
#if P_VIDEO
#if P_VIDFILE
#include <ptlib/videoio.h>
class PVideoFile : public PVideoFrameInfo
{
PCLASSINFO(PVideoFile, PVideoFrameInfo);
protected:
PVideoFile();
public:
virtual PBoolean Open(
const PFilePath & name, // Name of file to open.
PFile::OpenMode mode = PFile::ReadWrite, // Mode in which to open the file.
int opts = PFile::ModeDefault // <code>OpenOptions</code> enum# for open operation.
);
virtual PBoolean IsOpen() const { return m_file.IsOpen(); }
virtual PBoolean Close() { return m_file.Close(); }
virtual PBoolean WriteFrame(const void * frame);
virtual PBoolean ReadFrame(void * frame);
virtual off_t GetLength() const;
virtual PBoolean SetLength(
off_t len // New length of file in frames.
);
virtual off_t GetPosition() const;
virtual PBoolean SetPosition(
off_t pos,
PFile::FilePositionOrigin origin = PFile::Start
);
virtual PBoolean SetFrameSize(
unsigned width,
unsigned height
);
virtual PBoolean SetFrameRate(
unsigned rate
);
const PFilePath & GetFilePath() const { return m_file.GetFilePath(); }
PINDEX GetFrameBytes() const { return m_frameBytes; }
protected:
bool m_fixedFrameSize;
bool m_fixedFrameRate;
PINDEX m_frameBytes;
off_t m_headerOffset;
PFile m_file;
};
class PYUVFile : public PVideoFile
{
PCLASSINFO(PYUVFile, PVideoFile);
public:
PYUVFile();
virtual PBoolean Open(
const PFilePath & name, // Name of file to open.
PFile::OpenMode mode = PFile::ReadWrite, // Mode in which to open the file.
int opts = PFile::ModeDefault // <code>OpenOptions</code> enum# for open operation.
);
virtual PBoolean WriteFrame(const void * frame);
virtual PBoolean ReadFrame(void * frame);
protected:
bool m_y4mMode;
};
PFACTORY_LOAD(PYUVFile);
#endif
#endif
#endif // PTLIB_PVIDFILE_H
// End Of File ///////////////////////////////////////////////////////////////
PFile
This class represents a disk file.
Definition: file.h:60
PCLASSINFO
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PVideoFrameInfo::SetFrameRate
virtual PBoolean SetFrameRate(unsigned rate)
Set the video frame rate to be used on the device.
PFilePath
This class describes a full description for a file on the particular platform.
Definition: filepath.h:65
PFile::ReadWrite
File can be both read and written.
Definition: file.h:80
PVideoFrameInfo::SetFrameSize
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
videoio.h
PBoolean
BOOL PBoolean
Definition: object.h:102
PVideoFrameInfo
Definition: videoio.h:49
PFACTORY_LOAD
#define PFACTORY_LOAD(ConcreteType)
Definition: pfactory.h:431
PFile::FilePositionOrigin
FilePositionOrigin
Options for the origin in setting the file position.
Definition: file.h:457
PFile::ModeDefault
File options depend on the OpenMode parameter.
Definition: file.h:95
PFile::Start
Set position relative to start of file.
Definition: file.h:459
PFile::OpenMode
OpenMode
When a file is opened, it may restrict the access available to operations on the object instance...
Definition: file.h:77