ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ARVideoSource Class Reference

A video source provides video frames to the artoolkitX tracking module. More...

#include <ARVideoSource.h>

Public Member Functions

 ARVideoSource ()
 
 ~ARVideoSource ()
 
int getError ()
 
bool isOpen () const
 Returns true if the video source is open. More...
 
bool isRunning () const
 Returns true if the video source is open and ready to be queried. More...
 
void configure (const char *vconf, bool noCpara, const char *cparaName, const char *cparaBuff, size_t cparaBuffLen)
 Sets initial parameters which will be used when the video source is opened. More...
 
ARParamLTgetCameraParameters () const
 Returns the camera parameters for the video source. More...
 
int getVideoWidth () const
 Returns the width of the video in pixels. More...
 
int getVideoHeight () const
 Returns the height of the video in pixels. More...
 
AR_PIXEL_FORMAT getPixelFormat () const
 Returns the pixel format of the video. More...
 
bool open ()
 Opens the video source. More...
 
bool close ()
 Closes the video source. More...
 
bool captureFrame ()
 Asks the video source to capture a frame. More...
 
AR2VideoBufferTcheckoutFrameIfNewerThan (const AR2VideoTimestampT time)
 Checkout a locked video frame if the frame's timestamp is newer than 'time'. More...
 
void checkinFrame (void)
 Checkin a locked video frame. More...
 
AR2VideoParamTgetAR2VideoParam (void)
 Get the underlying AR2VideoParamT settings structure. More...
 
bool getFrameTextureRGBA32 (uint32_t *buffer)
 Populates the provided color buffer with the current video frame. More...
 

Detailed Description

A video source provides video frames to the artoolkitX tracking module.

Video sources contain information about the video, such as size and pixel format, camera parameters for distortion compensation, as well as the raw video data itself.

Constructor & Destructor Documentation

◆ ARVideoSource()

ARVideoSource::ARVideoSource ( )

◆ ~ARVideoSource()

ARVideoSource::~ARVideoSource ( )
Here is the call graph for this function:

Member Function Documentation

◆ captureFrame()

bool ARVideoSource::captureFrame ( )

Asks the video source to capture a frame.

Returns
true if the video source captured a frame, otherwise false
Here is the call graph for this function:

◆ checkinFrame()

void ARVideoSource::checkinFrame ( void  )

Checkin a locked video frame.

Each call to checkoutFrameIfNewerThan() which returns non-NULL MUST be balanced with a call to this function on the same thread.

See also
checkoutFrameIfNewerThan

◆ checkoutFrameIfNewerThan()

AR2VideoBufferT * ARVideoSource::checkoutFrameIfNewerThan ( const AR2VideoTimestampT  time)

Checkout a locked video frame if the frame's timestamp is newer than 'time'.

This function returns a pointer to the current video frame buffer, but only if the frame's timestamp is newer than the time passed in parameter 'time'. If the return value is non-NULL, the caller has non-exclusive read access to the frame buffer until the next call to checkinFrame(). If the return value is NULL, no further action is required. I.e. each call to this function which returns non-NULL MUST be balanced with a call to checkinFrame() on the same thread. Multiple callers may simultaneously checkout frames, but the next frame will not be made available until all callers have called checkinFrame() on the current frame.

Parameters
timeTimestamp of frame to compare. Passing a timestamp of {0, 0} will ensure that the timestamp test always passes.
Returns
Pointer to the buffer containing the current video frame, if frame's timestamp is newer and a frame is available.
See also
checkinFrame

◆ close()

bool ARVideoSource::close ( )

Closes the video source.

Returns
true if the video source was closed successfully, otherwise false.
Here is the call graph for this function:

◆ configure()

void ARVideoSource::configure ( const char *  vconf,
bool  noCpara,
const char *  cparaName,
const char *  cparaBuff,
size_t  cparaBuffLen 
)

Sets initial parameters which will be used when the video source is opened.

Parameters
vconfEither NULL (the default), to use the default video configuration, or a C-string containing the video configuration to apply.
noCparaIf false (the default), the default behaviour to determine the camera lens parameters for the video source will be followed. If true, the video source is treated as uncalibrated and attempts to retrieve the camera lens parameters will return NULL.
cparaNameEither NULL (the default), to use the default method for camera lens parameter discovery, or a C-string containing the filesystem path to a camera lens parameter file.
cparaBuffEither NULL (the default), to use the default method for camera lens parameter discovery, or a pointer to an in-memory buffer containing the contents of a camera lens parameter file. If non-NULL, then parameter cparaBuffLen must hold the length of this buffer.
cparaBuffLenIf parameter cparaBuff is NULL, this value is ignored. If parameter cparaBuff is non-NULL, this value must hold the length of the buffer pointed to by cparaBuff.

◆ getAR2VideoParam()

AR2VideoParamT * ARVideoSource::getAR2VideoParam ( void  )

Get the underlying AR2VideoParamT settings structure.

In some advanced circumstances, users might wish to make direct queries on the underlying AR2VideoParamT structure.

Returns
A pointer to the structure. No guarantee about the lifetime or validity of the structure is made.

◆ getCameraParameters()

ARParamLT * ARVideoSource::getCameraParameters ( ) const

Returns the camera parameters for the video source.

Returns
The camera parameters, if some are available, or NULL if no parameters are available.

◆ getError()

int ARVideoSource::getError ( )

◆ getFrameTextureRGBA32()

bool ARVideoSource::getFrameTextureRGBA32 ( uint32_t *  buffer)

Populates the provided color buffer with the current video frame.

Parameters
bufferThe color buffer to populate with frame data
Returns
true if the buffer was updated successfully, otherwise false
Here is the call graph for this function:

◆ getPixelFormat()

AR_PIXEL_FORMAT ARVideoSource::getPixelFormat ( ) const

Returns the pixel format of the video.

Returns
Pixel format of the video

◆ getVideoHeight()

int ARVideoSource::getVideoHeight ( ) const

Returns the height of the video in pixels.

Returns
Height of the video in pixels

◆ getVideoWidth()

int ARVideoSource::getVideoWidth ( ) const

Returns the width of the video in pixels.

Returns
Width of the video in pixels

◆ isOpen()

bool ARVideoSource::isOpen ( ) const

Returns true if the video source is open.

Returns
true if the video source is open

◆ isRunning()

bool ARVideoSource::isRunning ( ) const

Returns true if the video source is open and ready to be queried.

Returns
true if the video source is open and frame details are known

◆ open()

bool ARVideoSource::open ( )

Opens the video source.

Returns
true if the video source was opened successfully, false if a fatal error occured.
Here is the call graph for this function:

The documentation for this class was generated from the following files: