riff: Move demuxing code to a separate file.