emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GStreamer xwidget


From: Po Lu
Subject: Re: GStreamer xwidget
Date: Tue, 23 Nov 2021 15:07:08 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Richard Stallman <rms@gnu.org> writes:

> Can you please show me precisely how Emacs would specify which plugins
> to load?  What are the specifications of the interface?  What does the
> code actually look like?  If it uses any macros, what does it
> macroexpand into?

Here's how one would create a GStreamer element (and in doing so load a
plugin):

  GstElement *element = gst_element_factory_make ("factoryname", NULL);

Where "factoryname" is the name of the element factory you want.

GStreamer will then find and load the shared library containing the
plugin that provides an element by that name, and then use it to create
the GstElement.

Obviously, creating a GstElement is insufficient, because for it to be
useful one will inevitably have to connect it to something, and
configure it.

For configuration, GstElements use GObject properties, so if I created
an element of the type "tee", provided by `gst-plugins-base', and I
wanted to configure it to work without any other element being attached
to it, I would set the property named "allow-not-linked" to `TRUE' as
follows:

  GstElement *tee = gst_element_factory_make ("tee", NULL);
  g_object_set (G_OBJECT (tee), "allow-not-linked", TRUE, NULL);

Where `g_object_set' is provided by the GObject library (an object
system for C that is free software, developed by GNOME) and `G_OBJECT'
is a macro that casts `tee' from GstElement to the type named `GObject'
after checking at run-time that the type of `tee' is correct.

Then, I have to put it in a GstBin (which is a container for various
GstElements) like so:

  gst_bin_add (GST_BIN (bin), tee);

Where `gst_bin_add' is a function provided by the GStreamer library,
`bin' is the bin, and `GST_BIN' is a cast macro similar to `G_OBJECT',
but checks that `bin' is of the type `GstBin' instead of `GstObject'.

Afterwards, I will have to "link" (note that this has nothing to do with
linking programs with object files) `tee' to some other element that
displays its output, like such:

  gst_element_link (tee, that_other_element);

Thanks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]