PVideoChannel Class Reference

#include <video.h>

Inheritance diagram for PVideoChannel:

PChannel PObject

List of all members.

Construction

enum  Directions { Recorder, Player }
 PVideoChannel ()
 Create a video channel.
 PVideoChannel (const PString &device, Directions dir)
 ~PVideoChannel ()

Open functions

BOOL Open (const PString &device, Directions dir)
BOOL IsOpen () const
static PStringList GetDeviceNames (Directions dir)
static PString GetDefaultDevice (Directions dir)

Public Member Functions

virtual PINDEX GetGrabWidth ()
virtual PINDEX GetGrabHeight ()
virtual BOOL Read (void *buf, PINDEX len)
BOOL Write (const void *buf, PINDEX len)
virtual BOOL Redraw (const void *frame)
PINDEX GetRenderWidth ()
PINDEX GetRenderHeight ()
virtual void SetRenderFrameSize (int _width, int _height)
virtual void SetGrabberFrameSize (int _width, int _height)
virtual void AttachVideoPlayer (PVideoOutputDevice *device, BOOL keepCurrent=TRUE)
virtual void AttachVideoReader (PVideoInputDevice *device, BOOL keepCurrent=TRUE)
virtual
PVideoInputDevice
GetVideoReader ()
virtual
PVideoOutputDevice
GetVideoPlayer ()
virtual BOOL IsGrabberOpen ()
virtual BOOL IsRenderOpen ()
BOOL DisplayRawData (void *videoBuffer)
virtual void CloseVideoReader ()
virtual void CloseVideoPlayer ()
void RestrictAccess ()
void EnableAccess ()
BOOL ToggleVFlipInput ()
virtual BOOL Close ()
virtual PString GetName () const
PString GetErrorText () const

Protected Attributes

Directions direction
PString deviceName
PVideoInputDevicempInput
 Specified video device name, eg /dev/video0.
PVideoOutputDevicempOutput
 For grabbing video from the camera.
PMutex accessMutex
 For displaying video on the screen.

Static Protected Attributes

static PMutex dictMutex


Detailed Description

A class representing a video channel. This class is provided mainly for the playback or recording of video on the system.

Note that this video channel is implicitly a series of frames in YUV411P format. No conversion is performed on data to/from the channel.


Member Enumeration Documentation

enum PVideoChannel::Directions

Enumerator:
Recorder 
Player 


Constructor & Destructor Documentation

PVideoChannel::PVideoChannel (  ) 

Create a video channel.

PVideoChannel::PVideoChannel ( const PString device,
Directions  dir 
)

Create a video channel. Create a reference to the video drivers for the platform.

Parameters:
dir  Name of video driver/device Video I/O direction

PVideoChannel::~PVideoChannel (  ) 


Member Function Documentation

BOOL PVideoChannel::Open ( const PString device,
Directions  dir 
)

Open the specified device for playing or recording. The device name is platform specific and is as returned in the GetDevices() function.

Returns:
TRUE if the video device is valid for playing/recording.
Parameters:
dir  Name of video driver/device Video I/O direction

BOOL PVideoChannel::IsOpen (  )  const [virtual]

return True if one (or both) of the video device class pointers is non NULL. If either pointer is non NULL, then a device is ready to be written to, which indicates this channel is open.

Reimplemented from PChannel.

static PStringList PVideoChannel::GetDeviceNames ( Directions  dir  )  [static]

Get all of the names for video devices/drivers that are available on this platform. Note that a named device may not necessarily do both playing and recording so the arrays returned with the dir# parameter in each value is not necessarily the same.

Returns:
An array of platform dependent strings for each video player/recorder.

static PString PVideoChannel::GetDefaultDevice ( Directions  dir  )  [static]

Get the name for the default video devices/driver that is on this platform. Note that a named device may not necessarily do both playing and recording so the arrays returned with the dir# parameter in each value is not necessarily the same.

Returns:
A platform dependent string for the video player/recorder.

virtual PINDEX PVideoChannel::GetGrabWidth (  )  [virtual]

Return the width of the currently selected grabbing device.

virtual PINDEX PVideoChannel::GetGrabHeight (  )  [virtual]

Return the height of the currently selected grabbing device.

