2 playbins in a window

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

2 playbins in a window

Julien GILLES
Hi,

i am trying to play two videos in a window, using the playbin plugin.
I use an ximagesink as video-sink, and set overlay on a
GtkDrawingArea.

With a single playbin everything is fine, but if I try to create 2
playbins, strange things occurs : sometimes the application crashes,
sometime the application launches, but the two videos remains black
and there is a lot of GStreamer error on the standard output,
sometimes the two videos runs, but after 2 seconds one of them hangs.

Well, it seems to me that there is some global variables that prevents
the 2 instances to live together ; II wonder if  the playbin plugin is
guilty, or if the gstreamer framework allows twoo pipelines in the
same application...

--
Julien Gilles.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 2 playbins in a window

michael smith-6-3
On Tue, May 27, 2008 at 3:11 AM, Julien GILLES <[hidden email]> wrote:

> Hi,
>
> i am trying to play two videos in a window, using the playbin plugin.
> I use an ximagesink as video-sink, and set overlay on a
> GtkDrawingArea.
>
> With a single playbin everything is fine, but if I try to create 2
> playbins, strange things occurs : sometimes the application crashes,
> sometime the application launches, but the two videos remains black
> and there is a lot of GStreamer error on the standard output,
> sometimes the two videos runs, but after 2 seconds one of them hangs.
>
> Well, it seems to me that there is some global variables that prevents
> the 2 instances to live together ; II wonder if  the playbin plugin is
> guilty, or if the gstreamer framework allows twoo pipelines in the
> same application...

There should be no problem with running multiple pipelines in an
application - that's a normal use-case.

There also shouldn't be any problems specific to playbin. My guess is
that this is an application bug in your software, but I'm certainly
not sure about that.

Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 2 playbins in a window

Wim Taymans
In reply to this post by Julien GILLES
On Tue, 2008-05-27 at 12:11 +0200, Julien GILLES wrote:

> Hi,
>
> i am trying to play two videos in a window, using the playbin plugin.
> I use an ximagesink as video-sink, and set overlay on a
> GtkDrawingArea.
>
> With a single playbin everything is fine, but if I try to create 2
> playbins, strange things occurs : sometimes the application crashes,
> sometime the application launches, but the two videos remains black
> and there is a lot of GStreamer error on the standard output,
> sometimes the two videos runs, but after 2 seconds one of them hangs.

Can you paste those errors here? Maybe it's the type registration in
glib?

Wim

>
> Well, it seems to me that there is some global variables that prevents
> the 2 instances to live together ; II wonder if  the playbin plugin is
> guilty, or if the gstreamer framework allows twoo pipelines in the
> same application...
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 2 playbins in a window

Tim-Philipp Müller-2
In reply to this post by Julien GILLES
On Tue, 2008-05-27 at 12:11 +0200, Julien GILLES wrote:

> With a single playbin everything is fine, but if I try to create 2
> playbins, strange things occurs : sometimes the application crashes,
> sometime the application launches, but the two videos remains black
> and there is a lot of GStreamer error on the standard output,
> sometimes the two videos runs, but after 2 seconds one of them hangs.
>
> Well, it seems to me that there is some global variables that prevents
> the 2 instances to live together ; II wonder if  the playbin plugin is
> guilty, or if the gstreamer framework allows twoo pipelines in the
> same application...

There have been some issues with starting up two pipelines/playbins at
the same time. These should mostly be fixed in CVS (core and plugin
modules) (see e.g. http://bugzilla.gnome.org/show_bug.cgi?id=530317).

What versions are you trying with? What errors/warnings are you seeing?

Cheers
 -Tim



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: 2 playbins in a window

Julien GILLES
2008/5/27 Tim Müller <[hidden email]>:

> There have been some issues with starting up two pipelines/playbins at
> the same time. These should mostly be fixed in CVS (core and plugin
> modules) (see e.g. http://bugzilla.gnome.org/show_bug.cgi?id=530317).
>
> What versions are you trying with? What errors/warnings are you seeing?

GStreamer 0.10.18.

I have run the applications 3 times, 3 differents behaviours  (the
code is below).

1) The main window appears, and crashes immediatly. Std output is :

GLib-GObject-ERROR **: g_type_plugin_*() invalidly modified type
`GstStreamSelector'
aborting...
Abandon

Another test crashes with :

GLib-GObject-ERROR **: g_type_plugin_*() invalidly modified type `GstStreamInfo'
aborting...
Abandon

2) The window appears, with the 2 videos, but one stops playing after
a few seconds. No errors on standard output.

