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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,15 +14,18 @@
#define MAX_TAG_LEN CAMDEFRAMER_MAX_TAG_LEN #define MAX_TAG_LEN CAMDEFRAMER_MAX_TAG_LEN
#define MAXFRAMEBUF CAMDEFRAMER_MAX_QUEUED_FRAMES #define MAXFRAMEBUF CAMDEFRAMER_MAX_QUEUED_FRAMES
CamStreamingDeframer::CamStreamingDeframer(CamDevice *device) CamStreamingDeframer::CamStreamingDeframer(CamDevice *device)
: CamDeframer(device) : CamDeframer(device)
{ {
} }
CamStreamingDeframer::~CamStreamingDeframer() CamStreamingDeframer::~CamStreamingDeframer()
{ {
} }
ssize_t ssize_t
CamStreamingDeframer::Write(const void *buffer, size_t size) 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 For now you should be able to build it under Zeta with the
makefile provided. 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 : There are 3 kinds of device-specific folders :
addons/ contains actual usb chip support code for each device. addons/ contains actual usb chip support code for each device.
sensors/ contains code to handle CMOS sensors, as each model 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 device-specific addon and provide default handlers for usual
controls ? controls ?
References: References and other drivers of interest:
* Sonix linux drivers (several of them): * Sonix linux drivers (several of them):
http://sourceforge.net/projects/sonix/ -- http://sonix.sourceforge.net/ http://sourceforge.net/projects/sonix/ -- http://sonix.sourceforge.net/
@ -65,6 +61,13 @@ http://tgnard.free.fr/linux/
(datasheet) (datasheet)
http://www.mnementh.co.uk/sonix/sn9c102.pdf 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: * Other webcam drivers:
http://zc0302.sourceforge.net/zc0302.php?page=cams http://zc0302.sourceforge.net/zc0302.php?page=cams
http://www.medias.ne.jp/~takam/bsd/NetBSD.html 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: * Linux V4L webcam list:
http://linuxtv.org/v4lwiki/index.php/Webcams 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: * Fuji FinePix BeOS driver, should probably be merged at some point:
http://bebits.com/app/4185 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 "CamDebug.h"
#include "CamSensor.h" #include "CamSensor.h"
// see http://www.lrr.in.tum.de/~acher/quickcam/quickcam.html
const usb_webcam_support_descriptor kSupportedDevices[] = {
const usb_named_support_descriptor kSupportedDevices[] = { {{ 0, 0, 0, 0x046d, 0x0840 }, "Logitech", "QuickCam Express", NULL },
{{ 0, 0, 0, 0x046d, 0x0840 }, "Logitech", "QuickCam Express"}, {{ 0, 0, 0, 0x046d, 0x0850 }, "Logitech", "QuickCam Express LEGO", NULL },
{{ 0, 0, 0, 0x046d, 0x0850 }, "Logitech", "QuickCam Express LEGO"}, {{ 0, 0, 0, 0x046d, 0xd001 }, "Logitech", "QuickCam Express", NULL }, // Alan's
{{ 0, 0, 0, 0x046d, 0xd001 }, "Logitech", "QuickCam Express"}, // Alan's {{ 0, 0, 0, 0, 0}, NULL, NULL, NULL }
{{ 0, 0, 0, 0, 0}, NULL, NULL }
}; };
// -----------------------------------------------------------------------------
QuickCamDevice::QuickCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) QuickCamDevice::QuickCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device)
:CamDevice(_addon, _device) :CamDevice(_addon, _device)
{ {
fInitStatus = B_OK; fInitStatus = B_OK;
} }
// -----------------------------------------------------------------------------
QuickCamDevice::~QuickCamDevice() QuickCamDevice::~QuickCamDevice()
{ {
} }
// -----------------------------------------------------------------------------
bool bool
QuickCamDevice::SupportsBulk() QuickCamDevice::SupportsBulk()
{ {
return true; return true;
} }
// -----------------------------------------------------------------------------
bool bool
QuickCamDevice::SupportsIsochronous() QuickCamDevice::SupportsIsochronous()
{ {
return true; return true;
} }
// -----------------------------------------------------------------------------
status_t status_t
QuickCamDevice::StartTransfer() QuickCamDevice::StartTransfer()
{ {
@ -66,7 +64,7 @@ DumpRegs();
return CamDevice::StartTransfer(); return CamDevice::StartTransfer();
} }
// -----------------------------------------------------------------------------
status_t status_t
QuickCamDevice::StopTransfer() QuickCamDevice::StopTransfer()
{ {
@ -89,7 +87,7 @@ DumpRegs();
return err; return err;
} }
// -----------------------------------------------------------------------------
ssize_t ssize_t
QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count) 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); return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
} }
// -----------------------------------------------------------------------------
ssize_t ssize_t
QuickCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached) 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); return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
} }
// -----------------------------------------------------------------------------
status_t status_t
QuickCamDevice::GetStatusIIC() QuickCamDevice::GetStatusIIC()
{ {
@ -118,7 +116,7 @@ QuickCamDevice::GetStatusIIC()
return (status&0x08)?EIO:0; return (status&0x08)?EIO:0;
} }
// -----------------------------------------------------------------------------
status_t status_t
QuickCamDevice::WaitReadyIIC() QuickCamDevice::WaitReadyIIC()
{ {
@ -127,7 +125,7 @@ QuickCamDevice::WaitReadyIIC()
return EBUSY; return EBUSY;
} }
// -----------------------------------------------------------------------------
ssize_t ssize_t
QuickCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count) 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); return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, STV_I2C_WRITE, 0, 0x23, data);
} }
// -----------------------------------------------------------------------------
ssize_t ssize_t
QuickCamDevice::ReadIIC(uint8 address, uint8 *data) QuickCamDevice::ReadIIC(uint8 address, uint8 *data)
{ {
@ -156,7 +154,7 @@ QuickCamDevice::ReadIIC(uint8 address, uint8 *data)
} }
// -----------------------------------------------------------------------------
status_t status_t
QuickCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value, QuickCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
uint16 index, uint16 length, void* data) uint16 index, uint16 length, void* data)
@ -172,32 +170,33 @@ QuickCamDevice::SendCommand(uint8 dir, uint8 request, uint16 value,
return ret; return ret;
} }
// -----------------------------------------------------------------------------
QuickCamDeviceAddon::QuickCamDeviceAddon(WebCamMediaAddOn* webcam) QuickCamDeviceAddon::QuickCamDeviceAddon(WebCamMediaAddOn* webcam)
: CamDeviceAddon(webcam) : CamDeviceAddon(webcam)
{ {
SetSupportedDevices(kSupportedDevices); SetSupportedDevices(kSupportedDevices);
} }
// -----------------------------------------------------------------------------
QuickCamDeviceAddon::~QuickCamDeviceAddon() QuickCamDeviceAddon::~QuickCamDeviceAddon()
{ {
} }
// -----------------------------------------------------------------------------
const char * const char *
QuickCamDeviceAddon::BrandName() QuickCamDeviceAddon::BrandName()
{ {
return "QuickCam"; return "QuickCam";
} }
// -----------------------------------------------------------------------------
QuickCamDevice * QuickCamDevice *
QuickCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from) QuickCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from)
{ {
return new QuickCamDevice(*this, from); return new QuickCamDevice(*this, from);
} }
extern "C" status_t extern "C" status_t
B_WEBCAM_MKINTFUNC(quickcam) B_WEBCAM_MKINTFUNC(quickcam)
(WebCamMediaAddOn* webcam, CamDeviceAddon **addon) (WebCamMediaAddOn* webcam, CamDeviceAddon **addon)

View File

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