gpt4 book ai didi

browser - 如何将gstreamer videoink嵌入浏览器

转载 作者:行者123 更新时间:2023-12-02 04:04:28 28 4
gpt4 key购买 nike

我正在开发一个webkit-kernel-browser插件。
大多数插件都遵循NPAPI的规则。
调用NP_new函数后,浏览器应调用Npp_setwindows等。
但是chrome浏览器无法运行此程序。
它调用Np_destory直接完成实例。
因此,我无法获得浏览器的xid来设置视频接收器。
怎么解决呢?

当我使用firefox浏览器时,我可以获得xid。
不幸的是,当我使用gst_x_overlay_set_xwindow_id嵌入浏览器时。
浏览器崩溃了。
这是一些测试代码。

  gst_init (NULL, NULL);

player->pipeline = gst_element_factory_make ("playbin2", "playstation");
LOGMSG("create playbin2");
player->audio_sink = gst_element_factory_make ("alsasink", "audio-sink");
if (NULL == player->audio_sink)
{
player->audio_sink = gst_element_factory_make ("autoaudiosink", "audio-sink");
g_warning ("Could not create a GST audio_sink. Audio unavailable.");
}

player->video_sink = gst_element_factory_make ("xvimagesink", "video-sink");
if (NULL == player->video_sink)
{
//pvrvideosink is used for some special solution ,but this case never used
player->video_sink = gst_element_factory_make ("pvrvideosink","video-sink");

g_warning ("Could not create a GST video_sink. Video unavailable.");
}
g_object_set (player->video_sink, "force-aspect-ratio", TRUE, NULL);

sprintf(buff," \n pipleline:%p\n video:%p\n audio:%p\n uri:%s\n xid:%d",
player->pipeline,player->video_sink,player->audio_sink,player->uri,player->xid);
LOGMSG(buff);enter code here
// log shows all the content is ok
g_object_set (player->pipeline, "video-sink", player->video_sink, NULL);
g_object_set (player->pipeline, "audio-sink", player->audio_sink, NULL);
g_object_set (player->pipeline, "uri",player->uri, NULL);

player->bus = gst_element_get_bus (GST_ELEMENT (player->pipeline));
gst_bus_add_watch(player->bus,(void *)process_events,player);

LOGMSG("start set winid");
/*
chrome can not get the browser xid ,so it display the image in fullscreen way with the player 's own window. The firefox can not display the image at all. It crashed here.
*/
if (player->xid != 0 )
{
gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(GST_ELEMENT(player->video_sink)));
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_ELEMENT(player->video_sink)),player->xid);

gboolean spt = gst_x_overlay_set_render_rectangle
(GST_X_OVERLAY(GST_ELEMENT(player->video_sink)),10,10,480,270);
if (!spt)
{
LOGMSG("not support the rectangle");
}
gst_x_overlay_expose(GST_X_OVERLAY(GST_ELEMENT(player->video_sink)));

}

LOGMSG("set xwinid finished");
gst_element_set_state(player->pipeline,GST_STATE_PLAYING);

loop = g_main_loop_new (NULL, FALSE);
LOGMSG("start player loop");
g_main_loop_run (loop);

谁能给我一些有关这些的信息?

最好的祝福,
森林

最佳答案

尝试使用XEmbed

关于browser - 如何将gstreamer videoink嵌入浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8472582/

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