public SourceReaderExtra(string fileName, object state, SourceReader sourceReader) { FileName = fileName; State = state; SourceReader = sourceReader; }
SourceStream SetVideoMediaType(SourceReader sourceReader) { var sourceStream = sourceReader.Streams.First(s => s.IsSelected && s.NativeMediaType.IsVideo); sourceStream.CurrentMediaType = GetMediaTypeRGB(); return sourceStream; }
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); } }
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; }
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)); }
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); } }
private ProcessSample ConnectStreams(SourceReader sourceReader, SinkWriter sinkWriter) { return AVOperations.SeperateAudioVideo( ConnectAudioStreams(sourceReader, sinkWriter), ConnectVideoStreams(sourceReader, sinkWriter)); }