public H264(VideoDevice device) { this.device = device; // Pi4 only supports two: // "H.264", H264 // "Motion-JPEG", MJPEG sImageFormatDescription formatDesc = device.enumerateFormats(inputBufferType) .first(i => i.pixelFormat == inputPixelFormat, "h.264 decoder requires a hardware capable of decoding h.264. The provided video device can’t do that."); // Logger.logVerbose( "Compressed format: {0}", formatDesc ); inputFormat = new sImageFormat(ref formatDesc); // We gonna be using NV12, but generally speaking Pi4 supports following: // "Planar YUV 4:2:0", YUV420 // "Planar YVU 4:2:0", YVU420 // "Y/CbCr 4:2:0", NV12 // "Y/CrCb 4:2:0", NV21 // "16-bit RGB 5-6-5", RGB565 formatDesc = device.enumerateFormats(outputBufferType) .first(i => i.pixelFormat == outputPixelFormat, "h.264 decoder requires a hardware capable of decoding h.264 into NV12. The provided video device can’t do that."); outputFormat = new sImageFormat(ref formatDesc); inputSize = SizeSupported.query(device, inputPixelFormat); outputSize = SizeSupported.query(device, outputPixelFormat); }
void dbgPrintEncodedFormats() { Logger.logVerbose("Video output formats:"); foreach (var f in device.enumerateFormats(eBufferType.VideoOutputMPlane)) { Logger.logVerbose("{0}", f); } }