Example #1
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 #2
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 #3
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 #4
0
        internal SimpleTag(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

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

                case eElement.TagLanguage:
                    tagLanguage = reader.readAscii();
                    break;

                case eElement.TagLanguageIETF:
                    tagLanguageIETF = reader.readAscii();
                    break;

                case eElement.TagDefault:
                    tagDefault = (byte)reader.readUint(1);
                    break;

                case eElement.TagString:
                    tagString = reader.readUtf8();
                    break;

                case eElement.TagBinary:
                    tagBinary = Blob.read(reader);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Example #5
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 #6
0
        internal Targets(Stream stream)
        {
            List <ulong>  tagTrackUIDlist      = null;
            List <ulong>  tagEditionUIDlist    = null;
            List <ulong>  tagChapterUIDlist    = null;
            List <ulong>  tagAttachmentUIDlist = null;
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.TargetTypeValue:
                    targetTypeValue = (eTargetTypeValue)reader.readByte(50);
                    break;

                case eElement.TargetType:
                    targetType = Enum.Parse <eTargetType>(reader.readAscii());
                    break;

                case eElement.TagTrackUID:
                    if (null == tagTrackUIDlist)
                    {
                        tagTrackUIDlist = new List <ulong>();
                    }
                    tagTrackUIDlist.Add(reader.readUlong(0));
                    break;

                case eElement.TagEditionUID:
                    if (null == tagEditionUIDlist)
                    {
                        tagEditionUIDlist = new List <ulong>();
                    }
                    tagEditionUIDlist.Add(reader.readUlong(0));
                    break;

                case eElement.TagChapterUID:
                    if (null == tagChapterUIDlist)
                    {
                        tagChapterUIDlist = new List <ulong>();
                    }
                    tagChapterUIDlist.Add(reader.readUlong(0));
                    break;

                case eElement.TagAttachmentUID:
                    if (null == tagAttachmentUIDlist)
                    {
                        tagAttachmentUIDlist = new List <ulong>();
                    }
                    tagAttachmentUIDlist.Add(reader.readUlong(0));
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (tagTrackUIDlist != null)
            {
                tagTrackUID = tagTrackUIDlist.ToArray();
            }
            if (tagEditionUIDlist != null)
            {
                tagEditionUID = tagEditionUIDlist.ToArray();
            }
            if (tagChapterUIDlist != null)
            {
                tagChapterUID = tagChapterUIDlist.ToArray();
            }
            if (tagAttachmentUIDlist != null)
            {
                tagAttachmentUID = tagAttachmentUIDlist.ToArray();
            }
        }
Example #7
0
        internal TrackEntry(Stream stream)
        {
            List <BlockAdditionMapping> blockAdditionMappinglist = null;
            List <string>         codecInfoURLlist     = null;
            List <string>         codecDownloadURLlist = null;
            List <ulong>          trackOverlaylist     = null;
            List <TrackTranslate> trackTranslatelist   = null;
            ElementReader         reader = new ElementReader(stream);

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

                case eElement.TrackUID:
                    trackUID = reader.readUlong();
                    break;

                case eElement.TrackType:
                    trackType = (eTrackType)reader.readByte();
                    break;

                case eElement.FlagEnabled:
                    flagEnabled = (byte)reader.readUint(1);
                    break;

                case eElement.FlagDefault:
                    flagDefault = (byte)reader.readUint(1);
                    break;

                case eElement.FlagForced:
                    flagForced = (byte)reader.readUint(0);
                    break;

                case eElement.FlagLacing:
                    flagLacing = (byte)reader.readUint(1);
                    break;

                case eElement.MinCache:
                    minCache = reader.readUlong(0);
                    break;

                case eElement.MaxCache:
                    maxCache = reader.readUlong();
                    break;

                case eElement.DefaultDuration:
                    defaultDuration = reader.readUlong();
                    break;

                case eElement.DefaultDecodedFieldDuration:
                    defaultDecodedFieldDuration = reader.readUlong();
                    break;

                case eElement.TrackOffset:
                    trackOffset = reader.readInt(0);
                    break;

                case eElement.MaxBlockAdditionID:
                    maxBlockAdditionID = reader.readUlong(0);
                    break;

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

                case eElement.Name:
                    name = reader.readUtf8();
                    break;

                case eElement.Language:
                    language = reader.readAscii();
                    break;

                case eElement.LanguageIETF:
                    languageIETF = reader.readAscii();
                    break;

                case eElement.CodecID:
                    codecID = reader.readAscii();
                    break;

                case eElement.CodecPrivate:
                    codecPrivate = reader.readByteArray();
                    break;

                case eElement.CodecName:
                    codecName = reader.readUtf8();
                    break;

                case eElement.AttachmentLink:
                    attachmentLink = reader.readUlong();
                    break;

                case eElement.CodecSettings:
                    codecSettings = reader.readUtf8();
                    break;

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

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

                case eElement.CodecDecodeAll:
                    codecDecodeAll = (byte)reader.readUint(1);
                    break;

                case eElement.TrackOverlay:
                    if (null == trackOverlaylist)
                    {
                        trackOverlaylist = new List <ulong>();
                    }
                    trackOverlaylist.Add(reader.readUlong());
                    break;

                case eElement.CodecDelay:
                    codecDelay = reader.readUlong(0);
                    break;

                case eElement.SeekPreRoll:
                    seekPreRoll = reader.readUlong(0);
                    break;

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

                case eElement.Video:
                    video = new Video(stream);
                    break;

                case eElement.Audio:
                    audio = new Audio(stream);
                    break;

                case eElement.TrackOperation:
                    trackOperation = new TrackOperation(stream);
                    break;

                case eElement.TrickTrackUID:
                    trickTrackUID = reader.readUlong();
                    break;

                case eElement.TrickTrackSegmentUID:
                    trickTrackSegmentUID = reader.readGuid();
                    break;

                case eElement.TrickTrackFlag:
                    trickTrackFlag = reader.readUlong(0);
                    break;

                case eElement.TrickMasterTrackUID:
                    trickMasterTrackUID = reader.readUlong();
                    break;

                case eElement.TrickMasterTrackSegmentUID:
                    trickMasterTrackSegmentUID = reader.readGuid();
                    break;

                case eElement.ContentEncodings:
                    contentEncodings = new ContentEncodings(stream);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (blockAdditionMappinglist != null)
            {
                blockAdditionMapping = blockAdditionMappinglist.ToArray();
            }
            if (codecInfoURLlist != null)
            {
                codecInfoURL = codecInfoURLlist.ToArray();
            }
            if (codecDownloadURLlist != null)
            {
                codecDownloadURL = codecDownloadURLlist.ToArray();
            }
            if (trackOverlaylist != null)
            {
                trackOverlay = trackOverlaylist.ToArray();
            }
            if (trackTranslatelist != null)
            {
                trackTranslate = trackTranslatelist.ToArray();
            }
        }