xbmc/xbmc — pull request #2122 by amejia1 (2013-01-26 07:38:23+00:00)
Title: Libarchive RAR support

These changes are for finally getting XBMC using libarchive for RAR support. These changes will work with the latest git snapshot of libarchive, of which I plan on making a new release soon.

I did a few tests of the current implementation of RAR support in XBMC with the new libarchive changes. On average, using a build of XBMC with optimizations enabled had these run times.
TestRarFile.StoredRAR = 130ms
TestRarFile.NormalRAR = 50ms

So somehow, processing a compressed RAR works faster than a stored RAR. Now with a debug build of XBMC (optimizations disabled, debug enabled) using a debug build of libarchive, these were the times.

TestRarFile.StoredRAR = 6ms
TestRarFile.NormalRAR = 12ms

So to me it seems the changes needed to start using libarchive is worth the effort.

I also added a test case for a single large file in an uncompressed multivolume RAR. I tried cherry picking this change into master, but the test case failed miserably (wrong offsets, wrong data read). I'm not going to look into what could be the problem. I did do a comparison of the run times for running the multivolume test case using an optimized build of XBMC with the current RAR implementation against a debug build of XBMC using a debug build of libarchive. On average, current XBMC ran the multivolume test case at 170ms. The libarchive changes ran the test case at 5ms (yes five milliseconds, not a typo). So again, it should be clear that the switch to using libarchive is worth the effort.