GTK window with Quartz [starting from an issue with GStreamer]

筅森魡賤 提交于 2019-11-28 08:21:12

问题


I'm trying to get basic-tutorial-5 of the GStreamer SDK to work on OSX.

SDK downloaded from http://gstreamer.freedesktop.org/data/pkg/osx/1.2.4.1/

tutorials (for 1.0) from http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/

I get the following error

basic-tutorial-5.c:5:10: fatal error: 'gst/video/videooverlay.h' file not found

when I run

gcc `pkg-config gstreamer-1.0 gtk+-3.0 --cflags --libs` basic-tutorial-5.c -o basic5

Any pointers would be helpful!

Thanks.

EDIT:

There is a gst/video/videooverlay.h in /local/frameworks/Gstreamer.framework/Headers.

The output of pkg-config gstreamer-1.0 gtk+-3.0 --cflags --libs doesn't include /Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers

Thanks to @Biffen when using

    gcc `pkg-config --cflags --libs gtk+-3.0` -o basic5 basic-tutorial-5.c -I/Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers -framework GStreamer

There is a little more action:

        basic-tutorial-5.c:114:17: warning: 'gtk_button_new_from_stock' is deprecated
      [-Wdeprecated-declarations]
  play_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
                ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/gtkbutton.h:103:16: note: 
      'gtk_button_new_from_stock' declared here
GtkWidget*     gtk_button_new_from_stock    (const gchar    *stock_id);
               ^
basic-tutorial-5.c:114:44: warning: 'GtkStock' is deprecated
      [-Wdeprecated-declarations]
  play_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PLAY);
                                           ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:747:38: note: 
      expanded from macro 'GTK_STOCK_MEDIA_PLAY'
#define GTK_STOCK_MEDIA_PLAY       ((GtkStock)"gtk-media-play")
                                     ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:107:16: note: 
      'GtkStock' declared here
typedef char * GtkStock;
               ^
basic-tutorial-5.c:117:18: warning: 'gtk_button_new_from_stock' is deprecated
      [-Wdeprecated-declarations]
  pause_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PAUSE);
                 ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/gtkbutton.h:103:16: note: 
      'gtk_button_new_from_stock' declared here
GtkWidget*     gtk_button_new_from_stock    (const gchar    *stock_id);
               ^
basic-tutorial-5.c:117:45: warning: 'GtkStock' is deprecated
      [-Wdeprecated-declarations]
  pause_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_PAUSE);
                                            ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:733:38: note: 
      expanded from macro 'GTK_STOCK_MEDIA_PAUSE'
#define GTK_STOCK_MEDIA_PAUSE      ((GtkStock)"gtk-media-pause")
                                     ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:107:16: note: 
      'GtkStock' declared here
typedef char * GtkStock;
               ^
basic-tutorial-5.c:120:17: warning: 'gtk_button_new_from_stock' is deprecated
      [-Wdeprecated-declarations]
  stop_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
                ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/gtkbutton.h:103:16: note: 
      'gtk_button_new_from_stock' declared here
GtkWidget*     gtk_button_new_from_stock    (const gchar    *stock_id);
               ^
basic-tutorial-5.c:120:44: warning: 'GtkStock' is deprecated
      [-Wdeprecated-declarations]
  stop_button = gtk_button_new_from_stock (GTK_STOCK_MEDIA_STOP);
                                           ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:799:38: note: 
      expanded from macro 'GTK_STOCK_MEDIA_STOP'
#define GTK_STOCK_MEDIA_STOP       ((GtkStock)"gtk-media-stop")
                                     ^
/usr/local/Cellar/gtk+3/3.12.2/include/gtk-3.0/gtk/deprecated/gtkstock.h:107:16: note: 
      'GtkStock' declared here
typedef char * GtkStock;
               ^
6 warnings generated.

So it complies... This seems a huge step forward but still no cigar...

When I try to run basic5 I get:

(process:73178): GLib-GObject-WARNING **: cannot register existing type 'gchar'
**
GLib-GObject:ERROR:gvaluetypes.c:455:_g_value_types_init: assertion failed: (type == G_TYPE_CHAR)
Abort trap: 6

EDIT v2:

Thanks to nemequ I can now compile with gcc -o basic5 basic-tutorial-5.cpkg-config --libs --cflags gstreamer-1.0 gstreamer-video-1.0 gtk+-3.0`` and run ./basic5 to get the following error:

Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!

(basic5:77683): Gtk-WARNING **: cannot open display:

It seems that the gtk folder (and others, no doubt) are missing from the /Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers folder and so using the pkg-config.. is a work-around, maybe.

If I run ./basic5 in an XQuartz terminal I get the following error:

Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!

(basic5:78227): GLib-GIO-ERROR **: No GSettings schemas are installed on the system
Trace/BPT trap: 5

Anyone else have any ideas?


回答1:


For the initial problem, the solution depends on your system so it's a bit difficult to give you a good answer, but gst/video/videooverlay.h is part of the gstreamer-video-1.0 package, not gstreamer-1.0.

That said, if you're using the GStreamer SDK then according to the GStreamer SDK documentation, you should be using -framework GStreamer, not pkg-config.

As for the error you're seeing about "cannot register existing type", that tends to happen when you try to link against two different versions of the same library. TBH I've never seen it happen with gchar, but it probably means you're trying to link to two different version of glib or gobject, which makes sense—the gtk+-3.0 pkg-config file will pull in glib-2.0 and gobject-2.0 as dependencies, and they're both already included in the GStreamer SDK. AFAICT GTK+ is also included in the GStreamer SDK, so try just getting rid of the pkg-config stuff:

gcc -o basic5 basic-tutorial-5.c -I/Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers -framework GStreamer


来源:https://stackoverflow.com/questions/23777031/gtk-window-with-quartz-starting-from-an-issue-with-gstreamer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!