Example #1
0
		public TVViewer()
		{
			// initialize sdl stuff
			screen = Sdl.SDL_SetVideoMode(720, 576, 32, Sdl.SDL_HWSURFACE | Sdl.SDL_DOUBLEBUF);
			yuvOverlay = Sdl.SDL_CreateYUVOverlay(720, 576, Sdl.SDL_YUY2_OVERLAY, screen);
			rect = new Sdl.SDL_Rect(0, 0, 720, 576);
			pixels = Marshal.ReadIntPtr(Marshal.ReadIntPtr(yuvOverlay, 20));
			
			// initialize adapter
			adapter = new Adapter("/dev/video0");
			adapter.SetControlValue(Control.Mute, 0);
			
			// set desired capture method
			adapter.CaptureMethod = CaptureMethod.ReadWrite;
			
			// set video format
			VideoCaptureFormat format = new VideoCaptureFormat(720, 576);
			format.PixelFormat = v4l2_pix_format_id.YUYV;
			format.Field = v4l2_field.Interlaced;
			adapter.SetFormat(format);
			
			adapter.Input = adapter.Inputs[adapter.Inputs.IndexOf("Name", "Television")];
			adapter.Standard = adapter.Standards[adapter.Standards.IndexOf("Name", "PAL")];
			
			Events.Quit += quit;
			Events.KeyboardDown += keyDown;
		}
Example #2
0
 static byte[] Init(Adapter adapter, out VideoCaptureFormat format)
 {
     format = new VideoCaptureFormat() {
         Field = Video4Linux.Analog.Kernel.v4l2_field.Any
         ,Width = 358,Height = 288
         ,PixelFormat = Video4Linux.Analog.Kernel.v4l2_pix_format_id.GREY
     };
     adapter.SetFormat(format);
     //adapter.GetFormat(format);
     int count = (int)(format.Width*format.Height*2);
     byte[] buffer = new byte[count];
     //WL("Method "+adapter.CaptureMethod+" "+format.Width+" "+format.Height+" "+format.PixelFormat+" "+format.Field+" "+format.BytesPerLine+" "+count);
     return buffer;
 }