GstMeta buffers

Sebastian Dröge sebastian at centricular.com
Wed Oct 5 07:05:13 UTC 2016


On Mon, 2016-10-03 at 23:15 +0000, John P Poet wrote:
> On Fri, Sep 30, 2016 at 1:16 AM Sebastian Dröge <sebastian at centricular.com> wrote:
> > You can use a C++ class but you will have to store it as a pointer, and
> > make sure that you call delete on it when the meta is freed.
> > 
> > Storing C++ classes directly in C structs causes memory leaks as their
> > destructor can't be called.
> 
> 
> The problem I forgot about with using C++, is there is no direct way
> to call a C++ method from C.  Can I rename:
> 
>  gst-libav/ext/libav/gstavvidenc.c
> to
>  gst-libav/ext/libav/gstavvidenc.cpp
> 
> ?  

What do you want to add there? You *could* rename it of course, but
that's nothing we would ever accept upstream.

> Assuming the answer is no, means that I need to change my C++ methods
> to just be C functions.

That's indeed the preferred way :)

>   It is probably time for me to get a better handle on glib (GObject)
> stuff.  Until I started working on this gstreamer stuff, I had not
> written straight C in a couple of decades.  Do you happen to know of
> a good guide to "GObject for C++ programers"?

The tutorial in the GObject docs is quite good IMHO:
  https://developer.gnome.org/gobject/stable/pt02.html

In my experience, the biggest obstacles for people who (only) know C++
is to accept that writing GObject C code requires writing a lot of
boilerplate code (basically similar to what the C++ compiler does
behind your back), that the compiler does not know about GObject and
thus can't help you much, and that there is only single inheritance but
multiple implementations of interfaces (basically like in Java, C#,
etc)

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161005/4aabe086/attachment.sig>


More information about the gstreamer-devel mailing list