Example #1
0
        internal ContentEncodings(Stream stream)
        {
            List <ContentEncoding> contentEncodinglist = null;
            ElementReader          reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ContentEncoding:
                    if (null == contentEncodinglist)
                    {
                        contentEncodinglist = new List <ContentEncoding>();
                    }
                    contentEncodinglist.Add(new ContentEncoding(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (contentEncodinglist != null)
            {
                contentEncoding = contentEncodinglist.ToArray();
            }
        }
Example #2
0
        internal Cues(Stream stream)
        {
            cuePoint = default;
            List <CuePoint> cuePointlist = null;
            ElementReader   reader       = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.CuePoint:
                    if (null == cuePointlist)
                    {
                        cuePointlist = new List <CuePoint>();
                    }
                    cuePointlist.Add(new CuePoint(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (cuePointlist != null)
            {
                cuePoint = cuePointlist.ToArray();
            }
        }
Example #3
0
        internal CueReference(Stream stream)
        {
            cueRefTime       = default;
            cueRefCluster    = default;
            cueRefNumber     = 1;
            cueRefCodecState = 0;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.CueRefTime:
                    cueRefTime = reader.readUlong();
                    break;

                case eElement.CueRefCluster:
                    cueRefCluster = reader.readUlong();
                    break;

                case eElement.CueRefNumber:
                    cueRefNumber = reader.readUlong(1);
                    break;

                case eElement.CueRefCodecState:
                    cueRefCodecState = reader.readUlong(0);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #4
0
        internal Tags(Stream stream)
        {
            List <Tag>    taglist = null;
            ElementReader reader  = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.Tag:
                    if (null == taglist)
                    {
                        taglist = new List <Tag>();
                    }
                    taglist.Add(new Tag(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (taglist != null)
            {
                tag = taglist.ToArray();
            }
        }
Example #5
0
        internal ClusterPlaceholder(Stream stream, long segmentOffset)
        {
            long filePosition = stream.Position - 4;                // 4 for the cluster header.

            segmentPosition = filePosition - segmentOffset;

            timestamp = default;

            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                bool     fastForward = false;
                eElement id          = reader.readElementId();
                switch (id)
                {
                case eElement.Timestamp:
                    timestamp = reader.readUlong();
                    break;

                default:
                    fastForward = true;
                    break;
                }
                if (fastForward)
                {
                    break;
                }
            }
            stream.Seek(reader.endPosition, SeekOrigin.Begin);
        }
Example #6
0
        internal Chapters(Stream stream)
        {
            List <EditionEntry> editionEntrylist = null;
            ElementReader       reader           = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.EditionEntry:
                    if (null == editionEntrylist)
                    {
                        editionEntrylist = new List <EditionEntry>();
                    }
                    editionEntrylist.Add(new EditionEntry(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (editionEntrylist != null)
            {
                editionEntry = editionEntrylist.ToArray();
            }
        }
Example #7
0
        internal ChapterTrack(Stream stream)
        {
            List <ulong>  chapterTrackUIDlist = null;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ChapterTrackUID:
                    if (null == chapterTrackUIDlist)
                    {
                        chapterTrackUIDlist = new List <ulong>();
                    }
                    chapterTrackUIDlist.Add(reader.readUlong());
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (chapterTrackUIDlist != null)
            {
                chapterTrackUID = chapterTrackUIDlist.ToArray();
            }
        }
Example #8
0
        internal Tag(Stream stream)
        {
            List <SimpleTag> simpleTaglist = null;
            ElementReader    reader        = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.Targets:
                    targets = new Targets(stream);
                    break;

                case eElement.SimpleTag:
                    if (null == simpleTaglist)
                    {
                        simpleTaglist = new List <SimpleTag>();
                    }
                    simpleTaglist.Add(new SimpleTag(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (simpleTaglist != null)
            {
                simpleTag = simpleTaglist.ToArray();
            }
        }
Example #9
0
        internal BlockAdditionMapping(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.BlockAddIDValue:
                    blockAddIDValue = reader.readUlong();
                    break;

                case eElement.BlockAddIDName:
                    blockAddIDName = reader.readAscii();
                    break;

                case eElement.BlockAddIDType:
                    blockAddIDType = reader.readUlong(0);
                    break;

                case eElement.BlockAddIDExtraData:
                    blockAddIDExtraData = Blob.read(reader);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #10
0
        public EBML(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.stream.readElementId();
                switch (id)
                {
                case eElement.EBMLVersion:
                    version = reader.readUint(1);
                    break;

                case eElement.EBMLReadVersion:
                    readVersion = reader.readUint(1);
                    break;

                case eElement.DocType:
                    docType = reader.readAscii();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #11
0
        internal Slices(Stream stream)
        {
            timeSlice = default;
            List <TimeSlice> timeSlicelist = null;
            ElementReader    reader        = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.TimeSlice:
                    if (null == timeSlicelist)
                    {
                        timeSlicelist = new List <TimeSlice>();
                    }
                    timeSlicelist.Add(new TimeSlice(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (timeSlicelist != null)
            {
                timeSlice = timeSlicelist.ToArray();
            }
        }
Example #12
0
        internal Audio(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.SamplingFrequency:
                    samplingFrequency = reader.readFloat(8000);
                    break;

                case eElement.OutputSamplingFrequency:
                    outputSamplingFrequency = reader.readFloat();
                    break;

                case eElement.Channels:
                    channels = reader.readUlong(1);
                    break;

                case eElement.ChannelPositions:
                    channelPositions = Blob.read(reader);
                    break;

                case eElement.BitDepth:
                    bitDepth = reader.readUlong();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #13
0
        internal TrackJoinBlocks(Stream stream)
        {
            List <ulong>  trackJoinUIDlist = null;
            ElementReader reader           = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.TrackJoinUID:
                    if (null == trackJoinUIDlist)
                    {
                        trackJoinUIDlist = new List <ulong>();
                    }
                    trackJoinUIDlist.Add(reader.readUlong());
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (trackJoinUIDlist != null)
            {
                trackJoinUID = trackJoinUIDlist.ToArray();
            }
        }
Example #14
0
        internal BlockAdditions(Stream stream)
        {
            List <BlockMore> blockMorelist = null;
            ElementReader    reader        = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.BlockMore:
                    if (null == blockMorelist)
                    {
                        blockMorelist = new List <BlockMore>();
                    }
                    blockMorelist.Add(new BlockMore(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (blockMorelist != null)
            {
                blockMore = blockMorelist.ToArray();
            }
        }
Example #15
0
        internal SeekHead(Stream stream)
        {
            List <Seek>   seeklist = null;
            ElementReader reader   = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.Seek:
                    if (null == seeklist)
                    {
                        seeklist = new List <Seek>();
                    }
                    seeklist.Add(new Seek(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (seeklist != null)
            {
                seek = seeklist.ToArray();
            }
        }
Example #16
0
        internal CuePoint(Stream stream)
        {
            cueTime           = default;
            cueTrackPositions = default;
            List <CueTrackPositions> cueTrackPositionslist = null;
            ElementReader            reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.CueTime:
                    cueTime = reader.readUlong();
                    break;

                case eElement.CueTrackPositions:
                    if (null == cueTrackPositionslist)
                    {
                        cueTrackPositionslist = new List <CueTrackPositions>();
                    }
                    cueTrackPositionslist.Add(new CueTrackPositions(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (cueTrackPositionslist != null)
            {
                cueTrackPositions = cueTrackPositionslist.ToArray();
            }
        }
Example #17
0
        internal Projection(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ProjectionType:
                    projectionType = (eProjectionType)reader.readByte(0);
                    break;

                case eElement.ProjectionPrivate:
                    projectionPrivate = Blob.read(reader);
                    break;

                case eElement.ProjectionPoseYaw:
                    projectionPoseYaw = reader.readFloat(0);
                    break;

                case eElement.ProjectionPosePitch:
                    projectionPosePitch = reader.readFloat(0);
                    break;

                case eElement.ProjectionPoseRoll:
                    projectionPoseRoll = reader.readFloat(0);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #18
0
        internal ContentEncoding(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ContentEncodingOrder:
                    contentEncodingOrder = reader.readUlong(0);
                    break;

                case eElement.ContentEncodingScope:
                    contentEncodingScope = (eContentEncodingScope)reader.readByte(1);
                    break;

                case eElement.ContentEncodingType:
                    contentEncodingType = (eContentEncodingType)reader.readByte(0);
                    break;

                case eElement.ContentCompression:
                    contentCompression = new ContentCompression(stream);
                    break;

                case eElement.ContentEncryption:
                    contentEncryption = new ContentEncryption(stream);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #19
0
        internal TrackCombinePlanes(Stream stream)
        {
            List <TrackPlane> trackPlanelist = null;
            ElementReader     reader         = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.TrackPlane:
                    if (null == trackPlanelist)
                    {
                        trackPlanelist = new List <TrackPlane>();
                    }
                    trackPlanelist.Add(new TrackPlane(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (trackPlanelist != null)
            {
                trackPlane = trackPlanelist.ToArray();
            }
        }
Example #20
0
        internal Attachments(Stream stream)
        {
            List <AttachedFile> attachedFilelist = null;
            ElementReader       reader           = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.AttachedFile:
                    if (null == attachedFilelist)
                    {
                        attachedFilelist = new List <AttachedFile>();
                    }
                    attachedFilelist.Add(new AttachedFile(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (attachedFilelist != null)
            {
                attachedFile = attachedFilelist.ToArray();
            }
        }
Example #21
0
        internal SilentTracks(Stream stream)
        {
            List <ulong>  silentTrackNumberlist = null;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.SilentTrackNumber:
                    if (null == silentTrackNumberlist)
                    {
                        silentTrackNumberlist = new List <ulong>();
                    }
                    silentTrackNumberlist.Add(reader.readUlong());
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (silentTrackNumberlist != null)
            {
                silentTrackNumber = silentTrackNumberlist.ToArray();
            }
        }
Example #22
0
        internal CueTrackPositions(Stream stream)
        {
            cueTrack            = default;
            cueClusterPosition  = default;
            cueRelativePosition = default;
            cueDuration         = default;
            cueBlockNumber      = 1;
            cueCodecState       = 0;
            cueReference        = default;
            List <CueReference> cueReferencelist = null;
            ElementReader       reader           = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.CueTrack:
                    cueTrack = reader.readUlong();
                    break;

                case eElement.CueClusterPosition:
                    cueClusterPosition = reader.readUlong();
                    break;

                case eElement.CueRelativePosition:
                    cueRelativePosition = reader.readUlong();
                    break;

                case eElement.CueDuration:
                    cueDuration = reader.readUlong();
                    break;

                case eElement.CueBlockNumber:
                    cueBlockNumber = reader.readUlong(1);
                    break;

                case eElement.CueCodecState:
                    cueCodecState = reader.readUlong(0);
                    break;

                case eElement.CueReference:
                    if (null == cueReferencelist)
                    {
                        cueReferencelist = new List <CueReference>();
                    }
                    cueReferencelist.Add(new CueReference(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (cueReferencelist != null)
            {
                cueReference = cueReferencelist.ToArray();
            }
        }
Example #23
0
        internal static Blob read(ElementReader reader)
        {
            long len  = checked ((long)reader.stream.readUint8());
            Blob blob = new Blob(len, reader.stream);

            reader.stream.Seek(blob.position + blob.length, SeekOrigin.Begin);
            return(blob);
        }
Example #24
0
        internal ChapterDisplay(Stream stream)
        {
            List <string> chapLanguagelist     = null;
            List <string> chapLanguageIETFlist = null;
            List <string> chapCountrylist      = null;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ChapString:
                    chapString = reader.readUtf8();
                    break;

                case eElement.ChapLanguage:
                    if (null == chapLanguagelist)
                    {
                        chapLanguagelist = new List <string>();
                    }
                    chapLanguagelist.Add(reader.readAscii());
                    break;

                case eElement.ChapLanguageIETF:
                    if (null == chapLanguageIETFlist)
                    {
                        chapLanguageIETFlist = new List <string>();
                    }
                    chapLanguageIETFlist.Add(reader.readAscii());
                    break;

                case eElement.ChapCountry:
                    if (null == chapCountrylist)
                    {
                        chapCountrylist = new List <string>();
                    }
                    chapCountrylist.Add(reader.readAscii());
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (chapLanguagelist != null)
            {
                chapLanguage = chapLanguagelist.ToArray();
            }
            if (chapLanguageIETFlist != null)
            {
                chapLanguageIETF = chapLanguageIETFlist.ToArray();
            }
            if (chapCountrylist != null)
            {
                chapCountry = chapCountrylist.ToArray();
            }
        }
Example #25
0
        internal MasteringMetadata(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.PrimaryRChromaticityX:
                    primaryRChromaticityX = reader.readFloat();
                    break;

                case eElement.PrimaryRChromaticityY:
                    primaryRChromaticityY = reader.readFloat();
                    break;

                case eElement.PrimaryGChromaticityX:
                    primaryGChromaticityX = reader.readFloat();
                    break;

                case eElement.PrimaryGChromaticityY:
                    primaryGChromaticityY = reader.readFloat();
                    break;

                case eElement.PrimaryBChromaticityX:
                    primaryBChromaticityX = reader.readFloat();
                    break;

                case eElement.PrimaryBChromaticityY:
                    primaryBChromaticityY = reader.readFloat();
                    break;

                case eElement.WhitePointChromaticityX:
                    whitePointChromaticityX = reader.readFloat();
                    break;

                case eElement.WhitePointChromaticityY:
                    whitePointChromaticityY = reader.readFloat();
                    break;

                case eElement.LuminanceMax:
                    luminanceMax = reader.readFloat();
                    break;

                case eElement.LuminanceMin:
                    luminanceMin = reader.readFloat();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #26
0
        internal AttachedFile(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.FileDescription:
                    fileDescription = reader.readUtf8();
                    break;

                case eElement.FileName:
                    fileName = reader.readUtf8();
                    break;

                case eElement.FileMimeType:
                    fileMimeType = reader.readAscii();
                    break;

                case eElement.FileData:
                    fileData = Blob.read(reader);
                    break;

                case eElement.FileUID:
                    fileUID = reader.readUlong();
                    break;

                case eElement.FileReferral:
                    fileReferral = Blob.read(reader);
                    break;

                case eElement.FileUsedStartTime:
                    fileUsedStartTime = reader.readUlong();
                    break;

                case eElement.FileUsedEndTime:
                    fileUsedEndTime = reader.readUlong();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #27
0
        internal EditionEntry(Stream stream)
        {
            List <ChapterAtom> chapterAtomlist = null;
            ElementReader      reader          = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.EditionUID:
                    editionUID = reader.readUlong();
                    break;

                case eElement.EditionFlagHidden:
                    editionFlagHidden = (byte)reader.readUint(0);
                    break;

                case eElement.EditionFlagDefault:
                    editionFlagDefault = (byte)reader.readUint(0);
                    break;

                case eElement.EditionFlagOrdered:
                    editionFlagOrdered = (byte)reader.readUint(0);
                    break;

                case eElement.ChapterAtom:
                    if (null == chapterAtomlist)
                    {
                        chapterAtomlist = new List <ChapterAtom>();
                    }
                    chapterAtomlist.Add(new ChapterAtom(stream));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (chapterAtomlist != null)
            {
                chapterAtom = chapterAtomlist.ToArray();
            }
        }
Example #28
0
        internal ContentEncAESSettings(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.AESSettingsCipherMode:
                    aESSettingsCipherMode = (eAESSettingsCipherMode)reader.readByte();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #29
0
        internal ContentEncryption(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.ContentEncAlgo:
                    contentEncAlgo = (eContentEncAlgo)reader.readByte(0);
                    break;

                case eElement.ContentEncKeyID:
                    contentEncKeyID = Blob.read(reader);
                    break;

                case eElement.ContentEncAESSettings:
                    contentEncAESSettings = new ContentEncAESSettings(stream);
                    break;

                case eElement.ContentSignature:
                    contentSignature = Blob.read(reader);
                    break;

                case eElement.ContentSigKeyID:
                    contentSigKeyID = Blob.read(reader);
                    break;

                case eElement.ContentSigAlgo:
                    contentSigAlgo = (eContentSigAlgo)reader.readByte(0);
                    break;

                case eElement.ContentSigHashAlgo:
                    contentSigHashAlgo = (eContentSigHashAlgo)reader.readByte(0);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #30
0
        internal TimeSlice(Stream stream)
        {
            laceNumber      = 0;
            frameNumber     = 0;
            blockAdditionID = 0;
            delay           = 0;
            sliceDuration   = 0;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.LaceNumber:
                    laceNumber = reader.readUlong(0);
                    break;

                case eElement.FrameNumber:
                    frameNumber = reader.readUlong(0);
                    break;

                case eElement.BlockAdditionID:
                    blockAdditionID = reader.readUlong(0);
                    break;

                case eElement.Delay:
                    delay = reader.readUlong(0);
                    break;

                case eElement.SliceDuration:
                    sliceDuration = reader.readUlong(0);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }