作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试通过 P/Invoke(在 Ubuntu 上)使用 Gstreamer 在 GTK# 中显示视频。我尝试使用许多代码示例,但没有任何效果。这是其中之一:GTK#代码:
[DllImport("libgstTestDLL.so", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public extern static int play_file (StringBuilder path, IntPtr win);
...
play_file (new StringBuilder ().Append ("file:///home/user/Downloads/test.mp4"), screen.GdkWindow.Handle);
C 代码:
void play_file(char* path, void* hwnd_ptr){
GdkWindow* gdkWin = (GdkWindow*)hwnd_ptr;
pipeline = gst_element_factory_make("playbin", "player");
g_object_set (G_OBJECT (pipeline), "uri", path, NULL);
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(pipeline), GDK_WINDOW_XID(gdkWin));
gst_element_set_state(pipeline, GST_STATE_PLAYING);
}
执行 play_file
函数后,我的 GTK# 应用程序将关闭。如何在 GTK# 中正确使用 play_file
以及需要从 C 中的 play_file
函数执行什么才能在 GTK# 应用程序中显示视频?
最佳答案
我找到了解决方案。我使用以下命令将我的共享库与 libgstvideo-1.0.so 链接起来:target_link_libraries(${PROJECT_NAME} gstvideo-1.0)
。可用解决方案的完整描述 here .
关于c - 来自 GTK 的 gst_video_overlay_set_window_handle#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34468468/
我尝试通过 P/Invoke(在 Ubuntu 上)使用 Gstreamer 在 GTK# 中显示视频。我尝试使用许多代码示例,但没有任何效果。这是其中之一:GTK#代码: [DllImport("
我正在尝试一起使用 gstreamer 和 Qt5。只是带有 src->sink 的简单应用程序 - 用于在屏幕上显示某些内容。 这是一个源代码示例: #include #include #inc
我是一名优秀的程序员,十分优秀!