diff options
-rw-r--r-- | gstreamer-sharp/Caps.custom | 3 | ||||
-rw-r--r-- | tests/CapsTest.cs | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gstreamer-sharp/Caps.custom b/gstreamer-sharp/Caps.custom index de2e255..4ff992d 100644 --- a/gstreamer-sharp/Caps.custom +++ b/gstreamer-sharp/Caps.custom @@ -57,8 +57,9 @@ private void RemoveStructureReference (Structure s) { private void RemoveStructureReferences () { foreach (Structure s in structures.Values) { - RemoveStructureReference (s); + s.CreateNativeCopy (); } + structures.Clear (); } [DllImport ("libgstreamer-0.10.dll") ] diff --git a/tests/CapsTest.cs b/tests/CapsTest.cs index 826098c..f0e25a4 100644 --- a/tests/CapsTest.cs +++ b/tests/CapsTest.cs @@ -10,6 +10,7 @@ using System; using NUnit.Framework; using Gst; +using Gst.Video; [TestFixture] public class CapsTest { @@ -91,4 +92,16 @@ public class CapsTest { "height=(int)480"); Assert.IsTrue (caps3.IsEqual (caps4)); } + + [Test] + public void TestManagedReferences() { + Caps tmp = VideoUtil.FormatToTemplateCaps(Gst.Video.VideoFormat.RGBX); + Caps caps = tmp.Copy(); + caps[0]["width"] = 640; + caps[0]["height"] = 480; + + caps.Append(tmp); + Caps any = Caps.NewAny(); + caps.Merge(any); + } } |