paperview
paperview copied to clipboard
Is there any way to support videos?
Curious if this could be done as converting even just a 30fps video loop to bmps is a bit much given the amount of data you end up with
Video Loop: 30 sec., 30fps mp4: 3,7MB bpms: 5,58 GB
While many are probably fine with pixel style low fps loops, I personally can't stand it ':D
Yup, its pretty insane. Paperview is meant for running small 15 frame gifs that expand nicely into bitmaps since SDL2 has a built in bitmap loader. This keeps the code portable and about 100 lines at its core which is ideal for gathering upvotes on reddit ;D. People love small compact codes that do fun things.
But anyway, the gist to streaming whole mp4s to the wallpaper is to write a video player with SDL2, using the conventional setup where you render to the usual window. A tutorial is here:
http://dranger.com/ffmpeg/
The final step is to incorporate X11 by swapping out the window creation function, SDL_CreateWindow(), and hook it up to the X11 root display:
#include <SDL2/SDL.h>
#include <X11/Xlib.h>
...
Display* x11d = XOpenDisplay(NULL);
Window x11w = RootWindow(self.x11d, DefaultScreen(x11d));
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindowFrom((void*) x11w);
Thus, two libraries are relied on, SDL2, and X11 Xlib, and the final compile, assuming you put everything in main.c, is:
gcc main.c -lSDL2 -lX11 -o tadlyview
If you can get it right I am sure you will gather a good following!
Hi, Thanks to @glouw's tip, I managed to follow the basic idea of the Dranger's tutorial (although it's out of date, again) and created a video player (no audio) with libav and SDL2, which uses the X11 root window, like paperview. If you want to take a look: https://github.com/Theldus/anipaper
That's awesome, nice work.