Is it possible to remove a video source from a running pipe?

1,086 views
Skip to first unread message

Patrick Balleux

unread,
Sep 3, 2008, 1:14:14 PM9/3/08
to gstreamer-java
Hi,

I have a video pipe with a video mixer in it. I am able to add new
video source and connect them to the video mixer without problem and
without stopping the pipe.

Pseudo-code:

pipe.setState(PAUSED);

//Create a new video pipe...
//Add element to the pipe
//Connect to mixer...
lastSourceElement.link(mixer);

//Start the pipe
pipe.setState(PLAYING);

This is working greate, I tried with 4 video sources without problem.

But I want to do this:

Pseudo-code:
pipe.setState(PAUSED);

//Select the video source
lastSourceElement.unlink(mixer);
//Remove all elements from the pipe
//destroy the video source

//Start the pipe
pipe.setState(PLAYING);

The problem when I do this, the pipe is freezing, even if there are
other video source still feeding the mixer. Is there a special way to
do this when removing a source from a pipe or disconnecting from a
mixer?

Thank you.

thor

unread,
Sep 4, 2008, 5:47:58 AM9/4/08
to gstreamer-java
Hi,

I'm experiencing a similar issue when first adding a fake sink to a
pipeline and the removing in and adding a real sink instead.
This is done even before the the play method is called on pipeline.
The video simply freezes with the extra link/unlink calls.


so something like this
.....
mySrcElement.link(fakeSinkElement); // if I remove this it works
fine
....
mySrcElement.unlink(fakeSinkElement); // if I remove this it works
fine
mySrcElement.link(realSinkElement);
...
pipeline.play();

So possible bug in unlink method

I'll try digging into this, but any inputs are most welcome?

/thor

Patrick Balleux

unread,
Sep 4, 2008, 10:03:47 AM9/4/08
to gstreamer-java
I think that you have a good hint.

In another message, I have another problem that could be related as I
am unable to add an Element (like agingtv) in an already created
pipe. I can remove it, but it is impossible to insert a new one if
the links are already made.

I am gonna do some testing today as I think that we need to manually
link the pads like the DecodeBin element...

Patrick

Patrick Balleux

unread,
Sep 4, 2008, 8:19:17 PM9/4/08
to gstreamer-java
I've made some more testing and there is something that really do not
work in the libraries.

With this example:

... ! ffmpegcolorspace ! agingtv ! ffmpegcolorspace ! ...

If I pause the pipeline, remove agingtv, link the 1st ffmpeg to the
second, it will work, the agingtv will disapear.

But if I try to replace that effect by another one, I am unable to
relink the stream. The pipeline dies or freeze the whole java
process.

I tried this :

effect.disown()
pipe.remove(effect);
pipe.add(newEffect);
previous.link(newEffect);
newEffect.link(next);

And all variation by not removing, setting state of the elements to
NULL, etc... It should be simple but it is not working.

Results:
- Nothing changed
- Image freezes
- Pipe freezes
- Whole process freeses
- The stream feed dispapear from the image, but other stream are still
working.

The results are randoms and that leads me to believe that there is a
bug...

Any idea?

Patrick


On 4 sep, 05:47, thor <t...@faurmedia.dk> wrote:

Tal Shalif

unread,
Sep 6, 2008, 5:03:50 PM9/6/08
to gstream...@googlegroups.com
Using the python binding (gst-python) to run the same pipelines can give an indication on either this is a Java specific issue or not.

2008/9/5 Patrick Balleux <patrick...@gmail.com>



--
Tal Shalif
+81-90-9688-2696

Patrick Balleux

unread,
Sep 8, 2008, 3:18:17 AM9/8/08
to gstreamer-java
I don't know much about Python...



On 6 sep, 17:03, "Tal Shalif" <tsha...@gmail.com> wrote:
> Using the python binding (gst-python) to run the same pipelines can give an
> indication on either this is a Java specific issue or not.
>
> 2008/9/5 Patrick Balleux <patrick.ball...@gmail.com>

Tal Shalif

unread,
Sep 9, 2008, 8:05:05 PM9/9/08
to gstream...@googlegroups.com
The gstreamer developers use gst-python for running and testing the gstreamer framework. Look under gst-python/examples for the various ways to use it. It will save you time investigating gstreamer-java once you learn how to use it a bit.

Here is an example:

prompt> python
>>> import gst, sys
>>> pipeline = gst.parse_launch("videotestsrc name=src ! agingtv name=aging ! ximagesink name=sink")
>>> pipeline.set_state(gst.STATE_PLAYING)
...... after a while ...
>>> src = pipeline.get_by_name("src")
>>> sink = pipeline.get_by_name("sink")
>>> aging = pipeline.get_by_name("aging")
>>> pipeline.set_state(gst.STATE_PAUSED)
>>> pipeline.remove(aging)
>>> src.link(sink)
>>> pipeline.set_state(gst.STATE_PLAYING)

2008/9/8 Patrick Balleux <patrick...@gmail.com>



--
Tal Shalif
+81-90-9688-2696

Patrick

unread,
Sep 9, 2008, 8:08:25 PM9/9/08
to gstream...@googlegroups.com
Thanks,

I'll try this and will be very useful indeed...
--
Patrick Balleux
patrick...@gmail.com
Reply all
Reply to author
Forward
0 new messages