Ejemplo n.º 1
0
        public Mdia(FileStream fs, ulong maximumLength)
        {
            Position = (ulong)fs.Position;
            while (fs.Position < (long)maximumLength)
            {
                if (!InitializeSizeAndName(fs))
                    return;

                if (Name == "minf" && IsTextSubtitle || IsVobSubSubtitle || IsClosedCaption || IsVideo)
                {
                    UInt32 timeScale = 90000;
                    if (Mdhd != null)
                        timeScale = Mdhd.TimeScale;
                    Minf = new Minf(fs, Position, timeScale, HandlerType, this);
                }
                else if (Name == "hdlr")
                {
                    Buffer = new byte[Size - 4];
                    fs.Read(Buffer, 0, Buffer.Length);
                    HandlerType = GetString(8, 4);
                    if (Size > 25)
                        HandlerName = GetString(24, Buffer.Length - (24 + 5)); // TODO: How to find this?
                }
                else if (Name == "mdhd")
                {
                    Mdhd = new Mdhd(fs, Size);
                }
                fs.Seek((long)Position, SeekOrigin.Begin);
            }
        }
Ejemplo n.º 2
0
        public Mdia(Stream fs, ulong maximumLength)
        {
            HandlerType = string.Empty;
            Position    = (ulong)fs.Position;
            while (fs.Position < (long)maximumLength)
            {
                if (!InitializeSizeAndName(fs))
                {
                    return;
                }

                if (Name == "minf" && IsTextSubtitle || IsVobSubSubtitle || IsClosedCaption || IsVideo)
                {
                    ulong timeScale = 90000;
                    if (Mdhd != null)
                    {
                        timeScale = Mdhd.TimeScale;
                    }

                    var tempMinf = new Minf(fs, Position, timeScale, HandlerType, this);
                    if (tempMinf.Stbl != null)
                    {
                        Minf = tempMinf;
                    }
                }
                else if (Name == "hdlr")
                {
                    Buffer = new byte[Size - 4];
                    fs.Read(Buffer, 0, Buffer.Length);
                    HandlerType = GetString(8, 4);
                    if (Size > 25)
                    {
                        HandlerName = GetString(24, Buffer.Length - (24 + 5)); // TODO: How to find this?
                    }
                }
                else if (Name == "mdhd")
                {
                    Mdhd = new Mdhd(fs, Size);
                }
                fs.Seek((long)Position, SeekOrigin.Begin);
            }
        }