#include <video.h>
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 |
PVideoInputDevice * | mpInput |
Specified video device name, eg /dev/video0. | |
PVideoOutputDevice * | mpOutput |
For grabbing video from the camera. | |
PMutex | accessMutex |
For displaying video on the screen. | |
Static Protected Attributes | |
static PMutex | dictMutex |
Note that this video channel is implicitly a series of frames in YUV411P format. No conversion is performed on data to/from the channel.
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.
dir | Name of video driver/device Video I/O direction |
PVideoChannel::~PVideoChannel | ( | ) |
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.
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.
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.
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.
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.
Reimplemented from PChannel.
virtual PString PVideoChannel::GetName | ( | ) | const [virtual] |
PString PVideoChannel::GetErrorText | ( | ) | const |
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] |