ARWrapper Provides a C++ wrapper around ARToolKit and exposes a C and JNI API

- Main Page
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
VideoSource Class Referenceabstract

Base class for different video source implementations. More...

`#include <VideoSource.h>`

Inheritance diagram for VideoSource:

## Public Member Functions
virtual | ~VideoSource ()
int | getError ()
bool | isOpen ()
| Returns true if the video source is open. More...
bool | isRunning ()
| Returns true if the video source is open and ready to be queried. More...
void | configure (const char *vconf, const char *cparaName, const char *cparaBuff, size_t cparaBuffLen)
    Sets initial parameters which will be used when the video source
is opened. More...
ARParamLT * | getCameraParameters ()
| Returns the camera parameters for the video source. More...
int | getVideoWidth ()
| Returns the width of the video in pixels. More...
int | getVideoHeight ()
| Returns the height of the video in pixels. More...
AR_PIXEL_FORMAT | getPixelFormat ()
| Returns the pixel format of the video. More...
virtual const char * | getName ()=0
| Returns the name of this video source variation. More...
virtual bool | open ()=0
| Opens the video source. More...
virtual bool | close ()=0
| Closes the video source. More...
virtual bool | captureFrame ()=0
| Asks the video source to capture a frame. More...
ARUint8 * | getFrame ()
| Returns the current frame. More...
int | getFrameStamp ()
| Returns the current frame stamp. More...
bool | updateTexture (Color *buffer)
| Populates the provided color buffer with the current video frame. More...
bool | fastPath ()
bool | updateTexture32 (uint32_t *buffer)
void | updateTextureGL (int textureID)
| Updates the specified OpenGL texture with the current video frame. More...

## Static Public Member Functions
static VideoSource * | newVideoSource ()
| Returns the correct VideoSource subclass for use on the current platform. More...

## Protected Types
enum | DeviceState { DEVICE_CLOSED, DEVICE_OPEN, DEVICE_GETTING_READY, DEVICE_RUNNING }

## Protected Member Functions
void | setError (int error)
| VideoSource ()
| The constructor is not public because instances are created using a factory method. More...

## Protected Attributes
DeviceState | deviceState
| Current state of the video device. More...
char * | cameraParam
| Camera parameter filename. More...
char * | cameraParamBuffer
size_t | cameraParamBufferLen
ARParamLT * | cparamLT
| Camera paramaters. More...
char * | videoConfiguration
| Video configuration string. More...
int | videoWidth
| Width of the video frame in pixels. More...
int | videoHeight
| Height of the video frame in pixels. More...
AR_PIXEL_FORMAT | pixelFormat
| Pixel format from ARToolKit enumeration. More...
int | m_fastPath
GLenum | glPixIntFormat
GLenum | glPixFormat
GLenum | glPixType
ARUint8 * | frameBuffer
| Pointer to latest frame. Set by concrete subclass to point to frame data. More...
ARUint8 * | frameBuffer2
| For bi-planar formats, pointer to plane 2 of latest frame. Set by concrete subclass to point to frame data. More...
int | frameStamp
| Latest framestamp. Incremented in the concrete subclass when a new frame arrives. More...
int | m_error

## Detailed Description

Base class for different video source implementations.

A video source provides video frames to the ARToolKit 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. Different video source implementations are required to provide a standard interface for video input, even though different platforms handle video input quite differently.

## Member Enumeration Documentation

enum VideoSource::DeviceState
| protected

Enumerator
DEVICE_CLOSED | Device is closed.
DEVICE_OPEN | Device is open.
DEVICE_GETTING_READY | Device is moving from open to running.
DEVICE_RUNNING | Device is open and able to be queried.

## Constructor & Destructor Documentation

VideoSource::VideoSource | ( |  | ) |
| protected

The constructor is not public because instances are created using a factory method.

See Also
  newVideoSource()

VideoSource::~VideoSource | ( |  | ) |
| virtual

## Member Function Documentation

virtual bool VideoSource::captureFrame | ( |  | ) |
| pure virtual

Asks the video source to capture a frame.

This method must be provided by the subclass.

Returns
  true if the video source captured a frame, otherwise false

Implemented in AndroidVideoSource, and ARToolKitVideoSource.

virtual bool VideoSource::close | ( |  | ) |
| pure virtual

Closes the video source.

This method must be provided by the subclass.

