亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? grab-ng.c

?? 基于s3c2410的攝像頭驅動
?? C
字號:
/* * next generation[tm] xawtv capture interfaces * * (c) 2001 Gerd Knorr <kraxel@bytesex.org> * */#define NG_PRIVATE#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <pthread.h>#include <dirent.h>#include <fnmatch.h>#include <errno.h>#include <ctype.h>#include <inttypes.h>#include <sys/time.h>#include <sys/types.h>#include <dlfcn.h>#ifndef RTLD_NOW# define RTLD_NOW RTLD_LAZY#endif#include "grab-ng.h"int  ng_debug          = 3;//int  ng_debug          = 0;		add by quentinint  ng_chromakey      = 0x00ff00ff;int  ng_jpeg_quality   = 75;int  ng_ratio_x        = 4;int  ng_ratio_y        = 3;char ng_v4l_conf[256]  = "v4l-conf";/* --------------------------------------------------------------------- */const unsigned int ng_vfmt_to_depth[] = {    0,               /* unused   */    8,               /* RGB8     */    8,               /* GRAY8    */    16,              /* RGB15 LE */    16,              /* RGB16 LE */    16,              /* RGB15 BE */    16,              /* RGB16 BE */    24,              /* BGR24    */    32,              /* BGR32    */    24,              /* RGB24    */    32,              /* RGB32    */    16,              /* LUT2     */    32,              /* LUT4     */    16,		     /* YUYV     */    16,		     /* YUV422P  */    12,		     /* YUV420P  */    0,		     /* MJPEG    */    0,		     /* JPEG     */    16,		     /* UYVY     */};const char* ng_vfmt_to_desc[] = {    "none",    "8 bit PseudoColor (dithering)",    "8 bit StaticGray",    "15 bit TrueColor (LE)",    "16 bit TrueColor (LE)",    "15 bit TrueColor (BE)",    "16 bit TrueColor (BE)",    "24 bit TrueColor (LE: bgr)",    "32 bit TrueColor (LE: bgr-)",    "24 bit TrueColor (BE: rgb)",    "32 bit TrueColor (BE: -rgb)",    "16 bit TrueColor (lut)",    "32 bit TrueColor (lut)",    "16 bit YUV 4:2:2 (packed, YUYV)",    "16 bit YUV 4:2:2 (planar)",    "12 bit YUV 4:2:0 (planar)",    "MJPEG (AVI)",    "JPEG (JFIF)",    "16 bit YUV 4:2:2 (packed, UYVY)",};/* --------------------------------------------------------------------- */const unsigned int   ng_afmt_to_channels[] = {    0,  1,  2,  1,  2,  1,  2, 0};const unsigned int   ng_afmt_to_bits[] = {    0,  8,  8, 16, 16, 16, 16, 0};const char* ng_afmt_to_desc[] = {    "none",    "8bit mono",    "8bit stereo",    "16bit mono (LE)",    "16bit stereo (LE)",    "16bit mono (BE)",    "16bit stereo (BE)",    "mp3 compressed audio",};/* --------------------------------------------------------------------- */const char* ng_attr_to_desc[] = {    "none",    "norm",    "input",    "volume",    "mute",    "audio mode",    "color",    "bright",    "hue",    "contrast",};/* --------------------------------------------------------------------- */void ng_init_video_buf(struct ng_video_buf *buf){    memset(buf,0,sizeof(*buf));    pthread_mutex_init(&buf->lock,NULL);        pthread_cond_init(&buf->cond,NULL);}void ng_release_video_buf(struct ng_video_buf *buf){    int release;    pthread_mutex_lock(&buf->lock);    buf->refcount--;    release = (buf->refcount == 0);    pthread_mutex_unlock(&buf->lock);    if (release && NULL != buf->release)	buf->release(buf);}void ng_wakeup_video_buf(struct ng_video_buf *buf){    pthread_cond_signal(&buf->cond);}void ng_waiton_video_buf(struct ng_video_buf *buf){    pthread_mutex_lock(&buf->lock);    while (buf->refcount)	pthread_cond_wait(&buf->cond, &buf->lock);    pthread_mutex_unlock(&buf->lock);}static void ng_free_video_buf(struct ng_video_buf *buf){    free(buf->data);    free(buf);}struct ng_video_buf*ng_malloc_video_buf(struct ng_video_fmt *fmt, int size){    struct ng_video_buf *buf;    buf = malloc(sizeof(*buf));    if (NULL == buf)	return NULL;    ng_init_video_buf(buf);    buf->fmt  = *fmt;    buf->size = size;    buf->data = malloc(size);    if (NULL == buf->data) {	free(buf);	return NULL;    }    buf->refcount = 1;    buf->release  = ng_free_video_buf;    return buf;}/* --------------------------------------------------------------------- */struct ng_audio_buf*ng_malloc_audio_buf(struct ng_audio_fmt *fmt, int size){    struct ng_audio_buf *buf;    buf = malloc(sizeof(*buf)+size);    memset(buf,0,sizeof(*buf));    buf->fmt  = *fmt;    buf->size = size;    buf->data = (char*)buf + sizeof(*buf);    return buf;}/* --------------------------------------------------------------------- */struct ng_attribute*ng_attr_byid(struct ng_attribute *attrs, int id){    if (NULL == attrs)	return NULL;    for (;;) {	if (NULL == attrs->name)	    return NULL;	if (attrs->id == id)	    return attrs;	attrs++;    }}struct ng_attribute*ng_attr_byname(struct ng_attribute *attrs, char *name){    if (NULL == attrs)	return NULL;    for (;;) {	if (NULL == attrs->name)	    return NULL;	if (0 == strcasecmp(attrs->name,name))	    return attrs;	attrs++;    }}const char*ng_attr_getstr(struct ng_attribute *attr, int value){    int i;        if (NULL == attr)	return NULL;    if (attr->type != ATTR_TYPE_CHOICE)	return NULL;    for (i = 0; attr->choices[i].str != NULL; i++)	if (attr->choices[i].nr == value)	    return attr->choices[i].str;    return NULL;}intng_attr_getint(struct ng_attribute *attr, char *value){    int i,val;        if (NULL == attr)	return -1;    if (attr->type != ATTR_TYPE_CHOICE)	return -1;    for (i = 0; attr->choices[i].str != NULL; i++) {	if (0 == strcasecmp(attr->choices[i].str,value))	    return attr->choices[i].nr;    }    if (isdigit(value[0])) {	/* Hmm.  String not found, but starts with a digit.	   Check if this is a valid number ... */	val = atoi(value);	for (i = 0; attr->choices[i].str != NULL; i++)	    if (val == attr->choices[i].nr)		return attr->choices[i].nr;	    }    return -1;}voidng_attr_listchoices(struct ng_attribute *attr){    int i;        fprintf(stderr,"valid choices for \"%s\": ",attr->name);    for (i = 0; attr->choices[i].str != NULL; i++)	fprintf(stderr,"%s\"%s\"",		i ? ", " : "",		attr->choices[i].str);    fprintf(stderr,"\n");}intng_attr_int2percent(struct ng_attribute *attr, int value){    int range,percent;    range   = attr->max - attr->min;    percent = (value - attr->min) * 100 / range;    if (percent < 0)	percent = 0;    if (percent > 100)	percent = 100;    return percent;}intng_attr_percent2int(struct ng_attribute *attr, int percent){    int range,value;    range = attr->max - attr->min;    value = percent * range / 100 + attr->min;    if (value < attr->min)	value = attr->min;    if (value > attr->max)	value = attr->max;    return value;}intng_attr_parse_int(struct ng_attribute *attr, char *str){    int value,n;    if (0 == sscanf(str,"%d%n",&value,&n))	/* parse error */	return attr->defval;    if (str[n] == '%')	value = ng_attr_percent2int(attr,value);    if (value < attr->min)	value = attr->min;    if (value > attr->max)	value = attr->max;    return value;}/* --------------------------------------------------------------------- */voidng_ratio_fixup(int *width, int *height, int *xoff, int *yoff){    int h = *height;    int w = *width;    if (0 == ng_ratio_x || 0 == ng_ratio_y)	return;    if (w * ng_ratio_y < h * ng_ratio_x) {	*height = *width * ng_ratio_y / ng_ratio_x;	if (yoff)	    *yoff  += (h-*height)/2;    } else if (w * ng_ratio_y > h * ng_ratio_x) {	*width  = *height * ng_ratio_x / ng_ratio_y;	if (yoff)	    *xoff  += (w-*width)/2;    }}voidng_ratio_fixup2(int *width, int *height, int *xoff, int *yoff,		int ratio_x, int ratio_y, int up){    int h = *height;    int w = *width;    if (0 == ratio_x || 0 == ratio_y)	return;    if ((!up  &&  w * ratio_y < h * ratio_x) ||	(up   &&  w * ratio_y > h * ratio_x)) {	*height = *width * ratio_y / ratio_x;	if (yoff)	    *yoff  += (h-*height)/2;    } else if ((!up  &&  w * ratio_y > h * ratio_x) ||	       (up   &&  w * ratio_y < h * ratio_x)) {	*width  = *height * ratio_x / ratio_y;	if (yoff)	    *xoff  += (w-*width)/2;    }}int64_tng_tofday_to_timestamp(struct timeval *tv){    long long ts;    ts  = tv->tv_sec;    ts *= 1000000;    ts += tv->tv_usec;    ts *= 1000;    return ts;}int64_tng_get_timestamp(){    struct timeval tv;    gettimeofday(&tv,NULL);    return ng_tofday_to_timestamp(&tv);}/* --------------------------------------------------------------------- */static void clip_dump(char *state, struct OVERLAY_CLIP *oc, int count){    int i;    fprintf(stderr,"clip: %s - %d clips\n",state,count);    for (i = 0; i < count; i++)	fprintf(stderr,"clip:   %d: %dx%d+%d+%d\n",i,		oc[i].x2 - oc[i].x1,		oc[i].y2 - oc[i].y1,		oc[i].x1, oc[i].y1);}static void clip_drop(struct OVERLAY_CLIP *oc, int n, int *count){    (*count)--;    memmove(oc+n, oc+n+1, sizeof(struct OVERLAY_CLIP) * (*count-n));}void ng_check_clipping(int width, int height, int xadjust, int yadjust,		       struct OVERLAY_CLIP *oc, int *count){    int i,j;    if (ng_debug > 1) {	fprintf(stderr,"clip: win=%dx%d xa=%d ya=%d\n",		width,height,xadjust,yadjust);	clip_dump("init",oc,*count);    }    for (i = 0; i < *count; i++) {	/* fixup coordinates */	oc[i].x1 += xadjust;	oc[i].x2 += xadjust;	oc[i].y1 += yadjust;	oc[i].y2 += yadjust;    }    if (ng_debug > 1)	clip_dump("fixup adjust",oc,*count);    for (i = 0; i < *count; i++) {	/* fixup borders */	if (oc[i].x1 < 0)	    oc[i].x1 = 0;	if (oc[i].x2 < 0)	    oc[i].x2 = 0;	if (oc[i].x1 > width)	    oc[i].x1 = width;	if (oc[i].x2 > width)	    oc[i].x2 = width;	if (oc[i].y1 < 0)	    oc[i].y1 = 0;	if (oc[i].y2 < 0)	    oc[i].y2 = 0;	if (oc[i].y1 > height)	    oc[i].y1 = height;	if (oc[i].y2 > height)	    oc[i].y2 = height;    }    if (ng_debug > 1)	clip_dump("fixup range",oc,*count);    /* drop zero-sized clips */    for (i = 0; i < *count;) {	if (oc[i].x1 == oc[i].x2 || oc[i].y1 == oc[i].y2) {	    clip_drop(oc,i,count);	    continue;	}	i++;    }    if (ng_debug > 1)	clip_dump("zerosize done",oc,*count);    /* try to merge clips */ restart_merge:    for (j = *count - 1; j >= 0; j--) {	for (i = 0; i < *count; i++) {	    if (i == j)		continue;	    if (oc[i].x1 == oc[j].x1 &&		oc[i].x2 == oc[j].x2 &&		oc[i].y1 <= oc[j].y1 &&		oc[i].y2 >= oc[j].y1) {		if (ng_debug > 1)		    fprintf(stderr,"clip: merge y %d,%d\n",i,j);		if (oc[i].y2 < oc[j].y2)		    oc[i].y2 = oc[j].y2;		clip_drop(oc,j,count);		if (ng_debug > 1)		    clip_dump("merge y done",oc,*count);		goto restart_merge;	    }	    if (oc[i].y1 == oc[j].y1 &&		oc[i].y2 == oc[j].y2 &&		oc[i].x1 <= oc[j].x1 &&		oc[i].x2 >= oc[j].x1) {		if (ng_debug > 1)		    fprintf(stderr,"clip: merge x %d,%d\n",i,j);		if (oc[i].x2 < oc[j].x2)		    oc[i].x2 = oc[j].x2;		clip_drop(oc,j,count);		if (ng_debug > 1)		    clip_dump("merge x done",oc,*count);		goto restart_merge;	    }	}    }    if (ng_debug)	clip_dump("final",oc,*count);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
韩国女主播成人在线| 盗摄精品av一区二区三区| 久草在线在线精品观看| 成人免费观看男女羞羞视频| 欧美一区二区在线免费观看| 一区二区三区在线播放| 成人av在线一区二区三区| 日韩久久久久久| 五月天网站亚洲| 色综合久久88色综合天天| 国产欧美日韩三区| 蜜桃传媒麻豆第一区在线观看| 91黄色免费观看| 中文字幕永久在线不卡| 国产精品白丝jk黑袜喷水| 精品乱人伦一区二区三区| 亚洲福中文字幕伊人影院| 99久久伊人久久99| 国产亚洲一区二区三区四区 | 久久国产精品区| 欧美视频在线观看一区| 一区二区三区自拍| 色综合天天综合狠狠| 国产精品久久久久婷婷| 丁香六月综合激情| 国产精品亲子乱子伦xxxx裸| 国产suv精品一区二区6| 国产精品午夜免费| 成人黄色av网站在线| 国产精品区一区二区三| 99视频在线精品| 亚洲欧美日韩国产综合在线| 91免费版pro下载短视频| 国产精品国产自产拍高清av| av一二三不卡影片| 亚洲欧美色图小说| 精品婷婷伊人一区三区三| 亚洲亚洲人成综合网络| 制服丝袜成人动漫| 美国毛片一区二区| 国产视频一区二区在线观看| 成人免费看黄yyy456| 亚洲老妇xxxxxx| 欧美日韩国产三级| 狠狠色丁香久久婷婷综合丁香| 欧美精品一区二区久久婷婷| 懂色av噜噜一区二区三区av| 国产精品成人一区二区三区夜夜夜| 99在线精品一区二区三区| 亚洲黄色免费电影| 91麻豆精品国产91久久久资源速度 | 亚洲第一av色| 精品久久久三级丝袜| 成人性视频免费网站| 亚洲一区二区三区自拍| 欧美一区二区三区精品| 国产不卡免费视频| 一区二区日韩电影| xf在线a精品一区二区视频网站| 成人a区在线观看| 亚洲亚洲人成综合网络| 日韩精品自拍偷拍| 99re这里只有精品首页| 免费看日韩精品| 椎名由奈av一区二区三区| 91麻豆精品国产91久久久久| 成人网页在线观看| 亚洲成人精品一区二区| 国产亚洲精品aa| 欧美日韩一区二区欧美激情| 国产精品亚洲综合一区在线观看| 一区二区三区国产精华| 久久久久99精品国产片| 精品视频在线免费| 成人av先锋影音| 青青草成人在线观看| 自拍av一区二区三区| 欧美xingq一区二区| 91黄色小视频| 成人午夜激情影院| 精品一区二区三区久久| 亚洲国产成人tv| 国产精品午夜免费| www久久久久| 欧美一区二区三区视频免费| 91视频com| 国产成人日日夜夜| 久久成人综合网| 亚洲成在人线在线播放| 国产精品成人免费在线| 久久欧美中文字幕| 欧美一级高清片| 欧美猛男超大videosgay| aaa亚洲精品| 成人免费视频视频| 国产精品自拍毛片| 久久国产精品一区二区| 五月天欧美精品| 亚洲一区二区偷拍精品| 亚洲一区二区综合| 亚洲丝袜精品丝袜在线| 中文字幕一区二区三区av| 久久久久久一二三区| 日韩欧美二区三区| 日韩一级片网站| 日韩一区国产二区欧美三区| 制服丝袜亚洲网站| 欧美一区二区三区白人| 欧美日韩二区三区| 欧美最猛性xxxxx直播| 欧美在线你懂得| 欧美三日本三级三级在线播放| 欧美在线小视频| 欧美色图一区二区三区| 欧美另类高清zo欧美| 欧美一区二区在线不卡| 欧美一区二区福利在线| 精品久久久久久久久久久久包黑料 | 日韩视频在线你懂得| 日韩视频一区在线观看| 精品乱人伦一区二区三区| 精品国产乱码久久久久久老虎| 精品999在线播放| 亚洲一区二区三区国产| 一区二区成人在线视频| 亚洲成人先锋电影| 蜜桃av噜噜一区| 国产乱国产乱300精品| 成人av网站大全| 欧美最新大片在线看| 欧美一区二区三区日韩视频| 精品盗摄一区二区三区| 国产精品久久久久精k8| 一区二区三国产精华液| 欧美aaa在线| 国产1区2区3区精品美女| 91免费国产在线| 欧美日韩一级大片网址| 欧美大片在线观看一区二区| 欧美经典三级视频一区二区三区| 中文字幕亚洲在| 日韩精品高清不卡| 国产精品白丝jk白祙喷水网站| 色综合久久中文字幕| 欧美一区二区三区视频免费 | 国产精品传媒在线| 视频一区视频二区在线观看| 国产麻豆精品theporn| 色哦色哦哦色天天综合| 日韩精品中文字幕一区二区三区 | 91久久精品国产91性色tv| 91精品黄色片免费大全| 国产精品视频在线看| 日韩av中文字幕一区二区 | 欧美日韩在线电影| 久久久久免费观看| 五月天亚洲精品| 99v久久综合狠狠综合久久| 宅男在线国产精品| 亚洲欧美偷拍另类a∨色屁股| 狠狠久久亚洲欧美| 在线观看一区日韩| 国产精品污污网站在线观看| 蜜臀久久久久久久| 色综合久久88色综合天天6| 久久―日本道色综合久久| 五月婷婷综合激情| 色中色一区二区| 国产精品久久久一本精品| 日韩av在线免费观看不卡| 日本精品一级二级| 国产精品欧美精品| 国产一区二区在线看| 日韩一级黄色片| 一区二区三区国产精品| 99久久精品国产毛片| 国产无一区二区| 色综合色综合色综合色综合色综合 | 国产中文一区二区三区| 91精品国产日韩91久久久久久| 亚洲一区免费视频| 色综合色狠狠综合色| 欧美国产精品v| 国产mv日韩mv欧美| 日韩免费在线观看| 日本大胆欧美人术艺术动态| 欧美午夜精品久久久久久孕妇| 日韩理论片网站| 成人手机电影网| 国产欧美日本一区视频| 国产成人av电影在线播放| 久久综合久久综合久久| 久久99久久精品| 久久综合色8888| 国产一二三精品| 国产情人综合久久777777| 国产河南妇女毛片精品久久久| 久久久国产一区二区三区四区小说 | 69堂亚洲精品首页| 亚洲国产aⅴ成人精品无吗|