Change handling of out argument

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.
Add helper function _check_frames_and_channels()