Example #1
0
        static Mp4BoxFTYP CreateFTYPBox()
        {
            List <string> list = new List <string>();

            if (list != null)
            {
                list.Add("piff");
                list.Add("iso2");
                return(Mp4BoxFTYP.CreateFTYPBox("isml", 1, list));
            }
            return(null);
        }
Example #2
0
        public static bool InsertFTYPMOOV(string path, Mp4BoxFTYP boxftyp, Mp4BoxMOOV boxmoov)
        {
            bool result = false;

            try
            {
                FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
                if (fs != null)
                {
                    FileStream fso = new FileStream(path + ".ismv", FileMode.Create, FileAccess.ReadWrite);
                    if (fso != null)
                    {
                        byte[] data = boxftyp.GetBoxBytes();
                        if (data != null)
                        {
                            fso.Write(data, 0, data.Length);
                            data = boxmoov.GetBoxBytes();
                            if (data != null)
                            {
                                fso.Write(data, 0, data.Length);
                                data = new byte[65535];
                                long offset = 0;
                                while (offset < fs.Length)
                                {
                                    int Len = fs.Read(data, 0, data.Length);
                                    if (Len == 0)
                                    {
                                        break;
                                    }
                                    fso.Write(data, 0, Len);
                                    offset += Len;
                                }
                                if (offset == fs.Length)
                                {
                                    result = true;
                                }
                                fso.Close();
                            }
                        }
                    }
                    fs.Close();
                }
            }
            catch (Exception)
            {
                result = false;
            }

            return(result);
        }
Example #3
0
        static byte[] GetFTYPBoxData()
        {
            List <string> list = new List <string>();

            if (list != null)
            {
                list.Add("piff");
                list.Add("iso2");
                Mp4BoxFTYP box = Mp4BoxFTYP.CreateFTYPBox("isml", 1, list);
                if (box != null)
                {
                    return(box.GetBoxBytes());
                }
            }
            return(null);
        }