Creating a Rust binding for MPEG-TS

Sebastian Dröge sebastian at centricular.com
Tue May 8 09:15:46 UTC 2018


On Tue, 2018-05-08 at 09:43 +0100, Russel Winder wrote:
> Sebastian,
> 
> On Tue, 2018-05-08 at 10:13 +0300, Sebastian Dröge wrote:
> > Hi Russel,
> > 
> > On Mon, 2018-05-07 at 19:02 +0100, Russel Winder wrote:
> > > Hi,
> > > 
> > > I am progressing trying to create a Rust binding for MPEG-TS, D has one so
> > > Rust should as well. I seem to have a skeleton which is beginning to look
> > > half-way reasonable. However, for some synbols I am getting a fail in gir.
> > > For
> > > example:
> > > 
> > > thread 'main' panicked at 'Missing memory management functions for
> > > GstMpegts.DVBServiceListItem', src/codegen/record.rs:61:9
> > 
> > That's because it has no copy/free or ref/unref function. You'd need to
> > manually bind this one, i.e. add it to the manual section in the toml
> > file and write some code for it.
> 
> OK. So this is writing Rust code rather than writing stuff in the TOML file?
> 
> Not a problem, now I know the direction. Can you suggest the best current
> working example to use as a paradigm to drive things here? (I am working in a
> position of little knowledge, so good examples are crucial.)

Yes. This is probably closest to the SDP things in gstreamer-sdp. Check
the manually implemented code there. The src/*.rs files

> > > Commenting out from the Gir_GstMpegts.toml file all the symbols that cause
> > > this problem creates a reasonable set of files in gstreamer-mpegts/auto so
> > > the
> > > skeleton seems not broken.
> > 
> > You start by white-listing types one-by-one as needed and then make
> > sure for each that something reasonable is generated. Don't start with
> > everything at once as manual changes will be needed.
> 
> I went the other way and listed most types and then commented them out till
> there was a correct generation. Now I can uncomment the ones that have this
> problem and move them to manual and write the Rust code.

In many cases things that fail to autogenerate can also be fixed via
the toml file, or by fixing/adding features to the gir code generator,
or fixing the .gir introspection files.

> I am not sure what "whitelisting" means in this context.

Only types that you list are actually generated.

> > > Anyone any ideas why gir might be panicing at that point before I go
> > > digging
> > > starting from no knowledge?
> > > 
> > > Another problem fr some other symbols is:
> > > 
> > > WARN 2018-05-07T17:51:00Z: libgir::analysis::functions: Function
> > > gst_mpegts_descriptor_parse_dvb_ca_identifier has unsupported outs
> > > 
> > > Again before I go digging from a position of zero knowledge does anyone
> > > have
> > > any hints or advice to help speed things up for me?
> > 
> > GArray out parameters are not supported yet by gir and would have to be
> > added. Related https://github.com/gtk-rs/gir/issues/594
> > 
> > Features are only added to gir when someone actually needs them.
> > 
> > 
> > In general, the gtk-rs gitter chat would be a better place to discuss
> > issues with the gir code generator.
> 
> I vote for fixing this rather than hacking. 

Yes that would be better

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


More information about the gstreamer-devel mailing list