static GstFlowReturn get_buffer (GstMonoscope * monoscope, GstBuffer ** outbuf) { GstFlowReturn ret; if (GST_PAD_CAPS (monoscope->srcpad) == NULL) { if (!gst_monoscope_src_negotiate (monoscope)) return GST_FLOW_NOT_NEGOTIATED; } GST_LOG_OBJECT (monoscope, "allocating output buffer of size %d with caps %" GST_PTR_FORMAT, monoscope->outsize, GST_PAD_CAPS (monoscope->srcpad)); ret = gst_pad_alloc_buffer_and_set_caps (monoscope->srcpad, GST_BUFFER_OFFSET_NONE, monoscope->outsize, GST_PAD_CAPS (monoscope->srcpad), outbuf); if (ret != GST_FLOW_OK) return ret; if (*outbuf == NULL) return GST_FLOW_ERROR; return GST_FLOW_OK; }
/* make sure we are negotiated */ static GstFlowReturn ensure_negotiated (GstMonoscope * monoscope) { gboolean reconfigure; reconfigure = gst_pad_check_reconfigure (monoscope->srcpad); /* we don't know an output format yet, pick one */ if (reconfigure || !gst_pad_has_current_caps (monoscope->srcpad)) { if (!gst_monoscope_src_negotiate (monoscope)) return GST_FLOW_NOT_NEGOTIATED; } return GST_FLOW_OK; }