support nv12 capture pixel format on linux

This commit is contained in:
Craig Raw
2025-06-03 12:48:01 +02:00
parent 38f0068411
commit 364909cfa3
3 changed files with 4 additions and 3 deletions
@@ -6,6 +6,7 @@ public enum WebcamPixelFormat {
//Only V4L2 formats defined in linux/videodev2.h are required here, declared in order of priority for supported formats
PIX_FMT_RGB24("RGB3", true),
PIX_FMT_YUYV("YUYV", true),
PIX_FMT_NV12("NV12", true),
PIX_FMT_MJPG("MJPG", true);
private final String name;
@@ -182,9 +182,9 @@ public class WebcamService extends ScheduledService<Image> {
}
}
//On Linux, formats not defined in WebcamPixelFormat are unsupported so ask for RGB3
//On Linux, formats not defined in WebcamPixelFormat are unsupported
if(OsType.getCurrent() == OsType.UNIX && WebcamPixelFormat.fromFourCC(format.getFormatInfo().fourcc) == null) {
format.getFormatInfo().fourcc = WebcamPixelFormat.PIX_FMT_RGB24.getFourCC();
log.warn("Unsupported camera pixel format " + WebcamPixelFormat.fourCCToString(format.getFormatInfo().fourcc));
}
if(log.isDebugEnabled()) {