GNOME Bugzilla – Bug 739566
gdkpixbufoverlay: Fix relative-x/y and widen their range to support scolling images in/out of frame with GstController
Last modified: 2014-12-25 15:41:50 UTC
Range change reason : sliding an image in and out of the video frame with GstController relative-x was relative to overlay size not video frame size.
Created attachment 289896 [details] [review] Fix relative-x/y and change their range
Right now "xpos" tries to center the text and CLAMPs it : *xpos = (gint) (overlay->width * overlay->xpos) - width / 2; *xpos = CLAMP (*xpos, 0, overlay->width - width); This conflicts with GstController usage mostly because of the CLAMP but also because it doesn't offer precise positioning since text width is variable I propose we add a "center-on-xpos" property that makes xpos behave like it does now but when set to FALSE it removes the CLAMP and just sets xpos to "overlay->width * overlay->xpos" Same should be done for ypos and for gdkpixbufoverlay's relative-x/y
Upon further thought I think implementing a new non-property-range based controller would make more sense
Got a new suggestion then?
There's a positioning bug when offset-x is negative. Test : gst-launch-1.0 videotestsrc num-buffers=100 ! gdkpixbufoverlay offset-x=-50 location=/home/claudiu/overlay.png ! x264enc ! mp4mux ! filesink location=/tmp/out.mp4
Created attachment 291175 [details] [review] Fix positioning
Comment on attachment 291175 [details] [review] Fix positioning Well, the problem is that it's clearly not a positioning bug, but on purpose as per the property description: "For positive value, horizontal offset of overlay image in pixels from left of video image. For negative value, horizontal offset of overlay image in pixels from right of video image". So you're just changing this to suit your own needs, but someone else might be relying on the previous interpretation of negtive values.
Created attachment 291193 [details] [review] Added absolute properties
Thanks for the patch. After further discussion on IRC we decided to go or a positioning-mode property after all, so that we don't add even more offset properties, but just change the interpretation of the existing one: commit f0e8821f76e3b82027e21a3b6f261d378d3aa906 Author: Tim-Philipp Müller <tim@centricular.com> Date: Thu Dec 25 14:58:12 2014 +0000 tests: gdkpixbufoverlay-test: use absolute positioning to fix demo https://bugzilla.gnome.org/show_bug.cgi?id=739566 commit b76595d67eb8c56830ab7c1cb55a45c660b3394f Author: Tim-Philipp Müller <tim@centricular.com> Date: Thu Dec 25 14:53:09 2014 +0000 gdkpixbufoverlay: add "positioning-mode" property to allow absolute positions Set positioning-mode=pixels-absolute to allow positioning with absolute coordinates, meaning negative x/y offsets will be interpreted as being to the left/above the video frame instead of being interpreted as relative to the right/bottom edge of the video frame (which is a silly default, but that's how it is). This means we can nicely slide images into and out of the frame, see gdkpixbufoverlay-test. https://bugzilla.gnome.org/show_bug.cgi?id=739566 Now what's still missing is the direct/absolute support for GstController :)