Пример #1
0
    public void TestIntersecting()
    {
        Caps caps1 = Caps.FromString("video/x-raw-yuv, " +
                                     "format=(fourcc)I420, " +
                                     "width=(int)[ 1,1000 ], " +
                                     "height=(int)[ 1, 1000 ], " +
                                     "framerate=(fraction)[ 0/1, 100/1 ]");
        Caps caps2 = Caps.FromString("video/x-raw-yuv, " +
                                     "format=(fourcc)I420, " +
                                     "width=(int)640, " +
                                     "height=(int)480");

        Assert.IsNotNull(caps1);
        Assert.IsNotNull(caps2);

        Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps1");
        Assert.IsFalse(caps1.Handle == IntPtr.Zero, "Ooops, null handle in caps2");

        Caps caps3 = caps1.Intersect(caps2);

        Assert.IsFalse(caps3.IsFixed, "How come caps are FIXED?!");
        Assert.IsFalse(caps3.IsEmpty, "How come caps are EMPTY?!");

        Assert.AreEqual(caps2.ToString() + ", framerate=(fraction)[ 0/1, 100/1 ]", caps3.ToString());
    }