예제 #1
0
static GstFlowReturn
gst_vdp_sink_get_output_buffer (VdpSink * vdp_sink, GstCaps * caps,
    GstBuffer ** buf)
{
  GstStructure *structure;
  gint width, height;
  gint rgba_format;

  structure = gst_caps_get_structure (caps, 0);
  if (!gst_structure_get_int (structure, "width", &width) ||
      !gst_structure_get_int (structure, "height", &height) ||
      !gst_structure_get_int (structure, "rgba-format", &rgba_format)) {
    GST_WARNING_OBJECT (vdp_sink, "invalid caps for buffer allocation %"
        GST_PTR_FORMAT, caps);
    return GST_FLOW_ERROR;
  }

  *buf = GST_BUFFER (gst_vdp_output_buffer_new (vdp_sink->device,
          rgba_format, width, height));
  if (*buf == NULL) {
    return GST_FLOW_ERROR;
  }

  gst_buffer_set_caps (*buf, caps);

  return GST_FLOW_OK;
}
static GstVdpBuffer *
gst_vdp_output_buffer_pool_alloc_buffer (GstVdpBufferPool * bpool,
    GError ** error)
{
  GstVdpOutputBufferPool *opool = GST_VDP_OUTPUT_BUFFER_POOL (bpool);
  GstVdpDevice *device;

  device = gst_vdp_buffer_pool_get_device (bpool);
  return GST_VDP_BUFFER_CAST (gst_vdp_output_buffer_new (device,
          opool->rgba_format, opool->width, opool->height, error));
}