?? spcav4l.c
字號:
/* no more size available */ needsize = 0; } else { /* check upper masq */ while (!((needsize = needsize << 1) & vd->sizeothers) && needsize); } } // maybe == 1 } if(needsize){ /* set the size now check for a palette */ if(sizeconvert( &vd->hdrwidth,&vd->hdrheight,needsize) > 0){ if(debug) printf( "size not set fatal errors !!\n"); return -1; } if((needpalette = checkpalette(vd) < 0)){ return -1; } } else { if(debug) printf ("Damned no match found Fatal errors !!\n"); return -1; }return needsize; }#endifstatic intisSpcaChip (const char *BridgeName){ int i = -1; int find = -1; int size = 0; /* Spca506 return more with channel video, cut it */ /* return Bridge otherwhise -1 */ for (i = 0; i < MAX_BRIDGE -1; i++) { size = strlen (Blist[i].name) ; if(debug) printf ("is_spca %s \n",Blist[i].name); if (strncmp (BridgeName, Blist[i].name, size) == 0) { find = i; break; } } return find;}static intGetStreamId (const char *BridgeName){ int i = -1; int match = -1;/* return Stream_id otherwhise -1 */ if ((match = isSpcaChip (BridgeName)) < 0) { if(debug) printf ("Not an Spca5xx Camera !!\n"); return match; } switch (match) { case BRIDGE_SPCA505: case BRIDGE_SPCA506: i = YYUV; break; case BRIDGE_SPCA501: i = YUYV; break; case BRIDGE_SPCA508: i = YUVY; break; case BRIDGE_SPCA536: case BRIDGE_SPCA504: case BRIDGE_SPCA500: case BRIDGE_SPCA504B: case BRIDGE_SPCA533: case BRIDGE_SPCA504C: case BRIDGE_ZR364XX: case BRIDGE_ZC3XX: case BRIDGE_CX11646: case BRIDGE_SN9CXXX: case BRIDGE_MR97311: i = JPEG; break; case BRIDGE_ETOMS: case BRIDGE_SONIX: case BRIDGE_SPCA561: case BRIDGE_TV8532: i = GBRG; break; default: i = UNOW; // -1; if(debug) printf ("Unable to find a StreamId !!\n"); break; } return i;}static intGetDepth (int format){ int depth; switch (format) { case VIDEO_PALETTE_JPEG: { depth = 8; } break; case VIDEO_PALETTE_RAW: { depth = 8; } break; case VIDEO_PALETTE_YUV420P: { depth = (8 * 3) >> 1; } break; case VIDEO_PALETTE_RGB565: depth = 16; break; case VIDEO_PALETTE_RGB24: depth = 24; break; case VIDEO_PALETTE_RGB32: { depth = 32; } break; default: depth = -1; break; } return depth;}__u8SpcaGetBrightness (struct vdIn * vdin){ if (GetVideoPict (vdin) < 0) { if(debug) printf (" Error getBrightness \n"); return 0; } return ((vdin->videopict.brightness) >> 8);}voidSpcaSetBrightness (struct vdIn *vdin, __u8 bright){ vdin->videopict.brightness = bright << 8; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setBrightness \n"); }}__u8SpcaGetContrast (struct vdIn *vdin){ if (GetVideoPict (vdin) < 0) { if(debug) printf (" Error getContrast \n"); return 0; } return ((vdin->videopict.contrast) >> 8);}voidSpcaSetContrast (struct vdIn *vdin, __u8 contrast){ vdin->videopict.contrast = contrast << 8; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setContrast \n"); }}__u8SpcaGetColors (struct vdIn *vdin){ if (GetVideoPict (vdin) < 0) { if(debug) printf (" Error getColors \n"); return 0; } return ((vdin->videopict.colour) >> 8);}voidSpcaSetColors (struct vdIn *vdin, __u8 colors){ vdin->videopict.colour = colors << 8; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setColors \n"); }}/* we assume that struct videopict is initialized */unsigned short set_bright( struct vdIn *vdin,unsigned short brightnum){ // unsigned short bright =0; // bright = vdin->videopict.brightness; if( brightnum < 0xffff ){ vdin->videopict.brightness = brightnum; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return brightnum; }unsigned short upbright( struct vdIn *vdin){ unsigned short bright =0; bright = vdin->videopict.brightness; if(( bright+0x200) < 0xffff){ bright += 0x200; vdin->videopict.brightness = bright; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return bright; }unsigned short downbright( struct vdIn *vdin){ unsigned short bright =0; bright = vdin->videopict.brightness; if(( bright-0x200) > 0){ bright -= 0x200; vdin->videopict.brightness = bright; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return bright; }unsigned short set_contrast( struct vdIn *vdin,unsigned short contrastnum){ //unsigned short contrast =0; // contrast = vdin->videopict.contrast; if(contrastnum < 0xffff){ //contrast += 0x200; vdin->videopict.contrast = contrastnum; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return contrastnum;}unsigned short upcontrast( struct vdIn *vdin){ unsigned short contrast =0; contrast = vdin->videopict.contrast; if((contrast+0x200) < 0xffff){ contrast += 0x200; vdin->videopict.contrast = contrast; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return contrast;}unsigned short downcontrast( struct vdIn *vdin){ unsigned short contrast =0; contrast = vdin->videopict.contrast; if( (contrast-0x200) > 0){ contrast -= 0x200; vdin->videopict.contrast = contrast; if (SetVideoPict (vdin) < 0) { if(debug) printf (" Error setVideopict \n"); return 0; } } return contrast; }voidset_quality(struct vdIn *vdin,unsigned char qual){ struct video_param *videoparam= &vdin->videoparam; int fd = vdin->fd; //unsigned char qual = videoparam->quality; //qual += 1; spcaSetQuality(fd,videoparam,qual);}voidqualityUp(struct vdIn *vdin){ struct video_param *videoparam= &vdin->videoparam; int fd = vdin->fd; unsigned char qual = videoparam->quality; qual += 1; spcaSetQuality(fd,videoparam,qual);}voidqualityDown(struct vdIn *vdin){ struct video_param *videoparam= &vdin->videoparam; int fd = vdin->fd; unsigned char qual = videoparam->quality; if(qual > 0) qual--; spcaSetQuality(fd,videoparam,qual);}voidtimeUp(struct vdIn *vdin){ struct video_param *videoparam= &vdin->videoparam; int fd = vdin->fd; unsigned short dtime = videoparam->time_interval; dtime+=10; spcaSetTimeInterval(fd,videoparam,dtime);}voidtimeDown(struct vdIn *vdin){ struct video_param *videoparam= &vdin->videoparam; int fd = vdin->fd; unsigned short dtime = videoparam->time_interval; if(dtime > 0) dtime -=10; spcaSetTimeInterval(fd,videoparam,dtime);}voidspcaSetAutoExpo(struct vdIn *vdin){ struct video_param *videoparam = &vdin->videoparam; int fd = vdin->fd; videoparam->chg_para = CHGABRIGHT; videoparam->autobright = !videoparam->autobright; if(ioctl(fd,SPCASVIDIOPARAM, videoparam) == -1){ printf ("autobright error !!\n"); } else spcaPrintParam (fd,videoparam); }static void spcaPrintParam (int fd, struct video_param *videoparam){ if(ioctl(fd,SPCAGVIDIOPARAM, videoparam) == -1){ printf ("wrong spca5xx device\n"); } else printf("quality %d autoexpo %d Timeframe %d \n", videoparam->quality,videoparam->autobright,videoparam->time_interval);}static void spcaSetTimeInterval(int fd, struct video_param *videoparam, unsigned short dtime){ if (dtime < 1000) { videoparam->chg_para = CHGTINTER; videoparam->time_interval = dtime; if(ioctl(fd,SPCASVIDIOPARAM, videoparam) == -1){ printf ("frame_times error !!\n"); } else spcaPrintParam (fd,videoparam); }}static void spcaSetQuality(int fd, struct video_param *videoparam, unsigned char qindex){ if (qindex < 6) { videoparam->chg_para = CHGQUALITY; videoparam->quality = qindex; if(ioctl(fd,SPCASVIDIOPARAM, videoparam) == -1){ printf ("quality error !!\n"); } else spcaPrintParam (fd,videoparam); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -