mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 12:55:53 +00:00
Fix of Refcount property in Gst.Object
git-svn-id: svn://anonsvn.mono-project.com/source/branches/abock/gstreamer-sharp@63396 e3ebcda4-bce8-0310-ba0a-eca2169e7518
This commit is contained in:
parent
01cf9177ac
commit
8ad1c333e7
5 changed files with 49 additions and 34 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2006-08-05 Khaled Mohammed <khaled.mohammed@gmail.com>
|
||||||
|
* gstreamer-sharp/GStreamer.metadata: added a new xml node to hide
|
||||||
|
generation of Refcount by GAPI.
|
||||||
|
|
||||||
|
* gstreamer-sharp/Object.custom: added Refcount property there.
|
||||||
|
|
||||||
|
* tests/ElementTest.cs: Adding test to Add/Remove Pad.
|
||||||
|
|
||||||
2006-08-03 Khaled Mohammed <khaled.mohammed@gmail.com>
|
2006-08-03 Khaled Mohammed <khaled.mohammed@gmail.com>
|
||||||
* gstreamer-sharp/DynamicSignal.cs: Added the support for Retval.
|
* gstreamer-sharp/DynamicSignal.cs: Added the support for Retval.
|
||||||
Also changed the design to use only managed code.
|
Also changed the design to use only managed code.
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<attr path="/api/namespace/object[@name='Bin']" name="disable_gtype_ctor">1</attr>
|
<attr path="/api/namespace/object[@name='Bin']" name="disable_gtype_ctor">1</attr>
|
||||||
<attr path="/api/namespace/object[@name='Pipeline']" name="disable_gtype_ctor">1</attr>
|
<attr path="/api/namespace/object[@name='Pipeline']" name="disable_gtype_ctor">1</attr>
|
||||||
|
|
||||||
|
<attr path="/api/namespace/object[@name='Object']/field[@name='Refcount']" name="hidden">1</attr>
|
||||||
|
|
||||||
<attr path="/api/namespace/object[@name='Bin']/field[@name='Children']" name="hidden">1</attr>
|
<attr path="/api/namespace/object[@name='Bin']/field[@name='Children']" name="hidden">1</attr>
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,8 @@ customs = \
|
||||||
Debug.custom \
|
Debug.custom \
|
||||||
Element.custom \
|
Element.custom \
|
||||||
Message.custom \
|
Message.custom \
|
||||||
Pad.custom
|
Pad.custom \
|
||||||
|
Object.custom
|
||||||
|
|
||||||
build_customs = $(addprefix $(srcdir)/, $(customs))
|
build_customs = $(addprefix $(srcdir)/, $(customs))
|
||||||
|
|
||||||
|
|
|
@ -28,43 +28,27 @@ public class ElementTest
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGoodConstructor()
|
public void TestAddRemovePad()
|
||||||
{
|
{
|
||||||
Element sink = ElementFactory.Make("fakesink", "fake-sink");
|
Element e = ElementFactory.Make("fakesrc", "source");
|
||||||
|
/* create a new floating pad with refcount 1 */
|
||||||
|
Pad p = new Pad("source", PadDirection.Src);
|
||||||
|
Assert.AreEqual(p.Refcount, 1, "pad");
|
||||||
|
|
||||||
Assert.IsNotNull(sink, "fakesink plugin is not installed?");
|
/* ref it for ourselves */
|
||||||
Assert.IsFalse(sink.Handle == IntPtr.Zero, "sink Element has null handle");
|
Gst.Object.Ref(p.Handle);
|
||||||
//Assert.IsInstanceOfType(typeof(Element), sink, "sink is not an Element?");
|
Assert.AreEqual(p.Refcount, 2, "pad");
|
||||||
Assert.AreEqual(sink.Name, "fake-sink");
|
/* adding it sinks the pad -> not floating, same refcount */
|
||||||
|
e.AddPad(p);
|
||||||
|
Assert.AreEqual(p.Refcount, 2, "pad");
|
||||||
|
|
||||||
sink.Dispose();
|
/* removing it reduces the refcount */
|
||||||
}
|
e.RemovePad(p);
|
||||||
|
Assert.AreEqual(p.Refcount, 1, "pad");
|
||||||
[Test]
|
|
||||||
public void TestAddingAndRemovingPads()
|
|
||||||
{
|
|
||||||
Element src = ElementFactory.Make("fakesrc", "fake-src");
|
|
||||||
|
|
||||||
Assert.IsNotNull(src, "fakesrc plugin is not installed?");
|
|
||||||
|
|
||||||
Pad [] pads = new Pad[2];
|
|
||||||
|
|
||||||
pads[0] = new Pad("src1", PadDirection.Src);
|
|
||||||
pads[1] = new Pad("src2", PadDirection.Sink);
|
|
||||||
|
|
||||||
foreach(Pad P in pads) {
|
|
||||||
src.AddPad(P);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach(Pad P in pads) {
|
|
||||||
//Assert.IsTrue(src.Pads.IndexOf(P) >= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(Pad P in pads) {
|
|
||||||
Assert.IsTrue(src.RemovePad(P));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* clean up our own reference */
|
||||||
|
p.Dispose();
|
||||||
|
e.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,4 +170,25 @@ public class PipelineTest
|
||||||
pipeline.Dispose();
|
pipeline.Dispose();
|
||||||
bus.Dispose();
|
bus.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBaseTime() {
|
||||||
|
Element pipeline = ElementFactory.Make("pipeline", "pipeline");
|
||||||
|
Element fakesrc = ElementFactory.Make("fakesrc", "fakesrc");
|
||||||
|
Element fakesink = ElementFactory.Make("fakesink", "fakesink");
|
||||||
|
|
||||||
|
Assert.IsNotNull(pipeline, "Could not create pipeline");
|
||||||
|
Assert.IsNotNull(fakesrc, "Could not create fakesrc");
|
||||||
|
Assert.IsNotNull(fakesink, "Could not create fakesink");
|
||||||
|
|
||||||
|
fakesrc.SetProperty("is-live", true);
|
||||||
|
|
||||||
|
Bin bin = (Bin) pipeline;
|
||||||
|
bin.AddMany(fakesrc, fakesink);
|
||||||
|
Assert.IsTrue(fakesrc.Link(fakesink));
|
||||||
|
|
||||||
|
Pad sink = fakesink.GetPad("sink");
|
||||||
|
|
||||||
|
pipeline.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue