public object InterfaceControl(MIGInterfaceCommand request) { request.response = ""; //default success value // if (request.command == Command.CAMERA_GETPICTURE) { // get picture from camera <nodeid> // there is actually only single camera support though // TODO: check if file exists before opening it ("/dev/video0") if (_camerasource != IntPtr.Zero) { PictureBuffer pb = CameraCaptureV4LInterop.GetFrame(_camerasource); var data = new byte[pb.Size]; Marshal.Copy(pb.Data, data, 0, pb.Size); //System.IO.File.WriteAllBytes("html/test.jpg", data); return(data); } } else if (request.command == Command.CAMERA_GETLUMINANCE) { // TODO: .... } // return(request.response); }
/// <summary> /// Deallocates the picture buffer and resets the related buffer properties /// </summary> private unsafe void Deallocate() { if (PictureBuffer == IntPtr.Zero) { return; } ffmpeg.av_free(PictureBuffer.ToPointer()); PictureBuffer = IntPtr.Zero; PictureBufferLength = 0; PictureBufferStride = 0; PixelWidth = 0; PixelHeight = 0; }
public PictureRenderer(PictureBuffer pictureBuffer) { this.buffer = pictureBuffer ?? throw new ArgumentNullException(nameof(pictureBuffer)); }