diff -Nur linphone-1.7.1-orig/mediastreamer2/include/mediastreamer2/msvideo.h linphone-1.7.1/mediastreamer2/include/mediastreamer2/msvideo.h --- linphone-1.7.1-orig/mediastreamer2/include/mediastreamer2/msvideo.h 2007-01-20 06:28:42.000000000 +0800 +++ linphone-1.7.1/mediastreamer2/include/mediastreamer2/msvideo.h 2007-10-26 15:58:48.000000000 +0800 @@ -62,6 +62,7 @@ typedef enum{ MS_YUV420P, MS_YUYV, + MS_UYVY, MS_RGB24, MS_MJPEG }MSPixFmt; diff -Nur linphone-1.7.1-orig/mediastreamer2/src/msv4l.c linphone-1.7.1/mediastreamer2/src/msv4l.c --- linphone-1.7.1-orig/mediastreamer2/src/msv4l.c 2007-03-10 05:15:15.000000000 +0800 +++ linphone-1.7.1/mediastreamer2/src/msv4l.c 2007-10-26 16:19:01.000000000 +0800 @@ -45,6 +45,9 @@ /* Set enable workaround for bugs, bitfield */ #define VIDIOCQCSCOMPATIBLE _IOWR('v',QC_IOCTLBASE+10,int) +#ifndef VIDIOSFPS +#define VIDIOSFPS _IOW('v',BASE_VIDIOCPRIVATE+20, int) +#endif typedef struct V4lState{ int fd; @@ -440,24 +443,27 @@ } s->mmapdbuf=mmap(NULL,s->msize,PROT_READ,MAP_SHARED,s->fd,0); if (s->mmapdbuf==(void*)-1) { - ms_error("Could not mmap: %s",strerror(errno)); - s->mmapdbuf=NULL; - return -1; - }else { - /* initialize the mediastreamer buffers */ - ms_message("Using %i-frames mmap'd buffer at %p, len %i", - s->frame_max, s->mmapdbuf,s->msize); - for(i=0;iframe_max;i++){ - mblk_t *buf=esballoc((uint8_t*)s->mmapdbuf+vmbuf.offsets[i],vmbuf.offsets[1],0,NULL); - /* adjust to real size of picture*/ - if (s->pix_fmt==MS_RGB24) - buf->b_wptr+=s->vsize.width*s->vsize.height*3; - else - buf->b_wptr+=(s->vsize.width*s->vsize.height*3)/2; - s->frames[i]=buf; + /* for non-mmu arch */ + s->mmapdbuf=mmap(NULL,s->msize,PROT_READ,MAP_PRIVATE,s->fd,0); + if (s->mmapdbuf==(void*)-1) { + ms_error("Could not mmap: %s",strerror(errno)); + s->mmapdbuf=NULL; + return -1; } - s->frame_ind=0; } + /* initialize the mediastreamer buffers */ + ms_message("Using %i-frames mmap'd buffer at %p, len %i", + s->frame_max, s->mmapdbuf,s->msize); + for(i=0;iframe_max;i++){ + mblk_t *buf=esballoc((uint8_t*)s->mmapdbuf+vmbuf.offsets[i],vmbuf.offsets[1],0,NULL); + /* adjust to real size of picture*/ + if (s->pix_fmt==MS_RGB24) + buf->b_wptr+=s->vsize.width*s->vsize.height*3; + else + buf->b_wptr+=(s->vsize.width*s->vsize.height*3)/2; + s->frames[i]=buf; + } + s->frame_ind=0; return 0; } @@ -501,6 +507,7 @@ struct video_capability cap; int err; int i; + int fps = 0; int found=0; memset(&chan,0,sizeof(chan)); @@ -548,20 +555,25 @@ } ms_message("Default picture properties: brightness=%i,hue=%i,colour=%i,contrast=%i,depth=%i, palette=%i.", pict.brightness,pict.hue,pict.colour, pict.contrast,pict.depth, pict.palette); - /* trying YUV420P format:*/ + /* trying color format */ if (try_format(s->fd,&pict,VIDEO_PALETTE_YUV420P,16)){ ms_message("Driver supports YUV420P, using that format."); s->pix_fmt=MS_YUV420P; - }else{ - ms_message("Driver does not support YUV420P, trying RGB24..."); - if (try_format(s->fd, &pict,VIDEO_PALETTE_RGB24,24)){ - ms_message("Driver supports RGB24, using that format."); - s->pix_fmt=MS_RGB24; - }else{ - ms_fatal("Unsupported video pixel format."); - } + }else if (try_format(s->fd, &pict,VIDEO_PALETTE_RGB24,24)){ + ms_message("Driver supports RGB24, using that format."); + s->pix_fmt=MS_RGB24; + }else if (try_format(s->fd, &pict,VIDEO_PALETTE_YUV422, 16)){ + ms_message("Driver supports YUV422, using that format."); + s->pix_fmt=MS_YUYV; + }else if (try_format(s->fd, &pict,VIDEO_PALETTE_UYVY, 16)){ + ms_message("Driver supports UYVY, using that format."); + s->pix_fmt=MS_UYVY; + }else{ + ms_fatal("Unsupported video pixel format."); + return -1; } + if (!try_size(s,s->vsize)) { if (!try_size(s,MS_VIDEO_SIZE_NS1)){ if (!try_size(s,MS_VIDEO_SIZE_VGA)){ @@ -575,6 +587,14 @@ } } } + + /* Try HW frame rate control */ + fps = s->fps; + if (ioctl(s->fd, VIDIOSFPS, &fps) < 0 ) + ms_message("v4l_configure: cannot set HW frame rate control"); + else + ms_message("v4l_configure: set HW fps to be : %d", fps); + return 0; } @@ -585,6 +605,10 @@ return VIDEO_PALETTE_YUV420P; case MS_RGB24: return VIDEO_PALETTE_RGB24; + case MS_YUYV: + return VIDEO_PALETTE_YUV422; + case MS_UYVY: + return VIDEO_PALETTE_UYVY; default: ms_fatal("unsupported pix fmt"); return -1; @@ -792,6 +816,7 @@ } } + static void *v4l_thread(void *ptr){ V4lState *s=(V4lState*)ptr; int err=-1; diff -Nur linphone-1.7.1-orig/mediastreamer2/src/pixconv.c linphone-1.7.1/mediastreamer2/src/pixconv.c --- linphone-1.7.1-orig/mediastreamer2/src/pixconv.c 2007-01-04 05:41:25.000000000 +0800 +++ linphone-1.7.1/mediastreamer2/src/pixconv.c 2007-10-26 15:50:13.000000000 +0800 @@ -36,6 +36,8 @@ return PIX_FMT_YUV420P; case MS_YUYV: return PIX_FMT_YUYV422; + case MS_UYVY: + return PIX_FMT_UYVY422; default: ms_fatal("format not supported."); return -1; @@ -51,6 +53,8 @@ return MS_YUV420P; case PIX_FMT_YUYV422: return MS_YUYV; + case PIX_FMT_UYVY422: + return MS_UYVY; default: ms_fatal("format not supported."); return 0;