title: How to embed gstreamer videosink to a browser
body: <p>I am working on a webkit-kernel-browser plugin.
  Most plugin obey the rules of NPAPI.
  After call the NP_new function,the browser should call the Npp_setwindows and etc.
  But the chrome browser does not run this .
  It call the Np_destory to finished the instance straightly.
  So I can not get the browser 's xid to set the videosink on it .
  How can work it out?</p>
  
  <p>And when I use the firefox browser, I can get the xid.
  Unfortunately ,When I use the gst_x_overlay_set_xwindow_id to embed to the browser .
  The browser crashed.
  Here is some code for test.</p>
  
  <pre><code>  gst_init (NULL, NULL);
  
      player-&gt;pipeline = gst_element_factory_make ("playbin2", "playstation");
      LOGMSG("create playbin2");
      player-&gt;audio_sink = gst_element_factory_make ("alsasink", "audio-sink");
      if (NULL == player-&gt;audio_sink)
      {
          player-&gt;audio_sink = gst_element_factory_make ("autoaudiosink", "audio-sink");
          g_warning ("Could not create a GST audio_sink. Audio unavailable.");
      }
  
      player-&gt;video_sink = gst_element_factory_make ("xvimagesink", "video-sink");
      if (NULL == player-&gt;video_sink)
      {
          //pvrvideosink is used for some special solution ,but this case never used
          player-&gt;video_sink = gst_element_factory_make ("pvrvideosink","video-sink");
  
          g_warning ("Could not create a GST video_sink. Video unavailable.");
      }
     g_object_set (player-&gt;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-&gt;pipeline,player-&gt;video_sink,player-&gt;audio_sink,player-&gt;uri,player-&gt;xid);
      LOGMSG(buff);enter code here
  // log shows all the content is ok
      g_object_set (player-&gt;pipeline, "video-sink", player-&gt;video_sink, NULL);
      g_object_set (player-&gt;pipeline, "audio-sink", player-&gt;audio_sink, NULL);
      g_object_set (player-&gt;pipeline, "uri",player-&gt;uri, NULL);
  
      player-&gt;bus = gst_element_get_bus (GST_ELEMENT (player-&gt;pipeline));
      gst_bus_add_watch(player-&gt;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-&gt;xid != 0 )
      {
          gst_x_overlay_prepare_xwindow_id(GST_X_OVERLAY(GST_ELEMENT(player-&gt;video_sink)));
          gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_ELEMENT(player-&gt;video_sink)),player-&gt;xid);
  
          gboolean spt = gst_x_overlay_set_render_rectangle
                         (GST_X_OVERLAY(GST_ELEMENT(player-&gt;video_sink)),10,10,480,270);
          if (!spt)
          {
              LOGMSG("not support the rectangle");
          }
          gst_x_overlay_expose(GST_X_OVERLAY(GST_ELEMENT(player-&gt;video_sink)));
  
      }
  
      LOGMSG("set xwinid finished");
      gst_element_set_state(player-&gt;pipeline,GST_STATE_PLAYING);
  
      loop = g_main_loop_new (NULL, FALSE);
      LOGMSG("start player loop");
      g_main_loop_run (loop); 
  </code></pre>
  
  <hr>
  
  <p>Can anyone give me some information about these?</p>
  
  <p>Best regards,
  forest</p>