diff options
Diffstat (limited to '')
-rw-r--r-- | c_extension.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/c_extension.c b/c_extension.c index 7aebced..d2e7e4e 100644 --- a/c_extension.c +++ b/c_extension.c @@ -328,16 +328,28 @@ _abort_video_main1: static PyObject* video_images_get(PyObject* self, PyObject* args) { - npy_intp dims[3]; + if (!recthread_data_recent) { + // fprintf(stderr, "%s: no data from video thread", __func__); + PyErr_SetString(PyExc_RuntimeError, "No data from video thread"); + return NULL; + } struct color_pipe_t *cp = recthread_data_recent->color_pipe; - + + if (!cp) { + // fprintf(stderr, "%s: cannot read color pipeline\n", __func__); + PyErr_SetString(PyExc_RuntimeError, "Cannot read color pipeline"); + return NULL; + } if (!is_color) { - fprintf(stderr, "%s: not implemented for gray images\n", __func__); + // fprintf(stderr, "%s: not implemented for gray images\n", __func__); + PyErr_SetString(PyExc_RuntimeError, "Not implemented for gray images"); return NULL; } + npy_intp dims[3]; + dims[0] = cp->height; dims[1] = cp->width; dims[2] = 3; @@ -388,7 +400,7 @@ static PyObject* video_deinit(PyObject* self, PyObject* args) { static PyObject* video_xml_send(PyObject* self, PyObject* args) { Py_ssize_t count; - const uint8_t* str; + const char* str; if (!PyArg_ParseTuple(args, "s#", &str, &count)) { return NULL; } @@ -421,3 +433,4 @@ PyMODINIT_FUNC PyInit_o3000(void) { _import_array(); return PyModule_Create(&o3000); } + |