コード例 #1
0
/**
 * gst_video_buffer_set_overlay_composition:
 * @buf: a #GstBuffer
 * @comp: (allow-none): a #GstVideoOverlayComposition, or NULL to clear a
 *     previously-set composition
 *
 * Sets an overlay composition on a buffer. The buffer will obtain its own
 * reference to the composition, meaning this function does not take ownership
 * of @comp.
 *
 * Since: 0.10.36
 */
void
gst_video_buffer_set_overlay_composition (GstBuffer * buf,
        GstVideoOverlayComposition * comp)
{
    gst_buffer_set_qdata (buf, GST_OVERLAY_COMPOSITION_QUARK,
                          gst_structure_id_new (GST_OVERLAY_COMPOSITION_QUARK,
                                  COMPOSITION_QUARK, GST_TYPE_VIDEO_OVERLAY_COMPOSITION, comp, NULL));
}
コード例 #2
0
GstFlowReturn GStreamerReader::AllocateVideoBufferFull(GstPad* aPad,
                                                       guint64 aOffset,
                                                       guint aSize,
                                                       GstCaps* aCaps,
                                                       GstBuffer** aBuf,
                                                       nsRefPtr<PlanarYCbCrImage>& aImage)
{
  /* allocate an image using the container */
  ImageContainer* container = mDecoder->GetImageContainer();
  ImageFormat format = PLANAR_YCBCR;
  PlanarYCbCrImage* img = reinterpret_cast<PlanarYCbCrImage*>(container->CreateImage(&format, 1).get());
  nsRefPtr<PlanarYCbCrImage> image = dont_AddRef(img);

  /* prepare a GstBuffer pointing to the underlying PlanarYCbCrImage buffer */
  GstBuffer* buf = gst_buffer_new();
  GST_BUFFER_SIZE(buf) = aSize;
  /* allocate the actual YUV buffer */
  GST_BUFFER_DATA(buf) = image->AllocateAndGetNewBuffer(aSize);

  aImage = image;

#if GST_VERSION_MICRO >= 36
  /* create a GBoxed handle to hold the image */
  BufferData* data = new BufferData(image);

  /* store it in a GValue so we can put it in a GstStructure */
  GValue value = {0,};
  g_value_init(&value, buffer_data_get_type());
  g_value_take_boxed(&value, data);

  /* store the value in the structure */
  GstStructure* structure = gst_structure_new("moz-reader-data", nullptr);
  gst_structure_take_value(structure, "image", &value);

  /* and attach the structure to the buffer */
  gst_buffer_set_qdata(buf, g_quark_from_string("moz-reader-data"), structure);
#endif

  *aBuf = buf;
  return GST_FLOW_OK;
}