Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static PyObject *
- startVideoMode(PyObject *self, PyObject *args)
- {
- printf("Start the video mode\n");
- CHECK_DBR();
- PyObject *callback = NULL;
- int maxListLength, maxResultListLength, width, height, imageformat, iFormat, stride;
- if (!PyArg_ParseTuple(args, "iiiiiiO", &maxListLength, &maxResultListLength, &width, &height, &imageformat, &iFormat, &callback)) {
- return NULL;
- }
- updateFormat(iFormat);
- if (!PyCallable_Check(callback))
- {
- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
- return NULL;
- }
- else
- {
- Py_XINCREF(callback); /* Add a reference to new callback */
- Py_XDECREF(py_callback); /* Dispose of previous callback */
- py_callback = callback;
- }
- ImagePixelFormat format = IPF_RGB_888;
- if (imageformat == 0)
- {
- stride = width;
- format = IPF_GRAYSCALED;
- }
- else {
- stride = width * 3;
- format = IPF_RGB_888;
- }
- DBR_SetTextResultCallback(hBarcode, onResultCallback, NULL);
- int ret = DBR_StartFrameDecoding(hBarcode, maxListLength, maxResultListLength, width, height, stride, format, "");
- return Py_BuildValue("i", ret);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement