mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 19:42:26 +00:00
Make tests and samples compile again
This commit is contained in:
parent
ffa5406b48
commit
f380194b1a
4 changed files with 11 additions and 61 deletions
|
@ -116,7 +116,7 @@ public class DecodeBinTranscoder : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
Caps caps = args.Pad.Caps;
|
Caps caps = args.Pad.Caps;
|
||||||
Structure structure = caps.GetStructure(0);
|
Structure structure = caps[0];
|
||||||
|
|
||||||
if(!structure.Name.StartsWith("audio")) {
|
if(!structure.Name.StartsWith("audio")) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,7 +34,6 @@ public static class GstTypefindTest
|
||||||
private static void OnHaveType(object o, GLib.SignalArgs args)
|
private static void OnHaveType(object o, GLib.SignalArgs args)
|
||||||
{
|
{
|
||||||
Caps caps = args.Args[1] as Caps;
|
Caps caps = args.Args[1] as Caps;
|
||||||
caps.Refcount++;
|
|
||||||
Console.WriteLine("MimeType: {0}", caps);
|
Console.WriteLine("MimeType: {0}", caps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ public class CapsTest
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestFromString()
|
public void TestNewFromString()
|
||||||
{
|
{
|
||||||
Caps caps = Caps.FromString("video/x-raw-yuv, " +
|
Caps caps = Caps.NewFromString("video/x-raw-yuv, " +
|
||||||
"format=(fourcc)I420, " +
|
"format=(fourcc)I420, " +
|
||||||
"width=(int)384, " +
|
"width=(int)384, " +
|
||||||
"height=(int)288, " +
|
"height=(int)288, " +
|
||||||
|
@ -58,12 +58,12 @@ public class CapsTest
|
||||||
[Test]
|
[Test]
|
||||||
public void TestIntersecting()
|
public void TestIntersecting()
|
||||||
{
|
{
|
||||||
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
|
Caps caps1 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||||
"format=(fourcc)I420, " +
|
"format=(fourcc)I420, " +
|
||||||
"width=(int)[ 1,1000 ], " +
|
"width=(int)[ 1,1000 ], " +
|
||||||
"height=(int)[ 1, 1000 ], " +
|
"height=(int)[ 1, 1000 ], " +
|
||||||
"framerate=(fraction)[ 0/1, 100/1 ]");
|
"framerate=(fraction)[ 0/1, 100/1 ]");
|
||||||
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
|
Caps caps2 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||||
"format=(fourcc)I420, " +
|
"format=(fourcc)I420, " +
|
||||||
"width=(int)640, " +
|
"width=(int)640, " +
|
||||||
"height=(int)480");
|
"height=(int)480");
|
||||||
|
@ -88,10 +88,10 @@ public class CapsTest
|
||||||
[Test]
|
[Test]
|
||||||
public void TestUnion()
|
public void TestUnion()
|
||||||
{
|
{
|
||||||
Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
|
Caps caps1 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||||
"format=(fourcc)I420, " +
|
"format=(fourcc)I420, " +
|
||||||
"width=(int)640");
|
"width=(int)640");
|
||||||
Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
|
Caps caps2 = Caps.NewFromString("video/x-raw-yuv, " +
|
||||||
"format=(fourcc)I420, " +
|
"format=(fourcc)I420, " +
|
||||||
"height=(int)480");
|
"height=(int)480");
|
||||||
Assert.IsNotNull(caps1);
|
Assert.IsNotNull(caps1);
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PadTest
|
||||||
|
|
||||||
public static Caps PadGetCapsStub(Pad pad)
|
public static Caps PadGetCapsStub(Pad pad)
|
||||||
{
|
{
|
||||||
return Caps.FromString("video/x-raw-yuv");
|
return Caps.NewFromString("video/x-raw-yuv");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -129,56 +129,19 @@ public class PadTest
|
||||||
{
|
{
|
||||||
Pad src = new Pad("source", PadDirection.Src);
|
Pad src = new Pad("source", PadDirection.Src);
|
||||||
Assert.IsNotNull(src, "Pad could not be created");
|
Assert.IsNotNull(src, "Pad could not be created");
|
||||||
Assert.AreEqual(src.Refcount, 1, "source pad");
|
|
||||||
|
|
||||||
string name = src.Name;
|
string name = src.Name;
|
||||||
Assert.AreEqual(name, "source");
|
Assert.AreEqual(name, "source");
|
||||||
Assert.AreEqual(src.Refcount, 1, "source pad");
|
|
||||||
|
|
||||||
Pad sink = new Pad("sink", PadDirection.Sink);
|
Pad sink = new Pad("sink", PadDirection.Sink);
|
||||||
Assert.IsNotNull(sink, "Pad could not be created");
|
Assert.IsNotNull(sink, "Pad could not be created");
|
||||||
|
|
||||||
Assert.AreEqual(src.Link(sink), PadLinkReturn.Noformat);
|
Assert.AreEqual(src.Link(sink), PadLinkReturn.Noformat);
|
||||||
Assert.AreEqual(src.Refcount, 1, "source pad");
|
|
||||||
Assert.AreEqual(sink.Refcount, 1, "sink pad");
|
|
||||||
|
|
||||||
sink.Dispose();
|
sink.Dispose();
|
||||||
src.Dispose();
|
src.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRefcount()
|
|
||||||
{
|
|
||||||
Pad sink = new Pad("sink", PadDirection.Sink);
|
|
||||||
Assert.IsNotNull(sink, "Pad could not be created");
|
|
||||||
|
|
||||||
Pad src = new Pad("src", PadDirection.Src);
|
|
||||||
Assert.IsNotNull(src, "Pad could not be created");
|
|
||||||
|
|
||||||
Caps caps = Caps.FromString("foo/bar");
|
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
|
||||||
|
|
||||||
src.SetCaps(caps);
|
|
||||||
sink.SetCaps(caps);
|
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 3, "caps");
|
|
||||||
|
|
||||||
PadLinkReturn plr = src.Link(sink);
|
|
||||||
Assert.AreEqual(plr, PadLinkReturn.Ok, "Pad link failed");
|
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 3, "caps");
|
|
||||||
|
|
||||||
src.Unlink(sink);
|
|
||||||
Assert.AreEqual(caps.Refcount, 3, "caps");
|
|
||||||
|
|
||||||
src.Dispose();
|
|
||||||
sink.Dispose();
|
|
||||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
|
||||||
|
|
||||||
caps.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGetAllowedCaps()
|
public void TestGetAllowedCaps()
|
||||||
{
|
{
|
||||||
|
@ -204,11 +167,10 @@ public class PadTest
|
||||||
Caps caps = src.AllowedCaps;
|
Caps caps = src.AllowedCaps;
|
||||||
Assert.IsNull(caps);
|
Assert.IsNull(caps);
|
||||||
|
|
||||||
caps = Caps.FromString("foo/bar");
|
caps = Caps.NewFromString("foo/bar");
|
||||||
|
|
||||||
src.SetCaps(caps);
|
src.SetCaps(caps);
|
||||||
sink.SetCaps(caps);
|
sink.SetCaps(caps);
|
||||||
Assert.AreEqual(caps.Refcount, 3, "caps");
|
|
||||||
|
|
||||||
PadLinkReturn plr = src.Link(sink);
|
PadLinkReturn plr = src.Link(sink);
|
||||||
Assert.AreEqual(plr, PadLinkReturn.Ok);
|
Assert.AreEqual(plr, PadLinkReturn.Ok);
|
||||||
|
@ -217,18 +179,13 @@ public class PadTest
|
||||||
Assert.IsNotNull(gotcaps);
|
Assert.IsNotNull(gotcaps);
|
||||||
Assert.IsTrue(gotcaps.IsEqual(caps));
|
Assert.IsTrue(gotcaps.IsEqual(caps));
|
||||||
|
|
||||||
Assert.AreEqual(gotcaps.Refcount, 1, "gotcaps");
|
|
||||||
gotcaps.Dispose();
|
gotcaps.Dispose();
|
||||||
|
|
||||||
src.Unlink(sink);
|
src.Unlink(sink);
|
||||||
Assert.AreEqual(caps.Refcount, 3, "caps");
|
|
||||||
Assert.AreEqual(src.Refcount, 1, "src");
|
|
||||||
Assert.AreEqual(sink.Refcount, 1, "sink");
|
|
||||||
|
|
||||||
src.Dispose();
|
src.Dispose();
|
||||||
sink.Dispose();
|
sink.Dispose();
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
|
||||||
caps.Dispose();
|
caps.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,13 +203,11 @@ public class PadTest
|
||||||
Caps caps = src.AllowedCaps;
|
Caps caps = src.AllowedCaps;
|
||||||
Assert.IsNull(caps);
|
Assert.IsNull(caps);
|
||||||
|
|
||||||
caps = Caps.FromString("foo/bar");
|
caps = Caps.NewFromString("foo/bar");
|
||||||
src.SetCaps(caps);
|
src.SetCaps(caps);
|
||||||
Assert.AreEqual(caps.Refcount, 2, "caps");
|
|
||||||
|
|
||||||
Gst.Buffer buffer = new Gst.Buffer();
|
Gst.Buffer buffer = new Gst.Buffer();
|
||||||
Assert.AreEqual(src.Push(buffer), FlowReturn.NotLinked);
|
Assert.AreEqual(src.Push(buffer), FlowReturn.NotLinked);
|
||||||
Assert.AreEqual(buffer.Refcount, 1, "buffer");
|
|
||||||
buffer.Dispose();
|
buffer.Dispose();
|
||||||
|
|
||||||
ulong handler_id = src.AddBufferProbe(new Pad.BufferProbeDelegate(ProbeHandler));
|
ulong handler_id = src.AddBufferProbe(new Pad.BufferProbeDelegate(ProbeHandler));
|
||||||
|
@ -261,12 +216,8 @@ public class PadTest
|
||||||
buffer.Dispose();
|
buffer.Dispose();
|
||||||
src.RemoveBufferProbe((uint)handler_id);
|
src.RemoveBufferProbe((uint)handler_id);
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 2, "caps");
|
|
||||||
Assert.AreEqual(src.Refcount, 1, "src");
|
|
||||||
|
|
||||||
src.Dispose();
|
src.Dispose();
|
||||||
|
|
||||||
Assert.AreEqual(caps.Refcount, 1, "caps");
|
|
||||||
caps.Dispose();
|
caps.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue