public TrackEntry findVideoTrack() { if (null == this.tracks) { throw new ArgumentException("No tracks found in that file"); } TrackEntry[] tracks = this.tracks.SelectMany(t => t.trackEntry) .Where(e => e.trackType == eTrackType.Video) .ToArray(); if (tracks.Length < 1) { throw new ArgumentException("No video tracks found in that file"); } TrackEntry videoTrack; videoTrack = tracks[0]; if (tracks.Length > 1) { Logger.logWarning("Multiple video tracks, using the first one"); } switch (videoTrack.codecID) { case "V_MPEG4/ISO/AVC": videoCodec = eVideoCodec.h264; break; case "V_MPEGH/ISO/HEVC": videoCodec = eVideoCodec.h265; throw new NotSupportedException($"h265 video codec is not supported"); // break; default: throw new ArgumentException($"The video codec, \"{ videoTrack.codecID }\", is not supported by the library."); } if (null == videoTrack.codecPrivate) { throw new NotSupportedException($"The MKV is lacking private data of the h264 codec"); } return(videoTrack); }
public VideoTrack(MkvMediaFile file, TrackEntry track) { this.file = file; this.track = track; videoCodec = file.segment.videoCodec; switch (videoCodec) { case eVideoCodec.h264: videoParams = new VideoParams264(track); break; case eVideoCodec.h265: videoParams = new VideoParams265(track); break; default: throw new ApplicationException("Unexpected eVideoCodec value"); } maxBytesInFrame = MaxEncodedSize.find(file, track, videoParams.decodedSize.size); }