XOverlay lost after setting playbin state to Null
ralph.gucwa at racelogic.co.uk
Mon Nov 28 06:48:58 PST 2011
I'm developing a C# WPF application using OSSBuild and gstreamersharp. I'm
using XOverlayAdapter to display video on a hosted WindowsForms control to
which I have a Windows handle. Everything is working nicely except the
situation when I set the playbin2 state to Null which is required for
changing the source or changing the pipeline structure.
This is exactly what I'm doing (I stripped out all checks if the elements
have been created correctly):
1. Create a playbin
Gst.BasePlugins.PlayBin2 playBin = new Gst.BasePlugins.PlayBin2();
playBin.PlayFlags &= ~((Gst.BasePlugins.PlayBin2.PlayFlagsType)(1 <<
playBin.Bus.Message += new Gst.MessageHandler(OnPlayBinMessage);
2. Create a videosink
Gst.Video.VideoSink videoSink =
Gst.ElementFactory.Make("dshowvideosink") as Gst.Video.VideoSink;
videoSink["force-aspect-ratio"] = true;
3. Associate the videosink with a WindowsForms control (screen) to display
the video in a rectangular area in my WPF window.
Gst.Interfaces.XOverlayAdapter overlayAdapter = new
overlayAdapter.XwindowId = (ulong)screen.Handle;
4. Attach the videosink to the playbin
playBin.VideoSink = videoSink;
5. Set playbin's URI to some video file on my hard drive
playBin.Uri = @"file:///" + fileName.Replace('\\', '/');
6. Now I can play and pause the video by changing the state of the playbin
So far so good, everything is working smoothly, I can play, pause, seek the
video displayed in a rectangular area in my window. The problem starts when
I try to play another video file. According to all manuals, I should set the
pipeline state to Null before changing the URI:
7. Open another video file
playBin.Uri = @"file:///" + newFileName.Replace('\\', '/');
Unfortunately this causes the rectangular area in my window to become black
and a separate video window is created by GStreamer. It has nothing to do
with changing the URI, it is setting the playbin state to Null which
disconnects the video output from the overlay and pops up a new window.
What am I doing wrong?
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/XOverlay-lost-after-setting-playbin-state-to-Null-tp4115442p4115442.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel