pvfiledev.h
Go to the documentation of this file.
/*
* pvfiledev.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: 27357 $
* $Author: rjongbloed $
* $Date: 2012-03-28 19:39:08 -0500 (Wed, 28 Mar 2012) $
*/
#ifndef PTLIB_PVFILEDEV_H
#define PTLIB_PVFILEDEV_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib.h>
#if P_VIDEO
#if P_VIDFILE
#include <ptlib.h>
#include <ptlib/video.h>
#include <ptlib/vconvert.h>
#include <ptclib/pvidfile.h>
#include <ptclib/delaychan.h>
//
// This class defines a video capture (input) device that reads video from a raw YUV file
//
class PVideoInputDevice_YUVFile : public PVideoInputDevice
{
PCLASSINFO(PVideoInputDevice_YUVFile, PVideoInputDevice);
public:
enum {
Channel_PlayAndClose = 0,
Channel_PlayAndRepeat = 1,
Channel_PlayAndKeepLast = 2,
Channel_PlayAndShowBlack = 3,
ChannelCount = 4
};
PVideoInputDevice_YUVFile();
virtual ~PVideoInputDevice_YUVFile();
PBoolean Open(
const PString & deviceName,
PBoolean startImmediate = true
);
PBoolean IsOpen() ;
PBoolean Close();
PBoolean Start();
PBoolean Stop();
PBoolean IsCapturing();
static PStringArray GetInputDeviceNames();
virtual PStringArray GetDeviceNames() const
{ return GetInputDeviceNames(); }
static bool GetDeviceCapabilities(
const PString & /*deviceName*/,
Capabilities * /*caps*/
) { return false; }
virtual PINDEX GetMaxFrameBytes();
virtual PBoolean GetFrameData(
BYTE * buffer,
PINDEX * bytesReturned = NULL
);
virtual PBoolean GetFrameDataNoDelay(
BYTE * buffer,
PINDEX * bytesReturned = NULL
);
virtual PBoolean SetVideoFormat(
VideoFormat videoFormat
);
virtual int GetNumChannels() ;
virtual PBoolean SetChannel(
int channelNumber
);
virtual PBoolean SetColourFormat(
const PString & colourFormat // New colour format for device.
);
virtual PBoolean SetFrameRate(
unsigned rate
);
virtual PBoolean GetFrameSizeLimits(
unsigned & minWidth,
unsigned & minHeight,
unsigned & maxWidth,
unsigned & maxHeight
) ;
virtual PBoolean SetFrameSize(
unsigned width,
unsigned height
);
protected:
PVideoFile * m_file;
PAdaptiveDelay m_pacing;
unsigned m_frameRateAdjust;
bool m_opened;
};
//
// This class defines a video display (output) device that writes video to a raw YUV file
//
class PVideoOutputDevice_YUVFile : public PVideoOutputDevice
{
PCLASSINFO(PVideoOutputDevice_YUVFile, PVideoOutputDevice);
public:
PVideoOutputDevice_YUVFile();
virtual ~PVideoOutputDevice_YUVFile();
static PStringArray GetOutputDeviceNames();
virtual PStringArray GetDeviceNames() const
{ return GetOutputDeviceNames(); }
virtual PBoolean Open(
const PString & deviceName,
PBoolean startImmediate = true
);
PBoolean Start();
PBoolean Stop();
virtual PBoolean Close();
virtual PBoolean IsOpen();
virtual PBoolean SetColourFormat(
const PString & colourFormat // New colour format for device.
);
virtual PINDEX GetMaxFrameBytes();
virtual PBoolean SetFrameData(
unsigned x,
unsigned y,
unsigned width,
unsigned height,
const BYTE * data,
PBoolean endFrame = true
);
protected:
PVideoFile * m_file;
bool m_opened;
};
#endif // P_VIDFILE
#endif
#endif // PTLIB_PVFILEDEV_H
// End Of File ///////////////////////////////////////////////////////////////
PVideoInputDevice::GetFrameData
virtual PBoolean GetFrameData(BYTE *buffer, PINDEX *bytesReturned, unsigned int &flags)
Grab a frame, after a delay as specified by the frame rate.
PVideoInputDevice::GetFrameDataNoDelay
virtual PBoolean GetFrameDataNoDelay(BYTE *buffer, PINDEX *bytesReturned, unsigned int &flags)
Grab a frame.
PCLASSINFO
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PVideoDevice::Open
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.
PVideoFrameInfo::SetFrameRate
virtual PBoolean SetFrameRate(unsigned rate)
Set the video frame rate to be used on the device.
PVideoDevice::GetMaxFrameBytes
virtual PINDEX GetMaxFrameBytes()=0
Get the maximum frame size in bytes.
PStringArray
This is an array collection class of PString objects.
Definition: pstring.h:2024
video.h
PVideoOutputDevice::Start
virtual PBoolean Start()
Start the video device I/O display.
Definition: videoio.h:788
PVideoDevice::Stop
virtual PBoolean Stop()=0
Stop the video device I/O capture.
PBoolean
BOOL PBoolean
Definition: object.h:102
PVideoInputDevice::GetDeviceCapabilities
virtual bool GetDeviceCapabilities(Capabilities *capabilities) const
Retrieve a list of Device Capabilities.
Definition: videoio.h:1052
PVideoInputDevice::Close
virtual PBoolean Close()
Close the device.
Definition: videoio.h:1085
PVideoOutputDevice::Stop
virtual PBoolean Stop()
Stop the video device I/O display.
Definition: videoio.h:792
PVideoDevice::IsOpen
virtual PBoolean IsOpen()=0
Determine if the device is currently open.
PVideoDevice::GetNumChannels
virtual int GetNumChannels()
Get the number of video channels available on the device.
PVideoDevice::Start
virtual PBoolean Start()=0
Start the video device I/O capture.
PString
The character string class.
Definition: pstring.h:108
PVideoDevice::GetDeviceNames
virtual PStringArray GetDeviceNames() const =0
Get a list of all of the drivers available.
PAdaptiveDelay
Class for implementing an "adaptive" delay.
Definition: delaychan.h:52
PVideoInputDevice::IsCapturing
virtual PBoolean IsCapturing()=0
Determine if the video device I/O capture is in progress.
PVideoInputDevice
This class defines a video input device.
Definition: videoio.h:975
PVideoDevice::SetFrameSize
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
vconvert.h
PVideoFrameInfo::SetColourFormat
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
PVideoOutputDevice::Close
virtual PBoolean Close()
Close the device.
Definition: videoio.h:784
PVideoOutputDevice
This class defines a video output device.
Definition: videoio.h:716
PVideoDevice::SetChannel
virtual PBoolean SetChannel(int channelNumber)
Set the video channel to be used on the device.
PVideoOutputDevice::SetFrameData
virtual PBoolean SetFrameData(unsigned x, unsigned y, unsigned width, unsigned height, const BYTE *data, PBoolean endFrame=true)=0
Set a section of the output frame buffer.
pvidfile.h
PVideoDevice::GetFrameSizeLimits
virtual PBoolean GetFrameSizeLimits(unsigned &minWidth, unsigned &minHeight, unsigned &maxWidth, unsigned &maxHeight)
Get the minimum & maximum size of a frame on the device.
PVideoDevice::SetVideoFormat
virtual PBoolean SetVideoFormat(VideoFormat videoFormat)
Set the video format to be used.
delaychan.h
PVideoInputDevice::Open
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.