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

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

?? spcaview.c

?? 一個可以實現嵌入式視頻監控系統的最新版客戶端軟件。
?? C
?? 第 1 頁 / 共 5 頁
字號:
/****************************************************************************#	 	spcaview: Sdl video recorder and viewer with sound.         ##This package work with the spca5xx based webcam with the raw jpeg feature. ##All the decoding is in user space with the help of libjpeg.                ##.                                                                          ## 		Copyright (C) 2003 2004 2005 Michel Xhaard                  ##                                                                           ## This program is free software; you can redistribute it and/or modify      ## it under the terms of the GNU General Public License as published by      ## the Free Software Foundation; either version 2 of the License, or         ## (at your option) any later version.                                       ##                                                                           ## This program is distributed in the hope that it will be useful,           ## but WITHOUT ANY WARRANTY; without even the implied warranty of            ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             ## GNU General Public License for more details.                              ##                                                                           ## You should have received a copy of the GNU General Public License         ## along with this program; if not, write to the Free Software               ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA ##                                                                           #****************************************************************************/#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/file.h>#include <string.h>#include <pthread.h>#include <SDL/SDL.h>#include <SDL/SDL_thread.h>#include <SDL/SDL_audio.h>#include <SDL/SDL_timer.h>#include <linux/videodev.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <errno.h>#include <fcntl.h>#include <time.h>#include <sys/time.h>#include <signal.h>#include "SDL_audioin.h"#include "jconfig.h"#include "avilib.h"#include "dpsh.h"#include "utils.h"#include "tcputils.h"#include "spcaframe.h"#include "version.h"#define WAVE_AUDIO_PCM 1#define CHANNELS 1#define AUDIO_SAMPLERATE		22050 // 44100 // 11025 // 8000 // 22050#define AUDIO_SAMPLES			512 // 1024#define AUDIO_FORMAT			AUDIO_S16#define AUDIOSIZE 2#define NUM_CHUNCK 64 // 256 a large ring buffer #define MAXBUFFERSIZE (AUDIO_SAMPLES*AUDIOSIZE*NUM_CHUNCK)#define HELPBUFFERSIZE (AUDIO_SAMPLES*AUDIOSIZE)// INIT_BRIGHT is the initial brightness level// BRIGHTMEAN is the goal mean brightness for the // auto adjustment.// SPRING_CONSTANT determines the restoring force// for the auto adjust// BRIGHT_WINDOW is the window around the goal mean// in which no adjustment is to occur#define V4L_BRIGHT_MIN 0#define V4L_BRIGHT_MAX 50000 //65000#define BRIGHTMEAN 128 //145#define SPRING_CONSTANT 25#define BRIGHTWINDOW 10/* pictFlag should be set by the hardware or the timer *//* call_back function need to reset the flag */static int totmean;int interval = 0;volatile int pictFlag = 0;static int Oneshoot = 1;static int numshoot = 0;static int modshoot = 0;static videoOk = 0;/* picture structure */typedef struct pictstruct{	unsigned char *data;	int sizeIn;	int width;	int height;	int formatIn;	int mode;	avi_t *out_fd;	pthread_mutex_t mutex;	pthread_cond_t cond;} pictstruct;void *waitandshoot(void* ptr);/* sound buffer */struct Rbuffer {	Uint8 buffer[MAXBUFFERSIZE];	Uint8 helpbuffer[HELPBUFFERSIZE];	int ptread ;	int ptwrite;	};	Uint32 GetVideoBpp (void);	static Uint32 callback_timer (Uint32 interval){	pictFlag = 1;	//printf("TIMER ON !!!!\n");	return interval;}void callback_record(void *userdata, Uint8 *stream, int len){	int part1 =0;	int part2 =0; 	struct Rbuffer *mybuf=(struct Rbuffer*) userdata; 	if ((mybuf->ptwrite + len) > MAXBUFFERSIZE){ 		part1=MAXBUFFERSIZE-mybuf->ptwrite;		part2 = len-part1;		memcpy (mybuf->buffer+mybuf->ptwrite,stream,part1); 		memcpy (mybuf->buffer,stream+part1,part2); 	} else { 		memcpy(mybuf->buffer+mybuf->ptwrite,stream,len); 	} 	mybuf->ptwrite = (mybuf->ptwrite +len) % MAXBUFFERSIZE; //fprintf(stderr,"callback_record(%p,%d,%d %d)\n",userdata,mybuf->ptwrite,part1,part2); }void callback_play(void *userdata, Uint8 *stream, int len){	struct Rbuffer *mybuf=(struct Rbuffer*) userdata;		int ptwrite=mybuf->ptwrite ;	int ptread =mybuf->ptread;		int part1 =0;	int part2 =0;	int delta =0;	delta = ptwrite-ptread;			if(delta < 0){			if (((MAXBUFFERSIZE + delta) >= len)){					 			part1=MAXBUFFERSIZE-ptread;				if (part1 >=len){				part1 = len;				part2 = 0 ;				} else {	 			part2 = len-part1;				}				//fprintf(stderr,"callback_playT part1 %d part2 %d \n",part1,part2); 			 	 memcpy (mybuf->helpbuffer,mybuf->buffer+ptread,part1);				if (part2)			 	    memcpy (mybuf->helpbuffer+part1,mybuf->buffer,part2);			 	SDL_MixAudio(stream,mybuf->helpbuffer, len, SDL_MIX_MAXVOLUME);				mybuf->ptread = (mybuf->ptread +len) % MAXBUFFERSIZE; 				//fprintf(stderr,"callback_playT ptread %d ptwrite %d \n",ptread,ptwrite); 			 			 } else {			 	//fprintf(stderr,"Waiting for dataT to Play Ptread %dPtwrite %d !! \n",ptread,ptwrite);			}		} else {			if (delta >= len){				memcpy (mybuf->helpbuffer,mybuf->buffer+ptread,len);				SDL_MixAudio(stream,mybuf->helpbuffer, len, SDL_MIX_MAXVOLUME);				mybuf->ptread = (mybuf->ptread +len) % MAXBUFFERSIZE; 				//fprintf(stderr,"callback_playF ptread %d ptwrite %d \n",ptread,ptwrite);				} else {	 			//fprintf(stderr,"Waiting for dataF to Play Ptread %d Ptwrite %d !! \n",ptread,ptwrite);			}		}			 	}	static int clip_to(int x, int low, int high);//void equalize (unsigned char *src, int width, int height, int format);static int adjust_bright( struct video_picture *videopict, int fd);static int get_pic_mean ( int width, int height, const unsigned char *buffer,			  int is_rgb,int startx, int starty, int endx, 			  int endy );static int setVideoPict (struct video_picture *videopict, int fd);static int isSpcaChip (const char *BridgeName);/* return Bridge otherwhise -1 */static int getStreamId (const char * BridgeName);/* return Stream_id otherwhise -1 */static int probeSize (const char *BridgeName, int *width, int *height); /* return 1->ok otherwhise -1 */voidresize (unsigned char *dst,unsigned char *src, int Wd,int Hd,int Ws,int Hs) ;static intreadFrame (avi_t *out_fd,long i,unsigned char **jpegData, int * jpegSize, struct Rbuffer *RingBuffer, int maxsound, int *audiolen,	   int *soundbytes, int isaudio, int updown, int compress);static voidrefresh_screen (unsigned char *src, unsigned char *pict, int format, int width,		int height,int owidth ,int oheight, int size, int autobright);		int spcaClient (char *Ip, short port,int owidth, int oheight ,int statOn);int spcaPlay (char* inputfile, int width, int height);int spcaGrab (char *outputfile,char fourcc[4] , const char *videodevice, int image_width,int image_height, int format, int owidth, int oheight,	int grabMethod,int videoOn,int audioout,int videocomp,int autobright,int statOn,int decodeOn);	void *waitandshoot(void* ptr){ pictstruct *mypict = (pictstruct *) ptr;	int width = mypict->width;	int height = mypict->height;	int format = mypict->formatIn;	int size = mypict->sizeIn;	int mode = mypict->mode;	avi_t *fd = mypict->out_fd;	int status;while(1){    status = pthread_mutex_lock (&mypict->mutex);    if (status != 0) {fprintf(stderr,"Lock error!\n"); exit(-1);}	while (pictFlag == 0) {              /* Set predicate */ 	status = pthread_cond_wait(&mypict->cond, &mypict->mutex);    if (status != 0) {fprintf(stderr,"Wait error!\n"); exit(-1);} 	}	pictFlag = 0;	getJpegPicture(mypict->data,width,height,format,size,mode,fd);	if (modshoot)	 if (!(--numshoot)) Oneshoot = 0;    status = pthread_mutex_unlock (&mypict->mutex);    if (status != 0) {fprintf(stderr,"Unlock error!\n"); exit(-1);}    /******* EXIT the MONITOR ************///printf("Condition was accept, data.value=%d\n",pictFlag);}    return NULL;	}void init_callbackmessage(struct client_t* callback){    char key[4] ={'O','K','\0','\0'} ;	int x = 128;	int y = 128;	unsigned char sleepon=0;	unsigned char bright=0;	unsigned char contrast =0;	unsigned char exposure = 0;	unsigned char colors = 0;	unsigned char size = 0;	unsigned char fps = 0;	memcpy(callback->message,key,4);	callback->x = x;	callback->y = y;	callback->updobright=bright;	callback->updocontrast=contrast;	callback->updoexposure = exposure;	callback->updocolors = colors;	callback->sleepon=sleepon;	callback->updosize = size;	callback->fps = fps;	}/* callback spec 	updobright = 1 increase bright	updobright = 0 nothing todo	updobright = 2 decrease bright	same for all updocontrast updosize	sleepon =1 ask the server for no frame		on wakeup sleepon is cleared server will send frame 		and client should display	sleepon =2 ask the server to send a 100ms pulse on pin 14		pin 14 is inverted always 1 pulse 0*/void reset_callbackmessage(struct client_t* callback){    		callback->updobright= 0;	callback->updocontrast= 0;	callback->updoexposure = 0;	callback->updocolors = 0;	callback->sleepon= 0;	callback->updosize = 0;	callback->fps = 0;	}	intmain (int argc, char *argv[]){	/* Timing value used for statistic */		const char *videodevice = NULL;	/* default mmap */	int grabMethod = 1;		int format = VIDEO_PALETTE_YUV420P;	/******** output screen pointer ***/		int image_width = IMAGE_WIDTH;	int image_height = IMAGE_HEIGHT;	int owidth = 0;	int oheight = 0;	/**********************************/	/*        avi parametres          */	char *inputfile = NULL;	char *outputfile = NULL;	char fourcc[4] = "MJPG";		char *sizestring = NULL;	int use_libjpeg = 1;	char *separateur;	char *mode = NULL;	/*********************************/	/*          Starting Flags       */	int i;	int videoOn = 1;	int decodeOn =1 ;	int statOn = 0;	int audioout = 0;	int videocomp = 0;	int channel = 0;	int norme = 0;	int autobright = 0;	/*********************************/	char *AdIpPort;	char AdIp[]= "000.000.000.000";	unsigned short ports = 0;		/*********************************/	SPCASTATE funct;	 	/* init default bytes per pixels for VIDEO_PALETTE_RAW_JPEG 	*/	/* FIXME bpp is used as byte per pixel for the ouput screen	*/	/* we need also a bpp_in for the input stream as spcaview   	*/	/* can convert stream That will be a good idea to have 2 struct */	/* with all global data one for input the other for output      */ 	bpp = 3;	funct = GRABBER;	printf(" %s \n",version);	/* check arguments */	for (i = 1; i < argc; i++) {		/* skip bad arguments */		if (argv[i] == NULL || *argv[i] == 0 || *argv[i] != '-') {			continue;		}		if (strcmp (argv[i], "-d") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -d, aborting.\n");				exit (1);			}			videodevice = strdup (argv[i + 1]);		}		if (strcmp (argv[i], "-n") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -n, aborting.\n");				exit (1);			}			norme = atoi (argv[i + 1]);			if (norme < 0 || norme > 4)			printf ("Norme should be between 0..4 Read the readme !.\n");		}		if (strcmp (argv[i], "-c") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -c, aborting.\n");				exit (1);			}			channel = atoi (argv[i + 1]);			if (channel < 0 || channel > 9)			printf ("Channel should be between [0..3] || [6..9] Read the readme !.\n");		}		if (strcmp (argv[i], "-v") == 0) {			videoOn = 0;		}		if (strcmp (argv[i], "-j") == 0) {			decodeOn = 0;		}		if (strcmp (argv[i], "-t") == 0) {			statOn = 1;		}		if (strcmp (argv[i], "-z") == 0) {			videocomp = 1;		}		if (strcmp (argv[i], "-b") == 0) {		  autobright = 1;		}		if (strcmp (argv[i], "-f") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -f, aborting.\n");				exit (1);			}			mode = strdup (argv[i + 1]);			if (strncmp (mode, "r32", 3) == 0) {				format = VIDEO_PALETTE_RGB32;				bpp = 4;				snprintf (fourcc, 5, "RGB4");			} else if (strncmp (mode, "r24", 3) == 0) {				format = VIDEO_PALETTE_RGB24;				bpp = 3;				snprintf (fourcc, 5, "RGB3");			} else if (strncmp (mode, "r16", 3) == 0) {				format = VIDEO_PALETTE_RGB565;				bpp = 2;				snprintf (fourcc, 5, "RGB2");			} else if (strncmp (mode, "yuv", 3) == 0) {				format = VIDEO_PALETTE_YUV420P;				bpp = 3;				snprintf (fourcc, 5, "I420");			} else if (strncmp (mode, "jpg", 3) == 0) {				format = VIDEO_PALETTE_JPEG;				bpp = 3;				snprintf (fourcc, 5, "MJPG");			}else {				format = VIDEO_PALETTE_YUV420P;				bpp = 3;				snprintf (fourcc, 5, "I420");			}		}		if (strcmp (argv[i], "-i") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -i, aborting.\n");				exit (1);			}			inputfile = strdup (argv[i + 1]);			funct = PLAYER ;		}		if (strcmp (argv[i], "-g") == 0) {			/* Ask for read instead default  mmap */			grabMethod = 0;		}		if (strcmp (argv[i], "-a") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -a, aborting.\n");				exit (1);			}			audioout = atoi (argv[i + 1]);			if ((audioout < 0) || (audioout > 2)) {				audioout = 0;			}			printf ("audio channel %d\n", audioout);		}		if (strcmp (argv[i], "-o") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -o, aborting.\n");				exit (1);			}			outputfile = strdup (argv[i + 1]);		}		/* custom ? */		if (strcmp (argv[i], "-s") == 0) {			if (i + 1 >= argc) {				printf ("No parameter specified with -s, aborting.\n");				exit (1);			}			sizestring = strdup (argv[i + 1]);			image_width = strtoul (sizestring, &separateur, 10);			if (*separateur != 'x') {				printf ("Error in size use -s widthxheight \n");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产乱码久久| 午夜精品久久久久久久久| 亚洲成a人v欧美综合天堂下载| 韩国v欧美v亚洲v日本v| 欧美视频三区在线播放| 国产精品嫩草99a| 精品一二三四区| 91婷婷韩国欧美一区二区| 久久亚洲一级片| 天天影视涩香欲综合网| 色天天综合色天天久久| 国产午夜精品福利| 日韩av电影免费观看高清完整版 | 日韩和欧美一区二区三区| 国产精品18久久久久久久久 | 久久精工是国产品牌吗| 欧美少妇xxx| 亚洲理论在线观看| 成人av动漫在线| 精品久久久久久亚洲综合网 | 亚洲男人天堂av网| 成人影视亚洲图片在线| 国产午夜精品久久久久久久| 国内精品免费**视频| 精品三级在线看| 久久综合综合久久综合| 欧美丰满嫩嫩电影| 五月婷婷欧美视频| 精品污污网站免费看| 亚洲成av人片www| 欧美人动与zoxxxx乱| 日韩一区欧美二区| 91精品国产欧美日韩| 免费在线观看日韩欧美| 欧美一区二区二区| 九九九精品视频| 久久久久久久久久久99999| 国产精品一区不卡| 国产精品乱码人人做人人爱| 不卡的av中国片| 自拍偷拍亚洲综合| 精品视频在线视频| 裸体在线国模精品偷拍| 亚洲精品在线免费播放| 国产精品一区二区在线观看不卡| 国产精品视频九色porn| 色综合一个色综合| 天天射综合影视| 精品久久五月天| 成人av影院在线| 一区二区不卡在线视频 午夜欧美不卡在| 91视视频在线直接观看在线看网页在线看| 亚洲精品欧美激情| 欧美日韩一区二区不卡| 美女视频黄频大全不卡视频在线播放| 欧美v国产在线一区二区三区| 国产麻豆一精品一av一免费| 亚洲图片激情小说| 欧美日韩在线播放三区四区| 久久电影网站中文字幕| 欧美国产97人人爽人人喊| 在线亚洲+欧美+日本专区| 久久av中文字幕片| 中文字幕一区在线观看| 91精品国产综合久久蜜臀| 国产成人免费9x9x人网站视频| 国产精品盗摄一区二区三区| 欧美日韩一本到| 成人免费视频视频| 天天亚洲美女在线视频| 国产精品每日更新在线播放网址 | 91精品办公室少妇高潮对白| 捆绑调教美女网站视频一区| 亚洲日本一区二区| 精品成人一区二区| 欧洲精品在线观看| 国产白丝精品91爽爽久久| 日日夜夜精品视频天天综合网| 国产偷国产偷亚洲高清人白洁| 欧美美女一区二区在线观看| 成人免费毛片高清视频| 亚洲激情校园春色| 国产夜色精品一区二区av| 欧美群妇大交群的观看方式| 91蜜桃传媒精品久久久一区二区| 精品一区二区在线播放| 91精品国产麻豆国产自产在线 | 欧美精品xxxxbbbb| av在线播放成人| 国内精品自线一区二区三区视频| 一区二区欧美国产| 亚洲视频图片小说| 中文一区在线播放| 久久先锋资源网| 精品久久久久久久久久久久久久久 | 麻豆成人久久精品二区三区红| 一个色妞综合视频在线观看| 国产精品久久久久久亚洲伦| 久久日韩精品一区二区五区| 日韩一区二区麻豆国产| 欧美性视频一区二区三区| 91在线云播放| 99久久99久久免费精品蜜臀| 成人涩涩免费视频| 丁香婷婷综合网| 国产精品一级片| 国产精品18久久久久久久久| 精品一区二区三区的国产在线播放 | 99久久精品99国产精品 | 一区二区三区免费观看| 中文字幕在线免费不卡| 中文字幕一区二区三区在线播放| 国产无人区一区二区三区| 国产午夜亚洲精品羞羞网站| 国产亚洲短视频| 国产日韩欧美不卡| 国产精品视频一二| 亚洲欧美激情一区二区| 一区二区三区在线观看欧美| 亚洲无人区一区| 天天操天天干天天综合网| 天堂成人免费av电影一区| 日韩精品欧美精品| 激情图区综合网| 国产成人在线看| 成人av在线影院| 欧美婷婷六月丁香综合色| 欧美理论电影在线| 91麻豆精品91久久久久久清纯 | 亚洲精品在线三区| 欧美国产欧美亚州国产日韩mv天天看完整| 亚洲国产电影在线观看| 亚洲欧美日韩国产手机在线| 亚洲综合免费观看高清完整版| 香蕉加勒比综合久久 | 日本三级亚洲精品| 国产精品资源站在线| 91在线国产观看| 欧美日产国产精品| 一区二区三区四区五区视频在线观看| 久久久久久免费毛片精品| 日本一区二区三区电影| 亚洲免费在线观看| 日韩成人伦理电影在线观看| 久久99久久久久久久久久久| 大白屁股一区二区视频| 91黄色激情网站| 欧美r级在线观看| 久久精品夜色噜噜亚洲aⅴ| 色国产综合视频| 精品美女在线播放| 亚洲日本va在线观看| 奇米亚洲午夜久久精品| va亚洲va日韩不卡在线观看| 欧美精品国产精品| 国产欧美1区2区3区| 午夜在线成人av| 福利一区二区在线| 日韩亚洲欧美成人一区| 亚洲免费色视频| 精品一区二区三区久久久| 欧美日韩一区视频| 国产精品午夜电影| 麻豆高清免费国产一区| 在线观看日韩精品| 国产精品久久久久久久岛一牛影视| 午夜精品久久久久久久99水蜜桃| 国产剧情在线观看一区二区| 欧美群妇大交群中文字幕| 亚洲天天做日日做天天谢日日欢| 久久精品999| 欧美一区二区观看视频| 一区二区免费看| 色综合中文字幕国产 | 色哟哟日韩精品| 精品99一区二区三区| 亚洲二区视频在线| 91色乱码一区二区三区| 久久久www成人免费毛片麻豆| 日韩国产欧美视频| 在线免费观看不卡av| 中文字幕一区二区三区精华液| 九九精品一区二区| 日韩色视频在线观看| 日韩电影在线观看电影| 欧美日韩视频在线一区二区| 亚洲美女偷拍久久| 91麻豆.com| 亚洲色图清纯唯美| 97久久精品人人澡人人爽| 中文字幕免费观看一区| 国产99久久精品| 国产色91在线| 成人晚上爱看视频| 国产精品夫妻自拍| 99在线精品免费| 亚洲激情中文1区| 色素色在线综合| 午夜国产不卡在线观看视频| 欧美精品色综合|