ARWrapper
Provides a C++ wrapper around ARToolKit and exposes a C and JNI API
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Attributes | List of all members
AndroidVideoSource Class Reference

Video input implementation for Android. More...

#include <AndroidVideoSource.h>

Inheritance diagram for AndroidVideoSource:
VideoSource

Public Member Functions

 AndroidVideoSource ()
 
bool getVideoReadyAndroid (const int width, const int height, const int cameraIndex, const bool cameraIsFrontFacing)
 
virtual bool open ()
 Opens the video source. More...
 
size_t getFrameSize ()
 Returns the size of current frame. More...
 
void acceptImage (ARUint8 *ptr)
 
virtual bool captureFrame ()
 Asks the video source to capture a frame. More...
 
virtual bool close ()
 Closes the video source. More...
 
virtual const char * getName ()
 Returns the name of this video source variation. More...
 
- Public Member Functions inherited from VideoSource
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...
 
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...
 

Protected Attributes

AR2VideoParamT * gVid
 
int gCameraIndex
 
bool gCameraIsFrontFacing
 
- Protected Attributes inherited from VideoSource
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
 

Additional Inherited Members

- Static Public Member Functions inherited from VideoSource
static VideoSourcenewVideoSource ()
 Returns the correct VideoSource subclass for use on the current platform. More...
 
- Protected Types inherited from VideoSource
enum  DeviceState { DEVICE_CLOSED, DEVICE_OPEN, DEVICE_GETTING_READY, DEVICE_RUNNING }
 
- Protected Member Functions inherited from VideoSource
void setError (int error)
 
 VideoSource ()
 The constructor is not public because instances are created using a factory method. More...
 

Detailed Description

Video input implementation for Android.

On Android, video capture occurs in Java, and the frame data is passed across to the native code using JNI. Therefore, ARToolKit cannot open the camera and initiate video capture in the same way as it does on other platforms. Instead, the video source remains closed until the first frame arrives over JNI.

Constructor & Destructor Documentation

AndroidVideoSource::AndroidVideoSource ( )

Member Function Documentation

void AndroidVideoSource::acceptImage ( ARUint8 *  ptr)
bool AndroidVideoSource::captureFrame ( )
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

Implements VideoSource.

bool AndroidVideoSource::close ( )
virtual

Closes the video source.

This method must be provided by the subclass.

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

Implements VideoSource.

size_t AndroidVideoSource::getFrameSize ( )

Returns the size of current frame.

Returns
Size of the buffer containing the current video frame
const char * AndroidVideoSource::getName ( )
virtual

Returns the name of this video source variation.

This method must be provided by the subclass.

Returns
Name of the video source

Implements VideoSource.

bool AndroidVideoSource::getVideoReadyAndroid ( const int  width,
const int  height,
const int  cameraIndex,
const bool  cameraIsFrontFacing 
)
bool AndroidVideoSource::open ( )
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.

Implements VideoSource.

Member Data Documentation

int AndroidVideoSource::gCameraIndex
protected
bool AndroidVideoSource::gCameraIsFrontFacing
protected
AR2VideoParamT* AndroidVideoSource::gVid
protected

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