示例#1
0
        public void Properties_ReturnNativeValues()
        {
            var ffmpeg = new FFmpegClient();

            var nativeCodec        = ffmpeg.FindDecoder(AVCodecID.AV_CODEC_ID_H264);
            var nativeCodecContext = new NativeAVCodecContext
            {
            };

            var codec = new AVCodec(ffmpeg, &nativeCodecContext, (NativeAVCodec *)nativeCodec);

            Assert.Equal("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", codec.LongName);
            Assert.Equal("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (h264)", codec.ToString());
            Assert.Equal("h264", codec.Name);
            Assert.Equal(AVCodecCapabilities.DR1 | AVCodecCapabilities.Delay | AVCodecCapabilities.Threads | AVCodecCapabilities.SliceThreads, codec.Capabilities);
            Assert.True(codec.IsDecoder);
            Assert.False(codec.IsEncoder);
        }
示例#2
0
        public void ToString_ReturnsString()
        {
            var name = new byte[] { (byte)'t', (byte)'e', (byte)'s', (byte)'t' };

            fixed(byte *p = name)
            {
                var nativeCodec = new NativeAVCodec
                {
                    name      = p,
                    long_name = p,
                };

                var ffmpegMock   = new Mock <FFmpegClient>();
                var ffmpegClient = ffmpegMock.Object;

                var codecContext = new NativeAVCodecContext
                {
                };

                var codec = new AVCodec(ffmpegClient, &codecContext, &nativeCodec);

                Assert.Equal("test (test)", codec.ToString());
            }
        }