Skip to content

Conversation

@SolidEva
Copy link
Contributor

this enables usage like in cpp content-streamer

this enables usage like in cpp content-streamer
my_canvas.SetPixel(xstart+col, ystart+row, r, g, b)

cdef class FrameData:
cdef const char *__getData(self) except +:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cdef const char *__getData(self) except +:
cdef const char *__getData(self) except NULL:

except + means that code can throw C++ exception
except NULL - check exception state if returned value is NULL

def Serialize(self):
cdef const char* data
cdef size_t length
(<cppinc.FrameCanvas*>self.__getCanvas()).Serialize(&data, &length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that this won't work for your purpose. Serialize just returns pointer to internal frame representation (one instance per FrameCanvas), it does not copy it.

One option is to implement buffer protocol for FrameCanvas and then use python for memory management. I'll post PR soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants