Initial commit

parents
*~
*.swp
*target*
\ No newline at end of file
src-dirs = src
test-dirs =
include ../../global.inc
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef V4L2CAMERA_H
#define V4L2CAMERA_H
#include <linux/videodev2.h>
#include <libv4l2.h>
#include "lima/Debug.h"
#include "lima/SizeUtils.h"
#include "lima/Constants.h"
#include "lima/HwInterface.h"
namespace lima
{
namespace V4L2
{
class Camera
{
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "V4L2");
public:
class Callback
{
public:
virtual bool newFrame(int frame_id,const unsigned char*) = 0;
};
Camera(Callback*,const char* video_device = "/dev/video0");
~Camera();
// --- Detector Info
void getMaxImageSize(Size&);
void getCurrImageType(ImageType&);
void setCurrImageType(ImageType);
void getDetectorModel(std::string& det_model);
// --- Syn Obj
void getMinMaxExpTime(double& min,double& max);
void setExpTime(double exp_time);
void getExpTime(double& exp_time);
void setNbHwFrames(int nb_frames);
void getNbHwFrames(int& nb_frames);
// --- Acquisition interface
void reset(HwInterface::ResetLevel reset_level);
void prepareAcq();
void startAcq();
void stopAcq();
void getStatus(HwInterface::StatusType& status);
int getNbHwAcquiredFrames();
private:
class _AcqThread;
friend class _AcqThread;
Callback* m_cbk;
int m_fd;
struct v4l2_buffer m_buffer;
unsigned char* m_buffers[2];
std::string m_det_model;
int m_nb_frames;
int m_acq_frame_id;
bool m_acq_started;
bool m_acq_thread_run;
std::list<int> m_available_format;
_AcqThread* m_acq_thread;
int m_pipes[2];
bool m_quit;
Cond m_cond;
};
}
}
#endif
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef V4L2DETINFO_H
#define V4L2DETINFO_H
#include "lima/HwDetInfoCtrlObj.h"
namespace lima
{
namespace V4L2
{
class Camera;
class DetInfoCtrlObj : public HwDetInfoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera, "DetInfoCtrlObj", "V4L2");
public:
DetInfoCtrlObj(int fd);
virtual ~DetInfoCtrlObj();
virtual void getMaxImageSize(Size& max_image_size);
virtual void getDetectorImageSize(Size& det_image_size);
virtual void getDefImageType(ImageType& def_image_type);
virtual void getCurrImageType(ImageType& curr_image_type);
virtual void setCurrImageType(ImageType curr_image_type);
virtual void getPixelSize(double& x_size,double &y_size);
virtual void getDetectorType(std::string& det_type);
virtual void getDetectorModel(std::string& det_model);
virtual void registerMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
virtual void unregisterMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
void getAvailableFormat(std::list<int>& formats) const {formats = m_available_format;}
private:
void _maxImageSize(Size&);
void _getCurrentImageType(ImageType&);
HwMaxImageSizeCallbackGen m_mis_cb_gen;
int m_fd;
std::list<int> m_available_format;
std::string m_det_model;
};
}
}
#endif
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef V4L2INTERFACE_H
#define V4L2INTERFACE_H
#include "lima/Debug.h"
#include "lima/HwInterface.h"
namespace lima
{
namespace V4L2
{
class DetInfoCtrlObj;
class SyncCtrlObj;
class Camera;
class Interface : public HwInterface
{
DEB_CLASS_NAMESPC(DebModCamera, "Interface", "V4L2");
public:
Interface(const char* dev_path = "/dev/video0");
virtual ~Interface();
virtual void getCapList(CapList &) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status);
virtual int getNbHwAcquiredFrames();
private:
class _Callback;
friend class _Callback;
DetInfoCtrlObj* m_det_info;
SyncCtrlObj* m_sync;
Camera* m_cam;
_Callback* m_cbk;
};
}
}
#endif
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef V4L2SYNCCTRLOBJ_H
#define V4L2SYNCCTRLOBJ_H
#include "lima/HwSyncCtrlObj.h"
#include "V4L2Interface.h"
namespace lima
{
namespace V4L2
{
class SyncCtrlObj : public HwSyncCtrlObj
{
friend class Interface;
DEB_CLASS_NAMESPC(DebModCamera, "SyncCtrlObj", "V4L2");
public:
SyncCtrlObj(int fd);
virtual ~SyncCtrlObj();
virtual bool checkTrigMode(TrigMode trig_mode);
virtual void setTrigMode(TrigMode trig_mode);
virtual void getTrigMode(TrigMode& trig_mode);
virtual void setExpTime(double exp_time);
virtual void getExpTime(double& exp_time);
virtual bool checkAutoExposureMode(AutoExposureMode mode) const;
virtual void setLatTime(double lat_time);
virtual void getLatTime(double& lat_time);
virtual void setNbHwFrames(int nb_frames);
virtual void getNbHwFrames(int& nb_frames);
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
int m_fd;
int m_nb_frames;
};
}
}
#endif
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef V4L2VIDEOCTRLOBJ_H
#define V4L2VIDEOCTRLOBJ_H
#include "lima/HwVideoCtrlObj.h"
namespace lima
{
namespace V4L2
{
class DetInfoCtrlObj;
class VideoCtrlObj : public HwVideoCtrlObj
{
DEB_CLASS_NAMESPC(DebModCamera,"VideoCtrlObj","V4L2");
public:
VideoCtrlObj(int fd,DetInfoCtrlObj&);
virtual ~VideoCtrlObj();
virtual void getSupportedVideoMode(std::list<VideoMode>& list) const;
virtual void setVideoMode(VideoMode);
virtual void getVideoMode(VideoMode&) const;
virtual void setLive(bool);
virtual void getLive(bool&) const;
virtual void getGain(double&) const;
virtual void setGain(double);
virtual bool checkAutoGainMode(AutoGainMode) const;
virtual void setHwAutoGainMode(AutoGainMode);
virtual void checkBin(Bin& bin);
virtual void checkRoi(const Roi& set_roi,Roi& hw_roi);
virtual void setBin(const Bin&);
virtual void setRoi(const Roi&);
private:
int m_fd;
DetInfoCtrlObj& m_det_info;
Cond m_cond;
bool m_acq_started;
int m_pipes[2];
};
}
}
#endif
############################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2011
# European Synchrotron Radiation Facility
# BP 220, Grenoble 38043
# FRANCE
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
from Lima import module_helper
mod_path = __path__
depends_on = 'Core'
has_dependent = False
cleanup_data = module_helper.load_prepare(mod_path, depends_on, has_dependent)
from Lima import Core
cleanup_data = module_helper.load_dep_cleanup(cleanup_data)
from Lima.Tutorial.limatutorial import Tutorial as _Tuto
globals().update(_Tuto.__dict__)
module_helper.load_cleanup(cleanup_data)
del mod_path, depends_on, has_dependent, cleanup_data
del module_helper
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace Tutorial
{
class Camera
{
%TypeHeaderCode
#include <TutorialCamera.h>
%End
public:
class Callback
{
public:
virtual bool newFrame(int frame_id,const unsigned char*) = 0;
};
Camera(Callback*,const char* video_device = "/dev/video0");
~Camera();
// --- Detector Info
void getMaxImageSize(Size& /Out/);
void getCurrImageType(ImageType& /Out/);
void setCurrImageType(ImageType);
void getDetectorModel(std::string& det_model /Out/);
// --- Syn Obj
void getMinMaxExpTime(double& min /Out/,double& max /Out/);
void setExpTime(double exp_time);
void getExpTime(double& exp_time /out/);
void setNbHwFrames(int nb_frames);
void getNbHwFrames(int& nb_frames /Out/);
// --- Acquisition interface
void reset(HwInterface::ResetLevel reset_level);
void prepareAcq();
void startAcq();
void stopAcq();
void getStatus(HwInterface::StatusType& status /Out/);
int getNbHwAcquiredFrames();
};
};
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
namespace Tutorial
{
class Interface : HwInterface
{
%TypeHeaderCode
#include <TutorialInterface.h>
%End
public:
Interface(const char* dev_path = "/dev/video0");
virtual ~Interface();
virtual void getCapList(std::vector<HwCap> &cap_list /Out/) const;
virtual void reset(ResetLevel reset_level);
virtual void prepareAcq();
virtual void startAcq();
virtual void stopAcq();
virtual void getStatus(StatusType& status /Out/);
virtual int getNbHwAcquiredFrames();
};
};
*.o
*.P
*.d
tutorial-objs = TutorialDetInfoCtrlObj.o TutorialSyncCtrlObj.o TutorialInterface.o TutorialCamera.o
SRCS = $(tutorial-objs:.o=.cpp)
CXXFLAGS += -I../include -I../../../hardware/include -I../../../common/include -I../../../third-party/Processlib/core/include -pthread -fPIC -g
all: Tutorial.o
Tutorial.o: $(tutorial-objs)
$(LD) -o $@ -r $+
clean:
rm -f *.o *.P
.PHONY: check-syntax
check-syntax:
$(CXX) -Wall -Wextra -pedantic -fsyntax-only $(CXXFLAGS) $(CHK_SOURCES)
%.o : %.cpp
$(COMPILE.cpp) -MD $(CXXFLAGS) -o $@ $<
@cp $*.d $*.P; \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \
rm -f $*.d
-include $(SRCS:.cpp=.P)
.PHONY: check-syntax
check-syntax:
$(CXX) -Wall -Wextra -fsyntax-only $(CXXFLAGS) $(CHK_SOURCES)
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/mman.h>
#include <poll.h>
#include <unistd.h>
#include "V4L2Camera.h"
using namespace lima;
using namespace lima::V4L2;
class Camera::_AcqThread : public Thread
{
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "_AcqThread");
public:
_AcqThread(Camera &aCam);
protected:
virtual void threadFunction();
private:
Camera& m_cam;
};
Camera::Camera(Camera::Callback* cbk,const char* video_device):
m_cbk(cbk),
m_fd(-1),
m_nb_frames(1),
m_acq_frame_id(-1),
m_acq_started(false),
m_quit(false)
{
DEB_CONSTRUCTOR();
memset(&m_buffer,0,sizeof(m_buffer));
m_buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
m_fd = v4l2_open(video_device,O_RDWR);
if(m_fd < -1)
THROW_HW_ERROR(Error) << "Error opening: " << video_device
<< "(" << strerror(errno) << ")";
struct v4l2_capability cap;
int ret = v4l2_ioctl(m_fd, VIDIOC_QUERYCAP, &cap);
if(ret == -1)
THROW_HW_ERROR(Error) << "Error querying cap: " << strerror(errno);
DEB_TRACE() << DEB_VAR1(cap.driver) << ","
<< DEB_VAR1(cap.card) << ","
<< DEB_VAR1(cap.bus_info);
m_det_model = (char*)cap.card;
if(!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
THROW_HW_ERROR(Error) << "Error: dev. doesn't have VIDEO_CAPTURE cap.";
struct v4l2_fmtdesc formatdesc;
formatdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
for(formatdesc.index = 0;v4l2_ioctl(m_fd, VIDIOC_ENUM_FMT, &formatdesc) != -1;
++formatdesc.index)
{
m_available_format.push_back(formatdesc.pixelformat);
switch(formatdesc.pixelformat)
{
/* RGB formats */
case V4L2_PIX_FMT_RGB332: DEB_TRACE() << "As V4L2_PIX_FMT_RGB332";break;
case V4L2_PIX_FMT_RGB444: DEB_TRACE() << "As V4L2_PIX_FMT_RGB444";break;
case V4L2_PIX_FMT_RGB555: DEB_TRACE() << "As V4L2_PIX_FMT_RGB555";break;
case V4L2_PIX_FMT_RGB565: DEB_TRACE() << "As V4L2_PIX_FMT_RGB565";break;
case V4L2_PIX_FMT_RGB555X: DEB_TRACE() << "As V4L2_PIX_FMT_RGB555X";break;
case V4L2_PIX_FMT_RGB565X: DEB_TRACE() << "As V4L2_PIX_FMT_RGB565X";break;
case V4L2_PIX_FMT_BGR24: DEB_TRACE() << "As V4L2_PIX_FMT_BGR24";break;
case V4L2_PIX_FMT_RGB24: DEB_TRACE() << "As V4L2_PIX_FMT_RGB24";break;
case V4L2_PIX_FMT_BGR32: DEB_TRACE() << "As V4L2_PIX_FMT_BGR32";break;
case V4L2_PIX_FMT_RGB32: DEB_TRACE() << "As V4L2_PIX_FMT_RGB32";break;
/* Grey formats */
case V4L2_PIX_FMT_GREY: DEB_TRACE() << "As V4L2_PIX_FMT_GREY";break;
case V4L2_PIX_FMT_Y16: DEB_TRACE() << "As V4L2_PIX_FMT_Y16";break;
/* Palette formats */
case V4L2_PIX_FMT_PAL8: DEB_TRACE() << "As V4L2_PIX_FMT_PAL8";break;
/* Luminance+Chrominance formats */
case V4L2_PIX_FMT_YVU410: DEB_TRACE() << "As V4L2_PIX_FMT_YVU410";break;
case V4L2_PIX_FMT_YVU420: DEB_TRACE() << "As V4L2_PIX_FMT_YVU420";break;
case V4L2_PIX_FMT_YUYV: DEB_TRACE() << "As V4L2_PIX_FMT_YUYV";break;
case V4L2_PIX_FMT_YYUV: DEB_TRACE() << "As V4L2_PIX_FMT_YYUV";break;
case V4L2_PIX_FMT_YVYU: DEB_TRACE() << "As V4L2_PIX_FMT_YVYU";break;
case V4L2_PIX_FMT_UYVY: DEB_TRACE() << "As V4L2_PIX_FMT_UYVY";break;
case V4L2_PIX_FMT_VYUY: DEB_TRACE() << "As V4L2_PIX_FMT_VYUY";break;
case V4L2_PIX_FMT_YUV422P: DEB_TRACE() << "As V4L2_PIX_FMT_YUV422P";break;
case V4L2_PIX_FMT_YUV411P: DEB_TRACE() << "As V4L2_PIX_FMT_YUV411P";break;
case V4L2_PIX_FMT_Y41P: DEB_TRACE() << "As V4L2_PIX_FMT_Y41P";break;
case V4L2_PIX_FMT_YUV444: DEB_TRACE() << "As V4L2_PIX_FMT_YUV444";break;
case V4L2_PIX_FMT_YUV555: DEB_TRACE() << "As V4L2_PIX_FMT_YUV555";break;
case V4L2_PIX_FMT_YUV565: DEB_TRACE() << "As V4L2_PIX_FMT_YUV565";break;
case V4L2_PIX_FMT_YUV32: DEB_TRACE() << "As V4L2_PIX_FMT_YUV32";break;
case V4L2_PIX_FMT_YUV410: DEB_TRACE() << "As V4L2_PIX_FMT_YUV410";break;
case V4L2_PIX_FMT_YUV420: DEB_TRACE() << "As V4L2_PIX_FMT_YUV420";break;
case V4L2_PIX_FMT_HI240: DEB_TRACE() << "As V4L2_PIX_FMT_HI240";break;
case V4L2_PIX_FMT_HM12: DEB_TRACE() << "As V4L2_PIX_FMT_HM12";break;
/* two planes -- one Y, one Cr + Cb interleaved */
case V4L2_PIX_FMT_NV12: DEB_TRACE() << "As V4L2_PIX_FMT_NV12";break;
case V4L2_PIX_FMT_NV21: DEB_TRACE() << "As V4L2_PIX_FMT_NV21";break;
case V4L2_PIX_FMT_NV16: DEB_TRACE() << "As V4L2_PIX_FMT_NV16";break;
case V4L2_PIX_FMT_NV61: DEB_TRACE() << "As V4L2_PIX_FMT_NV61";break;
/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
case V4L2_PIX_FMT_SBGGR8: DEB_TRACE() << "As V4L2_PIX_FMT_SBGGR8";break;
case V4L2_PIX_FMT_SGBRG8: DEB_TRACE() << "As V4L2_PIX_FMT_SGBRG8";break;
case V4L2_PIX_FMT_SGRBG8: DEB_TRACE() << "As V4L2_PIX_FMT_SGRBG8";break;
case V4L2_PIX_FMT_SGRBG10: DEB_TRACE() << "As V4L2_PIX_FMT_SGRBG10";break;
/* 10bit raw bayer DPCM compressed to 8 bits */
case V4L2_PIX_FMT_SGRBG10DPCM8: DEB_TRACE() << "As V4L2_PIX_FMT_SGRBG10DPCM8";break;
/*
* 10bit raw bayer, expanded to 16 bits
* xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
*/
case V4L2_PIX_FMT_SBGGR16: DEB_TRACE() << "As V4L2_PIX_FMT_SBGGR16";break;
/* compressed formats */
case V4L2_PIX_FMT_MJPEG: DEB_TRACE() << "As V4L2_PIX_FMT_MJPEG";break;
case V4L2_PIX_FMT_JPEG: DEB_TRACE() << "As V4L2_PIX_FMT_JPEG";break;
case V4L2_PIX_FMT_DV: DEB_TRACE() << "As V4L2_PIX_FMT_DV";break;
case V4L2_PIX_FMT_MPEG: DEB_TRACE() << "As V4L2_PIX_FMT_MPEG";break;
/* Vendor-specific formats */
case V4L2_PIX_FMT_WNVA: DEB_TRACE() << "As V4L2_PIX_FMT_WNVA";break;
case V4L2_PIX_FMT_SN9C10X: DEB_TRACE() << "As V4L2_PIX_FMT_SN9C10X";break;
case V4L2_PIX_FMT_SN9C20X_I420: DEB_TRACE() << "As V4L2_PIX_FMT_SN9C20X_I420";break;
case V4L2_PIX_FMT_PWC1: DEB_TRACE() << "As V4L2_PIX_FMT_PWC1";break;
case V4L2_PIX_FMT_PWC2: DEB_TRACE() << "As V4L2_PIX_FMT_PWC2";break;
case V4L2_PIX_FMT_ET61X251: DEB_TRACE() << "As V4L2_PIX_FMT_ET61X251";break;
case V4L2_PIX_FMT_SPCA501: DEB_TRACE() << "As V4L2_PIX_FMT_SPCA501";break;
case V4L2_PIX_FMT_SPCA505: DEB_TRACE() << "As V4L2_PIX_FMT_SPCA505";break;
case V4L2_PIX_FMT_SPCA508: DEB_TRACE() << "As V4L2_PIX_FMT_SPCA508";break;
case V4L2_PIX_FMT_SPCA561: DEB_TRACE() << "As V4L2_PIX_FMT_SPCA561";break;
case V4L2_PIX_FMT_PAC207: DEB_TRACE() << "As V4L2_PIX_FMT_PAC207";break;
case V4L2_PIX_FMT_MR97310A: DEB_TRACE() << "As V4L2_PIX_FMT_MR97310A";break;
case V4L2_PIX_FMT_SQ905C: DEB_TRACE() << "As V4L2_PIX_FMT_SQ905C";break;
case V4L2_PIX_FMT_PJPG: DEB_TRACE() << "As V4L2_PIX_FMT_PJPG";break;
case V4L2_PIX_FMT_OV511: DEB_TRACE() << "As V4L2_PIX_FMT_OV511";break;
case V4L2_PIX_FMT_OV518: DEB_TRACE() << "As V4L2_PIX_FMT_OV518";break;
}
}
setCurrImageType(Bpp8);
struct v4l2_streamparm streamparm;
streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ret = v4l2_ioctl(m_fd,VIDIOC_G_PARM,&streamparm);
if(ret == -1)
THROW_HW_ERROR(Error) << "Error querying stream param : " << strerror(errno);
if(streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME)
{
DEB_TRACE() << "Time per frame supported";
struct v4l2_format format;
format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
v4l2_ioctl(m_fd,VIDIOC_G_FMT,&format);
struct v4l2_frmivalenum frmivalenum;
frmivalenum.width = format.fmt.pix.width;
frmivalenum.height = format.fmt.pix.height;
frmivalenum.pixel_format = format.fmt.pix.pixelformat;
for(frmivalenum.index = 0;v4l2_ioctl(m_fd,VIDIOC_ENUM_FRAMEINTERVALS,&frmivalenum) != -1;
++frmivalenum.index)
{
if(frmivalenum.type == V4L2_FRMIVAL_TYPE_DISCRETE)
DEB_TRACE() << frmivalenum.discrete.numerator
<< "/" << frmivalenum.discrete.denominator;
else if(<