Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
765 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...