gpt4 book ai didi

c - 带有 Quartz 的 GTK 窗口 [从 GStreamer 的问题开始]

转载 作者:太空狗 更新时间:2023-10-29 15:38:32 26 4
gpt4 key购买 nike

我正在尝试让 GStreamer SDK 的 basic-tutorial-5 在 OSX 上运行。

SDK 下载自http://gstreamer.freedesktop.org/data/pkg/osx/1.2.4.1/

教程(1.0)来自 http://cgit.freedesktop.org/~slomo/gst-sdk-tutorials/

我得到以下错误

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

当我运行时

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

任何指示都会有所帮助!

谢谢。

编辑:

/local/frameworks/Gstreamer.framework/Headers中有一个gst/video/videooverlay.h

pkg-config gstreamer-1.0 gtk+-3.0 --cflags --libs 的输出不包括 /Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers

使用时感谢@Biffen

    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

还有一点 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.

所以它符合...这似乎向前迈出了一大步,但仍然没有雪茄...

当我尝试运行 basic5 时,我得到:

(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

编辑 v2:

感谢 nemequ,我现在可以使用 gcc -o basic5 basic-tutorial-5.cpkg-config --libs --cflags gstreamer-1.0 gstreamer-video-1.0 gtk+-3.0` 进行编译` 并运行 ./basic5 得到以下错误:

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:

/Library/Frameworks/Gstreamer.framework/Versions/1.0/Headers 文件夹中似乎缺少 gtk 文件夹(毫无疑问还有其他文件夹),因此使用 pkg -config.. 可能是一种解决方法。

如果我在 XQuartz 终端中运行 ./basic5,我会收到以下错误:

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

还有其他人有什么想法吗?

最佳答案

对于最初的问题,解决方案取决于您的系统,因此很难给您一个好的答案,但是 gst/video/videooverlay.h 是 gstreamer-video-1.0 的一部分包,不是 gstreamer-1.0

也就是说,如果您使用的是 GStreamer SDK,那么根据 GStreamer SDK 文档,you should be using -framework GStreamer ,而不是 pkg-config。

至于您看到的关于“无法注册现有类型”的错误,当您尝试链接同一个库的两个不同版本时,往往会发生这种情况。 TBH 我从未见过 gchar 发生这种情况,但这可能意味着您正在尝试链接到两个不同版本的 glib 或 gobject,这是有道理的 - gtk+-3.0 pkg-config 文件将引入 glib-2.0gobject-2.0 作为依赖项,它们都已包含在 GStreamer SDK 中。 AFAICT GTK+ 也包含在 GStreamer SDK 中,因此请尝试去掉 pkg-config 内容:

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

关于c - 带有 Quartz 的 GTK 窗口 [从 GStreamer 的问题开始],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23777031/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com