[Gambas-devel] gb.v4l rework the gv4l2.c
Ron_1st
ronstk at ...124...
Sun Feb 22 17:51:14 CET 2009
Garret wrote:
>
> >switch (car)
> >{
>
> I little patronising - I've been coding in 'C' for about 25 years, I do know how a switch statement works (!)
I did not add the car example to explain how switch statement works.
You miss the point and now I know you don't know how it works.
Just add next line between the other case lines.
case GARRET_25Y_PROGRAMMER : gv4l2_debug("InowHowItWorks"); break;
What happens on the case line where a constant is given and is unknown?
case V4L2_PIX_FMT_SBGGR8: gv4l2_debug("SBGGR8"); break; <--- not in all videodev.h
The compiler thinks "What the f***k does he mean with GARRET_25Y_PROGRAMMER" ???
Followed by undeclared value GARRET_25Y_PROGRAMMER and trow a error and start play with his....
The part after the : (colon) will never be executed in runtime.
Even if you give compiler flags to continue during compile time. if posible, as MS does, then
in runtime the value of GARRET_25Y_PROGRAMMER" is still unknown and an error, halt or crash happens.
Or when you are lucky it walk all those bad cases and may be use the case default:
Your current says
default:
gv4l2_debug("Frame in unknown format");
break;
I prefer "Frame in unknown format. Found 0x1234" more then "Frame in unknown format" anyway.
Now I have something to search for.
The real error:
gv4l2.c:588: error: 'V4L2_PIX_FMT_Y16' undeclared (first use in this function)
make[4]: *** [gv4l2.lo] Error 1
and here the compile stops on my box.
>
> Had this been written from scratch not having to work / integrate with existing code, it would look a little different.
As I told before I apriciate your work done, realy no kidding.
I do understand having some basic working code is a easy then from scratch.
> All I can say is - if you don't like it, feel free to change it.
Yeah I know. Forgive me I did try to help your development from scratch by giving
a small bug report and a possible solution for you to investigate for usefull idea.
>
> The "best" solution would be to use #ifdef's on the V4L_PIX_FMT_**** 's that are not in your header file.
> As I don't know specifically which ones you don't have, nor do I have am 8.04 system to test any changes
> on, you would be better placed to make the changes.
> Once the offending formats are ifdef'd , you can safely remove videodev2.h from SVN and things should
> compile smoothly.
>
> i.e;
>
> #ifdef V4L2_PIX_FMT_SBGGR8
> case V4L2_PIX_FMT_SBGGR8: gv4l2_debug("SBGGR8"); break;
> #endif
Done see below.
> Would you care to have a crack at this ?
>
> Gareth.
Oh and little patronising?
A 33 year programming learning time in Assembly for 4040 8080 8085 Z80 8031 8048 6502 INS8060
with macro's, includes, MCS80 PL/M , CP/M, ZCPR and working on equipment to make it possible
for you to start learn C does not count :)
I know I still can learn from everyone, even a script kiddy with a age of 12, so you can.
So 25 year or 33 years do not say anything, I don't care about it.
Read next link special the end.
http://devexpress.com/Support/Center/p/Q180012.aspx
=================================================================
I did add #ifdef #endif around the missing pixel_formats.
#ifdef V4L2_PIX_FMT_SBGGR8
case V4L2_PIX_FMT_SBGGR8: gv4l2_debug("SBGGR8"); break;
#endif
I add to the default case message the format number.
default:
gv4l2_debug("Frame in unknown format. Format:0x" + format);
break;
It is save to remark/remove the added include in CWebcam.h now
The added file in gb.v4l/src/videodev2.h can stay but is not used.
Best regards,
Ron_1st
--
A: Delete the text you reply on.
Q: What to do to get my post on top?
---
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
---
A: Top-posting.
Q: What is the most annoying thing in e-mail?
More information about the Devel
mailing list