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

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.SeekID:
                    seekID = (eElement)reader.readUint();
                    break;

                case eElement.SeekPosition:
                    seekPosition = reader.readUlong();
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Beispiel #5
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();
            }
        }
Beispiel #6
0
        internal Video(Stream stream)
        {
            ElementReader reader = new ElementReader(stream);

            while (!reader.EOF)
            {
                eElement id = reader.readElementId();
                switch (id)
                {
                case eElement.FlagInterlaced:
                    flagInterlaced = (eFlagInterlaced)reader.readByte(0);
                    break;

                case eElement.FieldOrder:
                    fieldOrder = (eFieldOrder)reader.readByte(2);
                    break;

                case eElement.AlphaMode:
                    alphaMode = reader.readUlong(0);
                    break;

                case eElement.PixelWidth:
                    pixelWidth = reader.readUint();
                    break;

                case eElement.PixelHeight:
                    pixelHeight = reader.readUint();
                    break;

                case eElement.PixelCropBottom:
                    pixelCropBottom = reader.readUint(0);
                    break;

                case eElement.PixelCropTop:
                    pixelCropTop = reader.readUint(0);
                    break;

                case eElement.PixelCropLeft:
                    pixelCropLeft = reader.readUint(0);
                    break;

                case eElement.PixelCropRight:
                    pixelCropRight = reader.readUint(0);
                    break;

                case eElement.DisplayWidth:
                    displayWidth = reader.readUint();
                    break;

                case eElement.DisplayHeight:
                    displayHeight = reader.readUint();
                    break;

                case eElement.DisplayUnit:
                    displayUnit = (eDisplayUnit)reader.readByte(0);
                    break;

                case eElement.AspectRatioType:
                    aspectRatioType = (eAspectRatioType)reader.readByte(0);
                    break;

                case eElement.ColourSpace:
                    colourSpace = reader.readColorSpace();
                    break;

                case eElement.GammaValue:
                    gammaValue = reader.readFloat();
                    break;

                case eElement.FrameRate:
                    frameRate = reader.readFloat();
                    break;

                case eElement.Colour:
                    colour = new Colour(stream);
                    break;

                case eElement.Projection:
                    projection = new Projection(stream);
                    break;

                default:
                    reader.skipElement();
                    break;
                }
            }
        }
Beispiel #7
0
        internal ChapterAtom(Stream stream)
        {
            List <ChapterDisplay> chapterDisplaylist = null;
            List <ChapProcess>    chapProcesslist    = null;
            ElementReader         reader             = new ElementReader(stream);

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

                case eElement.ChapterStringUID:
                    chapterStringUID = reader.readUtf8();
                    break;

                case eElement.ChapterTimeStart:
                    chapterTimeStart = reader.readUlong();
                    break;

                case eElement.ChapterTimeEnd:
                    chapterTimeEnd = reader.readUlong();
                    break;

                case eElement.ChapterFlagHidden:
                    chapterFlagHidden = (byte)reader.readUint(0);
                    break;

                case eElement.ChapterFlagEnabled:
                    chapterFlagEnabled = (byte)reader.readUint(1);
                    break;

                case eElement.ChapterSegmentUID:
                    chapterSegmentUID = reader.readGuid();
                    break;

                case eElement.ChapterSegmentEditionUID:
                    chapterSegmentEditionUID = reader.readUlong();
                    break;

                case eElement.ChapterPhysicalEquiv:
                    chapterPhysicalEquiv = reader.readUlong();
                    break;

                case eElement.ChapterTrack:
                    chapterTrack = new ChapterTrack(stream);
                    break;

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

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

                default:
                    reader.skipElement();
                    break;
                }
            }
            if (chapterDisplaylist != null)
            {
                chapterDisplay = chapterDisplaylist.ToArray();
            }
            if (chapProcesslist != null)
            {
                chapProcess = chapProcesslist.ToArray();
            }
        }