Refactor V4L2 and X11 grabbers to share more code