Main Page | Directories | File List | Globals | Related Pages

VideoWrapper.cpp File Reference

Provides an interface adapter for multiple video capture APIs. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "VideoWrapper.h"
#include "VideoWrapperTypes.h"
#include "VideoWrapperTime.h"
#include "VideoWrapperCaptureReplay.h"

Functions

VWResult VIDEO_setPrintFunction (VWPrintFcn *func)
 Sets a callback function that may be used for printing messages from the video libraries.
VWResult VIDEO_loadLibrary (char *szLibIdentifier, char *szLibImplementation)
 Dynamically loads support for a camera library.
VWResult VIDEO_openVideo (char *lpCmdLine, VWHVideo *phVideo)
 Intializes a video camera.
VWResult VIDEO_close (VWHVideo hVideo)
 Close the video camera.
VWResult VIDEO_startVideo (VWHVideo hVideo)
 Starts aquiring frames from the camera.
VWResult VIDEO_stopVideo (VWHVideo hVideo)
 Stops aquiring frames from the camera.
VWResult VIDEO_getFrame (VWHVideo hVideo, unsigned char **ppbFrame, timeval *pTimestamp=NULL)
 Polls for new video frame.
VWResult VIDEO_releaseFrame (VWHVideo hVideo)
 Releases the frame so that memory may be deallocated.
VWResult VIDEO_resetVideo (VWHVideo hVideo, VWBool bAutomatic)
 Resets all the camera parameters to defaults.
VWResult VIDEO_showPropertiesDialog (VWHVideo hVideo)
 Displays the a pop-up property window associated with this device.
VWResult VIDEO_getWidth (VWHVideo hVideo, int *pnWidth)
 Gets the video width.
VWResult VIDEO_getHeight (VWHVideo hVideo, int *pnHeight)
 Gets the video height.
VWResult VIDEO_getDepth (VWHVideo hVideo, int *pnDepth)
 Gets color depth as bits per pixel.
VWResult VIDEO_getFrameRate (VWHVideo hVideo, double *pFrameRate)
 Gets the frame rate of the camera as frames per second.
VWResult VIDEO_setPropertyLong (VWHVideo hVideo, VWCamProp propId, long lValue1, long lValue2, VWBool bAuto)
 Sets a long-typed camera property such as white balance, gain, etc.
VWResult VIDEO_getPropertyLong (VWHVideo hVideo, VWCamProp propId, long *plValue1, long *plValue2, VWBool *pbAuto)
 Gets a long-typed camera property such as white balance, gain, etc.
VWResult VIDEO_getPropertyRangeLong (VWHVideo hVideo, VWCamProp propId, long *plMinValue, long *plMaxValue, VWBool *pbAuto)
 Gets the valid range for a long-typed camera property such as white balance, gain, etc.
VWResult VIDEO_setPropertyString (VWHVideo hVideo, VWCamProp propId, char *szValue)
 Sets a string-typed camera property.
VWResult VIDEO_getPropertyString (VWHVideo hVideo, VWCamProp propId, char *szValue, int nSize)
 Gets a string-typed camera property.
char *VW_API_ENTRY VIDEO_getErrDescription (VWResult resultCode)
 Gets a string describing the given VWResult code.
VWResult VIDEO_replaySetPlaybackPosition (VWHVideo hVideo, timeval tvNewPosition)
 Sets the current position for video playback to permit random access.
VWResult VIDEO_replaySetPlaybackLoop (VWHVideo hVideo, VWBool bLoop)
 Sets the loop state of the replay camera.
VWResult VIDEO_replayIsPlaybackFinished (VWHVideo hVideo, VWBool *pbFinished)
 Checks to see if playback is finished.


Detailed Description

Provides an interface adapter for multiple video capture APIs.

Copyright 2004-5, Georgia Tech Research Corporation, Atlanta, Georgia 30332-0415 All Rights Reserved


Function Documentation

VWResult VIDEO_close VWHVideo  hVideo  ) 
 

Close the video camera.

Parameters:
hVideo Handle to video camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_getDepth VWHVideo  hVideo,
int *  pnDepth
 

Gets color depth as bits per pixel.

Parameters:
hVideo Handle to video camera.
[out] pnDepth Pointer returning the bits per pixel.
Returns:
VWResult indicating success or failure.

char* VW_API_ENTRY VIDEO_getErrDescription VWResult  resultCode  ) 
 

Gets a string describing the given VWResult code.

Parameters:
resultCode VWResult code to describe.
Returns:
A string describing the VWResult code

VWResult VIDEO_getFrame VWHVideo  hVideo,
unsigned char **  ppbFrame,
timeval *  pTimestamp
 

Polls for new video frame.

Parameters:
hVideo Handle to video camera.
[out] ppbFrame Pointer returning the captured video frame. Memory is alocated by the camera library. If no frame is availible, ppbFrame returns NULL.
[out] pTimestamp Pointer returning the timestamp of the captured video frame.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_getFrameRate VWHVideo  hVideo,
double *  pdFrameRate
 

Gets the frame rate of the camera as frames per second.

Parameters:
hVideo Handle to video camera.
[out] pdFrameRate Pointer returning the frame rate of the camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_getHeight VWHVideo  hVideo,
int *  pnHeight
 

Gets the video height.

Parameters:
hVideo Handle to video camera.
[out] pnHeight Pointer returning the height of the video.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_getPropertyLong VWHVideo  hVideo,
VWCamProp  propId,
long *  plValue1 = NULL,
long *  plValue2 = NULL,
VWBool pbAuto = NULL
 

Gets a long-typed camera property such as white balance, gain, etc.

Some properties are composed of two values. Symbols for camera properties are defined in VideoWrapperTypes.h.

