Classes | Defines | Typedefs | Functions | Variables
video.c File Reference
#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include <CoreServices/CoreServices.h>
#include <pthread.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <AR/config.h>
#include <AR/ar.h>
#include <AR/video.h>
#include "videoInternal.h"
Include dependency graph for backup/lib/SRC/VideoMacOSX/video.c:

Go to the source code of this file.

Classes

struct  _AR2VideoParamT
struct  _VdigGrab

Defines

#define AR_PTHREAD_CANCELLED   ((void *) 1);
#define AR_VIDEO_DEBUG_FIX_DUAL_PROCESSOR_RACE
#define AR_VIDEO_IDLE_INTERVAL_MILLISECONDS_MAX   100L
#define AR_VIDEO_IDLE_INTERVAL_MILLISECONDS_MIN   20L
#define AR_VIDEO_STATUS_BIT_BUFFER   0x02
#define AR_VIDEO_STATUS_BIT_READY   0x01

Typedefs

typedef struct _AR2VideoParamTAR2VideoParamTRef
typedef struct _VdigGrab VdigGrab
typedef struct _VdigGrabVdigGrabRef

Functions

int ar2VideoCapNext (AR2VideoParamT *vid)
 call for the next grabbed video frame of a video source (multiple video inputs)
int ar2VideoCapStart (AR2VideoParamT *vid)
 start the capture of a video source (multiple video inputs)
int ar2VideoCapStop (AR2VideoParamT *vid)
 stop the capture of a video source (multiple video inputs)
int ar2VideoClose (AR2VideoParamT *vid)
 close a video source (multiple video inputs)
int ar2VideoDispOption (void)
 display the video option (multiple video inputs)
ARUint8ar2VideoGetImage (AR2VideoParamT *vid)
 get a video image from a video source (multiple video inputs)
int ar2VideoInqSize (AR2VideoParamT *vid, int *x, int *y)
 get the video image size of a video source (multiple video inputs)
static int ar2VideoInternalLock (pthread_mutex_t *mutex)
static void * ar2VideoInternalThread (void *arg)
static void ar2VideoInternalThreadCleanup (void *arg)
static int ar2VideoInternalUnlock (pthread_mutex_t *mutex)
AR2VideoParamTar2VideoOpen (char *config_in)
 open a video source (multiple video inputs)
int arVideoCapNext (void)
 call for the next grabbed video frame.
int arVideoCapStart (void)
 start the capture of video.
int arVideoCapStop (void)
 stop the capture of video.
int arVideoClose (void)
 close the video source. After your application has finished using a video stream, this function must be called to close the link to the input source, and free resources associated with the capture operation.
int arVideoDispOption (void)
 display the video option.
ARUint8arVideoGetImage (void)
 get the video image.
int arVideoInqSize (int *x, int *y)
 get the video image size, in pixels.
int arVideoOpen (char *config)
 open a video source.
