Cairooverlay and aspect ratios
Robert Schroll
rschroll at gmail.com
Tue Mar 3 15:26:35 PST 2015
Hi all,
I have an application using Gstreamer (via Vala and glib) that I'm
trying to update from 0.10 to 1.0. It features a pipeline with two
overlay video sinks. They have the same aspect ratio as each other,
but may have a different aspect ratio than the movie itself. On one
of the video outputs, I use a cairooverlay (and several converters) to
display a simple UI to control the movie. The code is online if you'd
like to see it: [1] shows where most of the pipeline is established and
[2] shows where the cairooverlay and its helpers are created.
In Gstreamer 0.10, both video outputs were scaled to completely fill
the output rectangle. Therefore, the cairooverlay worked out what that
scaling would be and distorted itself inversely to show up undistorted
on the display.
In Gstreamer 1.0 by default, the video output gets black bars on the
edges so that it isn't distorted when the output aspect ratio doesn't
match the movie aspect ratio. I can disable this for one output path
by setting force_aspect_ratio = false on the playbin that starts the
pipeline. But if I have two outputs, this only has an effect on the
last output. The first one still shows the letterboxing. So:
Question #1) Is there a way to disable force_aspect_ratio on all
outputs from the playbin?
Arguably, the letterboxing looks better than the distored video, so I'd
be okay using it for all outputs. But the cairooverlay (i) gets in its
caps_changed signal the dimensions of the output rectangle and (ii)
only gets drawn over the region of that rectangle that actually
contains the movie frame. Together, this means that the overlay gets
distorted in a manner it cannot know. So:
Question #2a) Is there a way to get the original movie dimensions in
the cairooverlay, so it can counter-act the deformation it will get in
being squished to cover only the frame?
Question #2b) Is there a way to let the cairooverlay draw over the
whole output rectangle, not just the region of the frame?
I hope this is clear to everyone, but if not, please let me know. I'll
do my best to clarify what I can.
Thanks,
Robert
[1]
https://github.com/rschroll/pdfpc/blob/gst1.0/src/classes/action/movie.vala#L232
[2]
https://github.com/rschroll/pdfpc/blob/gst1.0/src/classes/action/movie.vala#L439
More information about the gstreamer-devel
mailing list