Parameters:
propId Identifier of the property.
[out] plValue1 Pointer returning first property value.
[out] plValue2 Pointer returning second property value. Not used with most properties.
Returns:
VWResult indicating success or failure.
See also:
VWCamProp

VWResult VIDEO_getPropertyRangeLong VWHVideo  hVideo,
VWCamProp  propId,
long *  plMinValue = NULL,
long *  plMaxValue = NULL,
VWBool pbAuto = NULL
 

Gets the valid range for a long-typed camera property such as white balance, gain, etc.

Symbols for camera properties are defined in VideoWrapperTypes.h.

Parameters:
propId Identifier of the property.
lValue1 First property value.
lValue2 Second property value. Not used with most properties.
Returns:
VWResult indicating success or failure.
See also:
VWCamProp

VWResult VIDEO_getPropertyString VWHVideo  hVideo,
VWCamProp  propId,
char *  szValue,
int  nSize
 

Gets a string-typed camera property.

Parameters:
propId Identifier of the property.
[in] szValue Property value.
Returns:
VWResult indicating success or failure.
See also:
VWCamProp

VWResult VIDEO_getWidth VWHVideo  hVideo,
int *  pnWidth
 

Gets the video width.

Parameters:
hVideo Handle to video camera.
[out] pnWidth Pointer returning the width of the video.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_loadLibrary char *  szLibIdentifier,
char *  szLibImplementation
 

Dynamically loads support for a camera library.

Some camera libraries are 'preset' and VideoWrapper can load them automatically, however this function allows VideoWrapper to be extended at runtime to support additional camera libraries.

Parameters:
[in] szLibIdentifier Identifier to represent library in calls to VIDEO_openVideo.
[in] szLibImplementation Platform-specific implementation string.
  • Windows: File name of DLL implementing support.
  • Apple: Unsupported.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_openVideo char *  szInit,
VWHVideo phVideo
 

Intializes a video camera.

Parameters:
[in] szInit An implementation-dependent string used to configure the camera. Consult the 'VideoWrapper_xxx Details' page for the API adapter you are instantiating for the string format. Generally, however, the string is formatted as follows: "libId: camNum width frameRate colorMode scale outputMode" where
  • libId is the identifier for the API adapter library.
  • camNum is a number (starting at 0) representing the camera to open.
  • width is the desired frame width.
  • frameRate is the desired frame rate
  • colorMode is a string specifying the format of the desired color mode (e.g. rgb, yuv).
  • scale is 0 or 1. 1 means a mode of 2x or 4x the size can be used, and scaled to the correct size.
A noteable exception is the "replay" camera library, which will replay video frames that have been previously saved. In this case szInit takes the form: "replay: directory" where
  • replay is the identifier of the replay camera library.
  • directory is the path to the directory containing the saved video frames.
[out] phVideo Pointer to the handle for opened camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_releaseFrame VWHVideo  hVideo  ) 
 

Releases the frame so that memory may be deallocated.

Parameters:
hVideo Handle to video camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_replayIsPlaybackFinished VWHVideo  hVideo,
VWBool pbFinished
 

Checks to see if playback is finished.

Will return true after a call to getNextFrame goes past the last saved frame.

Parameters:
hVideo Handle to video camera.
[out] pbFinished Pointer returning TRUE if playback is finished, otherwise FALSE.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_replaySetPlaybackLoop VWHVideo  hVideo,
VWBool  bLoop
 

Sets the loop state of the replay camera.

Has no effect with other camera libraries. If the loop state is true, video playback will loop when the end is reached.

Parameters:
hVideo Handle to video camera.
bLoop The new loop state.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_replaySetPlaybackPosition VWHVideo  hVideo,
timeval  tvNewPosition
 

Sets the current position for video playback to permit random access.

Parameters:
hVideo Handle to video camera.
tvNewPosition Time offset from the beginning of the captured video.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_resetVideo VWHVideo  hVideo,
VWBool  bAutomatic
 

Resets all the camera parameters to defaults.

Parameters:
hVideo Handle to video camera.
bAutomatic If true, allow the camera to auto-adust.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_setPrintFunction VWPrintFcn *  fp  ) 
 

Sets a callback function that may be used for printing messages from the video libraries.

Parameters:
function: ptr to print function

VWResult VIDEO_setPropertyLong VWHVideo  hVideo,
VWCamProp  propId,
long  lValue1,
long  lValue2 = 0L,
VWBool  bAuto = FALSE
 

Sets a long-typed camera property such as white balance, gain, etc.

Some properties are composed of two values. Symbols for camera properties are defined in VideoWrapperTypes.h.

Parameters:
propId Identifier of the property.
lValue1 First property value.
lValue2 Second property value. Not used with most properties.
Returns:
VWResult indicating success or failure.
See also:
VWCamProp

VWResult VIDEO_setPropertyString VWHVideo  hVideo,
VWCamProp  propId,
char *  szValue
 

Sets a string-typed camera property.

Parameters:
propId Identifier of the property.
[in] szValue Property value.
Returns:
VWResult indicating success or failure.
See also:
VWCamProp

VWResult VIDEO_showPropertiesDialog VWHVideo  hVideo  ) 
 

Displays the a pop-up property window associated with this device.

Not supported by all camera libraries.

Parameters:
hVideo Handle to video camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_startVideo VWHVideo  hVideo  ) 
 

Starts aquiring frames from the camera.

Parameters:
hCam Handle to video camera.
Returns:
VWResult indicating success or failure.

VWResult VIDEO_stopVideo VWHVideo  hVideo  ) 
 

Stops aquiring frames from the camera.

Parameters:
hCam Handle to video camera.
Returns:
VWResult indicating success or failure.


Generated on Tue Oct 18 12:18:51 2005 for VideoWrapper API by  doxygen 1.4.1