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

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

?? grab-ng.c

?? 在基于ARM處理器的Liunx系統下的開放板上實現攝像頭圖像采集
?? 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          = 0;int  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一区二区三区免费野_久草精品视频
国产精品系列在线观看| 国产日产亚洲精品系列| 亚洲一级电影视频| 欧美亚洲国产一区二区三区| 亚洲综合小说图片| 欧美精品久久天天躁| 蜜桃久久久久久久| 欧美精品一区二区在线播放| 国产超碰在线一区| 亚洲精品免费在线观看| 欧美一区二区精品久久911| 美腿丝袜亚洲一区| 国产欧美精品日韩区二区麻豆天美| 国产91对白在线观看九色| 亚洲免费色视频| 制服丝袜av成人在线看| 国产麻豆视频一区二区| 亚洲少妇屁股交4| 欧美高清性hdvideosex| 国产精品一区二区三区四区| 综合婷婷亚洲小说| 91精品国产高清一区二区三区| 国产美女视频一区| 亚洲不卡在线观看| 国产性做久久久久久| 欧美日韩一区高清| 国产91精品在线观看| 亚洲一区二区中文在线| 欧美精品一区二区三区蜜桃| 91丝袜呻吟高潮美腿白嫩在线观看| 日韩—二三区免费观看av| 欧美高清在线一区二区| 欧美一区二区三区免费视频| www.日韩精品| 国产精品18久久久久久久久久久久| 国产午夜精品一区二区| 美女视频黄频大全不卡视频在线播放| 国产成人福利片| 欧美日韩免费观看一区二区三区| 日本欧美大码aⅴ在线播放| 国产欧美日韩精品在线| 欧美日韩在线三级| 国产精品一二三四| 日韩成人dvd| 成人欧美一区二区三区1314| 欧美一级高清片在线观看| 91啪在线观看| 国内精品伊人久久久久av影院| 亚洲综合色自拍一区| 国产视频一区二区在线| 欧美一区二区三区在线看| av激情综合网| 国产成人av一区| 精品亚洲国产成人av制服丝袜 | 国产亚洲成av人在线观看导航| 一本到一区二区三区| 成人一道本在线| 极品少妇xxxx精品少妇偷拍| 日韩精品三区四区| 亚洲综合激情另类小说区| 亚洲欧美一区二区视频| 精品国产伦一区二区三区观看方式| 欧洲精品一区二区| 91美女在线看| 成人av资源网站| 成人午夜在线视频| 国产精品99久| 国产中文字幕精品| 久久精品国产网站| 美女视频黄频大全不卡视频在线播放| 亚洲一区二区三区四区在线观看| 中文字幕在线观看一区二区| 国产婷婷色一区二区三区在线| 精品国产网站在线观看| 欧美一区二区三区不卡| 91精品欧美一区二区三区综合在 | 成人黄页在线观看| 亚洲男人的天堂av| 自拍偷拍亚洲欧美日韩| 成人性生交大合| 麻豆精品久久久| 欧美日韩精品专区| 在线免费一区三区| 91麻豆免费在线观看| 94-欧美-setu| 91视频精品在这里| 欧美亚洲国产一区在线观看网站| 欧美影视一区在线| 欧美久久久久中文字幕| 欧美精品v日韩精品v韩国精品v| 欧美人与禽zozo性伦| 正在播放亚洲一区| 欧美大片拔萝卜| 久久久久久久久久久电影| 中文一区二区完整视频在线观看| 中文字幕 久热精品 视频在线 | 日韩欧美国产小视频| 精品国产欧美一区二区| 国产亚洲人成网站| 亚洲手机成人高清视频| 亚洲国产视频a| 另类成人小视频在线| 国产成人亚洲精品青草天美| 93久久精品日日躁夜夜躁欧美| 欧美三级电影在线观看| 欧美大片日本大片免费观看| 欧美国产欧美亚州国产日韩mv天天看完整| 中文字幕免费观看一区| 亚洲黄色av一区| 蜜桃视频在线观看一区二区| 成人免费视频一区二区| 在线精品视频一区二区三四| 日韩午夜精品电影| 中文字幕一区在线观看视频| 亚洲mv在线观看| 精品亚洲成av人在线观看| 99久久国产综合精品色伊| 91国产精品成人| 精品国产青草久久久久福利| 亚洲日本青草视频在线怡红院| 五月激情综合色| 国产成人av一区二区| 欧美人与性动xxxx| 中文久久乱码一区二区| 婷婷国产在线综合| jlzzjlzz亚洲女人18| 91精品国产一区二区人妖| 国产精品久久久久久久久免费丝袜| 性做久久久久久免费观看欧美| 国产成人三级在线观看| 91.com在线观看| 亚洲欧洲国产专区| 精东粉嫩av免费一区二区三区| 91在线精品一区二区三区| 日韩欧美你懂的| 亚洲精品一二三| 国产成人精品综合在线观看| 91精品国产全国免费观看| 中文字幕亚洲电影| 韩国精品主播一区二区在线观看| 在线精品视频一区二区三四| 国产欧美视频一区二区| 老司机午夜精品99久久| 欧美色欧美亚洲另类二区| 国产欧美精品在线观看| 麻豆一区二区99久久久久| 欧美少妇一区二区| 中文字幕在线视频一区| 国产精品中文欧美| 欧美一区中文字幕| 亚洲国产一区二区三区青草影视| 99riav一区二区三区| 国产日韩欧美精品电影三级在线| 久久黄色级2电影| 777亚洲妇女| 亚洲v日本v欧美v久久精品| 色偷偷久久一区二区三区| 国产精品久久毛片a| 成人国产精品视频| 国产精品天干天干在观线| 狠狠色丁香婷婷综合| 日韩午夜精品电影| 日韩成人免费电影| 欧美日本高清视频在线观看| 亚洲午夜久久久久久久久久久 | 99久久99久久精品免费看蜜桃 | 97久久人人超碰| 国产精品欧美久久久久无广告| 国产九色精品成人porny| 精品毛片乱码1区2区3区| 日韩国产欧美在线视频| 制服丝袜在线91| 免费在线观看视频一区| 精品少妇一区二区三区视频免付费| 爽好久久久欧美精品| 91精品国产综合久久福利| 日韩在线一区二区三区| 日韩午夜在线观看| 国内久久精品视频| 日本一区二区三区在线观看| 菠萝蜜视频在线观看一区| 亚洲丝袜精品丝袜在线| 欧美色图激情小说| 麻豆国产精品视频| 久久久美女艺术照精彩视频福利播放| 国产精品性做久久久久久| 国产精品久久久久久久久快鸭 | √…a在线天堂一区| 在线视频综合导航| 日日噜噜夜夜狠狠视频欧美人 | 国产日产亚洲精品系列| 91在线观看污| 香蕉av福利精品导航| 日韩欧美激情一区| 东方欧美亚洲色图在线| 亚洲免费伊人电影| 欧美丰满少妇xxxbbb| 国产美女一区二区| 一区二区在线观看免费视频播放| 欧美日韩一级大片网址|