Speed up packet processing for Matroska demuxed subs

**Not for merge, discussion only!**

Processing packets from Matroska demuxed subs with ass_process_chunk() can be pretty slow. It uses an O(n) algorithm to check for packet duplicates. Likewise, every ass_render_frame() call must go through the whole event list.

This pull requests tries to fix this.