gpt4 book ai didi

c - 在 Weston 下运行嵌入在 GTK 窗口中的 Gstreamer 视频

转载 作者:太空宇宙 更新时间:2023-11-04 09:58:59 26 4
gpt4 key购买 nike

我正在测试 Gstreamer Waylandsink 示例,这是一个 Gstreamer 测试视频,嵌入到在 Weston 上运行的 GTK 窗口中: https://github.com/GStreamer/gst-plugins-bad/tree/master/tests/examples/waylandsink

这里还有关于回溯问题的更多描述: http://gstreamer-devel.966125.n4.nabble.com/Waylandsink-segmentation-fault-td4691887.html http://gstreamer-devel.966125.n4.nabble.com/GstVideoOverlay-td4691869.html http://gstreamer-devel.966125.n4.nabble.com/gst-video-overlay-set-render-rectangle-td4691801.html

窗口正常打开并正在运行视频示例,但在按钮上单击(按钮 NULL),我想删除我创建的视频渲染区域。根据方法 gst_video_overlay_set_render_rectangle 的文档,它应该关闭渲染区域: https://gstreamer.freedesktop.org/documentation/video/gstvideooverlay.html?gi-language=c

因此我添加了这段代码:

null_clicked_cb (GtkButton * button, DemoApp * d)
{
GtkAllocation allocation;
gtk_widget_get_allocation(d->video_widget,&allocation);
GstWaylandSink *sink = GST_WAYLAND_SINK (d->overlay);
GstVideoOverlay* overlay;
overlay = d->overlay;
gst_video_overlay_set_render_rectangle (overlay, allocation.x,allocation.y, -1, -1);
}

我正在为方法提供这些值:x 26 y 60 width -1 height -1我在 Weston 下随机得到了这些错误之一:Gdk 消息:从​​显示中读取事件时出错:协议(protocol)错误Gdk-message: Error 32 (Broken-pipe) displatching to Wayland 显示Gdk-message: 刷新显示错误

我在 Wayland Gnome shell 中遇到了这个错误:

0:00:02.355175744 25457 0x5641c5dd4150 ERROR               fdmemory
gstfdmemory.c:127:gst_fd_mem_map: 0x7f9edc00b680: fd 17: mmap failed: Cannot
allocate memory
0:00:02.355213222 25457 0x5641c5dd4150 ERROR waylandsink
wlshmallocator.c:78:gst_wl_shm_allocator_alloc:<wlshmallocator0> GstFdMemory
map failed
0:00:02.355238267 25457 0x5641c5dd4150 WARN GST_BUFFER
gstbuffer.c:907:gst_buffer_new_allocate: failed to allocate
5680698421285089536 bytes

(waylandexample:25457): GStreamer-CRITICAL **: 22:03:17.493:
gst_buffer_memset: assertion 'GST_IS_BUFFER (buffer)' failed

(waylandexample:25457): GStreamer-CRITICAL **: 22:03:17.493:
gst_buffer_peek_memory: assertion 'GST_IS_BUFFER (buffer)' failed

有人知道问题出在哪里吗?

谢谢

最佳答案

我终于设法摆脱了使用方法时弹出的错误消息:gst_video_overlay_set_render_rectangle()它仅在使用 playbin 和 sink waylandsink 时有效,如果我将管道与 videotestsrc 一起使用,它会在此方法处停止并产生上述错误。不幸的是,黑色子窗口的问题(导致全屏视频仅部分呈现)仍然存在,即使我认为我清除了所有呈现子窗口清除屏幕以全屏呈现单个视频(实际上是“全窗口”作为视频在单个 GTK 窗口中运行)我假设在剩余的三个窗口句柄上调用 gst_video_overlay_set_render_rectangle() 将清除该区域,不幸的是,黑色矩形随机保留在其他视频呈现的某些区域上。我在评论中附上了整个按钮点击方法以及我所有试图隐藏(清除、禁用或我应该如何命名)的尝试。

static void button_press_event(GtkWidget *widget, GdkEventButton *event, DemoApp * d) {

if (destroy == FALSE) {
gtk_widget_get_allocation(d->video_widget1, &allocation);
GstStateChangeReturn state;
//state = gst_element_set_state(d->pipeline0, GST_STATE_NULL);
//g_print("pipeline state:%d\r\n", state);
state = gst_element_set_state(d->pipeline1, GST_STATE_NULL);
g_print("pipeline state:%d\r\n", state);
state = gst_element_set_state(d->pipeline2, GST_STATE_NULL);
g_print("pipeline state:%d\r\n", state);
state = gst_element_set_state(d->pipeline3, GST_STATE_NULL);
g_print("pipeline state:%d\r\n", state);
/*
gboolean result = gst_video_overlay_set_render_rectangle(d->overlay1, -1,
-1, -1, -1);
*/
gboolean result = FALSE;

gtk_widget_get_allocation(d->video_widget0, &allocation);

result = gst_video_overlay_set_render_rectangle(d->overlay0, allocation.x,
allocation.y, -1, -1);
g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);

gtk_widget_get_allocation(d->video_widget1, &allocation);
result = FALSE;
result = gst_video_overlay_set_render_rectangle(d->overlay1, allocation.x,
allocation.y, -1, -1);
g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
// gst_object_unref(d->overlay1);

gtk_widget_get_allocation(d->video_widget2, &allocation);
result = FALSE;
result = gst_video_overlay_set_render_rectangle(d->overlay2, allocation.x,
allocation.y, -1, -1);
g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
//gst_object_unref(d->overlay2);


gtk_widget_get_allocation(d->video_widget3, &allocation);
result = FALSE;
result = gst_video_overlay_set_render_rectangle(d->overlay3, allocation.x,
allocation.y, -1, -1);
g_print("x=%d,y=%d,width=%d,height=%d, result=%d\r\n", allocation.x, allocation.y, allocation.width, allocation.height, result);
//gst_object_unref(d->overlay3);
/*
gst_video_overlay_expose(d->overlay0);
gst_video_overlay_expose(d->overlay1);
gst_video_overlay_expose(d->overlay2);
gst_video_overlay_expose(d->overlay3);
*/
/*
gst_video_overlay_set_window_handle(d->overlay1, (guintptr) 0);
gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
gst_video_overlay_set_window_handle(d->overlay2, (guintptr) 0);
*/
gtk_widget_set_visible(d->video_widget1, FALSE);
gtk_widget_set_visible(d->video_widget2, FALSE);
gtk_widget_set_visible(d->video_widget3, FALSE);

//gst_video_overlay_expose(d->overlay1);

//g_print("result=%d\r\n", result);
int width = gtk_widget_get_allocated_width(d->videoElementsGrid);
int height = gtk_widget_get_allocated_height(d->videoElementsGrid);
gtk_widget_set_size_request(d->video_widget0, width, height);
gtk_widget_get_allocation(d->video_widget0, &allocation);
struct wl_surface *window_handle = gdk_wayland_window_get_wl_surface(gtk_widget_get_window(d->video_widget0));
wl_surface_damage_buffer(window_handle,allocation.x,allocation.y,width,height);
//gst_element_set_state(d->pipeline0, GST_STATE_PLAYING);
destroy = TRUE;
} else {

关于c - 在 Weston 下运行嵌入在 GTK 窗口中的 Gstreamer 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57812555/

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