3) same as 2), but with a lot of errors :

(player:12602): GLib-GObject-WARNING **: cannot register existing type
`GstJackAudioSinkRingBuffer'

(player:12602): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

** (player:12602): CRITICAL **: gst_ring_buffer_open_device: assertion
`GST_IS_RING_BUFFER (buf)' failed

(player:12602): GLib-GObject-WARNING **: cannot register existing type
`GstJackAudioSinkRingBuffer'

(player:12602): GLib-GObject-CRITICAL **: g_object_new: assertion
`G_TYPE_IS_OBJECT (object_type)' failed

** (player:12602): CRITICAL **: gst_ring_buffer_open_device: assertion
`GST_IS_RING_BUFFER (buf)' failed


Here is the code :


#include <config.h>
#include <X11/Xlib.h>
#include <gst/gst.h>
#include <gst/interfaces/xoverlay.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>

static void
on_destroy (GtkWidget * widget, gpointer data)
{
    gtk_main_quit ();
}

static gboolean expose_cb(GtkWidget * widget, GdkEventExpose * event,
                                                  gpointer data)
{
        gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),
                                                                 GDK_WINDOW_XWINDOW(widget->window));
        gtk_widget_show_all(widget);
}


GstElement*
add_video(GtkFixed* fixed, gint x, gint y, gint w, gint h)
{
        const char* uri = "file:///tmp/foo.avi";
       
        GstElement* playbin    = gst_element_factory_make ("playbin", "play");
    GstElement* vsink = gst_element_factory_make ("ximagesink", "vsink");
        g_object_set (G_OBJECT (playbin), "video-sink", vsink, NULL);
        g_object_set (G_OBJECT (playbin), "uri", uri, NULL);

        GtkWidget* da = gtk_drawing_area_new();
  gtk_widget_set_size_request(da, w, h);
        gtk_fixed_put(GTK_FIXED(fixed), da, x, y);
        g_signal_connect(da, "expose-event", G_CALLBACK(expose_cb), vsink);
        gst_element_set_state(playbin, GST_STATE_PLAYING);
        return playbin;
}

static gboolean
bus_call (GstBus     *bus,
          GstMessage *msg,
          gpointer    data)
{
  GMainLoop *loop = (GMainLoop *) data;

  switch (GST_MESSAGE_TYPE (msg)) {
    case GST_MESSAGE_EOS:
      g_print ("End-of-stream\n");
      g_main_loop_quit (loop);
      break;
    case GST_MESSAGE_ERROR: {
      gchar *debug;
      GError *err;

      gst_message_parse_error (msg, &err, &debug);
      g_free (debug);

      g_print ("Error: %s\n", err->message);
      g_error_free (err);

      g_main_loop_quit (loop);
      break;
    }
    default:
      break;
  }

  return TRUE;
}


int
main (int argc, char *argv[])
{
    GtkWidget *window;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW (window), 1024, 768);
    g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK
(on_destroy), NULL);

        GtkWidget* fixed = gtk_fixed_new();
        gtk_container_add(GTK_CONTAINER(window), fixed);
        gtk_widget_show (fixed);


        const gchar *nano_str;
        guint major, minor, micro, nano;
       
        gst_init (&argc, &argv);
       
        gst_version (&major, &minor, &micro, &nano);
       
        if (nano == 1)
                nano_str = "(CVS)";
        else if (nano == 2)
                nano_str = "(Prerelease)";
        else
                nano_str = "";
       
        printf ("This program is linked against GStreamer %d.%d.%d %s\n",
                        major, minor, micro, nano_str);

       
        GstElement *v1 = add_video(GTK_FIXED(fixed), 0, 0, 300, 300);
        GstElement *v2 = add_video(GTK_FIXED(fixed), 301, 301, 300, 300);
        gst_element_set_state(v1, GST_STATE_PLAYING);
        gst_element_set_state(v2, GST_STATE_PLAYING);
       
    gtk_widget_show_all (window);
    gtk_main ();
       
    return 0;
}

--
Julien Gilles.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel