xbmc/xbmc — pull request #501 by CrystalP (2011-10-20 06:49:43+00:00)
Title: Clean the font cache directory before playing. Helps with ticket 12023.

The fonts embedded in an mkv are extracted every time a file is played and they accumulate over time in the special://temp/fonts directory. There doesn't seem to be a cleanup mechanism.

There are two issues:

- potential for conflicts with fonts extracted for a previous mkv file. The fonts are specified by name in ass scripts, not by file name. There could be (by accident or by malice) different fonts with the same name and different file names, and a font extracted earlier could be used instead of the font embedded in the file that's about to play. That seems to be the problem of ticket 12023.

- over time it could end up using a significant amount of disk space. Also takes slightly longer for libass to initialize if it has to search each font from a bunch of files, instead of just the few that came with the mkv.

This patch is simplistic and deletes all cached fonts when dvdplayer is initialized. The fonts are extracted from the mkv in dvdplayer::AddStream.

Chances are pretty good this is not the best place to put the fix and maybe the way to delete is also bad.
So please let me know what I did wrong :) I think this should be in Eden.