8 #include <VideoSource/VideoSource_Centaurus.hh>
13 char VideoSource_Centaurus::setup = 0;
15 VideoSource_Centaurus::VideoSource_Centaurus() {
18 setup1_ =
"PCI,card:0,channel:0";
19 setup2_ =
"PCI,card:0,channel:1";
22 VideoSource_Centaurus::~VideoSource_Centaurus() {
26 int VideoSource_Centaurus::OpenDevice() {
28 int res = OpenDevice(&setup, SV_OPENPROGRAM_DEFAULT, SV_OPENTYPE_DEFAULT, 0, 0);
33 int VideoSource_Centaurus::OpenDevice(
char * setup)
35 int res = OpenDevice(setup, SV_OPENPROGRAM_DEFAULT, SV_OPENTYPE_DEFAULT, 0, 0);
40 int VideoSource_Centaurus::OpenDevice(
char * setup,
int openprogram,
41 int opentype,
int timeout,
int spare) {
42 int res = sv_openex(&cam_handleP_, setup, openprogram, opentype, timeout,
45 BIASERR(
"sv_openex : " << sv_geterrortext(res) << endl)
57 std::string s = setup;
59 res = sv_option_set(cam_handleP_,SV_OPTION_MULTICHANNEL,SV_MULTICHANNEL_INPUT);
61 BIASERR(sv_geterrortext(res) << endl)
67 int VideoSource_Centaurus::CloseDevice() {
69 if (cam_handleP_ != NULL) {
70 res = sv_close(cam_handleP_);
72 BIASERR(
"sv_close : " << sv_geterrortext(res) << endl)
81 int VideoSource_Centaurus::SetVideoMode(
int mode) {
82 int res = sv_videomode(cam_handleP_, mode);
84 BIASERR(
"sv_videomode : " << sv_geterrortext(res) << endl);
90 int VideoSource_Centaurus::InitFiFo() {
91 int res = sv_fifo_init(cam_handleP_, &inputFifoP_, 1, 0, 1,
92 SV_FIFO_FLAG_VIDEOONLY, 0);
94 BIASERR(
"sv_fifo_init : " << sv_geterrortext(res) << endl);
97 res = sv_fifo_start(cam_handleP_, inputFifoP_);
99 BIASERR(
"sv_fifo_start " << sv_geterrortext(res) << endl);
109 if (cam_handleP_ != NULL) {
110 if (inputFifoP_ != NULL) {
112 flags |= SV_FIFO_FLAG_VSYNCWAIT;
113 flags |= SV_FIFO_FLAG_FLUSH;
115 sv_fifo_buffer* sv_buffer;
116 res = sv_fifo_getbuffer(cam_handleP_, inputFifoP_, &sv_buffer,
119 BIASERR(
"sv_fifo_getbuffer : " << sv_geterrortext(res) << endl);
126 res = sv_fifo_putbuffer(cam_handleP_, inputFifoP_, sv_buffer, NULL);
128 BIASERR(
"sv_fifo_putbuffer : " << sv_geterrortext(res) << endl);
132 BIASERR(
"call InitFiFo(...) first");
135 BIASERR(
"call OpenDevice(...) first " << endl);
143 bool alreadyOpend =
false;
144 if (cam_handleP_ == NULL) {
150 sv_storageinfo storageInfo;
151 int res = sv_storage_status(cam_handleP_, 0, NULL, &storageInfo,
152 sizeof(storageInfo), 0);
154 BIASERR(
"sv_storage_status : " << sv_geterrortext(res) << endl);
157 int colorMode = storageInfo.colormode;
159 int width = storageInfo.xsize;
160 int height = storageInfo.ysize;
163 case SV_COLORMODE_YUV422_YUYV:
164 image.
Init(width, height, 2, ImageBase::ST_unsignedchar);
166 cout <<
"color mode : YUV422_YUYV " << endl;
172 int videoMode = storageInfo.videomode;
173 switch (videoMode & SV_MODE_MASK) {
174 case SV_MODE_SMPTE274_25sF:
175 cout <<
"video mode : SV_MODE_SMPTE274_25sF " << endl;
181 int fps = storageInfo.fps;
182 cout <<
"FPS : " << fps << endl;
void SetColorModel(EColorModel Model)
unsigned int GetWidth() const
unsigned int GetChannelCount() const
returns the number of Color channels, e.g.
unsigned int GetHeight() const
const StorageType * GetImageData() const
overloaded GetImageData() from ImageBase
void Init(unsigned int width, unsigned int height, unsigned int nChannels=1, enum EStorageType storageType=ST_unsignedchar, const bool interleaved=true)
Initialize image size and channels.
This is the base class for images in BIAS.