tinyzimmer / go-gst

Gstreamer bindings and utilities for golang
GNU Lesser General Public License v2.1
130 stars 37 forks source link

Error: could not determine kind of name for C.GST_MESSAGE_DEVICE_CHANGED #17

Open andpp opened 3 years ago

andpp commented 3 years ago

Keep getting error:

~/work/go-gst/examples$ go run playbin/main.go 
# github.com/tinyzimmer/go-gst/gst
../gst/constants.go:335:40: could not determine kind of name for C.GST_MESSAGE_DEVICE_CHANGED
../gst/constants.go:832:30: could not determine kind of name for C.GST_QUERY_BITRATE

libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev are installed. What else do I miss?

brucekim commented 3 years ago

I found that GST_MESSAGE_DEVICE_CHANGED is defined in gstmessage.h that is one of headers inclusion in gst.h. Since gst/gst.go.h includes gst.h, it seems that your environment has not been correctly path setting for gstreamer.

In my environment, pkg-config found followings

) ✗ pkg-config --list-all | grep gst
gstreamer-player-1.0                GStreamer Player - GStreamer Player convenience library
gstreamer-video-1.0                 GStreamer Video Library - Video base classes and helper functions
gstreamer-riff-1.0                  GStreamer RIFF Library - RIFF helper functions
gstreamer-1.0                       GStreamer - Streaming media framework
gstreamer-net-1.0                   GStreamer networking library - Network-enabled GStreamer plug-ins and clocking
gstreamer-pbutils-1.0               GStreamer Base Utils Library - General utility functions
gstreamer-codecparsers-1.0          GStreamer codec parsers - Bitstream parsers for GStreamer elements
gstreamer-app-1.0                   GStreamer Application Library - Helper functions and base classes for application integration
gstreamer-photography-1.0           GStreamer Photography - GStreamer Photography digital image capture library
gstreamer-audio-1.0                 GStreamer Audio library - Audio helper functions and base classes
gstreamer-transcoder-1.0            GStreamer Transcoder - GStreamer Transcoder library
gstreamer-mpegts-1.0                GStreamer MPEG-TS - GStreamer MPEG-TS support
gstreamer-tag-1.0                   GStreamer Tag Library - Tag base classes and helper functions
gstreamer-webrtc-1.0                GStreamer WebRTC - GStreamer WebRTC support
gstreamer-gl-prototypes-1.0         GStreamer OpenGL Plugins Libraries (OpenGL Prototypes) - Streaming media framework, OpenGL plugins libraries (OpenGL Prototypes)
gstreamer-plugins-base-1.0          GStreamer Base Plugins Libraries - Streaming media framework, base plugins libraries
gstreamer-sctp-1.0                  GStreamer SCTP Library - SCTP helper functions
gstreamer-allocators-1.0            GStreamer Allocators Library - Allocators implementation
gstreamer-rtsp-1.0                  GStreamer RTSP Library - RTSP base classes and helper functions
gstreamer-check-1.0                 GStreamer check unit testing - Unit testing helper library for GStreamer modules
gstreamer-base-1.0                  GStreamer base classes - Base classes for GStreamer elements
gstreamer-fft-1.0                   GStreamer FFT Library - FFT implementation
gstreamer-plugins-bad-1.0           GStreamer Bad Plugin libraries - Streaming media framework, bad plugins libraries
gstreamer-insertbin-1.0             GStreamer Insert Bin - Bin to automatically and insertally link elements
gstreamer-sdp-1.0                   GStreamer SDP Library - SDP helper functions
gstreamer-rtp-1.0                   GStreamer RTP Library - RTP base classes and helper functions
gstreamer-bad-audio-1.0             GStreamer bad audio library, uninstalled - Bad audio library for GStreamer elements, Not Installed
gstreamer-gl-1.0                    GStreamer OpenGL Plugins Libraries - Streaming media framework, OpenGL plugins libraries
gstreamer-controller-1.0            GStreamer controller - Dynamic parameter control for GStreamer elements
andpp commented 3 years ago

Interesting. There is no GST_MESSAGE_DEVICE_CHANGED defined in my gstmessage.h What is your version of gstreamer? Mine is default for Ubuntu 18.04

~$ gst-launch-1.0 --gst-version
GStreamer Core Library version 1.14.5
brucekim commented 3 years ago

I found a comment of the macro as follow (required >= 1.16)

@GST_MESSAGE_DEVICE_CHANGED: Message indicating a #GstDevice was changed
125  *     a #GstDeviceProvider (Since: 1.16)

I installed gstreamer through gst-build

tinyzimmer commented 3 years ago

Mine is default for Ubuntu 18.04

The ubuntu repos have really old versions of GStreamer. These bindings assume at least 1.16 (maybe 1.18 recently I don't remember). As a separate topic, need to find a better way to handle gstreamer versioning.

andpp commented 3 years ago

Thank you, all! I'll try to upgrade to newer version. Maybe it would be good to add to the README minimal supported version of gstreamer?

tinyzimmer commented 3 years ago

It's there, albeit it in an obscure place. At the bottom under "Contributing" with other things I'm looking for more help on:

The bindings are not structured in a way to make version matching with GStreamer easy. Basically, you need a version compatible with what the bindings were written with (>=1.16).

Should probably make that pop out more

andpp commented 3 years ago

Yes, unfortunately I skipped section "Contributing" because I have none to contribute yet. It is my first experience with golang :)

tinyzimmer commented 3 years ago

Probably will leave this open as a reminder to myself that the README needs some serious love

andpp commented 3 years ago

I updated to newer version and it looks like gstreamer 1.16 is not enough. I guess it requiers 1.18

~/work/go-gst/examples$ go run playbin/main.go 
# github.com/tinyzimmer/go-gst/gst
../gst/gst_values.go:575:2: could not determine kind of name for C.gst_value_array_init
../gst/gst_values.go:633:2: could not determine kind of name for C.gst_value_list_init
~/work/go-gst/examples$ gst-launch-1.0 --version
gst-launch-1.0 version 1.16.2
GStreamer 1.16.2

Does golang support someting similar to #ifdef - #endif of C?

tinyzimmer commented 3 years ago

The go compiler doesn't have a preprocessor, so no, unfortunately.

The closest thing I could think of for accomplishing it would be build tags.

RSWilli commented 1 year ago

please continue a discussion at https://github.com/go-gst/go-gst (where future development of the bindings will take place), although this issue concerns very outdated versions of gstreamer, so it might not be necessary by now.