Hi,<br><br>I have questions about upstream caps renegotiation.  I&#39;ve read <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-upstream.html" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-nego-upstream.html</a> but I still have questions on the concrete implementation.<br>

<br>I&#39;m not sure what to do when caps needs to be renegotated.  As an example, let&#39;s take a simple plugin that takes a video stream from its sink pad, does a simple thing to it by copying it into another buffer, then pushes that buffer on its source pad.<br>
<br>The chain function would try to get the output buffer using gst_pad_alloc_buffer.  In the normal case, it would return a buffer of the same caps.<br><br>But in case of caps renegotiation coming from upstream, the buffer caps might be different.  And I wonder what to do in that case.  I have kind of a tree of questions about what to do in every case.  I guess the first thing to do would be to try to set the caps on the plugin&#39;s source pad (gst_pad_set_caps), which would in turn set the caps on the plugin&#39;s sink pad.<br>
<br>1) If gst_pad_set_caps function fails on the source pad (which would have also tried to call it on the sink pad), I guess this means that the negotiation failed (no possible format from downstream).  So the chain function should stop what it is doing, unref the input buffer and the output buffer, and return GST_FLOW_NOT_NEGOTIATED?<br>
2) If gst_pad_set_caps function succeeds on the sink pad, I guess it means the caps were succesfully negotiated upstream.  So what happens to the input buffer during all that procedure?  Is it still valid or not?<br>3) If it&#39;s not valid, I guess the chain function just has to stop what it&#39;s doing, unref the output (and the input?) buffer, but what should it returns as a return value?<br>
4) If the input buffer is still valid after caps renegotiation, I see two possibilities: it either can be used with the new caps or it cannot.  For instance, if the plugin is just flipping an image upside down, maybe it&#39;s able to flip a yuv buffer into another yuv buffer, a rgb buffer into another rgb buffer, but not a yuv buffer into a rgb buffer.  So two possibilities depending on wether the plugin can convert the buffer in the old caps into a buffer in the new caps.<br>
5) If it can do it, I guess there is no problem and the chain function just does it and returns GST_FLOW_OK<br>6) But if it can&#39;t do it, what does the function do?  I guess it unrefs the input &amp; output buffer, but what would the return value be?<br>
<br>Thanks a lot in advance for any explanations,<br><br>Martin<br>