pgssubdec: handle more complex PGS scenarios

Add ability to handle multiple palettes and objects simultaneously.
Each simultaneous object is given its own AVSubtitleRect.
Note that there can be up to 64 currently valid objects, but only
2 at any one time can be "presented".

Signed-off-by: Anton Khirnov <anton@khirnov.net>
doc: remove trailing ':' at the end of sections

Also lowercase "options" in "Advanced Video Options" for consistency.
avcodec/pgssubdec: rename PICTURE_SEGMENT

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: do not fail when part of the packet is faulty unless AV_EF_EXPLODE is set

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: split out flush_cache()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: Pass AVSubtitleRect to decode_rle()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: better error codes

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: Bail out of decode_rle() if error and AV_EF_EXPLODE is set

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avcodec/pgssubdec: fix end display time

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '253d0be6a1ecc343d29ff8e1df0ddf961ab9c772'

* commit '253d0be6a1ecc343d29ff8e1df0ddf961ab9c772':
  pgssubdec: handle more complex PGS scenarios

Conflicts:
	libavcodec/pgssubdec.c

Some of this has been split out and commited in cleanly split patches immedeately
before this merge

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Support raw dvdsub palette as stored on normal dvd's

This is how the palette is stored on dvd's. Currently
only xbmc passes the palette information to libavcodec
this way.
Check return value of avio_seek and avoid modifying state if it fails

The code still modifies state if the timestamp is not found. Not
sure exactly how to avoid that.
asf hacks
if av_read_packet returns AVERROR_IO, we are done. ffmpeg's codecs might or might not handle returning any completed demuxed packets correctly
added: Ticket #7187, TV Teletext support for DVB EBU Teletext streams
Don't accept mpegts PMT that isn't current
Don't reparse PMT unless it's version has changed
Read PID timestamps as well as PCR timestamps to find location in mpegts stream
Get stream durations using read_timestamp
changed: allow 4 second skew between streams in mov before attempting to seek