Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. static PyObject *
  2. startVideoMode(PyObject *self, PyObject *args)
  3. {
  4. printf("Start the video mode\n");
  5. CHECK_DBR();
  6.  
  7. PyObject *callback = NULL;
  8. int maxListLength, maxResultListLength, width, height, imageformat, iFormat, stride;
  9. if (!PyArg_ParseTuple(args, "iiiiiiO", &maxListLength, &maxResultListLength, &width, &height, &imageformat, &iFormat, &callback)) {
  10. return NULL;
  11. }
  12.  
  13. updateFormat(iFormat);
  14.  
  15. if (!PyCallable_Check(callback))
  16. {
  17. PyErr_SetString(PyExc_TypeError, "parameter must be callable");
  18. return NULL;
  19. }
  20. else
  21. {
  22. Py_XINCREF(callback); /* Add a reference to new callback */
  23. Py_XDECREF(py_callback); /* Dispose of previous callback */
  24. py_callback = callback;
  25. }
  26.  
  27. ImagePixelFormat format = IPF_RGB_888;
  28.  
  29. if (imageformat == 0)
  30. {
  31. stride = width;
  32. format = IPF_GRAYSCALED;
  33. }
  34. else {
  35. stride = width * 3;
  36. format = IPF_RGB_888;
  37. }
  38.  
  39. DBR_SetTextResultCallback(hBarcode, onResultCallback, NULL);
  40.  
  41. int ret = DBR_StartFrameDecoding(hBarcode, maxListLength, maxResultListLength, width, height, stride, format, "");
  42. return Py_BuildValue("i", ret);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement