Using a Bin

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

Using a Bin

José Luis Segura Lucas
Hello!

I'm trying to build a pipeline using an element and a Bin.

I can connect both (videotestsrc to a bin with decodebi2 and
autovideosink inside).

I add both (decodebin2 and autovideosink) to the bin, and then, added
videotestsrc and the bin to a pipeline.

At the end, I link the videotestsrc to the bin, and it doesn't work.

If I create the bin usign the "normal" way (declare the bin, the
elements, add it to the bin...) it simply can't link the videotestsrc
to the bin.

If I create the bin using parse_bin_from_description, all goes fine,
but the image of the videotestsrc "freeze". I suppose that I'm missing
some step... Can you help me?

Best regards and thanks in advance!

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

Luciana Fujii Pontello
On Fri, 2010-10-15 at 18:25 +0200, José Luis Segura Lucas wrote:

> If I create the bin usign the "normal" way (declare the bin, the
> elements, add it to the bin...) it simply can't link the videotestsrc
> to the bin.

When creating your bin you need to create a ghost pad targeting the
decodebin2 sink pad, so you can link the videotestsrc to the bin. Other
than that, you also need to connect to "new-decoded-pad" signal from
decodebin2 and link the pad to autovideosink in you callback.

> If I create the bin using parse_bin_from_description, all goes fine,
> but the image of the videotestsrc "freeze". I suppose that I'm missing
> some step... Can you help me?

I don't know what may be causing that. Check if that happens when you do
it the "normal" way too. But it's a little odd to use decodebin2 in that
pipeline. Why are you doing that?

Regards,

Luciana Fujii

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

José Luis Segura Lucas
El Fri, 15 Oct 2010 14:23:07 -0300
Luciana Fujii Pontello <[hidden email]> escribió:

> On Fri, 2010-10-15 at 18:25 +0200, José Luis Segura Lucas wrote:
>
> > If I create the bin usign the "normal" way (declare the bin, the
> > elements, add it to the bin...) it simply can't link the
> > videotestsrc to the bin.
>
> When creating your bin you need to create a ghost pad targeting the
> decodebin2 sink pad, so you can link the videotestsrc to the bin.
> Other than that, you also need to connect to "new-decoded-pad" signal
> from decodebin2 and link the pad to autovideosink in you callback.
>
> > If I create the bin using parse_bin_from_description, all goes fine,
> > but the image of the videotestsrc "freeze". I suppose that I'm
> > missing some step... Can you help me?
>
> I don't know what may be causing that. Check if that happens when you
> do it the "normal" way too.

Doing it the normal way (videotestsrc -> decodebin2 -> autovideosink)
works perfect (without using Bin)


> But it's a little odd to use decodebin2
> in that pipeline. Why are you doing that?

Well, I know. It is only an example. I use the decodebin2 because I
need two elements inside the bin and one outside. My problem is in
another program, but this is the smallest snippet I can imagine to show
the problem to you :-)

>
> Regards,

Thanks for your time!

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

José Luis Segura Lucas
I just try to use gst.Bin directly and it works (using ghost pads and
so...).

The only way I can't get it working is creating the Bin using the
function parse_bin_from_description. :-(

El Sat, 16 Oct 2010 00:13:48 +0200
José Luis Segura Lucas <[hidden email]> escribió:

> El Fri, 15 Oct 2010 14:23:07 -0300
> Luciana Fujii Pontello <[hidden email]> escribió:
> > On Fri, 2010-10-15 at 18:25 +0200, José Luis Segura Lucas wrote:
> >
> > > If I create the bin usign the "normal" way (declare the bin, the
> > > elements, add it to the bin...) it simply can't link the
> > > videotestsrc to the bin.
> >
> > When creating your bin you need to create a ghost pad targeting the
> > decodebin2 sink pad, so you can link the videotestsrc to the bin.
> > Other than that, you also need to connect to "new-decoded-pad"
> > signal from decodebin2 and link the pad to autovideosink in you
> > callback.
> >
> > > If I create the bin using parse_bin_from_description, all goes
> > > fine, but the image of the videotestsrc "freeze". I suppose that
> > > I'm missing some step... Can you help me?
> >
> > I don't know what may be causing that. Check if that happens when
> > you do it the "normal" way too.
>
> Doing it the normal way (videotestsrc -> decodebin2 -> autovideosink)
> works perfect (without using Bin)
>
>
> > But it's a little odd to use decodebin2
> > in that pipeline. Why are you doing that?
>
> Well, I know. It is only an example. I use the decodebin2 because I
> need two elements inside the bin and one outside. My problem is in
> another program, but this is the smallest snippet I can imagine to
> show the problem to you :-)
>
> >
> > Regards,
>
> Thanks for your time!
>


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

