示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
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);
        }
示例#4
0
        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);
        }
示例#5
0
 public ClustersCache(MkvMediaFile file)
 {
     this.file     = file;
     clustersCount = file.segment.cluster.Length;
     timeScaler    = TimeScaler.mkv(file.segment.info[0].timestampScale);
 }
示例#6
0
 public AudioReader(MkvMediaFile file, TrackEntry track) :
     base(file, track)
 {
 }
示例#7
0
 public AudioTrack(MkvMediaFile file, TrackEntry track)
 {
     this.file  = file;
     this.track = track;
     info       = new TrackInfo(track);
 }
示例#8
0
        public static int find(MkvMediaFile file, TrackEntry track, CSize size)
        {
            int pixels = size.cx * size.cy;

            return(pixels * maxBitsPerPixel / 8);
        }