Example #1
0
static void *process(void *arg)
{
	char buf[SIZE*3/2];
	int ret;
	unsigned short w, h;
	Keda_BufInfo bufinfo;
	int fd;

	CD *cd = (CD *)arg;
	printf("new thread!\n");
	cd->nfd = netinit(cd->host, cd->port);
	
	while(cd->thread_stat){
		ret = Keda_CaptureGetBuf(0, &bufinfo);
		if (ret){
			printf ("%s: get buffer failed!\n", __FUNCTION__);
			continue;
		}
		w = bufinfo.imgW;
		h = bufinfo.imgH ; 

		if (bufinfo.bufvirt){
			ret = netsend(cd->nfd, bufinfo.bufvirt, w*h*3/2);
		}
		ret = Keda_CapturePutBuf(0, &bufinfo);
		usleep(1*1000); 
	}
	netexit(cd->nfd);
	pthread_exit(0);
}
Example #2
0
/* FUNCTION: netmain_halt()
 *
 * Terminate the program.
 *
 * PARAM1: CLI_CTX            CLI context
 *
 * RETURNS: int               0 if successful, otherwise error code
 *
 * net halt
 */
STATIC int
netmain_halt(CLI_CTX ctx)
{
   if (!CLI_HELP(ctx))
   {
      netexit(0);                /* shut down hardware & exit to system */
   }

   return (0);
}