video.h
Go to the documentation of this file.
/*
* video.h
*
* Video interface class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* 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 Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): Derek Smithies (derek@indranet.co.nz)
*
* $Revision: 24459 $
* $Author: shorne $
* $Date: 2010-06-06 08:59:59 -0500 (Sun, 06 Jun 2010) $
*/
#ifndef PTLIB_VIDEO_H
#define PTLIB_VIDEO_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptbuildopts.h>
#if P_VIDEO
#include <ptlib/videoio.h>
class PVideoChannel : public PChannel
{
PCLASSINFO(PVideoChannel, PChannel);
public:
enum Directions {
Recorder,
Player
};
PVideoChannel();
PVideoChannel(
const PString & device,
Directions dir
);
//
~PVideoChannel();
// Destroy and close the video driver
PBoolean Open(
const PString & device,
Directions dir
);
PBoolean IsOpen() const;
static PStringArray GetDeviceNames(
Directions dir
) ;
static PString GetDefaultDevice(
Directions dir // Video I/O direction
);
virtual PINDEX GetGrabWidth();
virtual PINDEX GetGrabHeight();
virtual PBoolean Read(void * buf, PINDEX len);
// Low level read from the video channel. This function will block until the
// requested number of characters were read.
PBoolean Write(const void * buf, //Pointer to the image data to be rendered
PINDEX len);
virtual PBoolean Write(
const void * buf,
PINDEX len,
void * mark
);
virtual PBoolean Redraw(const void * frame);
PINDEX GetRenderWidth();
PINDEX GetRenderHeight();
virtual void SetRenderFrameSize(int width, int height);
virtual void SetRenderFrameSize(int width, int height,int sarwidth, int sarheight);
virtual void SetGrabberFrameSize(int width, int height);
virtual void AttachVideoPlayer(PVideoOutputDevice * device, PBoolean keepCurrent = true);
virtual void AttachVideoReader(PVideoInputDevice * device, PBoolean keepCurrent = true);
virtual PVideoInputDevice *GetVideoReader();
virtual PVideoOutputDevice *GetVideoPlayer();
virtual PBoolean IsGrabberOpen();
virtual PBoolean IsRenderOpen();
virtual PBoolean DisableDecode();
PBoolean DisplayRawData(void *videoBuffer);
virtual void CloseVideoReader();
virtual void CloseVideoPlayer();
void RestrictAccess();
void EnableAccess();
PBoolean ToggleVFlipInput();
virtual bool FlowControl(const void * flowData);
protected:
Directions direction;
PString deviceName;
PVideoInputDevice *mpInput;
PVideoOutputDevice *mpOutput;
PMutex accessMutex; // Ensure that only task is accesing
// members in this video channel.
private:
void Construct();
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/video.h"
#else
#include "unix/ptlib/video.h"
#endif
};
#endif // P_VIDEO
#endif // PTLIB_VIDEO_H
// End Of File ///////////////////////////////////////////////////////////////
PVideoChannel::CloseVideoReader
virtual void CloseVideoReader()
Destroy the attached grabber class.
PVideoChannel::IsRenderOpen
virtual PBoolean IsRenderOpen()
See if the rendering device is open.
PVideoChannel::Read
virtual PBoolean Read(void *buf, PINDEX len)
Low level read from the channel.
PVideoChannel::CloseVideoPlayer
virtual void CloseVideoPlayer()
Destroy the attached video display class.
PVideoChannel
A class representing a video channel.
Definition: video.h:53
PVideoChannel::PVideoChannel
PVideoChannel()
Create a video channel.
PVideoChannel::Open
PBoolean Open(const PString &device, Directions dir)
Open the specified device for playing or recording.
PVideoChannel::SetRenderFrameSize
virtual void SetRenderFrameSize(int width, int height)
Specify the width and height of the video stream, which is to be rendered onto the previously specifi...
PVideoChannel::AttachVideoPlayer
virtual void AttachVideoPlayer(PVideoOutputDevice *device, PBoolean keepCurrent=true)
Attach a user specific class for rendering video.
PVideoChannel::DisableDecode
virtual PBoolean DisableDecode()
Allow the outputdevice decide whether the decoder should ignore decode hence not render any output...
PVideoChannel::FlowControl
virtual bool FlowControl(const void *flowData)
Flow Control information Pass data to the channel for flowControl determination.
PVideoChannel::Recorder
Definition: video.h:61
PVideoChannel::SetGrabberFrameSize
virtual void SetGrabberFrameSize(int width, int height)
Specifiy the width and height of the video stream, which is to be extracted from the previously speci...
PVideoChannel::~PVideoChannel
~PVideoChannel()
PVideoChannel::IsOpen
PBoolean IsOpen() const
return True if one (or both) of the video device class pointers is non NULL.
PStringArray
This is an array collection class of PString objects.
Definition: pstring.h:2024
videoio.h
PVideoChannel::GetRenderHeight
PINDEX GetRenderHeight()
Return the previously specified height.
PVideoChannel::GetDeviceNames
static PStringArray GetDeviceNames(Directions dir)
Get all of the names for video devices/drivers that are available on this platform.
PVideoChannel::direction
Directions direction
Definition: video.h:256
PVideoChannel::accessMutex
PMutex accessMutex
For displaying video on the screen.
Definition: video.h:262
PBoolean
BOOL PBoolean
Definition: object.h:102
PVideoChannel::mpInput
PVideoInputDevice * mpInput
Specified video device name, eg /dev/video0.
Definition: video.h:259
PVideoChannel::AttachVideoReader
virtual void AttachVideoReader(PVideoInputDevice *device, PBoolean keepCurrent=true)
Attach a user specific class for acquiring video.
PVideoChannel::IsGrabberOpen
virtual PBoolean IsGrabberOpen()
See if the grabber is open.
PVideoChannel::GetVideoPlayer
virtual PVideoOutputDevice * GetVideoPlayer()
Return a pointer to the class for displaying video.
PVideoChannel::ToggleVFlipInput
PBoolean ToggleVFlipInput()
Toggle the vertical flip state of the video grabber.
PChannel
Abstract class defining I/O channel semantics.
Definition: channel.h:107
PString
The character string class.
Definition: pstring.h:108
PVideoChannel::GetGrabHeight
virtual PINDEX GetGrabHeight()
Return the height of the currently selected grabbing device.
PVideoChannel::Directions
Directions
Definition: video.h:60
PVideoChannel::GetRenderWidth
PINDEX GetRenderWidth()
Return the previously specified width.
PVideoChannel::DisplayRawData
PBoolean DisplayRawData(void *videoBuffer)
Get data from the attached inputDevice, and display on the attached ouptutDevice. ...
PVideoChannel::GetGrabWidth
virtual PINDEX GetGrabWidth()
Return the width of the currently selected grabbing device.
PVideoChannel::Write
PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel, which is data to be rendered to the local video display device...
PVideoInputDevice
This class defines a video input device.
Definition: videoio.h:975
PVideoChannel::GetVideoReader
virtual PVideoInputDevice * GetVideoReader()
Return a pointer to the class for acquiring video.
PVideoChannel::Player
Definition: video.h:62
PVideoChannel::Redraw
virtual PBoolean Redraw(const void *frame)
Cause the referenced data to be drawn to the previously defined media.
PVideoChannel::deviceName
PString deviceName
Definition: video.h:258
PVideoChannel::GetDefaultDevice
static PString GetDefaultDevice(Directions dir)
Get the name for the default video devices/driver that is on this platform.
PVideoChannel::RestrictAccess
void RestrictAccess()
Restrict others from using this video channel.
PVideoOutputDevice
This class defines a video output device.
Definition: videoio.h:716
PMutex
Synonym for PTimedMutex.
PVideoChannel::mpOutput
PVideoOutputDevice * mpOutput
For grabbing video from the camera.
Definition: video.h:260
PVideoChannel::EnableAccess
void EnableAccess()
Allow free access to this video channel.