virtual BOOL PVideoChannel::Read ( void *  buf,
PINDEX  len 
) [virtual]

Low level read from the channel. This function may block until the requested number of characters were read or the read timeout was reached. The GetLastReadCount() function returns the actual number of bytes read.

The GetErrorCode() function should be consulted after Read() returns FALSE to determine what caused the failure.

Returns:
TRUE indicates that at least one character was read from the channel. FALSE means no bytes were read due to timeout or some other I/O error.

Reimplemented from PChannel.

BOOL PVideoChannel::Write ( const void *  buf,
PINDEX  len 
) [virtual]

Low level write to the channel, which is data to be rendered to the local video display device.

Reimplemented from PChannel.

virtual BOOL PVideoChannel::Redraw ( const void *  frame  )  [virtual]

Cause the referenced data to be drawn to the previously defined media

PINDEX PVideoChannel::GetRenderWidth (  ) 

Return the previously specified width.

PINDEX PVideoChannel::GetRenderHeight (  ) 

Return the previously specified height.

virtual void PVideoChannel::SetRenderFrameSize ( int  _width,
int  _height 
) [virtual]

Specifiy the width and height of the video stream, which is to be rendered onto the previously specified device.

virtual void PVideoChannel::SetGrabberFrameSize ( int  _width,
int  _height 
) [virtual]

Specifiy the width and height of the video stream, which is to be extracted from the previously specified device.

virtual void PVideoChannel::AttachVideoPlayer ( PVideoOutputDevice device,
BOOL  keepCurrent = TRUE 
) [virtual]

Attach a user specific class for rendering video

If keepCurrent is true, an abort is caused when the program attempts to attach a new player when there is already a video player attached.

If keepCurrent is false, the existing video player is deleted before attaching the new player.

virtual void PVideoChannel::AttachVideoReader ( PVideoInputDevice device,
BOOL  keepCurrent = TRUE 
) [virtual]

Attach a user specific class for acquiring video

If keepCurrent is true, an abort is caused when the program attempts to attach a new reader when there is already a video reader attached.

If keepCurrent is false, the existing video reader is deleted before attaching the new reader.

virtual PVideoInputDevice* PVideoChannel::GetVideoReader (  )  [virtual]

Return a pointer to the class for acquiring video

virtual PVideoOutputDevice* PVideoChannel::GetVideoPlayer (  )  [virtual]

Return a pointer to the class for displaying video

virtual BOOL PVideoChannel::IsGrabberOpen (  )  [virtual]

See if the grabber is open

virtual BOOL PVideoChannel::IsRenderOpen (  )  [virtual]

See if the rendering device is open

BOOL PVideoChannel::DisplayRawData ( void *  videoBuffer  ) 

Get data from the attached inputDevice, and display on the attached ouptutDevice.

virtual void PVideoChannel::CloseVideoReader (  )  [virtual]

Destroy the attached grabber class.

virtual void PVideoChannel::CloseVideoPlayer (  )  [virtual]

Destroy the attached video display class.

void PVideoChannel::RestrictAccess (  ) 

Restrict others from using this video channel.

void PVideoChannel::EnableAccess (  ) 

Allow free access to this video channel.

BOOL PVideoChannel::ToggleVFlipInput (  ) 

Toggle the vertical flip state of the video grabber.

virtual BOOL PVideoChannel::Close (  )  [virtual]

Close the channel, shutting down the link to the data source.

Returns:
TRUE if the channel successfully closed.

Reimplemented from PChannel.

virtual PString PVideoChannel::GetName (  )  const [virtual]

Get the platform and I/O channel type name of the channel. For example, it would return the filename in PFile# type channels.

Returns:
the name of the channel.

Reimplemented from PChannel.

PString PVideoChannel::GetErrorText (  )  const


Member Data Documentation

Directions PVideoChannel::direction [protected]

PString PVideoChannel::deviceName [protected]

PVideoInputDevice* PVideoChannel::mpInput [protected]

Specified video device name, eg /dev/video0.

PVideoOutputDevice* PVideoChannel::mpOutput [protected]

For grabbing video from the camera.

PMutex PVideoChannel::accessMutex [protected]

For displaying video on the screen.

PMutex PVideoChannel::dictMutex [static, protected]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 14:40:16 2007 for PWLib by  doxygen 1.5.3