On Sat, 2005-07-16 at 17:51 +0200, Dirk Meyer wrote:
> Right. A kaa-mplayer with only one file seems a little bit stupid. 

It could as easily be bundled with kaa-base.  Or just bundle it and
kaa-xine with kaa-canvas and have kaa-canvas depend on both those.

> One question: how to you plan to mix xine and mplayer in mevas with
> mevas also running on xine/mplayer and fade in/out with only one xv
> engine?

Well, I'm not doing any of this for mevas.  This would be for the new
canvas code.

Anyway, I don't think I understand your question.  I could attempt to
interpret it, but I'd rather you rephrase. :)

But I can explain the architecture ...  The main Freevo or MeBox
interface would run on an Evas canvas rendering to X11 or dfb or
whatever.  (It could even render to the OSD of a PVR-350 using something
very similar to mevas.IvtvCanvas, since mevas.BitmapCanvas is pretty
much the same as evas.BufferCanvas.)   So kaa-canvas will have a
CanvasMovie class that can render video to an evas canvas (using either
xine or mplayer backend, the choice of which will largely be transparent
but configurable [i.e. xine for DVD, mplayer for the rest]).  This works
by having xine/mplayer render the video to a buffer, signaling the
canvas a new frame is available, and the canvas will do colorspace
conversion and update the display.  

With mplayer, this is done using vf_outbuf.  CanvasMovie starts MPlayer
using -vf outbuf, which allocates a buffer accessible over shared
memory.  Then CanvasMovie would attach to this memory and takes each
frame as it comes in, putting it into an evas Image object and updating
the canvas display.  MPlayer at this point does have another window
open, has grabbed the Xv port, but it would be underneath the Freevo
window, and vf_outbuf would prevent it from being drawn to.  When the
user wants to go fullscreen, vf_outbuf begins rendering to both the
buffer and the X11 window (Xv), then the canvas draws a nice
animation/zoom/fade/whatever, and then CanvasMovie object would tell the
root canvas (i.e. the X11 window) to hide, thereby exposing the MPlayer
window.  vf_outbuf then stops sending the video to the buffer.

All this is very hackish.  But I've tested it, and it does work.  If you
use a fairly dark colorkey (rather than the default blue) it looks
pretty seamless.

Another option I've been thinking about using -wid with mplayer, and
having it draw directly on top of the X11Canvas window.  That'd be a
better option for running on a desktop with a window manager and such,
although that's not a use-case I'm very interested in.  (I'm just
interested in a tv-out scenario where there is no window manager
running.)

Now, while the movie is running fullscreen, we want to be able to draw
to it as well.  Could be anything like a nice OSD interface, or
notification alerts -- say the user gets a new email or an instant
message.  The osd would be exposed as another canvas (specifically a
buffer canvas).  So the Freevo/MeBox process takes care of rendering the
OSD image using evas, but it does so to a shared memory buffer which
vf_osd draws to the running video.

A "picture" is worth 1000 words ...

        import kaa
        c = kaa.canvas.X11Canvas((640,480))
        movie = c.add_movie("dvd://", pos=(100,100), size=(400, -1))
        movie.play()
        
        def go_fullscreen(key, movie):
                movie.set_fullscreen(True)
                
                # This will print True
                print isinstance(movie.osd, kaa.canvas.Canvas)
                
                watermark = movie.osd.add_image("watermark.png",
                pos=(10, 10))
                watermark.set_color(a = 150)
                
                # You could even get crazy...
                m2 = movie.osd.add_movie("movie.avi", size=(200, -1))
                m2.set_color((255,200,200,200))
                m2.play()
                
        c.signals["key_press_event"].connect(go_fullscreen, movie)
        kaa.main()
        

So this would open a 640x480 window that has a running video of the DVD
at coordinates 100,100 that's 400 pixels wide.  It's playing and can be
manipulated like any other canvas object (resized, apply a color filter,
etc.)  It would use xine as the backend for this since it's a DVD.  When
the user hits a key in the window, the DVD will go fullscreen and draw
using Xv.  On top of the video, via OSD, will be watermark.png at coords
10,10 with alpha of 150.  Then, also over the OSD, will be a second
running video, movie.avi, that's 200 pixels wide.  (-1 says keep
aspect.)  This movie has a color filter applied -- it will have a
slightly red tint and be slightly transparent.

m2 itself will have an osd attribute.  You could do
m2.osd.add_image("foo.png") and what you'd have is foo.png rendered over
top a movie playing inside another movie that's fullscreen.  Or you
could do m2.add_movie() and see how many many levels you can do this
before your CPU crumbles. :)

So this is my vision.  All the building blocks are either well in place
or I've prototyped it so I know it's possible. 

Jason.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to