Add arguments always_2d, out and fill_value

See also #16

If less frames are left in the file than would fit into out and
fill_value=None, a smaller view into out is returned that contains only
the valid frames.
Factor out _read_or_write()