Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with pointers #344

Open
chfritz opened this issue Mar 24, 2023 · 2 comments
Open

Working with pointers #344

chfritz opened this issue Mar 24, 2023 · 2 comments

Comments

@chfritz
Copy link
Contributor

chfritz commented Mar 24, 2023

I know pointers are tricky, but I was hoping that you might have an idea how to work with function like gst_rtcp_buffer_map that are used to fill a variable with content:

gst_rtcp_buffer_map (GstBuffer *buffer, GstMapFlags flags, GstRTCPBuffer *rtcp)

I have a buffer that I got from RTPSession::on-feedback-rtcp and would like to map it to a RTCP buffer so I can read the content. Of course in C you would create a variable and then pass the address:

GstRTCPBuffer rtcp = GST_RTCP_BUFFER_INIT;
gst_rtcp_buffer_map (buf, GST_MAP_READWRITE, &rtcp);

and then do what you want with rtcp. Is there any way I can do the same via node-gtk? I've tried

const rtcp = new GstRtp.RTCPBuffer(1500);
GstRtp.rtcpBufferMap(buffer, 1, rtcp);

But that just throws

(process:3961601): GStreamer-CRITICAL **: 20:55:52.809: gst_object_ref: assertion 'object != NULL' failed

on the first line and then seg fault on the second.

@romgrk
Copy link
Owner

romgrk commented Mar 29, 2023

I'm not familiar enough with the GST API to answer here, it's fairly hard to inspect GST bindings due to its dynamic nature.

What I would recommend is to find how to do what you're trying to do with another of the GIR bindings frameworks (e.g. PyGObject), and copy what that code is doing. If PyGObject can do it, then we can do it here. If not, then it might not be possible.

The problem with codebases that use macros is that C macros are not runtime inspectable, so sometimes some stuff needs to be manually binded. We have (semi)manual bindings for cairo, I wouldn't be averse to adding some for GST in small quantities.

@romgrk
Copy link
Owner

romgrk commented Mar 29, 2023

See if some of this documentation can help, or try to find code examples for that use-case for PyGObject. If none of that works, provide a runnable code example and I could try to inspect what's the type of GstRTCPBuffer, from there I can debug further.

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

No branches or pull requests

2 participants