44#include "bitflow/BFciLib.h"
66 if (kCIEnoErr != (circ = CiMapFrameBuffers(s->
sCIp,
72 if ((NULL != s->
uPtrs) && (kCIEnoErr != (circ = CiUnmapFrameBuffers(s->
sCIp)))){
86 if (kCIEnoErr != (circ = CiAqSWreset(s->
sCIp))) {
88 if ((NULL != s->
uPtrs) && (kCIEnoErr != (circ = CiUnmapFrameBuffers(s->
sCIp)))){
99 int numberOfFrames = 0;
100 if (kCIEnoErr != (circ = CiAqStart(s->
sCIp, numberOfFrames)))
103 if ((NULL != s->
uPtrs) && (kCIEnoErr != (circ = CiUnmapFrameBuffers(s->
sCIp)))){
113 tCITDP cfgFN, cfg, camFN, cam, firmFN, firm, serial, cxp, spare;
115 if (kCIEnoErr != (circ = CiVFGinquire2(s->
sCIp, &cfgFN, &cfg, &camFN,
116 &cam, &firmFN, &firm, &serial, &cxp, &spare))) {
122 while (cam[x].descriptor != NULL) {
123 if (strcmp(cam[x].descriptor,
"CAMREGAFTER") == 0) {
124 tCIU32 *ptr = (tCIU32 *)(cam[x].datap);
127 if (ptr[0] == 0x000200C4) {
128 return *(
float *) (ptr + 1);
150 if (kCIEnoErr != (circ = CiVFGopen(s->
sNdx,
158 if (kCIEnoErr != (circ = CiVFGinitialize(s->
sCIp,NULL)))
164 if (kCIEnoErr != (circ = CiDrvrBuffConfigure(s->
sCIp, 20, 0, 0, 0, 0))) {
169 tCIU32 bitsPerPix, hROIsize, vROIsize, hROIoffset, vROIoffset, stride;
170 if (kCIEnoErr != (circ = CiBufferInterrogate(s->
sCIp, &s->
nFrames, &bitsPerPix, &hROIoffset, &hROIsize, &vROIoffset, &vROIsize, &stride)))
211 if ((NULL != s->
uPtrs) && (kCIEnoErr != (circ = CiUnmapFrameBuffers(s->
sCIp)))){
217 if ((NULL != s->
sCIp) && (kCIEnoErr != (circ = CiVFGclose(s->
sCIp)))) {
224static void debayer(
char *out,
char *in,
int width,
int height)
226 for (
int y = 0; y < height; y += 2) {
227 for (
int x = 0; x < width; ++x) {
230 *out++ = in[x + width];
232 for (
int x = 0; x < width; ++x) {
234 *out++ = in[x + width + 1];
235 *out++ = in[x + width];
271 circ = CiGetOldestNotDeliveredFrame(s->
sCIp, &frameID, &frameP);
278 if (kCIEnoErr != (circ = CiWaitNextUndeliveredFrame(s->
sCIp,-1)))
281 case kCIEaqAbortedErr:
294 circ = CiGetOldestNotDeliveredFrame(s->
sCIp, &frameID, &frameP);
295 if (circ == kCIEnoErr) {
300 case kCIEaqAbortedErr:
313 switch (circ = CiGetUndeliveredCount(s->
sCIp,&
count)) {
325 case kCIEaqAbortedErr:
347 *available_cards =
nullptr;
struct audio_frame ** audio
int void(** deleter)(void *))
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
static float get_fps(struct vidcap_state_bitflow *s)
static bool reset_acquisition(struct vidcap_state_bitflow *s)
static void debayer(char *out, char *in, int width, int height)
static const struct video_capture_info vidcap_bitflow_info
static void restartAcquisition(struct vidcap_state_bitflow *s)
static bool start_acquisition(struct vidcap_state_bitflow *s)
static bool map_frame_buffers(struct vidcap_state_bitflow *s)
static struct video_frame * vidcap_bitflow_grab(void *state, struct audio_frame **audio)
static void vidcap_bitflow_done(void *state)
static int vidcap_bitflow_init(struct vidcap_params *params, void **state)
static void vidcap_bitflow_probe(device_info **available_cards, int *count, void(**deleter)(void *))
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_ERROR
general errors
#define LOG_LEVEL_FATAL
errors that prevent UG run
#define LOG_LEVEL_WARNING
less severe errors
#define VIDCAP_INIT_OK
initialization successful
#define VIDCAP_NO_GENERIC_FPS_INDICATOR
#define VIDEO_CAPTURE_ABI_VERSION
#define VIDCAP_INIT_AUDIO_NOT_SUPPORTED
card does not support audio
@ LIBRARY_CLASS_VIDEO_CAPTURE
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
struct used to comunicate with audio capture/playback device
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int width
width of every tile (!)
unsigned int height
height of every tile (!)
void(* dispose)(struct video_frame *)
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
struct video_frame_callbacks callbacks
@ PROGRESSIVE
progressive frame
@ RGB
RGB 8-bit (packed into 24-bit word)
This is an umbrella header for video functions.
unsigned int vidcap_params_get_flags(const struct vidcap_params *params)
#define VIDCAP_FLAG_AUDIO_ANY