int is_pid_native (pid_t pid)
static SeqGrabComponent MakeSequenceGrabber (WindowRef pWindow, const int grabber)
static ComponentResult MakeSequenceGrabChannel (SeqGrabComponent seqGrab, SGChannel *psgchanVideo)
static int sysctlbyname_with_pid (const char *name, pid_t pid, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
VdigGrabRef vdgAllocAndInit (const int grabber)
static OSErr vdgDecompressionSequenceBegin (VdigGrab *pVdg, CGrafPtr dstPort, Rect *pDstRect, MatrixRecord *pDstScaleMatrix)
static OSErr vdgDecompressionSequenceEnd (VdigGrab *pVdg)
static OSErr vdgDecompressionSequenceWhen (VdigGrab *pVdg, Ptr theData, long dataSize)
static VideoDigitizerError vdgGetDataRate (VdigGrab *pVdg, long *pMilliSecPerFrame, Fixed *pFramesPerSecond, long *pBytesPerSecond)
static VideoDigitizerError vdgGetDeviceNameAndFlags (VdigGrab *pVdg, char *szName, long *pBuffSize, UInt32 *pVdFlags)
static VideoDigitizerError vdgGetImageDescription (VdigGrab *pVdg, ImageDescriptionHandle vdImageDesc)
static ComponentResult vdgGetSettings (VdigGrab *pVdg)
static VideoDigitizerError vdgIdle (VdigGrab *pVdg, int *pIsUpdated)
static bool vdgIsGrabbing (VdigGrab *pVdg)
static VideoDigitizerError vdgPoll (VdigGrab *pVdg, UInt8 *pQueuedFrameCount, Ptr *pTheData, long *pDataSize, UInt8 *pSimilarity, TimeRecord *pTime)
static VideoDigitizerError vdgPreflightGrabbing (VdigGrab *pVdg)
static ComponentResult vdgReleaseAndDealloc (VdigGrab *pVdg)
static VideoDigitizerError vdgReleaseBuffer (VdigGrab *pVdg, Ptr theData)
static ComponentResult vdgRequestSettings (VdigGrab *pVdg, const int showDialog, const int standardDialog, const int inputIndex)
static OSErr vdgSetDestination (VdigGrab *pVdg, CGrafPtr dstPort)
static VideoDigitizerError vdgStartGrabbing (VdigGrab *pVdg, MatrixRecord *pDstScaleMatrix)
static VideoDigitizerError vdgStopGrabbing (VdigGrab *pVdg)

Variables

static AR2VideoParamTgVid = NULL
static unsigned int gVidCount = 0

Define Documentation

#define AR_PTHREAD_CANCELLED   ((void *) 1);

Definition at line 111 of file backup/lib/SRC/VideoMacOSX/video.c.

Definition at line 99 of file backup/lib/SRC/VideoMacOSX/video.c.

Definition at line 102 of file backup/lib/SRC/VideoMacOSX/video.c.

Definition at line 101 of file backup/lib/SRC/VideoMacOSX/video.c.

#define AR_VIDEO_STATUS_BIT_BUFFER   0x02

Definition at line 105 of file backup/lib/SRC/VideoMacOSX/video.c.

#define AR_VIDEO_STATUS_BIT_READY   0x01

Definition at line 104 of file backup/lib/SRC/VideoMacOSX/video.c.


Typedef Documentation

Definition at line 178 of file backup/lib/SRC/VideoMacOSX/video.c.

typedef struct _VdigGrab VdigGrab

Definition at line 146 of file backup/lib/SRC/VideoMacOSX/video.c.

typedef struct _VdigGrab* VdigGrabRef

Definition at line 147 of file backup/lib/SRC/VideoMacOSX/video.c.


Function Documentation

call for the next grabbed video frame of a video source (multiple video inputs)

Companion function to arVideoCapNext for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing

Definition at line 1822 of file backup/lib/SRC/VideoMacOSX/video.c.

start the capture of a video source (multiple video inputs)

Companion function to arVideoCapStart for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing

Definition at line 1766 of file backup/lib/SRC/VideoMacOSX/video.c.

stop the capture of a video source (multiple video inputs)

Companion function to arVideoCapStop for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing

Definition at line 1827 of file backup/lib/SRC/VideoMacOSX/video.c.

int ar2VideoClose ( AR2VideoParamT vid)

close a video source (multiple video inputs)

Companion function to arVideoClose for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing.

Definition at line 1678 of file backup/lib/SRC/VideoMacOSX/video.c.

int ar2VideoDispOption ( void  )

display the video option (multiple video inputs)

Companion function to arVideoDispOption, for multiple video sources.

Definition at line 1216 of file backup/lib/SRC/VideoMacOSX/video.c.

get a video image from a video source (multiple video inputs)

Companion function to arVideoGetImage for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing

Definition at line 1907 of file backup/lib/SRC/VideoMacOSX/video.c.

int ar2VideoInqSize ( AR2VideoParamT vid,
int *  x,
int *  y 
)

get the video image size of a video source (multiple video inputs)

Companion function to arVideoInqSize for multiple video sources.

Parameters:
vida video handle structure for multi-camera grabbing

Definition at line 1889 of file backup/lib/SRC/VideoMacOSX/video.c.

static int ar2VideoInternalLock ( pthread_mutex_t *  mutex) [static]

Definition at line 930 of file backup/lib/SRC/VideoMacOSX/video.c.

static void* ar2VideoInternalThread ( void *  arg) [static]

Definition at line 987 of file backup/lib/SRC/VideoMacOSX/video.c.

static void ar2VideoInternalThreadCleanup ( void *  arg) [static]

Definition at line 969 of file backup/lib/SRC/VideoMacOSX/video.c.

static int ar2VideoInternalUnlock ( pthread_mutex_t *  mutex) [static]

Definition at line 957 of file backup/lib/SRC/VideoMacOSX/video.c.

AR2VideoParamT* ar2VideoOpen ( char *  config)

open a video source (multiple video inputs)

Companion function to arVideoOpen for multiple video sources. This function can be called multiple times to open multiple video streams. The maximum number of streams is dependent on the operating system and the performance characteristics of the host CPU and video capture infrastructure.

Parameters:
configstring of the selected video configuration.
Returns:
If the video path was successfully opened, this function returns a pointer to an AR2VideoParamT structure, an opaque structure which holds information and configuration for the video stream. This paramater should then be passed to other ar2Video* functions to specify which video stream is being operated upon. If the video path was not successfully opened, NULL will be returned. s

Definition at line 1257 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoCapNext ( void  )

call for the next grabbed video frame.

This function should be called at least once per frame. It has several purposes, depending on the operating system. It allows the video driver to perform housekeeping tasks and also signals to the video grabber that your code has finished using the most recent video frame returned by arVideoGetImage(), and that the video driver may re-use the memory occupied by the frame. The effect of this call is operating-system dependent. The best place to call this function is immediately after you have finished displaying the current video frame, i.e. after calling arglDispImage() or argDispImage().

Remarks:
On some operating systems, this function is a no-op.
Returns:
0 if successful, -1 if the video driver encountered an error.

Definition at line 922 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoCapStart ( void  )

start the capture of video.

This function starts the video capture routine.

Remarks:
On some operating systems, capture operations may run in a separate execution thread. This call starts that thread.
this function coupled with arVideoCapStop, can be call many times in your program (this may reduce the CPU load when video processing is stopped or for long and critical operations).
Returns:
0 if successful, -1 if the capture couldn't be started.

Definition at line 908 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoCapStop ( void  )

stop the capture of video.

This function stops the video capture routine.

Remarks:
On some operating systems, capture operations may run in a separate execution thread. This call stops that thread.
this function coupled with arVideoCapStart, can be call many times in your program (this may reduce the CPU load when video processing is stopped or for long and critical operations).
Returns:
0 if successful, -1 if the capture couldn't be stopped.

Definition at line 915 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoClose ( void  )

close the video source. After your application has finished using a video stream, this function must be called to close the link to the input source, and free resources associated with the capture operation.

Returns:
0 if shut down successfully, otherwise -1.

Definition at line 883 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoDispOption ( void  )

display the video option.

The video configuration options vary by operating system and platform. This function outputs to the standard output the options available on the current OS and platform.

Returns:
0

Definition at line 866 of file backup/lib/SRC/VideoMacOSX/video.c.

ARUint8* arVideoGetImage ( void  )

get the video image.

This function returns a buffer with a captured video image. The returned data consists of a tightly-packed array of pixels, beginning with the first component of the leftmost pixel of the topmost row, and continuing with the remaining components of that pixel, followed by the remaining pixels in the topmost row, followed by the leftmost pixel of the second row, and so on. The arrangement of components of the pixels in the buffer is determined by the configuration string passed in to the driver at the time the video stream was opened. If no pixel format was specified in the configuration string, then an operating- system dependent default, defined in <AR/config.h> is used. The memory occupied by the pixel data is owned by the video driver and should not be freed by your program. The pixels in the buffer remain valid until the next call to arVideoCapNext, or the next call to arVideoGetImage which returns a non-NULL pointer, or any call to arVideoCapStop or arVideoClose.

Returns:
A pointer to the pixel data of the captured video frame, or NULL if no new pixel data was available at the time of calling.

Definition at line 901 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoInqSize ( int *  x,
int *  y 
)

get the video image size, in pixels.

This function returns the size of the captured video frame, in pixels.

Parameters:
xa pointer to the length of the captured image
ya pointer to the width of the captured image
Returns:
0 if the dimensions are found successfully, otherwise -1

Definition at line 894 of file backup/lib/SRC/VideoMacOSX/video.c.

int arVideoOpen ( char *  config)

open a video source.

This function opens a video input path with the driver (and device) present on your platform. According to your operating system and the hardware the initialization will be different : a generic string structure is used for this issue. This function prepares the video stream for capture, but capture will not actually begin until arVideoCapStart is called.

Parameters:
configstring of the selected video configuration. See the video configuration documentation for more information on this parameter.
Returns:
0 if successful, -1 if a video path couldn't be opened

Definition at line 871 of file backup/lib/SRC/VideoMacOSX/video.c.

int is_pid_native ( pid_t  pid)

Definition at line 1196 of file backup/lib/SRC/VideoMacOSX/video.c.

static SeqGrabComponent MakeSequenceGrabber ( WindowRef  pWindow,
const int  grabber 
) [static]

Definition at line 199 of file backup/lib/SRC/VideoMacOSX/video.c.

static ComponentResult MakeSequenceGrabChannel ( SeqGrabComponent  seqGrab,
SGChannel *  psgchanVideo 
) [static]

Definition at line 262 of file backup/lib/SRC/VideoMacOSX/video.c.

static int sysctlbyname_with_pid ( const char *  name,
pid_t  pid,
void *  oldp,
size_t *  oldlenp,
void *  newp,
size_t  newlen 
) [static]

Definition at line 1166 of file backup/lib/SRC/VideoMacOSX/video.c.

VdigGrabRef vdgAllocAndInit ( const int  grabber)

Definition at line 326 of file backup/lib/SRC/VideoMacOSX/video.c.

static OSErr vdgDecompressionSequenceBegin ( VdigGrab pVdg,
CGrafPtr  dstPort,
Rect *  pDstRect,
MatrixRecord *  pDstScaleMatrix 
) [static]

Definition at line 573 of file backup/lib/SRC/VideoMacOSX/video.c.

static OSErr vdgDecompressionSequenceEnd ( VdigGrab pVdg) [static]

Definition at line 644 of file backup/lib/SRC/VideoMacOSX/video.c.

static OSErr vdgDecompressionSequenceWhen ( VdigGrab pVdg,
Ptr  theData,
long  dataSize 
) [static]

Definition at line 621 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgGetDataRate ( VdigGrab pVdg,
long *  pMilliSecPerFrame,
Fixed *  pFramesPerSecond,
long *  pBytesPerSecond 
) [static]

Definition at line 539 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgGetDeviceNameAndFlags ( VdigGrab pVdg,
char *  szName,
long *  pBuffSize,
UInt32 *  pVdFlags 
) [static]

Definition at line 369 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgGetImageDescription ( VdigGrab pVdg,
ImageDescriptionHandle  vdImageDesc 
) [static]

Definition at line 558 of file backup/lib/SRC/VideoMacOSX/video.c.

static ComponentResult vdgGetSettings ( VdigGrab pVdg) [static]

Definition at line 294 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgIdle ( VdigGrab pVdg,
int *  pIsUpdated 
) [static]

Definition at line 778 of file backup/lib/SRC/VideoMacOSX/video.c.

static bool vdgIsGrabbing ( VdigGrab pVdg) [static]

Definition at line 718 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgPoll ( VdigGrab pVdg,
UInt8 *  pQueuedFrameCount,
Ptr *  pTheData,
long *  pDataSize,
UInt8 *  pSimilarity,
TimeRecord *  pTime 
) [static]

Definition at line 723 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgPreflightGrabbing ( VdigGrab pVdg) [static]

Definition at line 414 of file backup/lib/SRC/VideoMacOSX/video.c.

static ComponentResult vdgReleaseAndDealloc ( VdigGrab pVdg) [static]

Definition at line 828 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgReleaseBuffer ( VdigGrab pVdg,
Ptr  theData 
) [static]

Definition at line 764 of file backup/lib/SRC/VideoMacOSX/video.c.

static ComponentResult vdgRequestSettings ( VdigGrab pVdg,
const int  showDialog,
const int  standardDialog,
const int  inputIndex 
) [static]

Definition at line 350 of file backup/lib/SRC/VideoMacOSX/video.c.

static OSErr vdgSetDestination ( VdigGrab pVdg,
CGrafPtr  dstPort 
) [static]

Definition at line 407 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgStartGrabbing ( VdigGrab pVdg,
MatrixRecord *  pDstScaleMatrix 
) [static]

Definition at line 667 of file backup/lib/SRC/VideoMacOSX/video.c.

static VideoDigitizerError vdgStopGrabbing ( VdigGrab pVdg) [static]

Definition at line 696 of file backup/lib/SRC/VideoMacOSX/video.c.


Variable Documentation

AR2VideoParamT* gVid = NULL [static]

Definition at line 184 of file backup/lib/SRC/VideoMacOSX/video.c.

unsigned int gVidCount = 0 [static]

Definition at line 185 of file backup/lib/SRC/VideoMacOSX/video.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


ar_recog
Author(s): Graylin Trevor Jay and Christopher Crick
autogenerated on Fri Jan 25 2013 12:15:01