mirror of https://github.com/PCSX2/pcsx2.git
Eyetoy: Improve logging
This commit is contained in:
parent
b6ac5e3be0
commit
02546459ea
|
@ -95,7 +95,7 @@ namespace usb_eyetoy
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("unk format %c%c%c%c\n", pixelformat, pixelformat >> 8, pixelformat >> 16, pixelformat >> 24);
|
||||
Console.Warning("Camera: Unknown format %c%c%c%c", pixelformat, pixelformat >> 8, pixelformat >> 16, pixelformat >> 24);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace usb_eyetoy
|
|||
|
||||
case EIO:
|
||||
default:
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_DQBUF", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_DQBUF", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (-1 == xioctl(fd, VIDIOC_QBUF, &buf))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_QBUF", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_QBUF", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ namespace usb_eyetoy
|
|||
CLEAR(cap);
|
||||
if (ioctl(fd, VIDIOC_QUERYCAP, &cap) >= 0)
|
||||
{
|
||||
Console.Warning("Camera: %s / %s\n", dev_name, (char*)cap.card);
|
||||
Console.Warning("Camera: %s / %s", dev_name, (char*)cap.card);
|
||||
if (!selectedDevice.empty() && strcmp(selectedDevice.c_str(), (char*)cap.card) == 0)
|
||||
{
|
||||
goto cont;
|
||||
|
@ -194,7 +194,7 @@ namespace usb_eyetoy
|
|||
fd = open(dev_name, O_RDWR | O_NONBLOCK, 0);
|
||||
if (-1 == fd)
|
||||
{
|
||||
Console.Warning("Cannot open '%s': %d, %s\n", dev_name, errno, strerror(errno));
|
||||
Console.Warning("Camera: Cannot open '%s': %d, %s", dev_name, errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -206,25 +206,25 @@ namespace usb_eyetoy
|
|||
{
|
||||
if (EINVAL == errno)
|
||||
{
|
||||
Console.Warning("%s is no V4L2 device\n", dev_name);
|
||||
Console.Warning("Camera: %s is no V4L2 device", dev_name);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_QUERYCAP", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_QUERYCAP", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
|
||||
{
|
||||
Console.Warning("%s is no video capture device\n", dev_name);
|
||||
Console.Warning("Camera: %s is no video capture device", dev_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(cap.capabilities & V4L2_CAP_STREAMING))
|
||||
{
|
||||
Console.Warning("%s does not support streaming i/o\n", dev_name);
|
||||
Console.Warning("Camera: %s does not support streaming i/o", dev_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -250,6 +250,27 @@ namespace usb_eyetoy
|
|||
}
|
||||
}
|
||||
|
||||
struct v4l2_fmtdesc fmtd;
|
||||
CLEAR(fmtd);
|
||||
struct v4l2_frmsizeenum frmsize;
|
||||
CLEAR(frmsize);
|
||||
|
||||
fmtd.index = 0;
|
||||
fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
while (xioctl(fd, VIDIOC_ENUM_FMT, &fmtd) >= 0)
|
||||
{
|
||||
frmsize.pixel_format = fmtd.pixelformat;
|
||||
frmsize.index = 0;
|
||||
while (xioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0)
|
||||
{
|
||||
Console.Warning("Camera: supported format[%d] '%s' : %dx%d",
|
||||
fmtd.index, fmtd.description,
|
||||
frmsize.discrete.width, frmsize.discrete.height);
|
||||
frmsize.index++;
|
||||
}
|
||||
fmtd.index++;
|
||||
}
|
||||
|
||||
struct v4l2_format fmt;
|
||||
CLEAR(fmt);
|
||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
|
@ -259,11 +280,11 @@ namespace usb_eyetoy
|
|||
|
||||
if (-1 == xioctl(fd, VIDIOC_S_FMT, &fmt))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_S_FMT", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_S_FMT", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
pixelformat = fmt.fmt.pix.pixelformat;
|
||||
Console.Warning("VIDIOC_S_FMT res=%dx%d, fmt=%c%c%c%c\n", fmt.fmt.pix.width, fmt.fmt.pix.height,
|
||||
Console.Warning("Camera: selected format: res=%dx%d, fmt=%c%c%c%c", fmt.fmt.pix.width, fmt.fmt.pix.height,
|
||||
pixelformat, pixelformat >> 8, pixelformat >> 16, pixelformat >> 24);
|
||||
|
||||
struct v4l2_requestbuffers req;
|
||||
|
@ -276,19 +297,19 @@ namespace usb_eyetoy
|
|||
{
|
||||
if (EINVAL == errno)
|
||||
{
|
||||
Console.Warning("%s does not support memory mapping\n", dev_name);
|
||||
Console.Warning("Camera: %s does not support memory mapping", dev_name);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_REQBUFS", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_REQBUFS", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (req.count < 2)
|
||||
{
|
||||
Console.Warning("Insufficient buffer memory on %s\n", dev_name);
|
||||
Console.Warning("Camera: Insufficient buffer memory on %s", dev_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -296,7 +317,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (!buffers)
|
||||
{
|
||||
Console.Warning("Out of memory\n");
|
||||
Console.Warning("Camera: Out of memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -311,7 +332,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (-1 == xioctl(fd, VIDIOC_QUERYBUF, &buf))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_QUERYBUF", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_QUERYBUF", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -320,7 +341,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (MAP_FAILED == buffers[n_buffers].start)
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "mmap", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "mmap", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +356,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (-1 == xioctl(fd, VIDIOC_QBUF, &buf))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_QBUF", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_QBUF", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -344,7 +365,7 @@ namespace usb_eyetoy
|
|||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (-1 == xioctl(fd, VIDIOC_STREAMON, &type))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_STREAMON", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_STREAMON", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -369,13 +390,13 @@ namespace usb_eyetoy
|
|||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
Console.Warning("%s error %d, %s\n", "select", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "select", errno, strerror(errno));
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
Console.Warning("select timeout\n");
|
||||
Console.Warning("Camera: select timeout");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -384,7 +405,7 @@ namespace usb_eyetoy
|
|||
}
|
||||
}
|
||||
eyetoy_running = 0;
|
||||
Console.Warning("V4L2 thread quit\n");
|
||||
Console.Warning("Camera: V4L2 thread quit");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -394,7 +415,7 @@ namespace usb_eyetoy
|
|||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (-1 == xioctl(fd, VIDIOC_STREAMOFF, &type))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "VIDIOC_STREAMOFF", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "VIDIOC_STREAMOFF", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -402,7 +423,7 @@ namespace usb_eyetoy
|
|||
{
|
||||
if (-1 == munmap(buffers[i].start, buffers[i].length))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "munmap", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "munmap", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -410,7 +431,7 @@ namespace usb_eyetoy
|
|||
|
||||
if (-1 == close(fd))
|
||||
{
|
||||
Console.Warning("%s error %d, %s\n", "close", errno, strerror(errno));
|
||||
Console.Warning("Camera: %s error %d, %s", "close", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
fd = -1;
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace usb_eyetoy
|
|||
HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pCreateDevEnum));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Error Creating Device Enumerator");
|
||||
Console.Warning("Camera: Error Creating Device Enumerator");
|
||||
return devList;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace usb_eyetoy
|
|||
hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnum, 0);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
Console.Warning("You have no video capture hardware");
|
||||
Console.Warning("Camera: You have no video capture hardware");
|
||||
return devList;
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,7 @@ namespace usb_eyetoy
|
|||
hr = pMoniker->BindToStorage(0, 0, IID_PPV_ARGS(&pPropBag));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Camera: BindToStorage err : %x", hr);
|
||||
pMoniker->Release();
|
||||
continue;
|
||||
}
|
||||
|
@ -112,7 +113,7 @@ namespace usb_eyetoy
|
|||
HRESULT hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGraphBuilder));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("CoCreateInstance CLSID_CaptureGraphBuilder2 err : %x", hr);
|
||||
Console.Warning("Camera: CoCreateInstance CLSID_CaptureGraphBuilder2 err : %x", hr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -120,21 +121,21 @@ namespace usb_eyetoy
|
|||
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pGraph));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("CoCreateInstance CLSID_FilterGraph err : %x", hr);
|
||||
Console.Warning("Camera: CoCreateInstance CLSID_FilterGraph err : %x", hr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
hr = pGraphBuilder->SetFiltergraph(pGraph);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("SetFiltergraph err : %x", hr);
|
||||
Console.Warning("Camera: SetFiltergraph err : %x", hr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
hr = pGraph->QueryInterface(IID_IMediaControl, (void**)&pControl);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("QueryInterface IID_IMediaControl err : %x", hr);
|
||||
Console.Warning("Camera: QueryInterface IID_IMediaControl err : %x", hr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -143,7 +144,7 @@ namespace usb_eyetoy
|
|||
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pCreateDevEnum));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Error Creating Device Enumerator");
|
||||
Console.Warning("Camera: Error Creating Device Enumerator");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -151,7 +152,7 @@ namespace usb_eyetoy
|
|||
hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnum, 0);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
Console.Warning("You have no video capture hardware");
|
||||
Console.Warning("Camera: You have no video capture hardware");
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
@ -164,7 +165,7 @@ namespace usb_eyetoy
|
|||
hr = pMoniker->BindToStorage(0, 0, IID_PPV_ARGS(&pPropBag));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("BindToStorage err : %x", hr);
|
||||
Console.Warning("Camera: BindToStorage err : %x", hr);
|
||||
goto freeMoniker;
|
||||
}
|
||||
|
||||
|
@ -177,7 +178,7 @@ namespace usb_eyetoy
|
|||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("Read name err : %x", hr);
|
||||
Console.Warning("Camera: Read name err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
Console.Warning("Camera: '%ls'", var.bstrVal);
|
||||
|
@ -190,7 +191,7 @@ namespace usb_eyetoy
|
|||
hr = pGraph->AddSourceFilterForMoniker(pMoniker, NULL, L"sourcefilter", &sourcefilter);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("AddSourceFilterForMoniker err : %x", hr);
|
||||
Console.Warning("Camera: AddSourceFilterForMoniker err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -209,7 +210,7 @@ namespace usb_eyetoy
|
|||
VIDEO_STREAM_CONFIG_CAPS scc;
|
||||
AM_MEDIA_TYPE* pmtConfig;
|
||||
hr = pSourceConfig->GetStreamCaps(iFormat, &pmtConfig, (BYTE*)&scc);
|
||||
Console.Warning("GetStreamCaps min=%dx%d max=%dx%d, fmt=%x",
|
||||
Console.Warning("Camera: GetStreamCaps min=%dx%d max=%dx%d, fmt=%x",
|
||||
scc.MinOutputSize.cx, scc.MinOutputSize.cy,
|
||||
scc.MaxOutputSize.cx, scc.MaxOutputSize.cy,
|
||||
pmtConfig->subtype);
|
||||
|
@ -238,14 +239,14 @@ namespace usb_eyetoy
|
|||
hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&samplegrabberfilter));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("CoCreateInstance CLSID_SampleGrabber err : %x", hr);
|
||||
Console.Warning("Camera: CoCreateInstance CLSID_SampleGrabber err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
hr = pGraph->AddFilter(samplegrabberfilter, L"samplegrabberfilter");
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("AddFilter samplegrabberfilter err : %x", hr);
|
||||
Console.Warning("Camera: AddFilter samplegrabberfilter err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -253,7 +254,7 @@ namespace usb_eyetoy
|
|||
hr = samplegrabberfilter->QueryInterface(IID_PPV_ARGS(&samplegrabber));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("QueryInterface err : %x", hr);
|
||||
Console.Warning("Camera: QueryInterface err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -264,7 +265,7 @@ namespace usb_eyetoy
|
|||
hr = samplegrabber->SetMediaType(&mt);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("SetMediaType err : %x", hr);
|
||||
Console.Warning("Camera: SetMediaType err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -272,7 +273,7 @@ namespace usb_eyetoy
|
|||
hr = samplegrabber->SetCallback(callbackhandler, 0);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
Console.Warning("SetCallback err : %x", hr);
|
||||
Console.Warning("Camera: SetCallback err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -280,14 +281,14 @@ namespace usb_eyetoy
|
|||
hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&nullrenderer));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("CoCreateInstance CLSID_NullRenderer err : %x", hr);
|
||||
Console.Warning("Camera: CoCreateInstance CLSID_NullRenderer err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
hr = pGraph->AddFilter(nullrenderer, L"nullrenderer");
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("AddFilter nullrenderer err : %x", hr);
|
||||
Console.Warning("Camera: AddFilter nullrenderer err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -295,7 +296,7 @@ namespace usb_eyetoy
|
|||
hr = pGraphBuilder->RenderStream(&PIN_CATEGORY_PREVIEW, &MEDIATYPE_Video, sourcefilter, samplegrabberfilter, nullrenderer);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("RenderStream err : %x", hr);
|
||||
Console.Warning("Camera: RenderStream err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -304,7 +305,7 @@ namespace usb_eyetoy
|
|||
hr = pGraphBuilder->ControlStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, sourcefilter, &start, &stop, 1, 2);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
Console.Warning("ControlStream err : %x", hr);
|
||||
Console.Warning("Camera: ControlStream err : %x", hr);
|
||||
goto freeVar;
|
||||
}
|
||||
|
||||
|
@ -376,7 +377,7 @@ namespace usb_eyetoy
|
|||
}
|
||||
else
|
||||
{
|
||||
Console.Warning("dshow_callback: unk format: len=%d bpp=%d", len, bitsperpixel);
|
||||
Console.Warning("Camera: dshow_callback: unknown format: len=%d bpp=%d", len, bitsperpixel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue