Difference between revisions of "MPlayer integration"
m |
m |
||
Line 36: | Line 36: | ||
vf_overlay is another program that does the same thing. | vf_overlay is another program that does the same thing. | ||
*http://urandom.ca/mebox/downloads.php | *http://urandom.ca/mebox/downloads.php | ||
+ | =Generating overlay bitmaps with SDL= | ||
+ | Our existing SDL code should be able to integrate quite nicely, thanks to the [http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fPixelFormat 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= | =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. | 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= | =See also= | ||
*http://www.mplayerhq.hu/ | *http://www.mplayerhq.hu/ |
Revision as of 21:17, 2 March 2007
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.
Bitmap overlays
Mplayer's menu system, while useable is not ideal. There is too much emphasis on layers of menus.
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.