Simplify the indexing logic in the av_encode() streams mapping code.