Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CameraSourceQTSG Class Reference

This interfaces with a specific camera through QuickTime and the Sequence Grabber, which is deprecated. See the alternative CameraSourceQTKit implementation. More...

#include <CameraSourceQTSG.h>

Inheritance diagram for CameraSourceQTSG:

Detailed Description

This interfaces with a specific camera through QuickTime and the Sequence Grabber, which is deprecated. See the alternative CameraSourceQTKit implementation.

This camera source is used on pre-10.6 systems, supporting 32 bit only

Definition at line 21 of file CameraSourceQTSG.h.

List of all members.

Public Member Functions

 CameraSourceQTSG (SeqGrabComponent grabber, const std::string &srcName, const std::string &devName, const std::string &inputName, int inputIdx) throw (std::pair<OSErr,const char*>)
 constructor, pass the short name, device name and input index
 ~CameraSourceQTSG ()
 destructor, free system resources
virtual const std::string & getName () const
 accessor for the instance name
virtual const std::string & getDeviceName () const
 accessor for the device name
virtual const std::string & getInputName () const
 accessor for the name of the input from the device
virtual unsigned int nextTimestamp ()
 Returns the simulator time of the next data segment.
virtual const std::string & nextName ()
 this is supposed to be the name for the next camera frame, we just reuse our static instance name
virtual void registerSource ()
 User hook, called when the data source should claim which outputs it provides feedback (providingOuput()).
virtual void deregisterSource ()
 User hook, called when the data source should release its claim on outputs with feedback (ignoringOuput()).
virtual bool advance ()
 Called when the simulator is stepping while paused or advancing a frozen data source, return true if successful, or false if no more data is available.

Public Attributes

plist::Primitive< int > layer
 Controls the resolution layer at which the image should be processed.
0 indicates "automatic" mode (picks layer closest to image's resolution), positive numbers indicate the resolution layer directly.
Negative values are relative to the number of layers marked available by the vision setup, so that typically -1 would correspond to the "double" layer, and -2 would correspond to the "full" layer.

Protected Member Functions

void initCamera ()
void doFreeze ()
 user hook for when frozen is set to true; advance() will be called by simulator at user discretion.
void doUnfreeze ()
 user hook for when frozen is set to false; if enteringRealtime() has been called then you should resume sending data.
RCRegionimgFrom2vuy (const unsigned char *s, short srcWidth, short srcHeight, short depth, long dataSize)
 Resamples a YUV 4:2:2 (aka '2vuy') image to a YUV 4:4:4 form which is expected in getData()'s payload.
RCRegionimgFromyuv2 (const unsigned char *s, short srcWidth, short srcHeight, short depth, long dataSize)
 Resamples a YUV 4:2:2 (aka 'yuv2' or 'yuvu') image to YUV 4:4:4 form which is expected in getData()'s payload.
bool poll ()

Static Protected Member Functions

static std::string p2c (unsigned char pascalStr[])
 converts from pascal-format string to c-format string
static void dumpLiteral (OSType t)
static ComponentResult setVideoChannelBounds (SGChannel videoChannel, const Rect *scaledVideoBounds)
static pascal ComponentResult compressCompleteBottleProc (SGChannel c, UInt8 *queuedFrameCount, SGCompressInfo *ci, TimeRecord *t, long refCon)
static pascal OSErr grabDataProc (SGChannel c, Ptr p, long len, long *offset, long chRefCon, TimeValue time, short writeType, long refCon)

Protected Attributes

CallbackPollThread poller
SeqGrabComponent sg
 sequence grabber, might need one of these globally instead of one per CameraSourceQTSG
SGChannel sgChan
 channel within the sequence grabber, I think there will be one channel per camera
GWorldPtr gworld
 graphics buffer to store the decompressed image (RGB, will have to be converted back to YUV)
std::string name
 name to use for image frames
const std::string deviceName
 name of hardware device the source is connected
const std::string devInputName
 name of the input on the device (in case a single device has multiple inputs)
int devInputIdx
 index number of the input
unsigned int frame
 current frame number
unsigned int skipped
 number of frames skipped since last successful frame
unsigned int queuedFrames
 number of frames the system indicates are waiting to be processed
bool grabbing
 set to true when setDataSourceThread is called with a non-NULL value, but can be set back to false if an error occurs
TimeValue lastTime
float duration
TimeScale chanTimeScale
TimeBase chanTimeBase
ImageSequence drawSeq
OSErr callbackerr
 error value from call back, so we can tell if an error came from SGIdle itself or the callback functions it may trigger
char * gworldBuf
 buffer used for gworld
bool burnIn
 set to true if the image should be skipped (e.g. clearing out a backlog of images when advancing while frozen

Private Member Functions

 CameraSourceQTSG (const CameraSourceQTSG &)
 don't call (copy constructor)
CameraSourceQTSGoperator= (const CameraSourceQTSG &)
 don't call (assignment operator)

Constructor & Destructor Documentation

CameraSourceQTSG ( SeqGrabComponent  grabber,
const std::string &  srcName,
const std::string &  devName,
const std::string &  inputName,
int  inputIdx 
) throw (std::pair<OSErr,const char*>)

constructor, pass the short name, device name and input index

Definition at line 24 of file CameraSourceQTSG.h.

~CameraSourceQTSG (  ) 

destructor, free system resources

CameraSourceQTSG ( const CameraSourceQTSG  )  [private]

don't call (copy constructor)


Member Function Documentation

virtual bool advance (  )  [virtual]

Called when the simulator is stepping while paused or advancing a frozen data source, return true if successful, or false if no more data is available.

Implements DataSource.

Referenced by poll().

static pascal ComponentResult compressCompleteBottleProc ( SGChannel  c,
UInt8 *  queuedFrameCount,
SGCompressInfo *  ci,
TimeRecord *  t,
long  refCon 
) [static, protected]
virtual void deregisterSource (  )  [virtual]

User hook, called when the data source should release its claim on outputs with feedback (ignoringOuput()).

It would be wise to call this from your destructor as well.

Reimplemented from DataSource.

void doFreeze (  )  [protected, virtual]

user hook for when frozen is set to true; advance() will be called by simulator at user discretion.

Reimplemented from DataSource.

void doUnfreeze (  )  [protected, virtual]

user hook for when frozen is set to false; if enteringRealtime() has been called then you should resume sending data.

Reimplemented from DataSource.

static void dumpLiteral ( OSType  t  )  [static, protected]
virtual const std::string& getDeviceName (  )  const [virtual]

accessor for the device name

Definition at line 47 of file CameraSourceQTSG.h.

virtual const std::string& getInputName (  )  const [virtual]

accessor for the name of the input from the device

Definition at line 49 of file CameraSourceQTSG.h.

virtual const std::string& getName (  )  const [virtual]

accessor for the instance name

Definition at line 45 of file CameraSourceQTSG.h.

static pascal OSErr grabDataProc ( SGChannel  c,
Ptr  p,
long  len,
long *  offset,
long  chRefCon,
TimeValue  time,
short  writeType,
long  refCon 
) [static, protected]
RCRegion* imgFrom2vuy ( const unsigned char *  s,
short  srcWidth,
short  srcHeight,
short  depth,
long  dataSize 
) [protected]

Resamples a YUV 4:2:2 (aka '2vuy') image to a YUV 4:4:4 form which is expected in getData()'s payload.

RCRegion* imgFromyuv2 ( const unsigned char *  s,
short  srcWidth,
short  srcHeight,
short  depth,
long  dataSize 
) [protected]

Resamples a YUV 4:2:2 (aka 'yuv2' or 'yuvu') image to YUV 4:4:4 form which is expected in getData()'s payload.

void initCamera (  )  [protected]

Referenced by CameraSourceQTSG().

virtual const std::string& nextName (  )  [virtual]

this is supposed to be the name for the next camera frame, we just reuse our static instance name

Implements DataSource.

Definition at line 52 of file CameraSourceQTSG.h.

virtual unsigned int nextTimestamp (  )  [virtual]

Returns the simulator time of the next data segment.

Should be in the future if nothing new since last data segment, otherwise should be the timestamp of the most recent data segment (older segments are skipped), return -1U if there is no more data

Implements DataSource.

Definition at line 51 of file CameraSourceQTSG.h.

CameraSourceQTSG& operator= ( const CameraSourceQTSG  )  [private]

don't call (assignment operator)

static std::string p2c ( unsigned char  pascalStr[]  )  [static, protected]

converts from pascal-format string to c-format string

Definition at line 68 of file CameraSourceQTSG.h.

bool poll (  )  [protected]

Definition at line 83 of file CameraSourceQTSG.h.

virtual void registerSource (  )  [virtual]

User hook, called when the data source should claim which outputs it provides feedback (providingOuput()).

Does not indicate the data source should start sending updates yet — wait for enteringRealtime() or advance() to be called

Reimplemented from DataSource.

static ComponentResult setVideoChannelBounds ( SGChannel  videoChannel,
const Rect *  scaledVideoBounds 
) [static, protected]

Member Data Documentation

bool burnIn [protected]

set to true if the image should be skipped (e.g. clearing out a backlog of images when advancing while frozen

Definition at line 106 of file CameraSourceQTSG.h.

OSErr callbackerr [protected]

error value from call back, so we can tell if an error came from SGIdle itself or the callback functions it may trigger

Definition at line 103 of file CameraSourceQTSG.h.

TimeBase chanTimeBase [protected]

Definition at line 101 of file CameraSourceQTSG.h.

TimeScale chanTimeScale [protected]

Definition at line 100 of file CameraSourceQTSG.h.

const std::string deviceName [protected]

name of hardware device the source is connected

Definition at line 90 of file CameraSourceQTSG.h.

Referenced by getDeviceName().

int devInputIdx [protected]

index number of the input

Definition at line 92 of file CameraSourceQTSG.h.

const std::string devInputName [protected]

name of the input on the device (in case a single device has multiple inputs)

Definition at line 91 of file CameraSourceQTSG.h.

Referenced by getInputName().

ImageSequence drawSeq [protected]

Definition at line 102 of file CameraSourceQTSG.h.

float duration [protected]

Definition at line 99 of file CameraSourceQTSG.h.

Referenced by nextTimestamp().

unsigned int frame [protected]

current frame number

Definition at line 94 of file CameraSourceQTSG.h.

bool grabbing [protected]

set to true when setDataSourceThread is called with a non-NULL value, but can be set back to false if an error occurs

Definition at line 97 of file CameraSourceQTSG.h.

Referenced by poll().

GWorldPtr gworld [protected]

graphics buffer to store the decompressed image (RGB, will have to be converted back to YUV)

Definition at line 88 of file CameraSourceQTSG.h.

char* gworldBuf [protected]

buffer used for gworld

Definition at line 105 of file CameraSourceQTSG.h.

TimeValue lastTime [protected]

Definition at line 98 of file CameraSourceQTSG.h.

Referenced by nextTimestamp().

Controls the resolution layer at which the image should be processed.
0 indicates "automatic" mode (picks layer closest to image's resolution), positive numbers indicate the resolution layer directly.
Negative values are relative to the number of layers marked available by the vision setup, so that typically -1 would correspond to the "double" layer, and -2 would correspond to the "full" layer.

Definition at line 58 of file CameraSourceQTSG.h.

Referenced by CameraSourceQTSG().

std::string name [protected]

name to use for image frames

Definition at line 89 of file CameraSourceQTSG.h.

Referenced by getName(), and nextName().

Definition at line 84 of file CameraSourceQTSG.h.

unsigned int queuedFrames [protected]

number of frames the system indicates are waiting to be processed

Definition at line 96 of file CameraSourceQTSG.h.

SeqGrabComponent sg [protected]

sequence grabber, might need one of these globally instead of one per CameraSourceQTSG

Definition at line 86 of file CameraSourceQTSG.h.

SGChannel sgChan [protected]

channel within the sequence grabber, I think there will be one channel per camera

Definition at line 87 of file CameraSourceQTSG.h.

unsigned int skipped [protected]

number of frames skipped since last successful frame

Definition at line 95 of file CameraSourceQTSG.h.


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

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:40 2016 by Doxygen 1.6.3