[gst-devel] caps negotiation

David Schleef ds at schleef.org
Sun Mar 28 11:45:04 CEST 2004


On Sun, Mar 28, 2004 at 05:57:44PM +0200, Daniel Gazard wrote:
> Hi,
> 
> I'm currently writing a new videosink gstreamer plugin however I'm
> getting a little confused about how caps negotiation is actually
> proceed.
> 
> Suppose that my video sink support a fixed resolution (e.g. 800x600)
> and I want to play a video with a resolution of, say, 320x240. I guess
> it's the job of the video sink to adapt itself to the video by, for
> example, displaying the video in the center of the screen. So the caps
> intersection between the plugin which deals with video decodage and
> the one which aimed to display the video had a resolution of
> 320x240. I'm getting this behavior by do not implementing the getcaps
> method (and therefore giving a range value about the resolution I am
> able to handle).
> 
> However, now suppose that between the plugin which proceed the video
> decodage and the video sink one, there is a plugin which scale the
> video (e.g. gstvideoscale). Here, the only way I found to force the
> scale is to implement my own getcaps function which returns a caps
> with a fixed resolution. The obvious issue with this method is I will
> not be able to connect anymore my plugin directly with a video decoder
> plugin which does not support the same resolution as mine. (I tried to
> play with the _fixate method without any success.)
> 
> What I want to basically do here is, during caps negotiation, asking
> if the other pad support a fixed resolution, if so I use his
> resolution (I adapt myself to his caps); if not, I use mine (he adapt
> itself to my caps). I had browse documentation and a few plugins
> sources but I'm still unable to do what I want. I would be very
> pleased if someone could give advice to do that.

If your video sink can automatically scale, it should provide
"width=(int)[16,4096],height=(int)[16,4096]", and accept any video
size that comes in.

When the user resizes the window, you should gst_pad_try_set_caps()
on the sink pad, and if that is successful, use the new size.  If
it is not successful, then you need to do something interesting with
the knowledge that your video stream is not the same size as your
window.

Video sinks use the size information obtained in the pad link function
to determine the "preferred" size of the window.  The pad link function
is called if a negotiation request comes from upstream (like, say, new
media), but not for negotiation requests originating from the video
sink (the user resizing the window).



dave...





More information about the gstreamer-devel mailing list