Beispiel #1
0
  void Y_camera_obj(int argc) {
    tCamera *camera = (tCamera *) ypush_obj(&camera_yObj, sizeof(tCamera));
    //    memset(handle,0,sizeof(tCamera));

    try {
      // initialise the Prosilica API
      if (!PvInitialize()) {
	// wait for a camera to be plugged
	waitForCamera();

	// get a camera from the list
	cameraGet(camera);

	// setup the camera
	cameraSetup(camera);
      } else {
	throw "failed to initialise the API\n";
      }
    } catch ( string msg ) {
      y_error(msg.c_str());
    }
    catch ( char const * msg ) {
      y_error(msg);
    }

  }
Beispiel #2
0
yav_ctxt *ypush_av()
{
  yav_ctxt * obj = (yav_ctxt *)ypush_obj(&yav_ops, sizeof(yav_ctxt));
  obj->picture=0;
  obj->tmp_picture=0;
  obj->video_outbuf=0;
  obj->frame_count=0;
  obj->video_outbuf_size=0;
  obj->oc=0;
  obj->video_st=0;
  obj->img_convert_ctx = 0;
  obj->codec=0;
  obj->open=0;
  //  audio_st=0;
  return obj;
}
Beispiel #3
0
Datei: yusb.c Projekt: emmt/yusb
void Y_usb_open_device(int argc)
{
  ydev_instance_t *obj = NULL;
  libusb_device* dev;
  int bus, port;
  int i, ret;

  if (argc != 2) {
    y_error("expecting exactly 2 arguments");
  }
  bus = ygets_i(1);
  port = ygets_i(0);

  load_device_list();
  for (i = 0; i < dev_count; ++i) {
    dev = dev_list[i];
    if (libusb_get_bus_number(dev) == bus &&
        libusb_get_port_number(dev) == port) {
      obj = (ydev_instance_t *)ypush_obj(&ydev_class, sizeof(ydev_instance_t));
      obj->device = libusb_ref_device(dev);
      ret = libusb_open(obj->device, &obj->handle);
      if (ret < 0) {
        obj->handle = NULL;
        failure("failed to open device", ret);
      }
      obj->bus = bus;
      obj->port = port;
      obj->address = libusb_get_device_address(dev);
      ret = libusb_get_device_descriptor(dev, &obj->descriptor);
      if (ret != 0) {
        free_dev_list();
        failure("unable to get device descriptor", ret);
      }
      break;
    }
  }
  free_dev_list();
  if (obj == NULL) {
    ypush_nil();
  }
}