GNOME Bugzilla – Bug 538656
xvimagesink support for autofill/colorkey property
Last modified: 2008-07-29 08:59:30 UTC
Curretly xvimagesink does autofill-colorkey. That is it fills the drawable with the colorkey so that you see the video. The programmer can fill the drawable by himself with the colorkey he chooses and paint things (like rectangles) with a different color over it. The video will be seen where the colorkey is visible.
Nieto, Noe M schrieb: > Hi everybody, > > > > I am writing an application where the user should be able to draw > (with the mouse) a rectangle on a playing video window (for now it is > an ximagesink). Thats not so easy. Curretly xvimagesink does autofill-colorkey. That is it fills the drawable with the colorkey so that you see the video. Please file an enhancement request, so that xvimagesink supports a property to turn off autofill and another to tell you about the colorkey. Then you can fill the drawable yourself with the colorkey and paint your rectangle in a different color over it. The video will be seen where the colorkey is visible. Stefan > > > > I try the following but I see nothing drawing on the screen… > > ### CONFIGURE PIPELINE TO CATCH SYNC MESSAGES > > bus = self.Pipeline.get_bus() > > bus.add_signal_watch() > > bus.enable_sync_message_emission() > > bus.connect('message', self.on_message) > > bus.connect('sync-message::element', self.on_sync_message) > > > > > > ############# > > ## Tell ximagesink to draw into the draw area that I give it, not in > it’s own … > > def on_sync_message(self, bus, message): > > if message.structure is None: > > return > > message_name = message.structure.get_name() > > if message_name == "prepare-xwindow-id": > > imagesink = message.src > > imagesink.set_property("force-aspect-ratio", True) > > imagesink.set_xwindow_id(self.DrawingArea.window.xid) > > > > ############# > > ## Now, on the expose event of the drawing area, paint the rectangle > according to user input (mouse) > > ############# > > def on_DrawingAreaCamera_expose_event(self,widget,event): > > #if self.area_selection_now is True: > > context = widget.window.cairo_create() > > #widget.window.draw(context) > > context.rectangle(self.area_selection) > > context.set_source_rgb(1,0,0) > > context.stroke() > > > > > > What is the right way to interact with ximagesink, so I can also draw > things on it’s drawable?? > > > > Regards >
*** Bug 538659 has been marked as a duplicate of this bug. ***
Its not mandatory for drivers to support those. The options I see so far: 1) 4 normal object properties gboolean autofill gboolean has-autofill GdkColor colorkey gboolean has-colorkey 2) a colorkey interface with two iface properties gboolean autofill GdkColor colorkey 2) only makes sense if similar colorkey handling exists anywhere else. It would also rely on GstImplementsInterface (as we know of the atoms when probing the hardware)
Setting properties is allowed to fail silently, so 'has-*' is not necessary. The application is responsible for reading back the property to see that is has the intended value.
Created attachment 113397 [details] [review] implement custom colorkey handling
Created attachment 113398 [details] test application small standalone test app, that does fakeshading with a checker pattern
Noe, have you had a chance to try the change?
Tonight I will download a snapshot and try it. I will let you know ...
One more thing. Right now the "colorkey" property exposes the color key the gstreamer sets (which right now is rgb={1,2,3}). I made the "colorkey" property readonly and just allow the app to query this so far. We might also want to allow the application to set a colorkey.
Thaytan was okay with this on irc too. 2008-07-29 Stefan Kost <ensonic@users.sf.net> * sys/xvimage/xvimagesink.c: * sys/xvimage/xvimagesink.h: Add autofill/colorkey properties. Fixes #538656.