Ejemplo n.º 1
0
static void
unwrap_buffer (gpointer buffer, gpointer user_data)
{
  PVR2DERROR pvr_error;
  GstDucatiBuffer *buf = GST_DUCATIBUFFER (buffer);
  GstPvrBufferPool *pool = (GstPvrBufferPool *) user_data;

  if (buf->wrapped) {
    pvr_error = PVR2DMemFree (pool->pvr_context, buf->src_mem);
    if (pvr_error != PVR2D_OK) {
      GST_ERROR_OBJECT (pool->element, "Failed to Unwrap buffer memory"
          "returned %d", pvr_error);
    }
    buf->wrapped = FALSE;
  }
}
Ejemplo n.º 2
0
static gint
codec_process (GstDucatiVidDec * self, gboolean send, gboolean flush)
{
  gint err;
  GstClockTime t;
  GstBuffer *outbuf = NULL;
  gint i;

  self->outArgs->outputID[0] = 0;
  self->outArgs->freeBufID[0] = 0;

  t = gst_util_get_timestamp ();
  err = VIDDEC3_process (self->codec,
      self->inBufs, self->outBufs, self->inArgs, self->outArgs);
  GST_INFO_OBJECT (self, "%10dns", (gint) (gst_util_get_timestamp () - t));

  if (err) {
    GST_WARNING_OBJECT (self, "err=%d, extendedError=%08x",
        err, self->outArgs->extendedError);

    err = VIDDEC3_control (self->codec, XDM_GETSTATUS,
        self->dynParams, self->status);

    GST_WARNING_OBJECT (self, "XDM_GETSTATUS: err=%d, extendedError=%08x",
        err, self->status->extendedError);

    if (XDM_ISFATALERROR (self->outArgs->extendedError) || flush) {
      /* we are processing for display and it is a non-fatal error, so lets
       * try to recover.. otherwise return the error
       */
      err = XDM_EFAIL;
    }
  }

  for (i = 0; self->outArgs->outputID[i]; i++) {
    if (G_UNLIKELY (self->first_out_buffer) && send) {
      /* send region of interest to sink on first buffer: */
      XDM_Rect *r = &(self->outArgs->displayBufs.bufDesc[0].activeFrameRegion);

      GST_DEBUG_OBJECT (self, "setting crop to %d, %d, %d, %d",
          r->topLeft.x, r->topLeft.y, r->bottomRight.x, r->bottomRight.y);

      gst_pad_push_event (self->srcpad,
          gst_event_new_crop (r->topLeft.y, r->topLeft.x,
              r->bottomRight.x - r->topLeft.x,
              r->bottomRight.y - r->topLeft.y));

      self->first_out_buffer = FALSE;
    }

    outbuf = codec_get_outbuf (self, self->outArgs->outputID[i]);
    if (send) {
      if (GST_IS_DUCATIBUFFER (outbuf)) {
        outbuf = gst_ducati_buffer_get (GST_DUCATIBUFFER (outbuf));
      }
      GST_DEBUG_OBJECT (self, "got buffer: %d %p (%" GST_TIME_FORMAT ")",
          i, outbuf, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
      gst_pad_push (self->srcpad, outbuf);
    } else {
      GST_DEBUG_OBJECT (self, "free buffer: %d %p", i, outbuf);
      gst_buffer_unref (outbuf);
    }
  }

  for (i = 0; self->outArgs->freeBufID[i]; i++) {
    codec_unlock_outbuf (self, self->outArgs->freeBufID[i]);
  }

  return err;
}