亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品欧美久久久久一区二区 | av不卡免费在线观看| 99久久久久久99| 欧美另类变人与禽xxxxx| 中文一区在线播放| 日韩电影免费在线看| 91色婷婷久久久久合中文| 精品国产伦一区二区三区免费| 亚洲人成影院在线观看| 国产河南妇女毛片精品久久久| 欧美系列日韩一区| 亚洲欧美激情小说另类| 国产成人综合亚洲91猫咪| 91麻豆精品国产91久久久久| 国产精品高潮呻吟久久| 国产酒店精品激情| 日韩久久精品一区| 日韩在线一区二区三区| 欧美亚男人的天堂| 自拍偷拍欧美精品| 成人av免费在线播放| 久久婷婷国产综合精品青草| 欧美bbbbb| 欧美人与z0zoxxxx视频| 亚洲精品成人精品456| 9人人澡人人爽人人精品| 久久久美女毛片| 国内精品视频一区二区三区八戒| 欧美一级一级性生活免费录像| 一区二区三区欧美日| 99麻豆久久久国产精品免费| 久久午夜电影网| 国产伦精一区二区三区| 日韩免费观看高清完整版在线观看| 亚洲超碰精品一区二区| 91国产免费观看| 一区二区三区欧美亚洲| 色视频欧美一区二区三区| 国产精品久久久久久久裸模| av网站一区二区三区| 国产精品美女久久久久av爽李琼 | 99久久精品国产毛片| 国产精品国产三级国产aⅴ原创| 国产成人欧美日韩在线电影| 国产日韩欧美麻豆| 欧美精品乱码久久久久久按摩| 亚洲成人精品一区| 91精品国模一区二区三区| 久国产精品韩国三级视频| 精品国产一区二区三区四区四 | 日韩在线卡一卡二| 精品国产精品网麻豆系列 | 日日夜夜免费精品| 精品国免费一区二区三区| 国产一区二区三区久久久| 国产偷国产偷精品高清尤物| 99精品在线观看视频| 午夜精品久久久久久久久久久| 日韩你懂的在线观看| 国产99久久久国产精品潘金| 日韩一区在线播放| 91精品一区二区三区久久久久久 | 欧美日韩精品一区视频| 亚洲成人一二三| 9191国产精品| 国产成人av一区| 亚洲国产视频在线| 日韩欧美一区二区久久婷婷| 国产成人在线色| 亚洲欧美日韩久久精品| 日韩欧美一区二区视频| 国产suv精品一区二区6| 亚洲第一搞黄网站| 欧美tickle裸体挠脚心vk| av激情成人网| 亚洲成人动漫av| 中文一区二区在线观看| 日韩欧美黄色影院| av一区二区久久| 日韩高清欧美激情| 亚洲精品视频观看| 欧美一卡二卡三卡四卡| 高清免费成人av| 亚洲一区二区在线观看视频 | 欧美国产精品劲爆| 欧美性做爰猛烈叫床潮| 国产一区欧美日韩| 亚洲激情图片qvod| 久久久精品一品道一区| 成人午夜视频免费看| 亚洲二区在线观看| 中日韩av电影| 91麻豆精品国产91久久久久久 | 91免费看片在线观看| 日韩av电影一区| 亚洲综合色自拍一区| 久久综合久久鬼色| 欧美自拍偷拍一区| 国产精品一区久久久久| 亚洲一卡二卡三卡四卡| 中文在线免费一区三区高中清不卡| 欧美日韩在线播放三区| 国产精品一区二区在线看| 麻豆精品视频在线| 亚洲123区在线观看| 国产精品色哟哟网站| 精品国产免费一区二区三区香蕉| 91黄色激情网站| 国产精品99久久不卡二区| 亚洲成人综合网站| 一区二区三区在线观看欧美| 国产亚洲欧美激情| 日韩一级片网站| 欧美日韩国产区一| 色老头久久综合| 成人性生交大片免费看中文网站| 丁香婷婷综合色啪| 丁香六月久久综合狠狠色| 久久精品国产99久久6| 亚洲国产日韩在线一区模特| 中文字幕制服丝袜成人av| 久久精品这里都是精品| 精品久久久久久久久久久久久久久| 欧美日韩国产一二三| 91视视频在线观看入口直接观看www | 免费看日韩a级影片| 亚洲一二三四区不卡| 亚洲精品国产一区二区精华液| 国产色产综合产在线视频| 欧美日韩三级在线| 欧美亚洲综合另类| 色94色欧美sute亚洲线路二| 99国产麻豆精品| 99久久亚洲一区二区三区青草| 风间由美一区二区av101| 国产一区二区在线看| 国产原创一区二区三区| 国产成人免费视频一区| 成人美女视频在线观看18| 成人av网址在线观看| 播五月开心婷婷综合| 色综合天天综合给合国产| 成人97人人超碰人人99| 不卡一区二区在线| 91传媒视频在线播放| 欧美大胆一级视频| 国产日韩欧美电影| 国产精品国产三级国产| 亚洲美女淫视频| 日韩国产一区二| 91在线高清观看| 91女人视频在线观看| 欧美亚洲国产一区二区三区va| 欧美日韩综合在线| 欧美一区二区视频在线观看2020 | 国产成+人+日韩+欧美+亚洲| proumb性欧美在线观看| 91黄色免费观看| 69p69国产精品| 中文字幕一区三区| 亚洲成人一区在线| 久久电影国产免费久久电影 | 亚洲一区二区三区激情| 日本不卡不码高清免费观看| 国产在线一区二区| 日本韩国精品一区二区在线观看| 在线不卡的av| 国产精品国产三级国产普通话99| 亚洲成人激情综合网| 国产一区二区三区免费观看| 一本大道久久a久久精品综合| 在线成人小视频| 国产精品网曝门| 亚洲免费观看高清完整版在线观看熊 | 免费成人在线网站| k8久久久一区二区三区| 欧美日韩国产电影| 欧美国产日本韩| 男男成人高潮片免费网站| 欧美精品久久一区| 精品久久久久久亚洲综合网| 成人免费一区二区三区在线观看| 视频一区二区国产| 成人激情av网| 欧美va亚洲va在线观看蝴蝶网| 中文字幕高清不卡| 国产精品香蕉一区二区三区| 欧洲激情一区二区| 国产日韩高清在线| 日韩国产欧美在线播放| 色欧美乱欧美15图片| 久久久亚洲午夜电影| 亚洲国产视频一区| 91在线码无精品| 久久只精品国产| 日韩激情视频在线观看| 在线播放中文字幕一区| 亚洲在线免费播放| jlzzjlzz亚洲女人18| 久久久久国产精品厨房|