lavc/utils: Add support for discarding samples from the end