subtitles: Get canvas dimensions from codec context

Fixes #1051
Merge remote-tracking branch 'upstream/master'