Xoverlay artifacts

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Xoverlay artifacts

Paulo Schreiner
Hello,

I'm developing a video player, to be embedded on a low cost PC. It
should play a sequence of short video clips, repeating when getting to
the end, but it should also be possible to include a video to be played
one time, at an arbitrary moment. But, one very important feature is
that the player looks "professional", that is, to the viewer it should
look like normal TV.

To that effect I leveraged the Gstreamer framework and developed a
sample application. It works ok, but i notice an artifact while playing
full-screen or any kind of scaled video. For a short time, a fraction of
a second, when the program starts playing a new clip, it appears on
screen with its original resolution, shortly thereafter it fills the
window allocated to it.

I'm using Xoverlay as described in the documentation, is it possible
that the xvvideosink is creating it's own window, and only a
split-second later doing the overlay? If I resize the window DURING
play, it works seamlessly.

The relevant code is:

    pipeline = gst_pipeline_new ("gst-player");

    bin = gst_element_factory_make ("playbin", "bin");
    videosink = gst_element_factory_make ("xvvideosink", "videosink");

    g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);

    gst_bin_add (GST_BIN (pipeline), bin);

    {
        GstBus *bus;
        bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
        gst_bus_add_watch (bus, bus_cb, NULL);
        gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window,
pipeline);
        gst_object_unref (bus);
    }

    g_object_set (G_OBJECT (bin), "uri", uri, NULL);
g_print("URI2: %s\n", uri);


    gst_element_set_state (pipeline, GST_STATE_PLAYING);
---------------------------------------------------------------------

This is executed when playing the first video.

-----------------------------------------------------------------------
static GstBusSyncReply
create_window (GstBus * bus, GstMessage * message, GstPipeline *
pipeline)
{
 // ignore anything but 'prepare-xwindow-id' element messages
 if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
   return GST_BUS_PASS;
 
 if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
   return GST_BUS_PASS;
 
 gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC
(message)),
     window); // window is a global
 
 gst_message_unref (message);
 
 return GST_BUS_DROP;
}
-------------------------------------------------------------------------
To play the next clip, i do as follows:
-------------------------------------------------------------------------
    gst_element_set_state (pipeline, GST_STATE_READY);
    g_object_set (G_OBJECT (bin), "uri",
current_play_list->uri_to_play, NULL);
        gst_element_set_state (pipeline, GST_STATE_PLAYING);
-------------------------------------------------------------------------



Full source with a makefile is available too:
http://www.jorjao81.com/player.tar.bz2

Could anyone help me? I really want to use gstreamer for this project,
and I'm probably doing something stupid... But i have to get rid of the
artifacts...

Sorry for this lengthy message, and thanks in advance.

Yours,
Paulo Schreiner



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Xoverlay artifacts

Paulo Schreiner
Solved it already :-) Sorry to bother...

changed the sink to xvimagesink and configured Xv and it worked...

Thanks,
Paulo Schreiner

On Wed, 2009-11-18 at 12:27 -0200, Paulo Schreiner wrote:

> Hello,
>
> I'm developing a video player, to be embedded on a low cost PC. It
> should play a sequence of short video clips, repeating when getting to
> the end, but it should also be possible to include a video to be played
> one time, at an arbitrary moment. But, one very important feature is
> that the player looks "professional", that is, to the viewer it should
> look like normal TV.
>
> To that effect I leveraged the Gstreamer framework and developed a
> sample application. It works ok, but i notice an artifact while playing
> full-screen or any kind of scaled video. For a short time, a fraction of
> a second, when the program starts playing a new clip, it appears on
> screen with its original resolution, shortly thereafter it fills the
> window allocated to it.
>
> I'm using Xoverlay as described in the documentation, is it possible
> that the xvvideosink is creating it's own window, and only a
> split-second later doing the overlay? If I resize the window DURING
> play, it works seamlessly.
>
> The relevant code is:
>
>     pipeline = gst_pipeline_new ("gst-player");
>
>     bin = gst_element_factory_make ("playbin", "bin");
>     videosink = gst_element_factory_make ("xvvideosink", "videosink");
>
>     g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
>
>     gst_bin_add (GST_BIN (pipeline), bin);
>
>     {
>         GstBus *bus;
>         bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>         gst_bus_add_watch (bus, bus_cb, NULL);
> gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window,
> pipeline);
>         gst_object_unref (bus);
>     }
>
>     g_object_set (G_OBJECT (bin), "uri", uri, NULL);
> g_print("URI2: %s\n", uri);
>
>
>     gst_element_set_state (pipeline, GST_STATE_PLAYING);
> ---------------------------------------------------------------------
>
> This is executed when playing the first video.
>
> -----------------------------------------------------------------------
> static GstBusSyncReply
> create_window (GstBus * bus, GstMessage * message, GstPipeline *
> pipeline)
> {
>  // ignore anything but 'prepare-xwindow-id' element messages
>  if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
>    return GST_BUS_PASS;
>  
>  if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
>    return GST_BUS_PASS;
>  
>  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC
> (message)),
>      window); // window is a global
>  
>  gst_message_unref (message);
>  
>  return GST_BUS_DROP;
> }
> -------------------------------------------------------------------------
> To play the next clip, i do as follows:
> -------------------------------------------------------------------------
>     gst_element_set_state (pipeline, GST_STATE_READY);
>     g_object_set (G_OBJECT (bin), "uri",
> current_play_list->uri_to_play, NULL);
> gst_element_set_state (pipeline, GST_STATE_PLAYING);
> -------------------------------------------------------------------------
>
>
>
> Full source with a makefile is available too:
> http://www.jorjao81.com/player.tar.bz2
>
> Could anyone help me? I really want to use gstreamer for this project,
> and I'm probably doing something stupid... But i have to get rid of the
> artifacts...
>
> Sorry for this lengthy message, and thanks in advance.
>
> Yours,
> Paulo Schreiner
>
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel