CameraSource Class Reference#include <CameraSourceOSX.h>
List of all members.
Detailed Description
Definition at line 18 of file CameraSourceOSX.h.
|
Public Member Functions |
| CameraSource (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
|
| ~CameraSource () |
| 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 | setDataSourceThread (LoadDataThread *ldt) |
| called by the LoadDataThread subclass, allows you to register for properties which your subclass may care about
|
virtual void | setDataSourceFramerate (float fps) |
| called by LoadDataThread whenever the expected framerate changes (LoadDataThread::framerate)
|
virtual unsigned int | getData (const char *&payload, unsigned int &payloadSize, unsigned int ×tamp, std::string &name) |
| called to retrieve the most recent data segment, or blocking until new 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 | imgFrom2vuy (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.
|
void | imgFromyuv2 (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.
|
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 |
SeqGrabComponent | sg |
| sequence grabber, might need one of these globally instead of one per CameraSource
|
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 |
UInt32 | 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
|
char * | imgbuf |
| buffer where YUV image will be stored and returned back to getData caller via payload parameter
|
size_t | imgbufSize |
| size of imgbuf allocation
|
size_t | imgbufUsed |
| amount of imgbuf's allocation which is actually in use with data
|
Private Member Functions |
| CameraSource (const CameraSource &) |
| don't call (copy constructor)
|
CameraSource & | operator= (const CameraSource &) |
| don't call (assignment operator)
|
Constructor & Destructor Documentation
CameraSource |
( |
SeqGrabComponent |
grabber, |
|
|
const std::string & |
srcName, |
|
|
const std::string & |
devName, |
|
|
const std::string & |
inputName, |
|
|
int |
inputIdx | |
|
) |
| | throw (std::pair<OSErr,const char*>) [inline] |
constructor, pass the short name, device name and input index
Definition at line 21 of file CameraSourceOSX.h.
destructor, free system resources
don't call (copy constructor)
Member Function Documentation
virtual const std::string& getName |
( |
|
) |
const [inline, virtual] |
virtual const std::string& getDeviceName |
( |
|
) |
const [inline, virtual] |
virtual const std::string& getInputName |
( |
|
) |
const [inline, virtual] |
accessor for the name of the input from the device
Definition at line 45 of file CameraSourceOSX.h.
virtual unsigned int nextTimestamp |
( |
|
) |
[inline, 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 - See also:
- timestamp argument of getData()
Implements DataSource.
Definition at line 47 of file CameraSourceOSX.h.
virtual const std::string& nextName |
( |
|
) |
[inline, 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 48 of file CameraSourceOSX.h.
called by the LoadDataThread subclass, allows you to register for properties which your subclass may care about
a pointer to the LoadDataThread is passed when this is becoming the current data source; NULL will be passed when the data source is no longer being used
Reimplemented from DataSource.
virtual void setDataSourceFramerate |
( |
float |
fr |
) |
[virtual] |
virtual unsigned int getData |
( |
const char *& |
payload, |
|
|
unsigned int & |
payloadSize, |
|
|
unsigned int & |
timestamp, |
|
|
std::string & |
name | |
|
) |
| | [virtual] |
called to retrieve the most recent data segment, or blocking until new data is available
- Parameters:
-
[out] | payload | on return, should point to beginning of data segment, or NULL if none available |
[out] | payloadSize | on return, should indicate size in bytes of data segment as payload |
[in] | timestamp | the suggested return time; if multiple samples may be taken in the interval, they should be skipped until this time |
[out] | timestamp | on return, should contain the time at which the data arrived (real time stream) or was scheduled to be sent (log on disk) |
[out] | name | on return, a human-readable name for the frame -- e.g. filename for a data file loaded from disk |
- Returns:
- frame serial number, used to tell when frames from the data source have been dropped (indicated by the return value incrementing by more than one)
If no more data is available, set payload to NULL, and return the current frame (i.e. don't increment serial number).
This call should block until data is available. Other functions may be called asynchronously from other threads while in this function, see ThreadNS::Lock to implement mutual exclusion locks if needed.
The input value of timestamp is a suggestion from the user's requested framerate -- try to return the frame closest to it. If it is already past (e.g. 0 on 'advance'), return the current data! If you return a timestamp in the future, the LoadDataThread will sleep until the appropriate time.
Note that this can be called when the source is frozen, which means you should unfreeze, get the current (unread) data or block until the next data, freeze again, and return the data.
Implements DataSource.
void initCamera |
( |
|
) |
[protected] |
static std::string p2c |
( |
unsigned char |
pascalStr[] |
) |
[inline, static, protected] |
converts from pascal-format string to c-format string
Definition at line 61 of file CameraSourceOSX.h.
static void dumpLiteral |
( |
OSType |
t |
) |
[static, protected] |
static ComponentResult setVideoChannelBounds |
( |
SGChannel |
videoChannel, |
|
|
const Rect * |
scaledVideoBounds | |
|
) |
| | [static, protected] |
static pascal ComponentResult compressCompleteBottleProc |
( |
SGChannel |
c, |
|
|
UInt8 * |
queuedFrameCount, |
|
|
SGCompressInfo * |
ci, |
|
|
TimeRecord * |
t, |
|
|
long |
refCon | |
|
) |
| | [static, protected] |
static pascal OSErr grabDataProc |
( |
SGChannel |
c, |
|
|
Ptr |
p, |
|
|
long |
len, |
|
|
long * |
offset, |
|
|
long |
chRefCon, |
|
|
TimeValue |
time, |
|
|
short |
writeType, |
|
|
long |
refCon | |
|
) |
| | [static, protected] |
void 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.
void 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.
don't call (assignment operator)
Member Data Documentation
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 55 of file CameraSourceOSX.h.
Referenced by CameraSource().
SeqGrabComponent sg [protected] |
channel within the sequence grabber, I think there will be one channel per camera
Definition at line 77 of file CameraSourceOSX.h.
graphics buffer to store the decompressed image (RGB, will have to be converted back to YUV)
Definition at line 78 of file CameraSourceOSX.h.
std::string name [protected] |
unsigned int frame [protected] |
number of frames skipped since last successful frame
Definition at line 85 of file CameraSourceOSX.h.
number of frames the system indicates are waiting to be processed
Definition at line 86 of file CameraSourceOSX.h.
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 87 of file CameraSourceOSX.h.
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 93 of file CameraSourceOSX.h.
buffer where YUV image will be stored and returned back to getData caller via payload parameter
Definition at line 97 of file CameraSourceOSX.h.
The documentation for this class was generated from the following file:
|