All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Radiant::VideoInput Class Referenceabstract

Base class for video input classes. More...

#include <Radiant/VideoInput.hpp>

Inheritance diagram for Radiant::VideoInput:
Radiant::VideoCamera

Public Member Functions

virtual const void * captureAudio (int *frameCount)
 Get audio data. More...
 
virtual const Radiant::VideoImagecaptureImage ()=0
 This method captures an image from the video source. More...
 
virtual bool close ()=0
 Close the device. More...
 
virtual void doneImage ()
 Inform the video handler that the application has used the image. More...
 
virtual Nimble::Vector2i focalPoint () const
 
virtual float fps () const =0
 Returns the current frame rate (int frames per second) of the video stream. More...
 
virtual void getAudioParameters (int *channels, int *sample_rate, AudioSampleFormat *format) const
 Get audio parameters. More...
 
virtual int height () const =0
 Returns the current height of a frame in the video stream images. More...
 
virtual ImageFormat imageFormat () const =0
 Returns the current image format of the stream. More...
 
virtual void setBrightness (float b)
 Set the brightness control of the device (if possible) More...
 
virtual void setExposure (float e)
 Set the exposure control of the device (if possible) More...
 
virtual void setGain (float g)
 Sets the camera gain (if possible). More...
 
virtual void setGamma (float g)
 Sets the gamma correction value. More...
 
virtual void setShutter (float t)
 Sets the shutter time. More...
 
virtual unsigned int size () const =0
 Returns the total size of one captured image frame in bytes. More...
 
virtual bool start ()=0
 Starts the data transmission. More...
 
virtual bool stop ()=0
 Stops the data transmission. More...
 
virtual uint64_t uid ()
 Returns the unique identifier for the input device. More...
 
virtual int width () const =0
 Returns the current width of a frame in the video stream images. More...
 
virtual ~VideoInput ()
 Destructor.
 

Protected Member Functions

 VideoInput ()
 Disabled.
 

Detailed Description

Base class for video input classes.

Potential child classes are: FireWire video input, USB video input and movie video input.

Authors
Tommi Ilmonen and Juha Laitinen

Member Function Documentation

virtual const void* Radiant::VideoInput::captureAudio ( int *  frameCount)
virtual

Get audio data.

This function returns a pointer to the internal audio PCM buffer. The audio PCM buffer is filled in the captureImage function, and this function only returns a pointer to the captured data.

This function should be called frequently, typically after each video frame. For many video sources (movie files in particular) this function will return null most of the time, as the audio is encoded in chunks so that audio frames cover multiple video frames. Thus you may have this function return the audio for one full second of the movie.

Parameters
frameCountThe number of frames available is stored inside this pointer.
Returns
Pointer to the raw PCM audio data. Usually the data is in int16_t format, but this is not mandatory. Use the getAudioParameters function to determine the audio sample format, and other paramters. The returned memory is usable until the next call to captureVideo.
virtual const Radiant::VideoImage* Radiant::VideoInput::captureImage ( )
pure virtual

This method captures an image from the video source.

The image is returned in the native format of the device.

See Also
imageFormat for the current format of the device.
Radiant::ImageConversion for conversions into application video formats
Note
The device has to be initialized, and the stream transmission has to be started before this method can be called.
See Also
start
Returns
pointer to the current captured image
virtual bool Radiant::VideoInput::close ( )
pure virtual

Close the device.

Returns
True if succeeded, false otherwise
virtual void Radiant::VideoInput::doneImage ( )
virtual

Inform the video handler that the application has used the image.

This function is necessary as some handlers need to release

the resources that relate to a particular frame.

virtual Nimble::Vector2i Radiant::VideoInput::focalPoint ( ) const
virtual
Returns
Focal point projected to image coordinates Default implementation returns the center of the image
virtual float Radiant::VideoInput::fps ( ) const
pure virtual

Returns the current frame rate (int frames per second) of the video stream.

Returns
Current frame rate
virtual void Radiant::VideoInput::getAudioParameters ( int *  channels,
int *  sample_rate,
AudioSampleFormat format 
) const
virtual

Get audio parameters.

Parameters
channelsThe number of channels in the video sound-track.
sample_rateAudio sample rate
formatThe audio sample format
virtual int Radiant::VideoInput::height ( ) const
pure virtual

Returns the current height of a frame in the video stream images.

Returns
Height of a frame
virtual ImageFormat Radiant::VideoInput::imageFormat ( ) const
pure virtual

Returns the current image format of the stream.

Returns
Image format of the stream
virtual void Radiant::VideoInput::setBrightness ( float  b)
virtual

Set the brightness control of the device (if possible)

Parameters
bBrightness to set

Reimplemented in Radiant::VideoCamera.

virtual void Radiant::VideoInput::setExposure ( float  e)
virtual

Set the exposure control of the device (if possible)

Parameters
eExposure to set

Reimplemented in Radiant::VideoCamera.

virtual void Radiant::VideoInput::setGain ( float  g)
virtual

Sets the camera gain (if possible).

Negative values sets automatic gain control. Manual range [0-1].

Parameters
gGain to set

Reimplemented in Radiant::VideoCamera.

virtual void Radiant::VideoInput::setGamma ( float  g)
virtual

Sets the gamma correction value.

Parameters
gValue of gamme to set

Reimplemented in Radiant::VideoCamera.

virtual void Radiant::VideoInput::setShutter ( float  t)
virtual

Sets the shutter time.

Larger values lead to longer shutter times. Negative values tell the system to use automatic shutter timing. Manual range [0-1].

Parameters
tTime for shutter

Reimplemented in Radiant::VideoCamera.

virtual unsigned int Radiant::VideoInput::size ( ) const
pure virtual

Returns the total size of one captured image frame in bytes.

Returns
Size of single image
virtual bool Radiant::VideoInput::start ( )
pure virtual

Starts the data transmission.

Returns
True if succeeded, false otherwise
virtual bool Radiant::VideoInput::stop ( )
pure virtual

Stops the data transmission.

Returns
True if succeeded, false otherwise
virtual uint64_t Radiant::VideoInput::uid ( )
virtual

Returns the unique identifier for the input device.

Returns
Identifier of the device
virtual int Radiant::VideoInput::width ( ) const
pure virtual

Returns the current width of a frame in the video stream images.

Note that it is quite common for video devices to not report the correct frame size before at least one frame has been captured.

Returns
Width of a frame