Luma -> Alpha with v1.18
Nicolas Dufresne
nicolas at ndufresne.ca
Tue Jan 11 02:27:01 UTC 2022
Le lun. 10 janv. 2022 07 h 00, amindfv--- via gstreamer-devel <
gstreamer-devel at lists.freedesktop.org> a écrit :
> On Mon, Jan 10, 2022 at 10:41:12AM +0100, Florian Echtler wrote:
> > On 10/01/2022 10:36, amindfv at mailbox.org wrote:
> > > On Mon, Jan 10, 2022 at 09:48:26AM +0100, Florian Echtler wrote:
> > > > On 10/01/2022 09:21, amindfv at mailbox.org wrote:
> > > > > On Sun, Jan 09, 2022 at 12:33:24PM -0800, amindfv at mailbox.org
> wrote:
> > > > >
> > > > > Here's my latest, boiled down to a simple example. I hope my
> inexperienced attempts aren't too horrifying, or if so they're easy enough
> to get on the right track.
> > > > >
> > > > > I've built the .so file, which is in the current directory. I then
> launch a hello world pipeline (unrelated to the new plugin), and hit an
> error loading the .so:
> > > > >
> > > > > $ GST_PLUGIN_PATH=$GST_PLUGIN_PATH:. gst-launch-1.0
> videotestsrc ! autovideosink
> > > > > (gst-plugin-scanner:149635): GStreamer-WARNING **:
> 00:02:44.715: Failed to load plugin './libgstalphacombine.so':
> ./libgstalphacombine.so: undefined symbol: gst_video_info_init
> > > > > Setting pipeline to PAUSED ...
> > > > > Pipeline is PREROLLING ...
> > > > > Pipeline is PREROLLED ...
> > > > > Setting pipeline to PLAYING ...
> > > > >
> > > > > gstalphacombine.c contains "#include <gst/video/video.h>", which
> in turn includes gst/video/video-info.h. In other words,
> gst_video_info_init "shouldn't" be undefined.
> > > >
> > > > It's defined for compile time, but apparently not for link time
> (which is
> > > > partially deferred until the library is actually loaded in this
> case).
> > >
> > > Thanks for the fast reply!
> > >
> > > > You can check with `ldd ./libgstalphacombine.so` whether there's
> just a
> > > > library path missing at load time;
> > >
> > > Here's the output; seems to my untrained eye not to be missing
> anything:
> > >
> > > $ ldd ./libgstalphacombine.so
> > > linux-vdso.so.1 (0x00007ffdbeded000)
> > > libgstreamer-1.0.so.0 =>
> /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 (0x00007f75529fa000)
> > > libgobject-2.0.so.0 =>
> /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f75529a0000)
> > > libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
> (0x00007f7552871000)
> > > libgmodule-2.0.so.0 =>
> /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f755286b000)
> > > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7552727000)
> > > libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
> (0x00007f7552721000)
> > > libunwind.so.8 => /usr/lib/x86_64-linux-gnu/libunwind.so.8
> (0x00007f7552704000)
> > > libdw.so.1 => /usr/lib/x86_64-linux-gnu/libdw.so.1
> (0x00007f755265b000)
> > > libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> (0x00007f7552639000)
> > > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7552474000)
> > > libffi.so.7 => /usr/lib/x86_64-linux-gnu/libffi.so.7
> (0x00007f7552468000)
> > > libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3
> (0x00007f75523f5000)
> > > /lib64/ld-linux-x86-64.so.2 (0x00007f7552b8b000)
> > > liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5
> (0x00007f75523cb000)
> > > libelf.so.1 => /usr/lib/x86_64-linux-gnu/libelf.so.1
> (0x00007f75523b0000)
> > > libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f7552393000)
> > > libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0
> (0x00007f7552380000)
> >
> > Yes, this looks okay, but...
> >
> > > > if this is not the case, then you would
> > > > need to modify your compiler flags to include whatever GStreamer
> sub-library
> > > > contains gst_video_info_init.
> > >
> > > The Makefile includes
> > >
> > > -I/usr/include/gstreamer-1.0
> > >
> > > and /usr/include/gstreamer-1.0/gst/video/video-info.h appears to
> define `gst_video_info_init`.
> >
> > I think you also need to add `-lgstvideo-1.0` to the link step (where all
> > the other -lgst... options are defined).
>
> Yes, that was it - thank you!
>
> I'm now able to, seemingly, load the .so file, but GStreamer doesn't seem
> to recognize the plugin:
>
> $ GST_PLUGIN_PATH=$GST_PLUGIN_PATH:. gst-launch-1.0 videotestsrc !
> alphacombine ! autovideosink # obviously this isn't a real pipeline
> WARNING: erroneous pipeline: no element "alphacombine"
> $ GST_PLUGIN_PATH=$GST_PLUGIN_PATH:. gst-inspect-1.0 alphacombine
> No such element or plugin 'alphacombine'
>
> Could it be related to the symbols the .so exports?:
>
> $ nm -D --defined-only libgstalphacombine.so
> 0000000000006220 D format_map
> 0000000000002830 T gst_alpha_combine_get_type
>
> I notice for the installed plugins there seem to be a uniform (and
> different) set of symbols:
>
> $ nm -D --defined-only
> /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstalpha.so
> 000000000000a670 T gst_plugin_alpha_get_desc
> 000000000000a680 T gst_plugin_alpha_register
> $ nm -D --defined-only
> /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstcompositor.so
> 000000000000cee0 T gst_plugin_compositor_get_desc
> 000000000000cef0 T gst_plugin_compositor_register
>
> I managed to get the `*_get_desc` and `*_register` symbols exported by
> copying from gstplugin.c, but clearly I'm still taking shots in the dark,
> and not yet successfully:
>
> #ifndef PACKAGE
> #define PACKAGE "jankyalphacombine"
> #endif
>
> GST_PLUGIN_DEFINE (
> GST_VERSION_MAJOR,
> GST_VERSION_MINOR,
> alpha_combine,
> "alphacombine thing",
> gst_alpha_combine_init,
> "1.0.0",
> "LGPL",
> "GStreamer",
> "http://gstreamer.net/"
> )
>
To help a little, alphacombibe is a feature (of type GstElement), it needs
to be registered in a plugin. Make sure to keep enough of plugin.c so this
feature is registered. Notice the original plugin is named codecalpha,
plugins .so files needs to be strictly named, since the entry function are
deduced from it.
> Thanks,
> Tom
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220110/c55c9469/attachment.htm>
More information about the gstreamer-devel
mailing list