Movie view does not work sometimes
There are several ways to decode and show GIF format image on android.
I tried using framework’s
Movie class to decode GIF, but it crashes on device which runs 4.1 or later.
Don’t know why that occurs but I need to show animated GIF on all OS version.
So I write a custom view to do that, and in a simple way.
Source can be found on Github.
GIF’s document says that it is encoded in little-endianGIF Specification.
But sometimes the HEADER part is in big-endian, like this.
The first 6 bytes
47 49 46 38 39 61 is
GIF89a, in big-endian. But sometimes in little-endian.(Not confirmed but I found some open source libraries read them by little-endian).
Note that, the following image size sector
7c02 fa00 (width: 636, height: 250) is little-endian.
So I should read bytes first in
BIG_ENDIAN, then turn byte order into
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20