Andoni Morales
El día 16 de octubre de 2010 00:28, José Luis Segura Lucas
<[hidden email]> escribió:
> I just try to use gst.Bin directly and it works (using ghost pads and
> so...).
>
> The only way I can't get it working is creating the Bin using the
> function parse_bin_from_description. :-(
You need to set the second argument to True, this will automatically
create a ghost pad for unliked pad in the bin.

Andoni

>
> El Sat, 16 Oct 2010 00:13:48 +0200
> José Luis Segura Lucas <[hidden email]> escribió:
>> El Fri, 15 Oct 2010 14:23:07 -0300
>> Luciana Fujii Pontello <[hidden email]> escribió:
>> > On Fri, 2010-10-15 at 18:25 +0200, José Luis Segura Lucas wrote:
>> >
>> > > If I create the bin usign the "normal" way (declare the bin, the
>> > > elements, add it to the bin...) it simply can't link the
>> > > videotestsrc to the bin.
>> >
>> > When creating your bin you need to create a ghost pad targeting the
>> > decodebin2 sink pad, so you can link the videotestsrc to the bin.
>> > Other than that, you also need to connect to "new-decoded-pad"
>> > signal from decodebin2 and link the pad to autovideosink in you
>> > callback.
>> >
>> > > If I create the bin using parse_bin_from_description, all goes
>> > > fine, but the image of the videotestsrc "freeze". I suppose that
>> > > I'm missing some step... Can you help me?
>> >
>> > I don't know what may be causing that. Check if that happens when
>> > you do it the "normal" way too.
>>
>> Doing it the normal way (videotestsrc -> decodebin2 -> autovideosink)
>> works perfect (without using Bin)
>>
>>
>> > But it's a little odd to use decodebin2
>> > in that pipeline. Why are you doing that?
>>
>> Well, I know. It is only an example. I use the decodebin2 because I
>> need two elements inside the bin and one outside. My problem is in
>> another program, but this is the smallest snippet I can imagine to
>> show the problem to you :-)
>>
>> >
>> > Regards,
>>
>> Thanks for your time!
>>
>
>
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
> Flex(R) Builder(TM)) enable the development of rich applications that run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



--
Andoni Morales Alastruey

LongoMatch:The Digital Coach
http://www.longomatch.ylatuya.es

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

José Luis Segura Lucas
El Sat, 16 Oct 2010 01:30:17 +0200
Andoni Morales <[hidden email]> escribió:
> > The only way I can't get it working is creating the Bin using the
> > function parse_bin_from_description. :-(
> You need to set the second argument to True, this will automatically
> create a ghost pad for unliked pad in the bin.

I tried, and it make no difference (only that I need to create the
ghost pad by hand if the second argument is false).

When I create the bin with that function, the bin is freeze and only
show one frame, not a video.

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

David Liu
In reply to this post by José Luis Segura Lucas
On 16/10/2010, at 2:25 AM, José Luis Segura Lucas wrote:

> Hello!
>
> I'm trying to build a pipeline using an element and a Bin.
>
> I can connect both (videotestsrc to a bin with decodebi2 and
> autovideosink inside).
>
> I add both (decodebin2 and autovideosink) to the bin, and then, added
> videotestsrc and the bin to a pipeline.
>
> At the end, I link the videotestsrc to the bin, and it doesn't work.

The pipeline you describe doesn't actually work (connecting a videotestsrc to decodebin2), i.e.:

Daves-MacBook-Pro:bin dave$ gst-launch videotestsrc ! bin. \( decodebin2 ! autovideosink \)
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2543): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
streaming task paused, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
Daves-MacBook-Pro:bin dave$

However, if you provide an encoded media file then it works fine:

Daves-MacBook-Pro:videos dave$ gst-launch filesrc location=Jumper.mov ! bin. \( decodebin2 name=a a. ! audioconvert ! audioresample ! autoaudiosink a. ! ffmpegcolorspace ! autovideosink \)
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstAudioSinkClock
[snip]


Cheers,

- Dave L
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using a Bin

José Luis Segura Lucas
I just test it on my Debian unstable and it works perfectly (your
command, copy and pasted).

I don't understand what is the difference between create the bin by
hand or using the function parse_bin_from_description.

A little example in Python:

import gobject
import gst

def connection(element, pad, next_element):
    print pad.get_name()
    if pad.get_name() == 'src0':
        element.link(next_element)

pipe = gst.Pipeline()

src = gst.element_factory_make('videotestsrc', 'src_element')

dec  = gst.element_factory_make('decodebin2', 'dec_element')
sink = gst.element_factory_make('xvimagesink', 'sink_element')

bin = gst.Bin('my_bin')
bin.add(dec, sink)

bin.add_pad(gst.GhostPad('bin_sink', dec.get_static_pad('sink')))
dec.connect('pad-added', connection, sink)

pipe.add(src, bin)
src.link(bin)

pipe.set_state(gst.STATE_PLAYING)

gobject.MainLoop().run()


This example works fine, but if I change:

 dec  = gst.element_factory_make('decodebin2', 'dec_element')
 sink = gst.element_factory_make('xvimagesink', 'sink_element')

 bin = gst.Bin('my_bin')
 bin.add(dec, sink)

 bin.add_pad(gst.GhostPad('bin_sink', dec.get_static_pad('sink')))
 dec.connect('pad-added', connection, sink)

to:

 bin = gst.parse_bin_from_description('decodebin2 ! xvimagesink', True)


It only freeze when it starts playing. I tried using a filesrc instead
the videotestsrc, and the result is the same: the first example works,
the second, doesn't play nothing


El Sat, 16 Oct 2010 20:44:04 +1000
David Liu <[hidden email]> escribió:

> The pipeline you describe doesn't actually work (connecting a
> videotestsrc to decodebin2), i.e.:
>
> Daves-MacBook-Pro:bin dave$ gst-launch videotestsrc ! bin.
> \( decodebin2 ! autovideosink \) Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> ERROR: from
> element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
> Internal data flow error. Additional debug info: gstbasesrc.c(2543):
> gst_base_src_loop
> (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: streaming
> task paused, reason not-linked (-1) ERROR: pipeline doesn't want to
> preroll. Setting pipeline to NULL ... Freeing pipeline ...
> Daves-MacBook-Pro:bin dave$
>
> However, if you provide an encoded media file then it works fine:
>
> Daves-MacBook-Pro:videos dave$ gst-launch filesrc
> location=Jumper.mov ! bin. \( decodebin2 name=a a. ! audioconvert !
> audioresample ! autoaudiosink a. ! ffmpegcolorspace ! autovideosink
> \) Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Pipeline
> is PREROLLED ... Setting pipeline to PLAYING ...
> New clock: GstAudioSinkClock
> [snip]
>
>
> Cheers,
>
> - Dave L

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel