Example #1
0
        public FileInfoFFmpeg GetFileInfo(string source, ProcessOptionsEncoder options = null, ProcessStartedEventHandler callback = null)
        {
            var result = new FileInfoFFmpeg();

            result.ParseFileInfo(OutputText, null);
            return(result);
        }
Example #2
0
        public void ParseAudioStreamInfo_Valid_ReturnsExpectedData(string text, int index, string format, int sampleRate, string channels, string bitDepth, int bitrate)
        {
            var result = FileInfoFFmpeg.ParseStreamInfo(text);

            var info = result as MediaAudioStreamInfo;

            Assert.NotNull(info);
            Assert.Equal(text, info.RawText);
            Assert.Equal(FFmpegStreamType.Audio, info.StreamType);
            Assert.Equal(index, info.Index);
            Assert.Equal(format, info.Format);
            Assert.Equal(sampleRate, info.SampleRate);
            Assert.Equal(channels, info.Channels);
            Assert.Equal(bitDepth, info.BitDepth);
            Assert.Equal(bitrate, info.Bitrate);
        }
        public override IProcessWorkerEncoder CreateEncoder(ProcessOptionsEncoder options = null, ProcessStartedEventHandler callback = null)
        {
            var Result = base.CreateEncoder(options, callback);

            Result.ProcessCompleted += (s, e) => {
                FileInfoFFmpeg Info = Result.FileInfo as FileInfoFFmpeg;
                if (Info != null && Info.FileStreams == null)
                {
                    // If no data was fed into the process, this will initialize FileStreams.
                    var MockP = Mock.Get <IProcess>(Result.WorkProcess);
                    MockP.Raise(x => x.ErrorDataReceived  += null, CreateMockDataReceivedEventArgs(null));
                    MockP.Raise(x => x.OutputDataReceived += null, CreateMockDataReceivedEventArgs(null));
                    if (Info.FileStreams != null)
                    {
                        Info.FileStreams.Add(new MediaVideoStreamInfo());
                        Info.FileStreams.Add(new MediaAudioStreamInfo());
                    }
                }
            };
            Instances.Add(Result);
            return(Result);
        }
Example #4
0
        public void ParseVideoStreamInfo_Valid_ReturnsExpectedData(string text, int index, string format, string colorSpace, string colorRange, string colorMatrix, int width, int height, int sar1, int sar2, int dar1, int dar2, double frameRate, int bitDepth, int bitrate)
        {
            var result = FileInfoFFmpeg.ParseStreamInfo(text);

            var info = result as MediaVideoStreamInfo;

            Assert.NotNull(info);
            Assert.Equal(text, info.RawText);
            Assert.Equal(FFmpegStreamType.Video, info.StreamType);
            Assert.Equal(index, info.Index);
            Assert.Equal(format, info.Format);
            Assert.Equal(colorSpace, info.ColorSpace);
            Assert.Equal(colorRange, info.ColorRange);
            Assert.Equal(colorMatrix, info.ColorMatrix);
            Assert.Equal(width, info.Width);
            Assert.Equal(height, info.Height);
            Assert.Equal(sar1, info.SAR1);
            Assert.Equal(sar2, info.SAR2);
            Assert.Equal(dar1, info.DAR1);
            Assert.Equal(dar2, info.DAR2);
            Assert.Equal(frameRate, info.FrameRate);
            Assert.Equal(bitDepth, info.BitDepth);
            Assert.Equal(bitrate, info.Bitrate);
        }
Example #5
0
        public void ParseAudioStreamInfo_Invalid_ReturnsNull(string text)
        {
            var result = FileInfoFFmpeg.ParseStreamInfo(text);

            Assert.Null(result);
        }
Example #6
0
        public void ParseAttribute_Any_ReturnsExpectedValue(string text, string key, string expected)
        {
            var result = FileInfoFFmpeg.ParseAttribute(text, key);

            Assert.Equal(expected, result);
        }