public static int find(MkvMediaFile file, TrackEntry track, CSize size) { ulong trackNum = track.trackNumber; int maxFound = 0; for (int i = 0; i < 166; i++) { Cluster firstCluster = file.segment.cluster[i].loadCluster(file.stream); int extraBytes = track.extraBytesCount(); int clusterMax = 0; foreach (var b in firstCluster.allBlobs()) { if (b.trackNumber != trackNum) { continue; } // Don't bother decoding NALUs. We don't need precise number, just a reasonable upper estimate. clusterMax = Math.Max(clusterMax, (int)b.length + extraBytes); } Console.WriteLine("{0}\t{1}", i, clusterMax); maxFound = Math.Max(maxFound, clusterMax); } return(maxFound); }
public ReaderBase(MkvMediaFile file, TrackEntry track) { clusters = file.clusters; this.track = track; trackNumber = track.trackNumber; strippedHeaders = track.strippedHeaderBytes(); strippedHeaderBytes = strippedHeaders?.Length ?? 0; seekIndex = file.segment.buildSeekIndex(trackNumber); stream = file.stream; loadCluster(0); }
public VideoReader(MkvMediaFile file, TrackEntry track, VideoParams videoParams, EncodedQueue queue) : base(file, track) { this.queue = queue; #if DEBUG if (null == queue) { return; } #endif // Enqueue SPS and PPS NALUs videoParams.enqueueParameters(queue); }
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); }
public ClustersCache(MkvMediaFile file) { this.file = file; clustersCount = file.segment.cluster.Length; timeScaler = TimeScaler.mkv(file.segment.info[0].timestampScale); }
public AudioReader(MkvMediaFile file, TrackEntry track) : base(file, track) { }
public AudioTrack(MkvMediaFile file, TrackEntry track) { this.file = file; this.track = track; info = new TrackInfo(track); }
public static int find(MkvMediaFile file, TrackEntry track, CSize size) { int pixels = size.cx * size.cy; return(pixels * maxBitsPerPixel / 8); }