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

            return(pixels * maxBitsPerPixel / 8);
        }