Beispiel #1
0
        public void Test2()
        {
            MediaDictionary options = new MediaDictionary();

            Output.WriteLine($"{((IntPtr)options.internalPointerPlaceHolder).ToInt64()}");
            Output.WriteLine($"={((IntPtr)options.ppDictionary).ToInt64()}");
            options.Add("protocol_whitelist", "file");
            options.Add("key", "value");
            options.Add("protocol_blacklist", "cache");
            Output.WriteLine($"{((IntPtr)options.internalPointerPlaceHolder).ToInt64()}");
            Output.WriteLine($"={((IntPtr)options.ppDictionary).ToInt64()}");
            var file = "222.mp4";
            AVFormatContext * pFormatContext  = null;
            AVFormatContext **ppFormatContext = &pFormatContext;
            var ret1 = ffmpeg.avformat_alloc_output_context2(ppFormatContext, OutFormat.Get("mpeg"), null, file);
            var ret2 = ffmpeg.avio_open2(&pFormatContext->pb, file, ffmpeg.AVIO_FLAG_WRITE, null, options);

            //Output.WriteLine($"{((IntPtr)options.ppDictionary).ToInt64()}");
            //Output.WriteLine($"{((IntPtr)options.internalPointerPlaceHolder).ToInt64()}");
            Output.WriteLine($"{((IntPtr)options.internalPointerPlaceHolder).ToInt64()}");
            Output.WriteLine($"={((IntPtr)options.ppDictionary).ToInt64()}");
            Output.WriteLine($"+{((IntPtr)(*options.ppDictionary)).ToInt64()}");
            Assert.True(options.Count == 1);
            Assert.Equal("key", options.First().Key);
            Assert.Equal("value", options.First().Value);
        }
        public void TestNotSupported()
        {
            MediaDictionary options = new MediaDictionary();

            options.Add("protocol_whitelist", "file");
            options.Add("key", "value"); // not supported
            options.Add("protocol_blacklist", "cache");
            var file = "test.mp4";
            AVFormatContext * pFormatContext  = null;
            AVFormatContext **ppFormatContext = &pFormatContext;
            var ret1 = ffmpeg.avformat_alloc_output_context2(ppFormatContext, null, null, file);
            var ret2 = ffmpeg.avio_open2(&pFormatContext->pb, file, ffmpeg.AVIO_FLAG_WRITE, null, options);

            Assert.True(options.Count == 1);
            Assert.Equal("key", options.First().Key);
            Assert.Equal("value", options.First().Value);
        }