[MPlayer-dev-eng] [PATCH] fix SAMI parsing

Howard Chu hyc at highlandsun.com
Sun Jun 6 22:18:11 CEST 2010


Hulu provides closed captions in (encrypted) SAMI format. After decryption, 
they still don't display properly in mplayer due to a number of parsing bugs. 
This patch fixes these issues.

Sorry for the whitespace/tabs, this file already had tabs and inconsistent 
whitespace so I had no idea what to do about it.

First, the Start= parameter is quoted, this patch skips the quote before 
calling strtol.

Second, there are other tags besides <br> used to end a line; the code was 
losing the latter parts of multi-line captions.

Third, SAMI can contain other HTML entities besides &nbsp; and they should be 
decoded. In this case I only checked for numeric entities, and mark the sub as 
utf8 if any are found. (Hulu uses &#9834; the Eight Note symbol, to indicate 
music when no other dialog is occurring.)
-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sub.txt
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100606/2a2af286/attachment.txt>


More information about the MPlayer-dev-eng mailing list