예제 #1
0
 public SourceReaderExtra(string fileName, object state, SourceReader sourceReader)
 {
     FileName = fileName;
     State = state;
     SourceReader = sourceReader;
 }
예제 #2
0
        SourceStream SetVideoMediaType(SourceReader sourceReader)
        {
            var sourceStream = sourceReader.Streams.First(s => s.IsSelected && s.NativeMediaType.IsVideo);

            sourceStream.CurrentMediaType = GetMediaTypeRGB();

            return sourceStream;
        }
예제 #3
0
        SourceStream SetVideoMediaType(SourceReader sourceReader)
        {
            try
            {
                var sourceStream = sourceReader.Streams.FirstOrDefault(s => s.IsSelected && s.NativeMediaType.IsVideo);

                if (sourceStream.IsNull)
                    throw new Exception("Unable to find video track within file.");

                sourceStream.CurrentMediaType = new MediaType() { MajorType = MFMediaType.Video, SubType = MFMediaType.RGB32 };

                return sourceStream;
            }
            catch (Exception e)
            {
                throw new Exception(string.Format("Unable to decode video stream. {0}", e.Message), e);
            }
        }
예제 #4
0
        SourceStream SetAudioMediaType(SourceReader sourceReader)
        {
            var sourceStream = sourceReader.Streams.First(s => s.IsSelected && s.NativeMediaType.IsAudio);

            sourceStream.CurrentMediaType = new MediaType() { MajorType = MFMediaType.Audio, SubType = MFMediaType.PCM };

            return sourceStream;
        }
예제 #5
0
        private ProcessSample ConnectVideoStreams(SourceReader sourceReader, SinkWriter sinkWriter)
        {
            var sourceVideoStream = SetVideoMediaType(sourceReader);
            var sinkVideoStream = AddStream(sinkWriter, sourceVideoStream.CurrentMediaType, CreateTargetVideoMediaType(sourceVideoStream.NativeMediaType));

            return AVOperations.MediaTypeChange(sinkVideoStream, AVOperations.SaveTo(sinkVideoStream));
        }
예제 #6
0
        private ProcessSample ConnectStreams(SourceReader shortSourceReader, SourceReader shortSourceReader2,  SourceReader sourceReader, SinkWriter sinkWriter)
        {
            SetAudioMediaType(shortSourceReader);
            SetVideoMediaType(shortSourceReader);

            SetAudioMediaType(shortSourceReader2);
            SetVideoMediaType(shortSourceReader2);

            return AVOperations.SeperateAudioVideo(
                ConnectAudioStreams(sourceReader, sinkWriter),
                ConnectVideoStreams(sourceReader, sinkWriter));
        }
        SourceStream SetAudioMediaType(SourceReader sourceReader)
        {
            try
            {
                var sourceStream = sourceReader.Streams.First(s => s.IsSelected && s.NativeMediaType.IsAudio);

                sourceStream.CurrentMediaType = new MediaType() { MajorType = MFMediaType.Audio, SubType = MFMediaType.PCM };

                return sourceStream;
            }
            catch(Exception e)
            {
                throw new Exception(string.Format("Unable to decode audio stream. {0}", e.Message), e);
            }
        }
예제 #8
0
 private ProcessSample ConnectStreams(SourceReader sourceReader, SinkWriter sinkWriter)
 {
     return AVOperations.SeperateAudioVideo(
         ConnectAudioStreams(sourceReader, sinkWriter),
         ConnectVideoStreams(sourceReader, sinkWriter));
 }