How to locate the xoverlay of gstreamer to an area in some browser.

Stefan Sauer ensonic at hora-obscura.de
Mon Dec 12 09:12:17 PST 2011


On 12/12/2011 04:03 AM, forestzhu wrote:
> Hi stefan,
>
> Nice to see your reply!
>> It returns true when the underlying videosink supports it.
> Cause it is a test code ,so I use the "xvimagesink".
> Anyway ,this videosink support this function.
>> First try without constraining the rendering to a subregion. Then the
>> video should fill
>> the whole window. 
> yes ,in this way ,without "gst_x_overlay_set_*" , it works.
>> Also please point us to your source code, tell us what
>> videosink you are using. Ensure that you follow the example for setting
>> up the xoverlay interface etc.
> My code about the gstreamer is such like below:
>
>
> -----------------------------------------
> 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);
> // 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.
> */
You need the xid otherwise this won't work. xvimagesink will open its
own xwindow then. Also please do as I suggested and follow the examples
that show how to obtain the xid. That being said, browsers move towards
using opengl for rendering and composition. This means that using a
opengl based videosink together with a protocol between the sink and the
browser is a better way (have a look at webkit-gtk).

Stefan

>     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);
>
> ------------------------------------------
> The code is ugly , but just for test. I don't know what went wrong.
>
> Please give me a hand.
>
> Best Regards!
> forest
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-locate-the-xoverlay-of-gstreamer-to-an-area-in-some-browser-tp4175712p4184641.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list