Make input selectable in v4l2 plugin.

This also includes some refactoring and bugfixes.