Problems with video, tee and queues

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

Problems with video, tee and queues

Alexey Chernov
Hello,

I suffer strange problem trying to modify the pipeline connecting
different elements to it through the queue.

I have a playbin playing video files and I need to show the video on
two separate screens (or windows at least). But second sink should
turn on request (by D-Bus but that's not so important). So the first
moment I have the following pipeline:
                      queue -- xvimagesink
                   /
playbin -- tee
                   \
                     queue -- fakesink

but when request is received it is transformed to the following:

                      queue -- xvimagesink
                   /
playbin -- tee
                   \
                      queue -- xvimagesink

Also, tee and next elements are contained to separate bin. Here's the
code of pipeline construction:

// some static elements
GstElement *_pipeline, *_videobin, *_mpoint, *_fakesink;

// pipeline construction
GstElement *, *tee, *xvimagesink;

_pipeline      = gst_element_factory_make("playbin",  NULL);

tee = gst_element_factory_make("tee",  NULL);
xvimagesink   = gst_element_factory_make("xvimagesink", NULL);

_videobin = gst_bin_new("videobin"); // static videobin
GstElement* queue1 = gst_element_factory_make("queue", NULL);
GstElement* queue2 = gst_element_factory_make("queue", NULL);
fakesink = gst_element_factory_make("fakesink", NULL);

_mpoint = queue2; // static mount point
gst_bin_add_many(GST_BIN(_videobin), tee, queue1, queue2, xvimagesink,
_fakesink, NULL);

gst_element_link_many(tee, queue1, xvimagesink, NULL);
gst_element_link_many(tee, queue2, _fakesink, NULL);
GstPad* pad = gst_element_get_static_pad (tee, "sink");
gst_element_add_pad (_videobin, gst_ghost_pad_new ("sink", pad));
gst_object_unref (GST_OBJECT (pad));

g_object_set(G_OBJECT (_pipeline), "uri", "video.avi", NULL);
g_object_set(G_OBJECT (_pipeline), "video-sink", _videobin, NULL);

/* Set the pipeline to "playing" state*/
gst_element_set_state (_pipeline, GST_STATE_PLAYING);

and when the request is received the following code change the sink element:

gst_element_unlink(_mpoint, _fakesink);
gst_bin_remove(GST_BIN(_videobin), _fakesink);
gst_element_set_state (_fakesink, GST_STATE_NULL);

GstElement* xv = gst_element_factory_make("xvimagesink",  NULL);
gst_bin_add(GST_BIN(_videobin), xv);
gst_element_link(_mpoint, xv);
gst_element_sync_state_with_parent(xv);
gst_element_set_state (_pipeline, GST_STATE_PLAYING);

So, everything is ok till the request is actually being received.
Suddenly the pipeline is getting stalled (while still staying in
PLAYING state), time messages on bus are coming in very pulsing manner
and another window for another xvimagesink isn't even appear. What can
be the cause of such a problem behavior? I guess it's because queue
elements but without queues videos aren't synchronized. Also, if both
xvimagesink's are connected to tee through queue right from start it
works quite flawlessly and without any problems.

Thanks in advance!

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with video, tee and queues

Luciana Fujii Pontello
On Mon, 2010-11-01 at 18:34 +0300, 4ernov wrote:

> So, everything is ok till the request is actually being received.
> Suddenly the pipeline is getting stalled (while still staying in
> PLAYING state), time messages on bus are coming in very pulsing manner
> and another window for another xvimagesink isn't even appear. What can
> be the cause of such a problem behavior?

You can't change the pipeline while playing like that. To do what you
want you need to block queue src pad, then unlink it and change the
elements like you do. Check this doc:
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt

Regards,

Luciana Fujii

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with video, tee and queues

Marco Ballesio
Hi,

On Sat, Nov 6, 2010 at 5:11 AM, Luciana Fujii Pontello <[hidden email]> wrote:
On Mon, 2010-11-01 at 18:34 +0300, 4ernov wrote:

> So, everything is ok till the request is actually being received.
> Suddenly the pipeline is getting stalled (while still staying in
> PLAYING state), time messages on bus are coming in very pulsing manner
> and another window for another xvimagesink isn't even appear. What can
> be the cause of such a problem behavior?

You can't change the pipeline while playing like that. To do what you
want you need to block queue src pad, then unlink it and change the
elements like you do. Check this doc:
http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-block.txt

alternatively, it is possible to use a valve element. When an element downstream has to be changed, you can set the "drop" property to true, replace the element and then unset it.

Regards
 

Regards,

Luciana Fujii

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with video, tee and queues

Alexey Chernov
Luciana, Marco, thanks a lot, spent on it much time with no result. Will try
both solutions, hope they help. Thank you.

On Saturday 06 November 2010 11:16:16 you wrote:

> Hi,
>
> On Sat, Nov 6, 2010 at 5:11 AM, Luciana Fujii Pontello <
>
> [hidden email]> wrote:
> > On Mon, 2010-11-01 at 18:34 +0300, 4ernov wrote:
> > > So, everything is ok till the request is actually being received.
> > > Suddenly the pipeline is getting stalled (while still staying in
> > > PLAYING state), time messages on bus are coming in very pulsing manner
> > > and another window for another xvimagesink isn't even appear. What can
> > > be the cause of such a problem behavior?
> >
> > You can't change the pipeline while playing like that. To do what you
> > want you need to block queue src pad, then unlink it and change the
> > elements like you do. Check this doc:
> >
> > http://cgit.freedesktop.org/gstreamer/gstreamer/tree/docs/design/part-blo
> > ck.txt
>
> alternatively, it is possible to use a valve element. When an element
> downstream has to be changed, you can set the "drop" property to true,
> replace the element and then unset it.
>
> Regards
>
> > Regards,
> >
> > Luciana Fujii
> >
> >
> > -------------------------------------------------------------------------
> > ----- The Next 800 Companies to Lead America's Growth: New Video
> > Whitepaper David G. Thomson, author of the best-selling book "Blueprint
> > to a Billion" shares his insights and actions to help propel your
> > business during the next growth cycle. Listen Now!
> > http://p.sf.net/sfu/SAP-dev2dev
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel