Dimi Paun wrote:
On Fri, 2005-05-20 at 12:26 +0200, Maarten Lankhorst wrote:
What do you suggest then ... fprintf(stderr?
Absolutely not. :) But there are other options available: TRACE/WARN/FIXME. There's also MESSAGE, but it should be used *very* little. Also remember that most people will not see MESSAGE()s anyway because they only go to console.
Ah well, it doesn't matter much, wrote it so II could keep video contact in the first place
- if (stat (device, &st) == -1) {
ERR("%s: %s\n", device, strerror(errno));
CoTaskMemFree(capBox);
return E_FAIL;
- }
Why is this a ERR()?
This is more like a WARN or MESSAGE.
You are partially right, see below.
- if (!S_ISCHR (st.st_mode)) {
ERR("%s: Not a device\n", device);
CoTaskMemFree(capBox);
return E_FAIL;
- }
Same here.
No, /dev/video* should never be an ordinary file, and see below.
- capBox->fd = open(device, O_RDWR | O_NONBLOCK);
- if (capBox->fd == -1) {
ERR("%s: Failed to open: %s\n", device, strerror(errno));
CoTaskMemFree(capBox);
return E_FAIL;
- }
Ditto.
Like I said before, it shouldn't fail at this point, if it fails it should be at *capgetdriverdescription*, because it executes the same stuff, only if that function succeeds it will try to open the device here, the only time I can imagine it fails here, is when using the builtin devenum, which only rescans when the registry key currentuser/microsoft/activemovie doesn't exist any more, the video class should be rescanned every time the constructor gets called, so if a webcam is plugged in and/or modprobed it will be found inmediately, and when it is disconnected/rmmod'd it will disappear inmediately, instead of trying to initialise it anyway. Since for msn messenger I recommended to install Internet Explorer using winetools, the windows version of devenum and quartz will be used, so that these ERR's should never occur, and if they occur, it will be at avicap32, not here...
To be honest, I expected more arguments about my reading thread, since that doesn't do much error checking, and doesn't call ifiltergraph::stop if an error occurs... :/