Esempio n. 1
0
static GstDucatiBuffer *
gst_ducati_buffer_new (GstPvrBufferPool * pool)
{
  PVR2DERROR pvr_error;
  GstDucatiBuffer *self = (GstDucatiBuffer *)
      gst_mini_object_new (GST_TYPE_DUCATIBUFFER);

  GST_LOG_OBJECT (pool->element, "creating buffer %p in pool %p", self, pool);

  self->pool = (GstPvrBufferPool *)
      gst_mini_object_ref (GST_MINI_OBJECT (pool));

  GST_BUFFER_DATA (self) = gst_ducati_alloc_1d (pool->size);
  GST_BUFFER_SIZE (self) = pool->size;
  GST_LOG_OBJECT (pool->element, "width=%d, height=%d and size=%d",
      pool->padded_width, pool->padded_height, pool->size);

  pvr_error =
      PVR2DMemWrap (pool->pvr_context, GST_BUFFER_DATA (self), 0, pool->size,
      NULL, &(self->src_mem));
  if (pvr_error != PVR2D_OK) {
    GST_LOG_OBJECT (pool->element, "Failed to Wrap buffer memory"
        "returned %d", pvr_error);
  } else {
    self->wrapped = TRUE;
  }

  gst_buffer_set_caps (GST_BUFFER (self), pool->caps);

  return self;
}
Esempio n. 2
0
static void
gst_ducati_viddec_get_property (GObject * obj,
    guint prop_id, GValue * value, GParamSpec * pspec)
{
  GstDucatiVidDec *self = GST_DUCATIVIDDEC (obj);

  switch (prop_id) {
    case PROP_VERSION: {
      int err;
      char *version = gst_ducati_alloc_1d (VERSION_LENGTH);

      /* in case something fails: */
      snprintf (version, VERSION_LENGTH, "unsupported");

      if (! self->engine)
        engine_open (self);

      if (! self->codec)
        codec_create (self);

      if (self->codec) {
        self->status->data.buf = (XDAS_Int8 *) TilerMem_VirtToPhys (version);
        self->status->data.bufSize = VERSION_LENGTH;

        err = VIDDEC3_control (self->codec, XDM_GETVERSION,
            self->dynParams, self->status);
        if (err) {
          GST_ERROR_OBJECT (self, "failed XDM_GETVERSION");
        }

        self->status->data.buf = NULL;
        self->status->data.bufSize = 0;
      }

      g_value_set_string (value, version);

      MemMgr_Free (version);

      break;
    }
    default: {
      G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
      break;
    }
  }
}
Esempio n. 3
0
static gboolean
codec_create (GstDucatiVidDec * self)
{
  gint err;
  const gchar *codec_name;

  codec_delete (self);

  if (G_UNLIKELY (!self->engine)) {
    GST_ERROR_OBJECT (self, "no engine");
    return FALSE;
  }

  /* these need to be set before VIDDEC3_create */
  self->params->maxWidth = self->width;
  self->params->maxHeight = self->height;

  codec_name = GST_DUCATIVIDDEC_GET_CLASS (self)->codec_name;

  /* create codec: */
  GST_DEBUG_OBJECT (self, "creating codec: %s", codec_name);
  self->codec = VIDDEC3_create (self->engine, (String)codec_name, self->params);

  if (!self->codec) {
    return FALSE;
  }

  err = VIDDEC3_control (self->codec, XDM_SETPARAMS, self->dynParams, self->status);
  if (err) {
    GST_ERROR_OBJECT (self, "failed XDM_SETPARAMS");
    return FALSE;
  }

  self->first_in_buffer = TRUE;
  self->first_out_buffer = TRUE;

  /* allocate input buffer and initialize inBufs: */
  self->inBufs->numBufs = 1;
  self->input = gst_ducati_alloc_1d (self->width * self->height);
  self->inBufs->descs[0].buf = (XDAS_Int8 *) TilerMem_VirtToPhys (self->input);
  self->inBufs->descs[0].memType = XDM_MEMTYPE_RAW;

  return TRUE;
}