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

标签 browser gtk gstreamer

我正在开发一个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/

相关文章:

javascript - html - 如何动态更改网页的 url

browser - 是否可以从移动设备获得唯一的识别号?

java - Gstreamer Tee/队列多流水线

javascript - 如何获取浏览器权限列表

browser - 如何在 Google Compute Engine VM 上打开浏览器

c++ - 当小部件太大时的 Gtk 3

c - 如何使 Gtk3 应用程序在 Ubuntu 上看起来更好?

c - GTK 将结构传递给 C 中的回调函数

audio - gstreamer 从缓冲区读取分贝