MPlayer integration

From Organic Design wiki
Revision as of 21:32, 2 March 2007 by Rob (talk | contribs) (front panel and menus)

Mplayer has become somewhat of a monolithic application in the linux world. Our use of mplayer will be to delegate to it the task which it does best, while retaining control over all other aspects. In particular the user interface provided by mplayer is somewhat primitive (athough extensible). It does however allow a bitmap overlay in real time via a pipe. This enables another program to generate the interface and have mplayer display it.

Design ideas

My media center requires that the most common functions be available via the front panel without the need to use the remote control.

  • Play, stop, pause
  • Chapter seek (DVD), Playlist seek (USB/Data disc), Photo seek (by directory or category)
    • Foward, back
  • Input device select - Radio, DVD, USB (whatever is connected), Network - one button - matrix display reflects current setting
  • Media select (video/photo/audio/all) - one button - matrix display reflects current setting

Mplayer's menu system, while useable is not ideal. There is too much emphasis on layers of menus.

The simplicity of the font panel controls will be reflected in the remote control buttons. I want to avoid traversing a menu with the remote entirely. In cases where we want to access heirarchical structures, thumbnails of the content are more appropriate than text lists. Who cares if the name of a picture is dcs1273563254.jpg - this has no meaning.

Bitmap overlays

bmovl is mplayer's built in overlay engine. When invoking mplayer in slave mode you can use this command to begin to use the bitmap overlay

bmovl=hidden:opaque:<fifo>
    Read bitmaps from a FIFO and display them in window.

        hidden: sets the default value of the 'hidden' flag (boolean)
        opaque: flag switching between alphablended (transparent) and opaque (fast) mode
        fifo: path/filename for the FIFO (named pipe connecting mplayer -vop bmovl to the controlling application) 

    FIFO commands are: 

    RGBA32 width height xpos ypos alpha clear
    followed by width*height*4 bytes of raw RGBA32 data.

    ABGR32 width height xpos ypos alpha clear
    followed by width*height*4 bytes of raw ABGR32 data.

    RGB24 width height xpos ypos alpha clear
    followed by width*height*3 bytes of raw RGB32 data.

    BGR24 width height xpos ypos alpha clear
    followed by width*height*3 bytes of raw BGR32 data. <fifo>

See the mplayer man page this information was taken from for more details.


There is a program called Realtime Video Effects that makes it easy to feed Mplayer the correct bitmaps to display dynamic content over the top of video.

vf_overlay is another program that does the same thing.

Generating overlay bitmaps with SDL

Our existing SDL code should be able to integrate quite nicely, thanks to the SDL_PixelFormat function. This function specifies the bit packing for the SDL surface to be created. As long as this packing matches whatever packing is used in the overlay the bitmaps should work together. All that is required is a serialise function that will send the raw bitmap data into mplayer's pipe.

Limitations

Mplayer's codecs do not handle review well - that is visually seeking backwards through video. This is the fault of the MPEG format, as the compresion is not desiged to play backwards.

See also