static void
gst_v4l2_transform_finalize (GObject * object)
{
  GstV4l2Transform *self = GST_V4L2_TRANSFORM (object);

  gst_v4l2_object_destroy (self->v4l2capture);
  gst_v4l2_object_destroy (self->v4l2output);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_v4l2_video_dec_finalize (GObject * object)
{
  GstV4l2VideoDec *self = GST_V4L2_VIDEO_DEC (object);

  gst_v4l2_object_destroy (self->v4l2capture);
  gst_v4l2_object_destroy (self->v4l2output);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_v4l2src_finalize (GstV4l2Src * v4l2src)
{
  gst_v4l2_object_destroy (v4l2src->v4l2object);

  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (v4l2src));
}
示例#4
0
static void
gst_v4l2sink_finalize (GstV4l2Sink * v4l2sink)
{
  gst_v4l2_object_destroy (v4l2sink->v4l2object);

  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (v4l2sink));
}
static GstV4l2Device *
gst_v4l2_device_provider_probe_device (GstV4l2DeviceProvider * provider,
    const gchar * device_path, const gchar * device_name, GstStructure * props)
{
  GstV4l2Object *v4l2obj;
  GstCaps *caps;
  GstV4l2Device *device = NULL;
  struct stat st;
  GstV4l2DeviceType type = GST_V4L2_DEVICE_TYPE_INVALID;

  g_return_val_if_fail (props != NULL, NULL);

  if (stat (device_path, &st) == -1)
    return NULL;

  if (!S_ISCHR (st.st_mode))
    return NULL;

  v4l2obj = gst_v4l2_object_new ((GstElement *) provider,
      V4L2_BUF_TYPE_VIDEO_CAPTURE, device_path, NULL, NULL, NULL);

  if (!gst_v4l2_open (v4l2obj))
    goto destroy;

  gst_structure_set (props, "device.api", G_TYPE_STRING, "v4l2", NULL);
  gst_structure_set (props, "device.path", G_TYPE_STRING, device_path, NULL);

  gst_structure_set (props, "v4l2.device.driver", G_TYPE_STRING,
      v4l2obj->vcap.driver, NULL);
  gst_structure_set (props, "v4l2.device.card", G_TYPE_STRING,
      v4l2obj->vcap.card, NULL);
  gst_structure_set (props, "v4l2.device.bus_info", G_TYPE_STRING,
      v4l2obj->vcap.bus_info, NULL);
  gst_structure_set (props, "v4l2.device.version", G_TYPE_UINT,
      v4l2obj->vcap.version, NULL);
  gst_structure_set (props, "v4l2.device.capabilities", G_TYPE_UINT,
      v4l2obj->vcap.capabilities, NULL);
  gst_structure_set (props, "v4l2.device.device_caps", G_TYPE_UINT,
      v4l2obj->vcap.device_caps, NULL);

  if (v4l2obj->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)
    type = GST_V4L2_DEVICE_TYPE_SOURCE;

  if (v4l2obj->vcap.capabilities & V4L2_CAP_VIDEO_OUTPUT) {
    /* Morph it in case our initial guess was wrong */
    v4l2obj->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;

    if (type == GST_V4L2_DEVICE_TYPE_INVALID)
      type = GST_V4L2_DEVICE_TYPE_SINK;
    else
      /* We ignore M2M devices that are both capture and output for now
       * The provider is not for them
       */
      goto close;
  }

  caps = gst_v4l2_object_get_caps (v4l2obj, NULL);

  if (caps == NULL)
    goto close;
  if (gst_caps_is_empty (caps)) {
    gst_caps_unref (caps);
    goto close;
  }

  device = gst_v4l2_device_new (device_path,
      device_name ? device_name : (gchar *) v4l2obj->vcap.card, caps, type,
      props);
  gst_caps_unref (caps);

close:

  gst_v4l2_close (v4l2obj);

destroy:

  gst_v4l2_object_destroy (v4l2obj);

  if (props)
    gst_structure_free (props);

  return device;
}