Video Live Wallpaper, Part 3

In the last post, we saw what we needed to do in order to use FFmpeg to decode a video. In particular, we loaded a video, decoded a frame, and saved it into pFrameConverted->data[0]. All that remains is to display this frame on the phone. For that we’re going to use GLWallpaperService. It works just like a regular WallpaperService except that you can run OpenGL code.

For the remainder, I’m going to assume that you know how to create a live wallpaper—nothing fancy, just the basic “hello world” live wallpaper. Another prerequisite is that you’ve read Dranger’s FFmpeg tutorials, namely Tutorials 1 and 2.

The idea is to grab a video frame, draw the frame on the texture, then draw the texture on the screen using the correct aspect ratio.

Continue reading