- style cleanup (remove // -----, 2 lines between funcs)

- hooks to handle probing sensor chips instead of hardcoding them.
- more urls for reference drivers (the macam driver would be interesting but it's GPL and ObjC :-( )...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25320 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-05-05 15:38:02 +00:00
parent 5b880818a5
commit 74b3713ab9
15 changed files with 335 additions and 198 deletions

View File

@ -11,6 +11,7 @@
#include "CamDebug.h"
#include "CamDevice.h"
WebCamMediaAddOn::WebCamMediaAddOn(image_id imid)
: BMediaAddOn(imid),
fInitStatus(B_NO_INIT),
@ -34,6 +35,7 @@ WebCamMediaAddOn::WebCamMediaAddOn(image_id imid)
fInitStatus = B_OK;
}
WebCamMediaAddOn::~WebCamMediaAddOn()
{
delete fRoster;
@ -51,6 +53,7 @@ WebCamMediaAddOn::InitCheck(const char **out_failure_text)
return B_OK;
}
int32
WebCamMediaAddOn::CountFlavors()
{
@ -67,6 +70,7 @@ WebCamMediaAddOn::CountFlavors()
return count;//(count > 0)?count:1;//1;
}
/*
* The pointer to the flavor received only needs to be valid between
* successive calls to BMediaAddOn::GetFlavorAt().
@ -97,6 +101,7 @@ WebCamMediaAddOn::GetFlavorAt(int32 n, const flavor_info **out_info)
return B_OK;
}
BMediaNode *
WebCamMediaAddOn::InstantiateNodeFor(
const flavor_info *info, BMessage* /*_config*/, status_t* /*_out_error*/)
@ -142,6 +147,7 @@ WebCamMediaAddOn::InstantiateNodeFor(
return node;
}
status_t
WebCamMediaAddOn::CameraAdded(CamDevice* device)
{
@ -150,6 +156,7 @@ WebCamMediaAddOn::CameraAdded(CamDevice* device)
return B_OK;
}
status_t
WebCamMediaAddOn::CameraRemoved(CamDevice* device)
{
@ -158,6 +165,7 @@ WebCamMediaAddOn::CameraRemoved(CamDevice* device)
return B_OK;
}
void
WebCamMediaAddOn::FillDefaultFlavorInfo(flavor_info* info)
{
@ -175,6 +183,7 @@ WebCamMediaAddOn::FillDefaultFlavorInfo(flavor_info* info)
info->out_formats = &fMediaFormat;
}
BMediaAddOn *
make_media_addon(image_id imid)
{

View File

@ -2,28 +2,33 @@
#include "CamDevice.h"
#include "CamDebug.h"
CamBufferedFilterInterface::CamBufferedFilterInterface(CamDevice *device, bool allowWrite)
: CamFilterInterface(device),
fAllowWrite(allowWrite)
{
}
CamBufferedFilterInterface::~CamBufferedFilterInterface()
{
}
ssize_t
CamBufferedFilterInterface::Read(void *buffer, size_t size)
{
return fInternalBuffer.Read(buffer, size);
}
ssize_t
CamBufferedFilterInterface::ReadAt(off_t pos, void *buffer, size_t size)
{
return fInternalBuffer.ReadAt(pos, buffer, size);
}
ssize_t
CamBufferedFilterInterface::Write(const void *buffer, size_t size)
{
@ -32,6 +37,7 @@ CamBufferedFilterInterface::Write(const void *buffer, size_t size)
return fInternalBuffer.Write(buffer, size);
}
ssize_t
CamBufferedFilterInterface::WriteAt(off_t pos, const void *buffer, size_t size)
{
@ -40,18 +46,21 @@ CamBufferedFilterInterface::WriteAt(off_t pos, const void *buffer, size_t size)
return fInternalBuffer.WriteAt(pos, buffer, size);
}
off_t
CamBufferedFilterInterface::Seek(off_t position, uint32 seek_mode)
{
return fInternalBuffer.Seek(position, seek_mode);
}
off_t
CamBufferedFilterInterface::Position() const
{
return fInternalBuffer.Position();
}
status_t
CamBufferedFilterInterface::SetSize(off_t size)
{
@ -60,6 +69,7 @@ CamBufferedFilterInterface::SetSize(off_t size)
return fInternalBuffer.SetSize(size);
}
size_t
CamBufferedFilterInterface::FrameSize()
{
@ -67,6 +77,7 @@ CamBufferedFilterInterface::FrameSize()
return 0;
}
status_t
CamBufferedFilterInterface::DropFrame()
{
@ -76,6 +87,7 @@ CamBufferedFilterInterface::DropFrame()
return B_OK;
}
status_t
CamBufferedFilterInterface::SetVideoFrame(BRect frame)
{

View File

@ -15,16 +15,19 @@
#define IB fInputBuffs[fInputBuffIndex]
CamBufferingDeframer::CamBufferingDeframer(CamDevice *device)
: CamDeframer(device),
fInputBuffIndex(0)
{
}
CamBufferingDeframer::~CamBufferingDeframer()
{
}
ssize_t
CamBufferingDeframer::Write(const void *buffer, size_t size)
{
@ -100,6 +103,7 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
return size;
}
size_t
CamBufferingDeframer::DiscardFromInput(size_t size)
{

View File

@ -17,7 +17,7 @@ struct { const char *name; TransformInstFunc instfunc; } kTransformTable[] = {
};
#undef B_WEBCAM_DECLARE_CSTRANSFORM
// -----------------------------------------------------------------------------
CamColorSpaceTransform::CamColorSpaceTransform()
: fInitStatus(B_NO_INIT),
fVideoFrame()
@ -25,41 +25,41 @@ CamColorSpaceTransform::CamColorSpaceTransform()
}
// -----------------------------------------------------------------------------
CamColorSpaceTransform::~CamColorSpaceTransform()
{
}
// -----------------------------------------------------------------------------
status_t
CamColorSpaceTransform::InitCheck()
{
return fInitStatus;
}
// -----------------------------------------------------------------------------
const char *
CamColorSpaceTransform::Name()
{
return "<unknown>";
}
// -----------------------------------------------------------------------------
color_space
CamColorSpaceTransform::OutputSpace()
{
return B_RGB32;
}
// -----------------------------------------------------------------------------
status_t
CamColorSpaceTransform::SetVideoFrame(BRect rect)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
CamColorSpaceTransform *
CamColorSpaceTransform::Create(const char *name)
{

View File

@ -6,6 +6,7 @@
#define MAX_TAG_LEN CAMDEFRAMER_MAX_TAG_LEN
#define MAXFRAMEBUF CAMDEFRAMER_MAX_QUEUED_FRAMES
CamDeframer::CamDeframer(CamDevice *device)
: CamFilterInterface(device),
fDevice(device),
@ -21,6 +22,7 @@ fNumEOFTags(0)
fCurrentFrame = AllocFrame();
}
CamDeframer::~CamDeframer()
{
delete_sem(fFrameSem);
@ -28,6 +30,7 @@ CamDeframer::~CamDeframer()
delete fCurrentFrame;
}
ssize_t
CamDeframer::Read(void *buffer, size_t size)
{
@ -38,6 +41,7 @@ CamDeframer::Read(void *buffer, size_t size)
return f->Read(buffer, size);
}
ssize_t
CamDeframer::ReadAt(off_t pos, void *buffer, size_t size)
{
@ -48,6 +52,7 @@ CamDeframer::ReadAt(off_t pos, void *buffer, size_t size)
return f->ReadAt(pos, buffer, size);
}
off_t
CamDeframer::Seek(off_t position, uint32 seek_mode)
{
@ -58,6 +63,7 @@ CamDeframer::Seek(off_t position, uint32 seek_mode)
return f->Seek(position, seek_mode);
}
off_t
CamDeframer::Position() const
{
@ -68,6 +74,7 @@ CamDeframer::Position() const
return f->Position();
}
status_t
CamDeframer::SetSize(off_t size)
{
@ -75,6 +82,7 @@ CamDeframer::SetSize(off_t size)
return EINVAL;
}
ssize_t
CamDeframer::Write(const void *buffer, size_t size)
{
@ -83,6 +91,7 @@ CamDeframer::Write(const void *buffer, size_t size)
return EINVAL;
}
ssize_t
CamDeframer::WriteAt(off_t pos, const void *buffer, size_t size)
{
@ -92,12 +101,14 @@ CamDeframer::WriteAt(off_t pos, const void *buffer, size_t size)
return EINVAL;
}
status_t
CamDeframer::WaitFrame(bigtime_t timeout)
{
return acquire_sem_etc(fFrameSem, 1, B_RELATIVE_TIMEOUT, timeout);
}
status_t
CamDeframer::GetFrame(CamFrame **frame, bigtime_t *stamp)
{
@ -111,6 +122,7 @@ CamDeframer::GetFrame(CamFrame **frame, bigtime_t *stamp)
return B_OK;
}
status_t
CamDeframer::DropFrame()
{
@ -123,6 +135,7 @@ CamDeframer::DropFrame()
return B_OK;
}
status_t
CamDeframer::RegisterSOFTags(const uint8 **tags, int count, size_t len, size_t skip)
{
@ -139,6 +152,7 @@ CamDeframer::RegisterSOFTags(const uint8 **tags, int count, size_t len, size_t s
return B_OK;
}
status_t
CamDeframer::RegisterEOFTags(const uint8 **tags, int count, size_t len, size_t skip)
{
@ -155,6 +169,7 @@ CamDeframer::RegisterEOFTags(const uint8 **tags, int count, size_t len, size_t s
return B_OK;
}
int
CamDeframer::FindTags(const uint8 *buf, size_t buflen, const uint8 **tags, int tagcount, size_t taglen, size_t skiplen, int *which)
{
@ -171,22 +186,24 @@ CamDeframer::FindTags(const uint8 *buf, size_t buflen, const uint8 **tags, int t
return -1;
}
int
CamDeframer::FindSOF(const uint8 *buf, size_t buflen, int *which)
{
return FindTags(buf, buflen, fSOFTags, fNumSOFTags, fLenSOFTags, fSkipSOFTags, which);
}
int
CamDeframer::FindEOF(const uint8 *buf, size_t buflen, int *which)
{
return FindTags(buf, buflen, fEOFTags, fNumEOFTags, fLenEOFTags, fSkipEOFTags, which);
}
CamFrame *
CamDeframer::AllocFrame()
{
return new CamFrame();
}

View File

@ -26,7 +26,7 @@ struct { const char *name; SensorInstFunc instfunc; } kSensorTable[] = {
};
#undef B_WEBCAM_DECLARE_SENSOR
// -----------------------------------------------------------------------------
CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
: fInitStatus(B_NO_INIT),
fSensor(NULL),
@ -34,6 +34,7 @@ CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
fCamDeviceAddon(_addon),
fDevice(_device),
fSupportedDeviceIndex(-1),
fChipIsBigEndian(false),
fTransferEnabled(false),
fLocker("WebcamDeviceLock")
{
@ -62,7 +63,7 @@ CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
fBuffer = (uint8 *)malloc(fBufferLen);
}
// -----------------------------------------------------------------------------
CamDevice::~CamDevice()
{
close(fDumpFD);
@ -71,28 +72,28 @@ CamDevice::~CamDevice()
delete fDeframer;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::InitCheck()
{
return fInitStatus;
}
// -----------------------------------------------------------------------------
bool
CamDevice::Matches(BUSBDevice* _device)
{
return (_device) == (fDevice);
}
// -----------------------------------------------------------------------------
BUSBDevice*
CamDevice::GetDevice()
{
return fDevice;
}
// -----------------------------------------------------------------------------
void
CamDevice::Unplugged()
{
@ -100,14 +101,14 @@ CamDevice::Unplugged()
fBulkIn = NULL;
}
// -----------------------------------------------------------------------------
bool
CamDevice::IsPlugged()
{
return (fDevice != NULL);
}
// -----------------------------------------------------------------------------
const char *
CamDevice::BrandName()
{
@ -116,7 +117,7 @@ CamDevice::BrandName()
return "<unknown>";
}
// -----------------------------------------------------------------------------
const char *
CamDevice::ModelName()
{
@ -125,21 +126,21 @@ CamDevice::ModelName()
return "<unknown>";
}
// -----------------------------------------------------------------------------
bool
CamDevice::SupportsBulk()
{
return false;
}
// -----------------------------------------------------------------------------
bool
CamDevice::SupportsIsochronous()
{
return false;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::StartTransfer()
{
@ -160,7 +161,7 @@ CamDevice::StartTransfer()
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::StopTransfer()
{
@ -182,7 +183,7 @@ CamDevice::StopTransfer()
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::SetVideoFrame(BRect frame)
{
@ -190,21 +191,21 @@ CamDevice::SetVideoFrame(BRect frame)
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::SetScale(float scale)
{
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::SetVideoParams(float brightness, float contrast, float hue, float red, float green, float blue)
{
return B_OK;
}
// -----------------------------------------------------------------------------
void
CamDevice::AddParameters(BParameterGroup *group, int32 &index)
{
@ -224,35 +225,35 @@ CamDevice::SetParameterValue(int32 id, bigtime_t when, const void *value, size_t
}
// -----------------------------------------------------------------------------
size_t
CamDevice::MinRawFrameSize()
{
return 0;
}
// -----------------------------------------------------------------------------
size_t
CamDevice::MaxRawFrameSize()
{
return 0;
}
// -----------------------------------------------------------------------------
bool
CamDevice::ValidateStartOfFrameTag(const uint8 *tag, size_t taglen)
{
return true;
}
// -----------------------------------------------------------------------------
bool
CamDevice::ValidateEndOfFrameTag(const uint8 *tag, size_t taglen, size_t datalen)
{
return true;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::WaitFrame(bigtime_t timeout)
{
@ -261,64 +262,60 @@ CamDevice::WaitFrame(bigtime_t timeout)
return EINVAL;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp)
{
return EINVAL;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
{
return EINVAL;
}
// -----------------------------------------------------------------------------
bool
CamDevice::Lock()
{
return fLocker.Lock();
}
// -----------------------------------------------------------------------------
void
CamDevice::Unlock()
{
fLocker.Unlock();
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteReg8(uint16 address, uint8 data)
{
return WriteReg(address, &data, sizeof(uint8));
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteReg16(uint16 address, uint16 data)
{
// XXX: ENDIAN???
if (fChipIsBigEndian)
data = B_HOST_TO_BENDIAN_INT16(data);
else
data = B_HOST_TO_LENDIAN_INT16(data);
return WriteReg(address, (uint8 *)&data, sizeof(uint16));
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
/*
status_t
CamDevice::GetStatusIIC()
@ -326,35 +323,98 @@ CamDevice::GetStatusIIC()
return ENOSYS;
}
*/
// -----------------------------------------------------------------------------
/*status_t
CamDevice::WaitReadyIIC()
{
return ENOSYS;
}
*/
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteIIC8(uint8 address, uint8 data)
{
return WriteIIC(address, &data, 1);
}
// -----------------------------------------------------------------------------
ssize_t
CamDevice::WriteIIC16(uint8 address, uint16 data)
{
if (Sensor() && Sensor()->IsBigEndian())
data = B_HOST_TO_BENDIAN_INT16(data);
else
data = B_HOST_TO_LENDIAN_INT16(data);
return WriteIIC(address, (uint8 *)&data, 2);
}
ssize_t
CamDevice::ReadIIC(uint8 address, uint8 *data)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::ProbeSensor()
{
const usb_webcam_support_descriptor *devs;
const usb_webcam_support_descriptor *dev = NULL;
status_t err;
int32 i;
PRINT((CH ": probing sensors..." CT));
if (fCamDeviceAddon.SupportedDevices() == NULL)
return B_ERROR;
devs = fCamDeviceAddon.SupportedDevices();
for (i = 0; devs[i].vendor; i++)
{
if (GetDevice()->VendorID() != devs[i].desc.vendor)
continue;
if (GetDevice()->ProductID() != devs[i].desc.product)
continue;
dev = &devs[i];
break;
}
if (!dev)
return ENODEV;
if (!dev->sensors) // no usable sensor
return ENOENT;
BString sensors(dev->sensors);
for (i = 0; i > -1 && i < sensors.Length(); ) {
BString name;
sensors.CopyInto(name, i, sensors.FindFirst(',', i) - i);
PRINT((CH ": probing sensor '%s'..." CT, name.String()));
fSensor = CreateSensor(name.String());
if (fSensor) {
err = fSensor->Probe();
if (err >= B_OK)
return B_OK;
PRINT((CH ": sensor '%s' Probe: %s" CT, name.String(), strerror(err)));
delete fSensor;
fSensor = NULL;
}
i = sensors.FindFirst(',', i+1);
if (i > - 1)
i++;
}
return ENOENT;
}
CamSensor *
CamDevice::CreateSensor(const char *name)
{
@ -363,17 +423,18 @@ CamDevice::CreateSensor(const char *name)
if (!strcmp(kSensorTable[i].name, name))
return kSensorTable[i].instfunc(this);
}
PRINT((CH ": sensor '%s' not found" CT, name));
return NULL;
}
// -----------------------------------------------------------------------------
void
CamDevice::SetDataInput(BDataIO *input)
{
fDataInput = input;
}
// -----------------------------------------------------------------------------
status_t
CamDevice::DataPumpThread()
{
@ -459,7 +520,7 @@ CamDevice::DataPumpThread()
return B_OK;
}
// -----------------------------------------------------------------------------
int32
CamDevice::_DataPumpThread(void *_this)
{
@ -467,13 +528,13 @@ CamDevice::_DataPumpThread(void *_this)
return dev->DataPumpThread();
}
// -----------------------------------------------------------------------------
void
CamDevice::DumpRegs()
{
}
// -----------------------------------------------------------------------------
status_t
CamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
uint16 index, uint16 length, void* data)
@ -489,26 +550,26 @@ CamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
return ret;
}
// -----------------------------------------------------------------------------
CamDeviceAddon::CamDeviceAddon(WebCamMediaAddOn* webcam)
: fWebCamAddOn(webcam),
fSupportedDevices(NULL)
{
}
// -----------------------------------------------------------------------------
CamDeviceAddon::~CamDeviceAddon()
{
}
// -----------------------------------------------------------------------------
const char *
CamDeviceAddon::BrandName()
{
return "<unknown>";
}
// -----------------------------------------------------------------------------
status_t
CamDeviceAddon::Sniff(BUSBDevice *device)
{
@ -537,16 +598,16 @@ CamDeviceAddon::Sniff(BUSBDevice *device)
return ENODEV;
}
// -----------------------------------------------------------------------------
CamDevice *
CamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from)
{
return NULL;
}
// -----------------------------------------------------------------------------
void
CamDeviceAddon::SetSupportedDevices(const usb_named_support_descriptor *devs)
CamDeviceAddon::SetSupportedDevices(const usb_webcam_support_descriptor *devs)
{
fSupportedDevices = devs;
}

View File

@ -33,7 +33,8 @@ typedef struct {
usb_support_descriptor desc;
const char *vendor;
const char *product;
} usb_named_support_descriptor;
const char *sensors; // possible sensors this cam uses (comma separated)
} usb_webcam_support_descriptor;
// This class represents each webcam
class CamDevice {
@ -96,6 +97,7 @@ class CamDevice {
//virtual status_t WaitReadyIIC();
virtual ssize_t WriteIIC(uint8 address, uint8 *data, size_t count);
virtual ssize_t WriteIIC8(uint8 address, uint8 data);
virtual ssize_t WriteIIC16(uint8 address, uint16 data);
virtual ssize_t ReadIIC(uint8 address, uint8 *data);
@ -108,6 +110,7 @@ class CamDevice {
protected:
virtual status_t SendCommand(uint8 dir, uint8 request, uint16 value,
uint16 index, uint16 length, void* data);
virtual status_t ProbeSensor();
CamSensor *CreateSensor(const char *name);
status_t fInitStatus;
flavor_info fFlavorInfo;
@ -127,6 +130,7 @@ class CamDevice {
CamDeviceAddon& fCamDeviceAddon;
BUSBDevice* fDevice;
int fSupportedDeviceIndex;
bool fChipIsBigEndian;
bool fTransferEnabled;
thread_id fPumpThread;
BLocker fLocker;
@ -147,14 +151,14 @@ class CamDeviceAddon {
virtual status_t Sniff(BUSBDevice *device);
virtual CamDevice* Instantiate(CamRoster &roster, BUSBDevice *from);
void SetSupportedDevices(const usb_named_support_descriptor *devs);
const usb_named_support_descriptor* SupportedDevices() const
void SetSupportedDevices(const usb_webcam_support_descriptor *devs);
const usb_webcam_support_descriptor* SupportedDevices() const
{ return fSupportedDevices; };
WebCamMediaAddOn* WebCamAddOn() const { return fWebCamAddOn; };
private:
WebCamMediaAddOn* fWebCamAddOn;
const usb_named_support_descriptor* fSupportedDevices; // last is {{0,0,0,0,0}, NULL, NULL}
const usb_webcam_support_descriptor* fSupportedDevices; // last is {{0,0,0,0,0}, NULL, NULL, NULL }
};
// internal modules

View File

@ -2,6 +2,7 @@
#include "CamDevice.h"
#include "CamDebug.h"
CamFilterInterface::CamFilterInterface(CamDevice *device)
: BPositionIO(),
fDevice(device),
@ -11,10 +12,12 @@ fNextOfKin(NULL)
}
CamFilterInterface::~CamFilterInterface()
{
}
status_t
CamFilterInterface::ChainFilter(CamFilterInterface *to)
{
@ -24,6 +27,7 @@ CamFilterInterface::ChainFilter(CamFilterInterface *to)
return B_OK;
}
status_t
CamFilterInterface::DetachFilter(CamFilterInterface *from)
{
@ -33,12 +37,14 @@ CamFilterInterface::DetachFilter(CamFilterInterface *from)
return B_OK;
}
CamFilterInterface*
CamFilterInterface::ChainFilter()
{
return fNextOfKin;
}
ssize_t
CamFilterInterface::Read(void *buffer, size_t size)
{
@ -47,6 +53,7 @@ CamFilterInterface::Read(void *buffer, size_t size)
return EINVAL;
}
ssize_t
CamFilterInterface::ReadAt(off_t pos, void *buffer, size_t size)
{
@ -56,6 +63,7 @@ CamFilterInterface::ReadAt(off_t pos, void *buffer, size_t size)
return EINVAL;
}
ssize_t
CamFilterInterface::Write(const void *buffer, size_t size)
{
@ -64,6 +72,7 @@ CamFilterInterface::Write(const void *buffer, size_t size)
return EINVAL;
}
ssize_t
CamFilterInterface::WriteAt(off_t pos, const void *buffer, size_t size)
{
@ -73,6 +82,7 @@ CamFilterInterface::WriteAt(off_t pos, const void *buffer, size_t size)
return EINVAL;
}
off_t
CamFilterInterface::Seek(off_t position, uint32 seek_mode)
{
@ -81,12 +91,14 @@ CamFilterInterface::Seek(off_t position, uint32 seek_mode)
return EINVAL;
}
off_t
CamFilterInterface::Position() const
{
return 0LL;
}
status_t
CamFilterInterface::SetSize(off_t size)
{
@ -94,12 +106,14 @@ CamFilterInterface::SetSize(off_t size)
return EINVAL;
}
size_t
CamFilterInterface::FrameSize()
{
return 0;
}
status_t
CamFilterInterface::WaitFrame(bigtime_t timeout)
{
@ -108,6 +122,7 @@ CamFilterInterface::WaitFrame(bigtime_t timeout)
return EINVAL;
}
status_t
CamFilterInterface::DropFrame()
{
@ -116,6 +131,7 @@ CamFilterInterface::DropFrame()
return B_OK;
}
status_t
CamFilterInterface::SetVideoFrame(BRect frame)
{
@ -124,3 +140,4 @@ CamFilterInterface::SetVideoFrame(BRect frame)
fVideoFrame = frame;
return B_OK;
}

View File

@ -13,7 +13,7 @@ extern "C" status_t get_webcam_addon_##modname(WebCamMediaAddOn* webcam, CamDevi
#undef B_WEBCAM_MKINTFUNC
// ---------------------------------------------------------------------------
CamRoster::CamRoster(WebCamMediaAddOn* _addon)
: BUSBRoster(),
fLocker("WebcamRosterLock"),
@ -24,12 +24,12 @@ CamRoster::CamRoster(WebCamMediaAddOn* _addon)
LoadExternalAddons();
}
// ---------------------------------------------------------------------------
CamRoster::~CamRoster()
{
}
// ---------------------------------------------------------------------------
status_t
CamRoster::DeviceAdded(BUSBDevice* _device)
{
@ -56,7 +56,7 @@ CamRoster::DeviceAdded(BUSBDevice* _device)
return B_ERROR;
}
// ---------------------------------------------------------------------------
void
CamRoster::DeviceRemoved(BUSBDevice* _device)
{
@ -77,7 +77,7 @@ CamRoster::DeviceRemoved(BUSBDevice* _device)
}
}
// ---------------------------------------------------------------------------
uint32
CamRoster::CountCameras()
{
@ -89,7 +89,7 @@ CamRoster::CountCameras()
return count;
}
// ---------------------------------------------------------------------------
bool
CamRoster::Lock()
{
@ -97,7 +97,7 @@ CamRoster::Lock()
return fLocker.Lock();
}
// ---------------------------------------------------------------------------
void
CamRoster::Unlock()
{
@ -106,7 +106,7 @@ CamRoster::Unlock()
return;
}
// ---------------------------------------------------------------------------
CamDevice*
CamRoster::CameraAt(int32 index)
{
@ -114,7 +114,7 @@ CamRoster::CameraAt(int32 index)
return (CamDevice *)fCameras.ItemAt(index);
}
// ---------------------------------------------------------------------------
status_t
CamRoster::LoadInternalAddons()
{
@ -137,7 +137,7 @@ CamRoster::LoadInternalAddons()
return B_OK;
}
// ---------------------------------------------------------------------------
status_t
CamRoster::LoadExternalAddons()
{
@ -162,5 +162,5 @@ CamRoster::LoadExternalAddons()
return B_OK;
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------

View File

@ -1,9 +1,10 @@
#include "CamSensor.h"
#include "CamDebug.h"
// -----------------------------------------------------------------------------
CamSensor::CamSensor(CamDevice *_camera)
: fInitStatus(B_NO_INIT),
fIsBigEndian(false),
fTransferEnabled(false),
fVideoFrame(),
fLastParameterChanges(0),
@ -12,34 +13,42 @@ CamSensor::CamSensor(CamDevice *_camera)
}
// -----------------------------------------------------------------------------
CamSensor::~CamSensor()
{
}
// -----------------------------------------------------------------------------
status_t
CamSensor::Probe()
{
// default is to match by USB IDs
return B_OK;
}
status_t
CamSensor::InitCheck()
{
return fInitStatus;
}
// -----------------------------------------------------------------------------
status_t
CamSensor::Setup()
{
return fInitStatus;
}
// -----------------------------------------------------------------------------
const char *
CamSensor::Name()
{
return "<unknown>";
}
// -----------------------------------------------------------------------------
status_t
CamSensor::StartTransfer()
{
@ -47,7 +56,7 @@ CamSensor::StartTransfer()
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamSensor::StopTransfer()
{
@ -55,21 +64,21 @@ CamSensor::StopTransfer()
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
CamSensor::SetVideoFrame(BRect rect)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
status_t
CamSensor::SetVideoParams(float brightness, float contrast, float hue, float red, float green, float blue)
{
return ENOSYS;
}
// -----------------------------------------------------------------------------
void
CamSensor::AddParameters(BParameterGroup *group, int32 &index)
{
@ -88,7 +97,7 @@ CamSensor::SetParameterValue(int32 id, bigtime_t when, const void *value, size_t
return B_BAD_VALUE;
}
// -----------------------------------------------------------------------------
CamDevice *
CamSensor::Device()
{

View File

@ -11,6 +11,8 @@ class CamSensor
CamSensor(CamDevice *_camera);
virtual ~CamSensor();
virtual status_t Probe(); // returns B_OK if found.
virtual status_t InitCheck();
virtual status_t Setup();
@ -21,6 +23,7 @@ class CamSensor
virtual status_t StopTransfer();
virtual bool TransferEnabled() const { return fTransferEnabled; };
virtual bool IsBigEndian() const { return fIsBigEndian; };
virtual bool Use400kHz() const { return false; };
virtual bool UseRealIIC() const { return true; };
virtual uint8 IICReadAddress() const { return 0; };
@ -52,6 +55,7 @@ class CamSensor
#endif
protected:
status_t fInitStatus;
bool fIsBigEndian;
bool fTransferEnabled;
BRect fVideoFrame;
int32 fFirstParameterID;

View File

@ -14,15 +14,18 @@
#define MAX_TAG_LEN CAMDEFRAMER_MAX_TAG_LEN
#define MAXFRAMEBUF CAMDEFRAMER_MAX_QUEUED_FRAMES
CamStreamingDeframer::CamStreamingDeframer(CamDevice *device)
: CamDeframer(device)
{
}
CamStreamingDeframer::~CamStreamingDeframer()
{
}
ssize_t
CamStreamingDeframer::Write(const void *buffer, size_t size)
{

View File

@ -21,10 +21,6 @@ easily.
For now you should be able to build it under Zeta with the
makefile provided.
Making a Jamfile might get tricky as several source files are
created by the makefile itself to include addons and censors
in the build.
There are 3 kinds of device-specific folders :
addons/ contains actual usb chip support code for each device.
sensors/ contains code to handle CMOS sensors, as each model
@ -56,7 +52,7 @@ ParameterWeb or forward ParameterWeb changes right to the
device-specific addon and provide default handlers for usual
controls ?
References:
References and other drivers of interest:
* Sonix linux drivers (several of them):
http://sourceforge.net/projects/sonix/ -- http://sonix.sourceforge.net/
@ -65,6 +61,13 @@ http://tgnard.free.fr/linux/
(datasheet)
http://www.mnementh.co.uk/sonix/sn9c102.pdf
* some of the (many!) linux quickcam drivers:
http://www.lrr.in.tum.de/~acher/quickcam/quickcam.html
http://www.seismo.ethz.ch/linux/webcam.html
* Creative's own list of linux drivers:
http://connect.creativelabs.com/opensource/Lists/Webcam%20Support/AllItems.aspx
* Other webcam drivers:
http://zc0302.sourceforge.net/zc0302.php?page=cams
http://www.medias.ne.jp/~takam/bsd/NetBSD.html
@ -79,6 +82,13 @@ http://www.iglu.org.il/lxr/source/include/linux/usb.h
* Linux V4L webcam list:
http://linuxtv.org/v4lwiki/index.php/Webcams
* Linux source code crossref:
http://lxr.linux.no/linux
* Fuji FinePix BeOS driver, should probably be merged at some point:
http://bebits.com/app/4185
* Macam generic OSX webcam driver (interesting but sadly GPL and in ObjC):
http://webcam-osx.sourceforge.net/index.html
http://webcam-osx.sourceforge.net/cameras/index.php list of supported cams in OSX
http://sourceforge.net/projects/webcam-osx

View File

@ -2,45 +2,43 @@
#include "CamDebug.h"
#include "CamSensor.h"
// see http://www.lrr.in.tum.de/~acher/quickcam/quickcam.html
const usb_named_support_descriptor kSupportedDevices[] = {
{{ 0, 0, 0, 0x046d, 0x0840 }, "Logitech", "QuickCam Express"},
{{ 0, 0, 0, 0x046d, 0x0850 }, "Logitech", "QuickCam Express LEGO"},
{{ 0, 0, 0, 0x046d, 0xd001 }, "Logitech", "QuickCam Express"}, // Alan's
{{ 0, 0, 0, 0, 0}, NULL, NULL }
const usb_webcam_support_descriptor kSupportedDevices[] = {
{{ 0, 0, 0, 0x046d, 0x0840 }, "Logitech", "QuickCam Express", NULL },
{{ 0, 0, 0, 0x046d, 0x0850 }, "Logitech", "QuickCam Express LEGO", NULL },
{{ 0, 0, 0, 0x046d, 0xd001 }, "Logitech", "QuickCam Express", NULL }, // Alan's
{{ 0, 0, 0, 0, 0}, NULL, NULL, NULL }
};
// -----------------------------------------------------------------------------
QuickCamDevice::QuickCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
:CamDevice(_addon, _device)
{
fInitStatus = B_OK;
}
// -----------------------------------------------------------------------------
QuickCamDevice::~QuickCamDevice()
{
}
// -----------------------------------------------------------------------------
bool
QuickCamDevice::SupportsBulk()
{
return true;
}
// -----------------------------------------------------------------------------
bool
QuickCamDevice::SupportsIsochronous()
{
return true;
}
// -----------------------------------------------------------------------------
status_t
QuickCamDevice::StartTransfer()
{
@ -66,7 +64,7 @@ DumpRegs();
return CamDevice::StartTransfer();
}
// -----------------------------------------------------------------------------
status_t
QuickCamDevice::StopTransfer()
{
@ -89,7 +87,7 @@ DumpRegs();
return err;
}
// -----------------------------------------------------------------------------
ssize_t
QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
@ -97,7 +95,7 @@ QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
}
// -----------------------------------------------------------------------------
ssize_t
QuickCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
@ -105,7 +103,7 @@ QuickCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
}
// -----------------------------------------------------------------------------
status_t
QuickCamDevice::GetStatusIIC()
{
@ -118,7 +116,7 @@ QuickCamDevice::GetStatusIIC()
return (status&0x08)?EIO:0;
}
// -----------------------------------------------------------------------------
status_t
QuickCamDevice::WaitReadyIIC()
{
@ -127,7 +125,7 @@ QuickCamDevice::WaitReadyIIC()
return EBUSY;
}
// -----------------------------------------------------------------------------
ssize_t
QuickCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
{
@ -147,7 +145,7 @@ QuickCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, STV_I2C_WRITE, 0, 0x23, data);
}
// -----------------------------------------------------------------------------
ssize_t
QuickCamDevice::ReadIIC(uint8 address, uint8 *data)
{
@ -156,7 +154,7 @@ QuickCamDevice::ReadIIC(uint8 address, uint8 *data)
}
// -----------------------------------------------------------------------------
status_t
QuickCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
uint16 index, uint16 length, void* data)
@ -172,32 +170,33 @@ QuickCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
return ret;
}
// -----------------------------------------------------------------------------
QuickCamDeviceAddon::QuickCamDeviceAddon(WebCamMediaAddOn* webcam)
: CamDeviceAddon(webcam)
{
SetSupportedDevices(kSupportedDevices);
}
// -----------------------------------------------------------------------------
QuickCamDeviceAddon::~QuickCamDeviceAddon()
{
}
// -----------------------------------------------------------------------------
const char *
QuickCamDeviceAddon::BrandName()
{
return "QuickCam";
}
// -----------------------------------------------------------------------------
QuickCamDevice *
QuickCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from)
{
return new QuickCamDevice(*this, from);
}
extern "C" status_t
B_WEBCAM_MKINTFUNC(quickcam)
(WebCamMediaAddOn* webcam, CamDeviceAddon **addon)

View File

@ -8,51 +8,51 @@
#include <interface/Bitmap.h>
#include <media/Buffer.h>
const usb_named_support_descriptor kSupportedDevices[] = {
{{ 0, 0, 0, 0x0c45, 0x6005 }, "Sonix", "Sonix"}, // mine
{{ 0, 0, 0, 0x0c45, 0x6009 }, "Trust", "spacec@m 120" },
{{ 0, 0, 0, 0x0c45, 0x600d }, "Trust", "spacec@m 120" },
const usb_webcam_support_descriptor kSupportedDevices[] = {
{{ 0, 0, 0, 0x0c45, 0x6005 }, "Sonix", "Sonix", "foo,bar,tas5110c1b" }, // mine
{{ 0, 0, 0, 0x0c45, 0x6009 }, "Trust", "spacec@m 120", NULL },
{{ 0, 0, 0, 0x0c45, 0x600d }, "Trust", "spacec@m 120", NULL },
/* other devices that should be supported,
* cf. sn9c102-1.15 linux driver, sn9c102_sensor.h
* for IDs and sensors
*/
{{ 0, 0, 0, 0x0c45, 0x6001 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6024 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6025 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6028 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6029 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x602a }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x602b }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x602c }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6030 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6080 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6082 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6083 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x6088 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x608a }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x608b }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x608c }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x608e }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x608f }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60a0 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60a2 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60a3 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60a8 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60aa }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60ab }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60ac }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60ae }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60af }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60b0 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60b2 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60b3 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60b8 }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60ba }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60bb }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60bc }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0x0c45, 0x60be }, "Sonix", "Sonix generic" },
{{ 0, 0, 0, 0, 0}, NULL, NULL }
{{ 0, 0, 0, 0x0c45, 0x6001 }, "Sonix", "Sonix generic", "tas5110c1b" },
{{ 0, 0, 0, 0x0c45, 0x6024 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6025 }, "Sonix", "Sonix generic", "tas5110c1b,XXX" },
{{ 0, 0, 0, 0x0c45, 0x6028 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6029 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x602a }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x602b }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x602c }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6030 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6080 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6082 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6083 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x6088 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x608a }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x608b }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x608c }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x608e }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x608f }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60a0 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60a2 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60a3 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60a8 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60aa }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60ab }, "Sonix", "Sonix generic", "tas5110c1b" },
{{ 0, 0, 0, 0x0c45, 0x60ac }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60ae }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60af }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60b0 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60b2 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60b3 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60b8 }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60ba }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60bb }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60bc }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0x0c45, 0x60be }, "Sonix", "Sonix generic", NULL },
{{ 0, 0, 0, 0, 0}, NULL, NULL, NULL }
};
// 12 bytes actually
@ -69,7 +69,7 @@ static const uint8 *eof_marks[] = { eof_mark_1, eof_mark_2, eof_mark_3, eof_mark
void bayer2rgb24(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT);
void bayer2rgb32le(unsigned char *dst, unsigned char *src, long int WIDTH, long int HEIGHT);
// -----------------------------------------------------------------------------
SonixCamDevice::SonixCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
:CamDevice(_addon, _device)
{
@ -84,19 +84,7 @@ SonixCamDevice::SonixCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
if ((GetDevice()->ProductID() & ~0x3F) == 0x6080) {
fChipVersion = 3; // says V4L2
}
switch (GetDevice()->ProductID()) {
case 0x6001:
case 0x6005:
case 0x60ab:
fSensor = CreateSensor("tas5110c1b");
break;
case 0x6025:
fSensor = CreateSensor("tas5110c1b");
//XXX:probe!
break;
default:
break;
}
err = ProbeSensor();
// fDeframer = new CamBufferingDeframer(this);
fDeframer = new CamStreamingDeframer(this);
@ -142,7 +130,7 @@ SonixCamDevice::SonixCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
//SetScale(1);
}
// -----------------------------------------------------------------------------
SonixCamDevice::~SonixCamDevice()
{
if (Sensor())
@ -150,21 +138,21 @@ SonixCamDevice::~SonixCamDevice()
fSensor = NULL;
}
// -----------------------------------------------------------------------------
bool
SonixCamDevice::SupportsBulk()
{
return true;
}
// -----------------------------------------------------------------------------
bool
SonixCamDevice::SupportsIsochronous()
{
return true;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::StartTransfer()
{
@ -188,7 +176,7 @@ DumpRegs();
return CamDevice::StartTransfer();
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::StopTransfer()
{
@ -209,7 +197,7 @@ DumpRegs();
return err;
}
// -----------------------------------------------------------------------------
ssize_t
SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
{
@ -222,7 +210,7 @@ SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x08, address, 0, count, data);
}
// -----------------------------------------------------------------------------
ssize_t
SonixCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
{
@ -238,7 +226,7 @@ SonixCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x00, address, 0, count, data);
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::GetStatusIIC()
{
@ -251,7 +239,7 @@ SonixCamDevice::GetStatusIIC()
return (status&0x08)?EIO:0;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::WaitReadyIIC()
{
@ -271,7 +259,7 @@ SonixCamDevice::WaitReadyIIC()
return EBUSY;
}
// -----------------------------------------------------------------------------
ssize_t
SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
{
@ -307,7 +295,7 @@ SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
return B_OK;
}
// -----------------------------------------------------------------------------
ssize_t
SonixCamDevice::ReadIIC(uint8 address, uint8 *data)
{
@ -358,7 +346,7 @@ SonixCamDevice::ReadIIC(uint8 address, uint8 *data)
return 1;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::SetVideoFrame(BRect frame)
{
@ -379,7 +367,7 @@ SonixCamDevice::SetVideoFrame(BRect frame)
return CamDevice::SetVideoFrame(frame);
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::SetScale(float scale)
{
@ -405,7 +393,7 @@ SonixCamDevice::SetScale(float scale)
return err;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::SetVideoParams(float brightness, float contrast, float hue, float red, float green, float blue)
{
@ -490,7 +478,7 @@ SonixCamDevice::SetParameterValue(int32 id, bigtime_t when, const void *value, s
}
// -----------------------------------------------------------------------------
size_t
SonixCamDevice::MinRawFrameSize()
{
@ -502,7 +490,7 @@ SonixCamDevice::MinRawFrameSize()
return (size_t)(w*h);
}
// -----------------------------------------------------------------------------
size_t
SonixCamDevice::MaxRawFrameSize()
{
@ -510,7 +498,7 @@ SonixCamDevice::MaxRawFrameSize()
return MinRawFrameSize()+1024*0; // fixed size frame (uncompressed)
}
// -----------------------------------------------------------------------------
bool
SonixCamDevice::ValidateStartOfFrameTag(const uint8 *tag, size_t taglen)
{
@ -523,7 +511,7 @@ SonixCamDevice::ValidateStartOfFrameTag(const uint8 *tag, size_t taglen)
return true;
}
// -----------------------------------------------------------------------------
bool
SonixCamDevice::ValidateEndOfFrameTag(const uint8 *tag, size_t taglen, size_t datalen)
{
@ -537,7 +525,7 @@ SonixCamDevice::ValidateEndOfFrameTag(const uint8 *tag, size_t taglen, size_t da
return true;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */)
{
@ -567,7 +555,7 @@ SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */)
return B_OK;
}
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
{
@ -602,7 +590,7 @@ SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
return B_OK;
}
// -----------------------------------------------------------------------------
void
/* DEBUG: dump the SN regs */
SonixCamDevice::DumpRegs()
@ -625,7 +613,7 @@ SonixCamDevice::DumpRegs()
}
#if 0
// -----------------------------------------------------------------------------
status_t
SonixCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
uint16 index, uint16 length, void* data)
@ -642,26 +630,26 @@ SonixCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
}
#endif
// -----------------------------------------------------------------------------
SonixCamDeviceAddon::SonixCamDeviceAddon(WebCamMediaAddOn* webcam)
: CamDeviceAddon(webcam)
{
SetSupportedDevices(kSupportedDevices);
}
// -----------------------------------------------------------------------------
SonixCamDeviceAddon::~SonixCamDeviceAddon()
{
}
// -----------------------------------------------------------------------------
const char *
SonixCamDeviceAddon::BrandName()
{
return "Sonix";
}
// -----------------------------------------------------------------------------
SonixCamDevice *
SonixCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from)
{