Returns
  true if the video source was closed successfully, otherwise false.

Implemented in AndroidVideoSource, and ARToolKitVideoSource.

void VideoSource::configure | ( | const char * | vconf,
|  | const char * | cparaName,
|  | const char * | cparaBuff,
|  | size_t | cparaBuffLen
| ) |  |

    Sets initial parameters which will be used when the video source

is opened.

bool VideoSource::fastPath | ( |  | ) |

ARParamLT * VideoSource::getCameraParameters | ( |  | ) |

Returns the camera parameters for the video source.

Returns
  the camera parameters

int VideoSource::getError | ( |  | ) |

ARUint8 * VideoSource::getFrame | ( |  | ) |

Returns the current frame.

Returns
  Pointer to the buffer containing the current video frame

int VideoSource::getFrameStamp | ( |  | ) |

Returns the current frame stamp.

If the returned value has changed since the last time this function was called, then the caller can assume a new frame is available.

Returns
  The current frame stamp, incremented on each new frame arrival

virtual const char* VideoSource::getName | ( |  | ) |
| pure virtual

Returns the name of this video source variation.

This method must be provided by the subclass.

Returns
  Name of the video source

Implemented in AndroidVideoSource, and ARToolKitVideoSource.

AR_PIXEL_FORMAT VideoSource::getPixelFormat | ( |  | ) |

Returns the pixel format of the video.

Returns
  Pixel format of the video

int VideoSource::getVideoHeight | ( |  | ) |

Returns the height of the video in pixels.

Returns
  Height of the video in pixels

int VideoSource::getVideoWidth | ( |  | ) |

Returns the width of the video in pixels.

Returns
  Width of the video in pixels

bool VideoSource::isOpen | ( |  | ) |

Returns true if the video source is open.

Returns
  true if the video source is open

bool VideoSource::isRunning | ( |  | ) |

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

VideoSource * VideoSource::newVideoSource | ( |  | ) |
| static

Returns the correct VideoSource subclass for use on the current platform.

Returns
  New instance of an appropriate VideoSource

virtual bool VideoSource::open | ( |  | ) |
| pure virtual

Opens the video source.

This method must be provided by the subclass.

Returns
  true if the video source was opened successfully, false if a fatal error occured.

Implemented in AndroidVideoSource, and ARToolKitVideoSource.

void VideoSource::setError | ( | int | error | ) |
| protected

bool VideoSource::updateTexture | ( | Color * | buffer | ) |

Populates the provided color buffer with the current video frame.

Parameters

  buffer | The color buffer to populate with frame data

Returns
  true if the buffer was updated successfully, otherwise false

bool VideoSource::updateTexture32 | ( | uint32_t * | buffer | ) |

void VideoSource::updateTextureGL | ( | int | textureID | ) |

Updates the specified OpenGL texture with the current video frame.

Parameters

  textureID | The OpenGL texture ID to which the video frame should be uploaded

## Member Data Documentation

char* VideoSource::cameraParam
| protected

Camera parameter filename.

char* VideoSource::cameraParamBuffer
| protected

size_t VideoSource::cameraParamBufferLen
| protected

ARParamLT* VideoSource::cparamLT
| protected

Camera paramaters.

DeviceState VideoSource::deviceState
| protected

Current state of the video device.

ARUint8* VideoSource::frameBuffer
| protected

Pointer to latest frame. Set by concrete subclass to point to frame data.

ARUint8* VideoSource::frameBuffer2
| protected

For bi-planar formats, pointer to plane 2 of latest frame. Set by concrete subclass to point to frame data.

int VideoSource::frameStamp
| protected

Latest framestamp. Incremented in the concrete subclass when a new frame arrives.

GLenum VideoSource::glPixFormat
| protected

GLenum VideoSource::glPixIntFormat
| protected

GLenum VideoSource::glPixType
| protected

int VideoSource::m_error
| protected

int VideoSource::m_fastPath
| protected

AR_PIXEL_FORMAT VideoSource::pixelFormat
| protected

Pixel format from ARToolKit enumeration.

char* VideoSource::videoConfiguration
| protected

Video configuration string.

int VideoSource::videoHeight
| protected

Height of the video frame in pixels.

int VideoSource::videoWidth
| protected

Width of the video frame in pixels.

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

- include/ARWrapper/VideoSource.h
- lib/SRC/ARWrapper/VideoSource.cpp