How can I make two links between two elements?

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

How can I make two links between two elements?

wl2776
Administrator
I'd like to mimic playbin2's behavior and construct similar pipeline using gst-launch.

When playbin2 loads mpeg2 file, it creates mpegpsdemux with two source pads (one pad per elementary stream) and multiqueue with two sink pads connects them:

  
    +----------------+        +--------------+
    |GstMpegPSDemux  |        |GstMultiQueue |
->  |sink            |  ----> |sink0    src0 |--->
    |        video_e0|--'     |              | 
    |        audio_c0|------->|sink1    src1 |--->
    +----------------+        +--------------+

However, I cannot do that.

The pipeline

"filesrc location=/path/video/10.mpg ! typefind ! mpegpsdemux name=demux demux.video_e0,audio_c0 ! multiqueue.sink0,sink1 multiqueue0 ! video/mpeg ! mpegvideoparse ! mpeg2dec ! queue ! ffmpegcolorspace ! autovideosink multiqueue0 ! audio/mpeg ! mp3parse ! fakesink "

doesn't create multiqueue and doesn't connect audio source pad from the MPEG-PS demuxer.
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two links between two elements?

Edward Hervey
Administrator
On Tue, 2010-07-20 at 02:02 -0700, wl2776 wrote:

> I'd like to mimic playbin2's behavior and construct similar pipeline using
> gst-launch.
>
> When playbin2 loads mpeg2 file, it creates mpegpsdemux with two source pads
> (one pad per elementary stream) and multiqueue with two sink pads connects
> them:
>
>  
>     +----------------+        +--------------+
>     |GstMpegPSDemux  |        |GstMultiQueue |
> ->  |sink            |  ----> |sink0    src0 |--->
>     |        video_e0|--'     |              |
>     |        audio_c0|------->|sink1    src1 |--->
>     +----------------+        +--------------+
>
> However, I cannot do that.
>
> The pipeline
>
> "filesrc location=/path/video/10.mpg ! typefind ! mpegpsdemux name=demux
> demux.video_e0,audio_c0 ! multiqueue.sink0,sink1 multiqueue0 ! video/mpeg !
> mpegvideoparse ! mpeg2dec ! queue ! ffmpegcolorspace ! autovideosink
> multiqueue0 ! audio/mpeg ! mp3parse ! fakesink "

  You can't link multiple pads in one go like that you need to do
something like:

  ... ! sourceelement name=d  sinkelement name=m ! ...

  d.first_pad ! m.first_pad d.second_pad ! m.second_pad

>
> doesn't create multiqueue and doesn't connect audio source pad from the
> MPEG-PS demuxer.



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two links between two elements?

wl2776
Administrator
Edward Hervey wrote
  You can't link multiple pads in one go like that you need to do
something like:

  ... ! sourceelement name=d  sinkelement name=m ! ...

  d.first_pad ! m.first_pad d.second_pad ! m.second_pad
filesrc ! typefind ! mpegpsdemux name=demux multiqueue name=mq  ! demux.video_e0 ! mq.sink0 ! mpegvideoparse ! mpeg2dec ! queue ! ffmpegcolorspace ! autovideosink demux.audio_c0 ! mq.sink1 ! mp3parse ! autoaudiosink

This produces 3 parallel chains:
1. filesrc -> typefind -> demux -> multiqueue
and demux.audio_e0 src pad is connected to the mq.sink0 sink pad. The multiqueue mq doesn't have sink1 pad, and its src0 pad is unconnected.

2. mpegvideoparse -> mpeg2dec -> queue-> ffmpegcsp -> autovideosink
mpegvideoparse.sink pad is unconnected

3. mpegaudioparse -> autoaudiosink
mpegaudioparse.sink is also unconnected

I also requested to create mp3parse element, but it is not created.

Can the problem be in that multiqueue's sink pads are on request?
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two links between two elements?

wl2776
Administrator
filesrc ! typefind ! mpegpsdemux name=demux multiqueue name=mq demux.audio_c0 ! mq.sink0 mq.src0 ! mp3parse ! autoaudiosink  demux.video_e0 ! mq.sink1 mq.src1 ! mpegvideoparse ! mpeg2dec ! queue ! ffmpegcolorspace ! autovideosink

This has produced the required pipeline, but then I've got:

message from "demux" (error): GstMessageError, gerror=(GstGError)NULL, debug=(string)"gstmpegdemux.c\(2725\):\ gst_flups_demux_loop\ \(\):\ /GstPipeline:pipeline0/GstMpegPSDemux:demux:\012stream\ stopped\,\ reason\ not-negotiated";

I am testing this using seek example ($GST_PLUGINS_BASE/test/examples/seek.c)
I've added the code, dumping a pipeline to a .dot file.
Here they are: player.dot (20kb): player.dot, and produced PNG (500kb): player.png

What is not negotiated?
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two links between two elements?

wl2776
Administrator
Ah! Of course!
wl2776 wrote
filesrc [...]
What is not negotiated?
I've forgot audio decoder after mp3parse.

filesrc ! typefind ! mpegpsdemux name=demux multiqueue name=mq demux.audio_c0 ! mq.sink0 mq.src0 ! mp3parse ! ffdec_mp3 ! autoaudiosink  demux.video_e0 ! mq.sink1 mq.src1 ! mpegvideoparse ! mpeg2dec !  queue ! ffmpegcolorspace ! autovideosink

Now it plays, but only after a seek.
And it doesn't step back. However, if I replace ffdec_mp3 with mad or flump3dec, it steps back.
Seems like Q.D.E. :)

Will try to build mad plugin in OSSBuild.
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two links between two elements?

wl2776
Administrator
Finally.
filesrc ! typefind ! mpegpsdemux name=demux multiqueue max-size-bytes=2097152 name=mq demux.audio_c0 ! mq.sink0 mq.src0 ! mp3parse ! flump3dec ! input-selector ! audiotee ! audioconvert ! audioresample ! pulsesink  demux.video_e0 ! mq.sink1 mq.src1 ! mpegvideoparse ! mpeg2dec ! input-selector ! queue max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! ffmpegcolorspace ! videoscale ! xvimagesink

This pipeline is very close to that the playbin2 constructs.
One question, now just for sporty interest, why does it begin playing only after a seek?

If I press play button on the seek's form and then dump the pipeline to the dot file, it can be seen that videosink is in the transition from paused to playing, and all other elements are paused