if ((vchan.flags & VIDEO_VC_AUDIO)==VIDEO_VC_AUDIO) {
if ( (vchan.flags & VIDEO_VC_TUNER)==VIDEO_VC_TUNER) {
int initVideoDev(char *videodevice, v4linfo *info ){long int v4lfrequency=0;int volume=-1;	memcpy(&vinfo,info,sizeof(vinfo)); 	fd = open(videodevice, O_RDWR|O_CREAT);  	if(fd<=0)  	{    		perror("open");    		return 0;  	}  	if(ioctl(fd, VIDIOCGMBUF, &vm)<0)  	{  		perror("VIDIOCMCAPTUREi0");		return 0;  	}  	if(vm.frames<2)  	{	  	fprintf(stderr, "stoopid prog want min 2 cap buffs!\n");  		return 0;  	}  // fprintf(stderr, "We have vm.frames=%d\n", vm.frames);  	buf = (unsigned char*)mmap(0, vm.size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);  	if (buf<=0)  	{   		perror("mmap");   		return 0;  	}  	vchan.channel = info->channel;  	if(ioctl(fd, VIDIOCGCHAN, &vchan)<0) perror("VIDIOCGCHAN");  	// choose the right input  	if(ioctl(fd, VIDIOCSCHAN, &vchan)<0) perror("VIDIOCSCHAN");  	// if channel has a audio then activate it  	if ((vchan.flags & VIDEO_VC_AUDIO)==VIDEO_VC_AUDIO) {    	// we assume only a channel with audio can have a tuner therefore    	// we only tune here if we are supposed to    	if (info->frequency != 0.0)	{      		v4lfrequency  = ((unsigned long)info->frequency)*16;      		v4lfrequency |= ((unsigned long)( (info->frequency-(v4lfrequency/16))*100 )*16)/100; // ??????      		if (ioctl(fd, VIDIOCSFREQ, &v4lfrequency)<0) perror("VIDIOCSFREQ");      		if (!quiet) fprintf(stderr, "tuner frequency set to '%5.4f' MHz.\n", info->frequency);    	}    	if (!quiet) fprintf(stderr, "%s\n", "unmuting tv-audio");    	// audio hack, to enable audio from tvcard, in case we use a tuner    	va.audio = 0; // use audio channel 0    	if (ioctl(fd, VIDIOCGAUDIO, &va)<0) perror("VIDIOCGAUDIO");    	origaudio = va;    	if (!quiet) fprintf(stderr, "audio volume was '%d'\n", va.volume);    	va.audio = 0;    	va.flags &= ~VIDEO_AUDIO_MUTE; // now this really has to work    	if ((volume==-1 && va.volume<32768) || volume!=-1) {      	if (volume==-1)	{        	va.volume = 32768;            // no more silence 8-)      	}	 else	 {        	va.volume = volume;      	}      	if (!quiet) fprintf(stderr, "audio volume set to '%d'\n", va.volume);    	}    	if (ioctl(fd, VIDIOCSAUDIO, &va)<0) perror("VIDIOCSAUDIO");  } else {    if (!quiet) fprintf(stderr, "channel '%d' has no tuner (composite)\n", info->channel);  }  // setting video mode  vt.tuner = 0;  if(ioctl(fd, VIDIOCGTUNER, &vt)<0) perror("VIDIOCGTUNER");  if (info->ntsc)         { vt.flags |= VIDEO_TUNER_NTSC;  vt.mode |= VIDEO_MODE_NTSC; }    else if (info->secam) { vt.flags |= VIDEO_TUNER_SECAM; vt.mode |= VIDEO_MODE_SECAM; }      else          { vt.flags |= VIDEO_TUNER_PAL;   vt.mode |= VIDEO_MODE_PAL; }  vt.tuner = 0;  if(ioctl(fd, VIDIOCSTUNER, &vt)<0) perror("VIDIOCSTUNER");  // make sure we use the right input  if(ioctl(fd, VIDIOCSCHAN, &vchan)<0) perror("VIDIOCSCHAN");  mm.height = info->height;  mm.width  = info->width;  mm.format = VIDEO_PALETTE_YUV420P    ; /* YCrCb422 */  mm.frame  = 0;  if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTUREi0");  mm.frame  = 1;  if(ioctl(fd, VIDIOCMCAPTURE, &mm)<0) perror("VIDIOCMCAPTUREi1");  	printf("Video init successfull\n");	return 1;  }