media-add-ons/usb_webcam: Fix -wformat=
Change-Id: Ie726c7b4ef9328e5542d845a1e7276e0509c4682 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3344 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
17904e6253
commit
edb4846779
@@ -84,7 +84,7 @@ WebCamMediaAddOn::CountFlavors()
|
|||||||
status_t
|
status_t
|
||||||
WebCamMediaAddOn::GetFlavorAt(int32 n, const flavor_info **out_info)
|
WebCamMediaAddOn::GetFlavorAt(int32 n, const flavor_info **out_info)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%d, ) roster %p is %lx" CT, n, fRoster, fInitStatus));
|
PRINT((CH "(%d, ) roster %p is %" B_PRIx32 CT, n, fRoster, fInitStatus));
|
||||||
int32 count;
|
int32 count;
|
||||||
CamDevice* cam;
|
CamDevice* cam;
|
||||||
if (!fRoster)
|
if (!fRoster)
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
|
|||||||
b = (uint8 *)IB.Buffer();
|
b = (uint8 *)IB.Buffer();
|
||||||
l = IB.BufferLength();
|
l = IB.BufferLength();
|
||||||
|
|
||||||
PRINT((CH "(%p, %d), IB: %d" CT, buffer, size, IB.BufferLength()));
|
PRINT((CH "(%p, %" B_PRIuSIZE "), IB: %" B_PRIuSIZE CT, buffer, size,
|
||||||
|
IB.BufferLength()));
|
||||||
|
|
||||||
if (l < (int)(fMinFrameSize + fSkipSOFTags + fSkipEOFTags))
|
if (l < (int)(fMinFrameSize + fSkipSOFTags + fSkipEOFTags))
|
||||||
return size; // not enough data anyway
|
return size; // not enough data anyway
|
||||||
@@ -56,7 +57,8 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
|
|||||||
if (fFrames.CountItems() < MAXFRAMEBUF)
|
if (fFrames.CountItems() < MAXFRAMEBUF)
|
||||||
fCurrentFrame = AllocFrame();
|
fCurrentFrame = AllocFrame();
|
||||||
else {
|
else {
|
||||||
PRINT((CH "DROPPED %d bytes! (too many queued frames)" CT, size));
|
PRINT((CH "DROPPED %" B_PRIuSIZE " bytes! "
|
||||||
|
"(too many queued frames)" CT, size));
|
||||||
return size; // drop XXX
|
return size; // drop XXX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,7 +95,9 @@ CamBufferingDeframer::Write(const void *buffer, size_t size)
|
|||||||
|
|
||||||
// queue it
|
// queue it
|
||||||
BAutolock f(fLocker);
|
BAutolock f(fLocker);
|
||||||
PRINT((CH ": Detaching a frame (%d bytes, %d to %d / %d)" CT, (size_t)fCurrentFrame->Position(), s, e, l));
|
PRINT((CH ": Detaching a frame (%" B_PRIuSIZE " bytes, "
|
||||||
|
"%d to %d / %d)" CT, (size_t)fCurrentFrame->Position(),
|
||||||
|
s, e, l));
|
||||||
fCurrentFrame->Seek(0LL, SEEK_SET);
|
fCurrentFrame->Seek(0LL, SEEK_SET);
|
||||||
fFrames.AddItem(fCurrentFrame);
|
fFrames.AddItem(fCurrentFrame);
|
||||||
release_sem(fFrameSem);
|
release_sem(fFrameSem);
|
||||||
@@ -113,7 +117,9 @@ size_t
|
|||||||
CamBufferingDeframer::DiscardFromInput(size_t size)
|
CamBufferingDeframer::DiscardFromInput(size_t size)
|
||||||
{
|
{
|
||||||
int next = (fInputBuffIndex+1)%2;
|
int next = (fInputBuffIndex+1)%2;
|
||||||
PRINT((CH ": %d bytes of %d from buffs[%d] (%d left)" CT, size, IB.BufferLength(), fInputBuffIndex, IB.BufferLength() - size));
|
PRINT((CH ": %" B_PRIuSIZE " bytes of %" B_PRIuSIZE " from buffs[%d] "
|
||||||
|
"(%" B_PRIuSIZE " left)" CT,
|
||||||
|
size, IB.BufferLength(), fInputBuffIndex, IB.BufferLength() - size));
|
||||||
fInputBuffs[next].Seek(0LL, SEEK_SET);
|
fInputBuffs[next].Seek(0LL, SEEK_SET);
|
||||||
fInputBuffs[next].SetSize(0);
|
fInputBuffs[next].SetSize(0);
|
||||||
uint8 *buff = (uint8 *)IB.Buffer();
|
uint8 *buff = (uint8 *)IB.Buffer();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ CamRoster::DeviceAdded(BUSBDevice* _device)
|
|||||||
fAddon->CameraAdded(cam);
|
fAddon->CameraAdded(cam);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
PRINT((CH " error 0x%08lx" CT, err));
|
PRINT((CH " error 0x%08" B_PRIx32 CT, err));
|
||||||
}
|
}
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ CamRoster::CountCameras()
|
|||||||
{
|
{
|
||||||
int32 count;
|
int32 count;
|
||||||
fLocker.Lock();
|
fLocker.Lock();
|
||||||
PRINT((CH "(): %ld cameras" CT, fCameras.CountItems()));
|
PRINT((CH "(): %" B_PRId32 " cameras" CT, fCameras.CountItems()));
|
||||||
count = fCameras.CountItems();
|
count = fCameras.CountItems();
|
||||||
fLocker.Unlock();
|
fLocker.Unlock();
|
||||||
return count;
|
return count;
|
||||||
@@ -157,7 +157,9 @@ CamRoster::LoadExternalAddons()
|
|||||||
// if (sclass != B_SYMBOL_TYPE_TEXT)
|
// if (sclass != B_SYMBOL_TYPE_TEXT)
|
||||||
// continue;
|
// continue;
|
||||||
err = (*get_webcam_addon_func)(fAddon, &addon);
|
err = (*get_webcam_addon_func)(fAddon, &addon);
|
||||||
PRINT((CH ": Loaded addon '%s' with error 0x%08lx" CT, (err>0)?NULL:addon->BrandName(), err));
|
PRINT((CH ": Loaded addon '%s' with error 0x%08" B_PRIx32 CT,
|
||||||
|
(err > 0) ? NULL : addon->BrandName(),
|
||||||
|
err));
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ CamSensor::ProbeByIICSignature(const uint8 *regList, const uint8 *matchList,
|
|||||||
uint8 value = 0;
|
uint8 value = 0;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
len = Device()->ReadIIC8(regList[i], &value);
|
len = Device()->ReadIIC8(regList[i], &value);
|
||||||
PRINT((CH ": ReadIIC8 = %d val = %d" CT, len, value));
|
PRINT((CH ": ReadIIC8 = %" B_PRIdSSIZE " val = %d" CT, len, value));
|
||||||
if (len < 1)
|
if (len < 1)
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
if (value != matchList[i])
|
if (value != matchList[i])
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
|||||||
if (fFrames.CountItems() < MAXFRAMEBUF)
|
if (fFrames.CountItems() < MAXFRAMEBUF)
|
||||||
fCurrentFrame = AllocFrame();
|
fCurrentFrame = AllocFrame();
|
||||||
else {
|
else {
|
||||||
PRINT((CH "DROPPED %d bytes! (too many queued frames)" CT, size));
|
PRINT((CH "DROPPED %" B_PRIuSIZE " bytes! "
|
||||||
|
"(too many queued frames)" CT, size));
|
||||||
return size; // drop XXX
|
return size; // drop XXX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,7 +131,8 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
|||||||
PRINT((CH ": EOF? %02x [%02x %02x %02x %02x] %02x" CT, buf[i-1], buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4]));
|
PRINT((CH ": EOF? %02x [%02x %02x %02x %02x] %02x" CT, buf[i-1], buf[i], buf[i+1], buf[i+2], buf[i+3], buf[i+4]));
|
||||||
while ((j = FindEOF(buf + i, bufsize - i, &which)) > -1) {
|
while ((j = FindEOF(buf + i, bufsize - i, &which)) > -1) {
|
||||||
i += j;
|
i += j;
|
||||||
PRINT((CH "| EOF[%d] at offset %d; pos %Ld" CT, which, i, fCurrentFrame->Position()));
|
PRINT((CH "| EOF[%d] at offset %d; pos %" B_PRIdOFF CT,
|
||||||
|
which, i, fCurrentFrame->Position()));
|
||||||
if (fCurrentFrame->Position()+i >= fMaxFrameSize) {
|
if (fCurrentFrame->Position()+i >= fMaxFrameSize) {
|
||||||
// too big: discard
|
// too big: discard
|
||||||
//i = -1;
|
//i = -1;
|
||||||
@@ -163,7 +165,9 @@ CamStreamingDeframer::Write(const void *buffer, size_t size)
|
|||||||
}
|
}
|
||||||
if (detach) {
|
if (detach) {
|
||||||
BAutolock f(fLocker);
|
BAutolock f(fLocker);
|
||||||
PRINT((CH ": Detaching a frame (%d bytes, end = %d, )" CT, (size_t)fCurrentFrame->Position(), end));
|
PRINT((CH ": Detaching a frame "
|
||||||
|
"(%" B_PRIuSIZE " bytes, end = %d, )" CT,
|
||||||
|
(size_t)fCurrentFrame->Position(), end));
|
||||||
fCurrentFrame->Seek(0LL, SEEK_SET);
|
fCurrentFrame->Seek(0LL, SEEK_SET);
|
||||||
if (discard) {
|
if (discard) {
|
||||||
delete fCurrentFrame;
|
delete fCurrentFrame;
|
||||||
|
|||||||
@@ -913,13 +913,14 @@ VideoProducer::FrameGenerator()
|
|||||||
((fFrame - fFrameBase) *
|
((fFrame - fFrameBase) *
|
||||||
(1000000 / fConnectedFormat.field_rate)) -
|
(1000000 / fConnectedFormat.field_rate)) -
|
||||||
fProcessingLatency;
|
fProcessingLatency;
|
||||||
PRINT(("PS: %Ld\n", fProcessingLatency));
|
PRINT(("PS: %" B_PRIdBIGTIME "\n", fProcessingLatency));
|
||||||
|
|
||||||
/* Drop frame if it's at least a frame late */
|
/* Drop frame if it's at least a frame late */
|
||||||
if (wait_until < system_time())
|
if (wait_until < system_time())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PRINTF(1, ("FrameGenerator: wait until %Ld, %ctimed out, %crunning, %cenabled.\n",
|
PRINTF(1, ("FrameGenerator: wait until %" B_PRIdBIGTIME ", "
|
||||||
|
"%ctimed out, %crunning, %cenabled.\n",
|
||||||
wait_until,
|
wait_until,
|
||||||
(err == B_OK)?'!':' ',
|
(err == B_OK)?'!':' ',
|
||||||
(fRunning)?' ':'!',
|
(fRunning)?' ':'!',
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ DumpRegs();
|
|||||||
ssize_t
|
ssize_t
|
||||||
NW80xCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
NW80xCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
|
||||||
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
|
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +146,8 @@ NW80xCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
|||||||
ssize_t
|
ssize_t
|
||||||
NW80xCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
|
NW80xCamDevice::ReadReg(uint16 address, uint8 *data, size_t count, bool cached)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
|
||||||
|
cached));
|
||||||
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
|
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
|
||||||
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
|
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ DumpRegs();
|
|||||||
ssize_t
|
ssize_t
|
||||||
QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
|
||||||
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
|
return SendCommand(USB_REQTYPE_DEVICE_OUT, 0x04, address, 0, count, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,8 @@ QuickCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
|
||||||
|
cached));
|
||||||
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
|
memset(data, 0xaa, count); // linux drivers do that without explaining why !?
|
||||||
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
|
return SendCommand(USB_REQTYPE_DEVICE_IN, 0x04, address, 0, count, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,10 +289,11 @@ SonixCamDevice::PowerOnSensor(bool on)
|
|||||||
ssize_t
|
ssize_t
|
||||||
SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
|
||||||
status_t err;
|
status_t err;
|
||||||
if (address + count > SN9C102_REG_COUNT) {
|
if (address + count > SN9C102_REG_COUNT) {
|
||||||
PRINT((CH ": Invalid register range [%u;%u]" CT, address, address+count));
|
PRINT((CH ": Invalid register range [%u;%" B_PRIuSIZE "]" CT, address,
|
||||||
|
address + count));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
memcpy(&fCachedRegs[address], data, count);
|
memcpy(&fCachedRegs[address], data, count);
|
||||||
@@ -306,10 +307,12 @@ SonixCamDevice::WriteReg(uint16 address, uint8 *data, size_t count)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
PRINT((CH "(%u, @%p, %u, %d)" CT, address, data, count, cached));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ", %d)" CT, address, data, count,
|
||||||
|
cached));
|
||||||
status_t err;
|
status_t err;
|
||||||
if (address + count > SN9C102_REG_COUNT) {
|
if (address + count > SN9C102_REG_COUNT) {
|
||||||
PRINT((CH ": Invalid register range [%u;%u]" CT, address, address+count));
|
PRINT((CH ": Invalid register range [%u;%" B_PRIuSIZE "]" CT, address,
|
||||||
|
address + count));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (cached) {
|
if (cached) {
|
||||||
@@ -361,7 +364,7 @@ SonixCamDevice::WriteIIC(uint8 address, uint8 *data, size_t count)
|
|||||||
{
|
{
|
||||||
status_t err;
|
status_t err;
|
||||||
uint8 buffer[8];
|
uint8 buffer[8];
|
||||||
PRINT((CH "(%u, @%p, %u)" CT, address, data, count));
|
PRINT((CH "(%u, @%p, %" B_PRIuSIZE ")" CT, address, data, count));
|
||||||
|
|
||||||
if (!Sensor())
|
if (!Sensor())
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
@@ -655,7 +658,7 @@ SonixCamDevice::ValidateStartOfFrameTag(const uint8 *tag, size_t taglen)
|
|||||||
// SOF come with an 00, 40, 80, C0 sequence,
|
// SOF come with an 00, 40, 80, C0 sequence,
|
||||||
// supposedly corresponding with an equal byte in the end tag
|
// supposedly corresponding with an equal byte in the end tag
|
||||||
fFrameTagState = tag[7] & 0xC0;
|
fFrameTagState = tag[7] & 0xC0;
|
||||||
PRINT((CH "(, %d) state %x" CT, taglen, fFrameTagState));
|
PRINT((CH "(, %" B_PRIuSIZE ") state %x" CT, taglen, fFrameTagState));
|
||||||
|
|
||||||
// which seems to be the same as of the EOF tag
|
// which seems to be the same as of the EOF tag
|
||||||
return true;
|
return true;
|
||||||
@@ -696,7 +699,7 @@ SonixCamDevice::GetFrameBitmap(BBitmap **bm, bigtime_t *stamp /* = NULL */)
|
|||||||
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
|
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
|
||||||
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
|
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
|
||||||
b = new BBitmap(VideoFrame().OffsetToSelf(0,0), 0, B_RGB32, w*4);
|
b = new BBitmap(VideoFrame().OffsetToSelf(0,0), 0, B_RGB32, w*4);
|
||||||
PRINT((CH ": Frame: %dx%d" CT, w, h));
|
PRINT((CH ": Frame: %ldx%ld" CT, w, h));
|
||||||
|
|
||||||
bayer2rgb24((unsigned char *)b->Bits(), (unsigned char *)f->Buffer(), w, h);
|
bayer2rgb24((unsigned char *)b->Bits(), (unsigned char *)f->Buffer(), w, h);
|
||||||
|
|
||||||
@@ -726,17 +729,20 @@ SonixCamDevice::FillFrameBuffer(BBuffer *buffer, bigtime_t *stamp)
|
|||||||
|
|
||||||
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
|
long int w = (long)(VideoFrame().right - VideoFrame().left + 1);
|
||||||
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
|
long int h = (long)(VideoFrame().bottom - VideoFrame().top + 1);
|
||||||
PRINT((CH ": VideoFrame = %fx%f,%fx%f Frame: %dx%d" CT, VideoFrame().left, VideoFrame().top, VideoFrame().right, VideoFrame().bottom, w, h));
|
PRINT((CH ": VideoFrame = %fx%f,%fx%f Frame: %ldx%ld" CT,
|
||||||
|
VideoFrame().left, VideoFrame().top, VideoFrame().right,
|
||||||
|
VideoFrame().bottom, w, h));
|
||||||
|
|
||||||
if (buffer->SizeAvailable() >= (size_t)w*h*4)
|
if (buffer->SizeAvailable() >= (size_t)w*h*4)
|
||||||
bayer2rgb32le((unsigned char *)buffer->Data(), (unsigned char *)f->Buffer(), w, h);
|
bayer2rgb32le((unsigned char *)buffer->Data(), (unsigned char *)f->Buffer(), w, h);
|
||||||
|
|
||||||
delete f;
|
delete f;
|
||||||
|
|
||||||
PRINT((CH ": available %d, required %d" CT, buffer->SizeAvailable(), w*h*4));
|
PRINT((CH ": available %" B_PRIuSIZE ", required %ld" CT,
|
||||||
|
buffer->SizeAvailable(), w*h*4));
|
||||||
if (buffer->SizeAvailable() < (size_t)w*h*4)
|
if (buffer->SizeAvailable() < (size_t)w*h*4)
|
||||||
return E2BIG;
|
return E2BIG;
|
||||||
PRINT((CH ": got 1 frame (len %d)" CT, buffer->SizeUsed()));
|
PRINT((CH ": got 1 frame (len %" B_PRIuSIZE ")" CT, buffer->SizeUsed()));
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user