Xv and MPlayer on Maemo

Last week I had a problem with MPlayer using the option “-wid” while doing some test applications: every time that the video came back from fullscreen (while playing on a given window) it crashed.

After some a lot of tests with the help of Leonardo Sobral, we discovered that Maemo’s Xv had a problem with X errors. Following some info on the maemo-dev list we reached a thread where Daniel Stone (Nokia) and Siarhei Siamashka (MPlayer for Maemo) were having a discussion about bugs on Xv and video output in general.

Daniel Stone gave us a tip of ignoring X errors and just “keep going” as they never happened. After changing some emails with Siarhei, we decided that it was probably the best thing to do.

After that I started reading this document about X (it’s a really good doc for beginners on X) and realized that it was easy to make a patch for MPlayer (actually, Xv driver for MPlayer) to just ignore X errors (we were getting Bad Value error).

Using the function XSetErrorHandler I could set a function to be the error handler. This function must have a signature like this:

 x_window_error_handler(Display *display, XErrorEvent *error_event)

And you can get the error (integer value) inside error_event->error_code . Just did some log procedures and then returned 0 (zero) as nothing happened and there is it! A fully working fullscreen feature on MPlayer when it’s using Xv and “-wid”.

Leave a Reply

Your email address will not be published. Required fields are marked *