subtitles: Get canvas dimensions from codec context

Fixes #1051