mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
working WebPGetFeatures
This commit is contained in:
parent
3273b0c4b9
commit
4852aa5b65
11
_webp.c
11
_webp.c
|
@ -8,10 +8,10 @@
|
||||||
PyObject* WebPGetFeatures_wrapper(PyObject* self, PyObject* args)
|
PyObject* WebPGetFeatures_wrapper(PyObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
PyBytesObject *webp_string;
|
PyBytesObject *webp_string;
|
||||||
const uint8_t* webp = NULL;
|
uint8_t* webp = NULL;
|
||||||
VP8StatusCode vp8_status_code = VP8_STATUS_OK;
|
VP8StatusCode vp8_status_code = VP8_STATUS_OK;
|
||||||
Py_ssize_t size;
|
Py_ssize_t size;
|
||||||
WebPBitstreamFeatures* const features;
|
WebPBitstreamFeatures features;
|
||||||
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "S", &webp_string)) {
|
if (!PyArg_ParseTuple(args, "S", &webp_string)) {
|
||||||
|
@ -21,10 +21,10 @@ PyObject* WebPGetFeatures_wrapper(PyObject* self, PyObject* args)
|
||||||
|
|
||||||
PyBytes_AsStringAndSize((PyObject *) webp_string, (char**)&webp, &size);
|
PyBytes_AsStringAndSize((PyObject *) webp_string, (char**)&webp, &size);
|
||||||
|
|
||||||
vp8_status_code = WebPGetFeatures(webp, size, features);
|
vp8_status_code = WebPGetFeatures(webp, size, (WebPBitstreamFeatures *)&features);
|
||||||
|
|
||||||
if (vp8_status_code == VP8_STATUS_OK) {
|
if (vp8_status_code == VP8_STATUS_OK) {
|
||||||
printf("%i", features->has_alpha);
|
printf("%i", features.has_alpha);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: raise some sort of error
|
// TODO: raise some sort of error
|
||||||
|
@ -33,8 +33,7 @@ PyObject* WebPGetFeatures_wrapper(PyObject* self, PyObject* args)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
free((void*)webp);
|
return Py_BuildValue("b", features.has_alpha);
|
||||||
return Py_BuildValue("b", features->has_alpha);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user