Exemple #1
0
 public BoxLongPair(BoxNode node1, long num1, BoxNode node2, long num2)
 {
     this.node1 = node1;
     this.number1 = num1;
     this.node2 = node2;
     this.number2 = num2;
 }
 public BoxDetail[] Decode(BoxNode node, byte[] data)
 {
     Array.Copy(data, 8, tmpbuf4, 0, 4);
     string uuidname = Encoding.ASCII.GetString(tmpbuf4);
     //details.Add(new BoxDetail("Sub Name", uuidname, ""));
     Array.Copy(data, 12, tmpbuf12, 0, 12);
     //details.Add(new BoxDetail("Uuid", BitConverter.ToString(tmpbuf12), ""));
     switch (uuidname) {
     case "titl":
         break;
     case "auth":
         break;
     case "lght":
         break;
     case "memo":
         break;
     case "vrsn":
         break;
     }
     throw new Exception("Not implemented.");
 }
 /// <summary>
 /// �w�肳�ꂽBox��ǂݍ��݂܂��B
 /// </summary>
 /// <param name="box">�ǂݍ���Box</param>
 /// <returns></returns>
 public bool OpenBox(BoxNode box)
 {
     byte[] bin = File.ReadAllBytes(box.DumpFile);
     MemoryStream ms = new MemoryStream(bin);
     bineditMain.BinaryStream = ms;
     if (box.Children.Count > 0) {
         bineditMain.ReadOnly = true;
     }
     this.box = box;
     SetText();
     return true;
 }
 /// <summary>
 /// �w�肳�ꂽBox�ɑΉ����Ă��邩�ǂ�����擾���܂��B
 /// </summary>
 /// <param name="box">�m�F����BoxNode</param>
 /// <returns>�Ή����Ă���ΐ^�A����Ȃ���΋U</returns>
 public bool CanOpen(BoxNode box)
 {
     return true;
 }
        public BoxDetail[] Decode(BoxNode node, byte[] data)
        {
            List<BoxDetail> details = new List<BoxDetail>();
            switch (node.BoxName) {
            case "ftyp":
                Array.Copy(data, 8, tmpbuf4, 0, 4);
                details.Add(new BoxDetail("Major brand", Encoding.ASCII.GetString(tmpbuf4), ""));
                Array.Copy(data, 12, tmpbuf4, 0, 4);
                details.Add(new BoxDetail("Version", BitConverter.ToString(tmpbuf4), ""));
                for (int i = 0; i * 4 + 16 < node.Length; i++) {
                    Array.Copy(data, 16 + (i * 4), tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Conpatible brand#" + i.ToString(), Encoding.ASCII.GetString(tmpbuf4), ""));
                }
                break;
            case "uuid":
                Array.Copy(data, 8, tmpbuf4, 0, 4);
                string uuidname = Encoding.ASCII.GetString(tmpbuf4);
                details.Add(new BoxDetail("Sub Name", uuidname, ""));
                Array.Copy(data, 12, tmpbuf12, 0, 12);
                details.Add(new BoxDetail("Uuid", BitConverter.ToString(tmpbuf12), ""));
                switch (uuidname) {
                case "mvml":
                    Array.Copy(data, 24, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Reserved?", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 28, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Flag", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 32, tmpbuf4, 0, 4);
                    Array.Reverse(tmpbuf4);
                    timetmp = BitConverter.ToUInt32(tmpbuf4, 0);
                    details.Add(new BoxDetail("Timestamp", (appleday.AddSeconds(timetmp)).ToString(), ""));
                    break;
                case "enci":
                    Array.Copy(data, 24, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Reserved?", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 28, tmpbuf8, 0, 8);
                    details.Add(new BoxDetail("Hardware Vendor?", Encoding.ASCII.GetString(tmpbuf8), ""));
                    Array.Copy(data, 36, tmpbuf8, 0, 8);
                    details.Add(new BoxDetail("Hardware Name", Encoding.ASCII.GetString(tmpbuf8), ""));
                    Array.Copy(data, 44, tmpbuf8, 0, 8);
                    details.Add(new BoxDetail("Encoder Version?", Encoding.ASCII.GetString(tmpbuf8), ""));
                    Array.Copy(data, 52, tmpbuf8, 0, 8);
                    details.Add(new BoxDetail("Encoder Type", Encoding.ASCII.GetString(tmpbuf8), ""));
                    break;
                case "cpgd":
                    Array.Copy(data, 24, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Flag1", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 28, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Flag2", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 32, tmpbuf4, 0, 4);
                    Array.Reverse(tmpbuf4);
                    timetmp = BitConverter.ToUInt32(tmpbuf4, 0);
                    details.Add(new BoxDetail("Expiration Date", (appleday.AddDays(timetmp)).ToString(), ""));
                    Array.Copy(data, 36, tmpbuf4, 0, 4);
                    Array.Reverse(tmpbuf4);
                    timetmp = BitConverter.ToUInt32(tmpbuf4, 0);
                    details.Add(new BoxDetail("Expiration Date", new TimeSpan(0, 0, (int)timetmp).ToString(), ""));
                    Array.Copy(data, 40, tmpbuf4, 0, 4);
                    Array.Reverse(tmpbuf4);
                    details.Add(new BoxDetail("Expiration Count", BitConverter.ToUInt32(tmpbuf4, 0).ToString(), ""));
                    break;
                case "chku":
                    Array.Copy(data, 24, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Reserved?", BitConverter.ToString(tmpbuf4), ""));
                    Array.Copy(data, 28, tmpbuf128, 0, 128);
                    details.Add(new BoxDetail("DigitalSignature", BitConverter.ToString(tmpbuf128), ""));
                    break;
                case "prop":
                    Array.Copy(data, 24, tmpbuf4, 0, 4);
                    details.Add(new BoxDetail("Reserved?", BitConverter.ToString(tmpbuf4), ""));
                    break;
                }
                break;
            }

            return details.ToArray();
        }
 public bool IsDecodable(BoxNode node)
 {
     switch (node.BoxName) {
     case "ftyp":
     case "uuid":
         return true;
     default:
         return false;
     }
 }
 public bool IsDecodable(BoxNode node)
 {
     if (node.BoxName == "mvhd") {
         return true;
     }
     return false;
 }
        public BoxDetail[] Decode(BoxNode xnode, byte[] data)
        {
            List<BoxDetail> details = new List<BoxDetail>();

            details.Add(new BoxDetail("Version", BitConverter.ToString(data, 0x08, 1), ""));
            details.Add(new BoxDetail("Flags", BitConverter.ToString(data, 0x09, 3), ""));
            Array.Reverse(data, 0x0C, 4);
            details.Add(new BoxDetail("Creation Date",
                appleday.AddSeconds((double)BitConverter.ToUInt32(data, 0x0C)).ToString(), ""));
            Array.Reverse(data, 0x10, 4);
            details.Add(new BoxDetail("Modification Date",
                appleday.AddSeconds((double)BitConverter.ToUInt32(data, 0x10)).ToString(), ""));
            Array.Reverse(data, 0x14, 4);
            uint tscale = BitConverter.ToUInt32(data, 0x14);
            details.Add(new BoxDetail("Time Scale", tscale.ToString(), ""));
            Array.Reverse(data, 0x18, 4);
            uint duration = BitConverter.ToUInt32(data, 0x18);
            details.Add(new BoxDetail("Duration", duration.ToString(), ""));
            details.Add(new BoxDetail("Duration", new TimeSpan((long)((duration / tscale) * Math.Pow(10, 7))).ToString(), ""));
            Array.Reverse(data, 0x1C, 2);
            Array.Reverse(data, 0x1E, 2);
            ushort rate1 = BitConverter.ToUInt16(data, 0x1C);
            ushort rate2 = BitConverter.ToUInt16(data, 0x1E);
            details.Add(new BoxDetail("Preferred Rate", (rate1 + (Single)(rate2 / 0x10000)).ToString(), ""));
            byte vol1 = data[0x20];
            byte vol2 = data[0x21];
            details.Add(new BoxDetail("Preferred Volume", (vol1 + (Single)(vol2 / 0x100)).ToString(), ""));
            details.Add(new BoxDetail("Reserved", BitConverter.ToString(data, 0x22, 0x2B), ""));
            Array.Reverse(data, 0x2C, 4);
            Array.Reverse(data, 0x30, 4);
            Array.Reverse(data, 0x34, 4);
            Array.Reverse(data, 0x38, 4);
            Array.Reverse(data, 0x3C, 4);
            Array.Reverse(data, 0x40, 4);
            Array.Reverse(data, 0x48, 4);
            Array.Reverse(data, 0x4C, 4);
            details.Add(new BoxDetail("Movie Matrix[A]", BitConverter.ToUInt32(data, 0x2C).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[B]", BitConverter.ToUInt32(data, 0x30).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[U]", BitConverter.ToUInt32(data, 0x34).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[C]", BitConverter.ToUInt32(data, 0x38).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[D]", BitConverter.ToUInt32(data, 0x3C).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[V]", BitConverter.ToUInt32(data, 0x40).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[X]", BitConverter.ToUInt32(data, 0x44).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[Y]", BitConverter.ToUInt32(data, 0x48).ToString(), ""));
            details.Add(new BoxDetail("Movie Matrix[W]", BitConverter.ToUInt32(data, 0x4C).ToString(), ""));
            Array.Reverse(data, 0x50, 4);
            Array.Reverse(data, 0x54, 4);
            Array.Reverse(data, 0x58, 4);
            Array.Reverse(data, 0x5C, 4);
            Array.Reverse(data, 0x60, 4);
            Array.Reverse(data, 0x64, 4);
            uint prevt = BitConverter.ToUInt32(data, 0x50);
            details.Add(new BoxDetail("Preview Time", prevt.ToString(), ""));
            details.Add(new BoxDetail("Preview Time", new TimeSpan((long)((prevt / tscale) * Math.Pow(10, 7))).ToString(), ""));
            uint prevd = BitConverter.ToUInt32(data, 0x54);
            details.Add(new BoxDetail("Preview Duration", prevt.ToString(), ""));
            details.Add(new BoxDetail("Preview Duration", new TimeSpan((long)((prevd / tscale) * Math.Pow(10, 7))).ToString(), ""));
            uint postert = BitConverter.ToUInt32(data, 0x58);
            details.Add(new BoxDetail("Poster Time", postert.ToString(), ""));
            details.Add(new BoxDetail("Poster Time", new TimeSpan((long)((postert / tscale) * Math.Pow(10, 7))).ToString(), ""));
            uint selectiont = BitConverter.ToUInt32(data, 0x5C);
            details.Add(new BoxDetail("Selection Time", selectiont.ToString(), ""));
            details.Add(new BoxDetail("Selection Time", new TimeSpan((long)((selectiont / tscale) * Math.Pow(10, 7))).ToString(), ""));
            uint selectiond = BitConverter.ToUInt32(data, 0x60);
            details.Add(new BoxDetail("Selection Duration", selectiond.ToString(), ""));
            details.Add(new BoxDetail("Selection Duration", new TimeSpan((long)((selectiond / tscale) * Math.Pow(10, 7))).ToString(), ""));
            uint currentt = BitConverter.ToUInt32(data, 0x64);
            details.Add(new BoxDetail("Current Time", currentt.ToString(), ""));
            details.Add(new BoxDetail("Current Time", new TimeSpan((long)((currentt / tscale) * Math.Pow(10, 7))).ToString(), ""));
            Array.Reverse(data, 0x68, 4);
            details.Add(new BoxDetail("Next Track ID", BitConverter.ToUInt32(data, 0x68).ToString(), ""));

            return details.ToArray();
        }
 public bool IsDecodable(BoxNode node)
 {
     return node.BoxName == "uuid";
 }