Exemple #1
0
        private static SmackerHeader ReadHeader(Stream s)
        {
            SmackerHeader smk = new SmackerHeader();
            int i;

            /* read and check header */
            smk.Signature = Util.ReadDWord(s);
            if (smk.Signature != Util.MakeTag('S', 'M', 'K', '2') && smk.Signature != Util.MakeTag('S', 'M', 'K', '4'))
                throw new InvalidDataException("Not an SMK stream");

            smk.Width = Util.ReadDWord(s);
            smk.Height = Util.ReadDWord(s);
            smk.NbFrames = Util.ReadDWord(s);
            smk.Pts_Inc = (int)Util.ReadDWord(s);
            smk.Fps = CalcFps(smk);
            smk.Flags = Util.ReadDWord(s);
            for (i = 0; i < 7; i++)
                smk.AudioSize[i] = Util.ReadDWord(s);
            smk.TreesSize = Util.ReadDWord(s);
            smk.NMap_Size = Util.ReadDWord(s);
            smk.MClr_Size = Util.ReadDWord(s);
            smk.Full_Size = Util.ReadDWord(s);
            smk.Type_Size = Util.ReadDWord(s);
            for (i = 0; i < 7; i++)
                smk.AudioRate[i] = Util.ReadDWord(s); ;
            smk.Dummy = Util.ReadDWord(s);

            /* setup data */
            if (smk.NbFrames > 0xFFFFFF)
                throw new InvalidDataException("Too many frames: " + smk.NbFrames);

            return smk;
        }
Exemple #2
0
 private static double CalcFps(SmackerHeader smk)
 {
     if ((int)smk.Pts_Inc > 0)
     {
         return(1000.0 / (int)smk.Pts_Inc);
     }
     else if ((int)smk.Pts_Inc < 0)
     {
         return(100000.0 / (-(int)smk.Pts_Inc));
     }
     else
     {
         return(10.0);
     }
 }
Exemple #3
0
        private static SmackerHeader ReadHeader(Stream s)
        {
            SmackerHeader smk = new SmackerHeader();
            int           i;

            /* read and check header */
            smk.Signature = Util.ReadDWord(s);
            if (smk.Signature != Util.MakeTag('S', 'M', 'K', '2') && smk.Signature != Util.MakeTag('S', 'M', 'K', '4'))
            {
                throw new InvalidDataException("Not an SMK stream");
            }

            smk.Width    = Util.ReadDWord(s);
            smk.Height   = Util.ReadDWord(s);
            smk.NbFrames = Util.ReadDWord(s);
            smk.Pts_Inc  = (int)Util.ReadDWord(s);
            smk.Fps      = CalcFps(smk);
            smk.Flags    = Util.ReadDWord(s);
            for (i = 0; i < 7; i++)
            {
                smk.AudioSize[i] = Util.ReadDWord(s);
            }
            smk.TreesSize = Util.ReadDWord(s);
            smk.NMap_Size = Util.ReadDWord(s);
            smk.MClr_Size = Util.ReadDWord(s);
            smk.Full_Size = Util.ReadDWord(s);
            smk.Type_Size = Util.ReadDWord(s);
            for (i = 0; i < 7; i++)
            {
                smk.AudioRate[i] = Util.ReadDWord(s);
            }
            ;
            smk.Dummy = Util.ReadDWord(s);

            /* setup data */
            if (smk.NbFrames > 0xFFFFFF)
            {
                throw new InvalidDataException("Too many frames: " + smk.NbFrames);
            }

            return(smk);
        }
Exemple #4
0
 private static double CalcFps(SmackerHeader smk)
 {
     if ((int)smk.Pts_Inc > 0)
         return 1000.0 / (int)smk.Pts_Inc;
     else if ((int)smk.Pts_Inc < 0)
         return 100000.0 / (-(int)smk.Pts_Inc);
     else
         return 10.0;
 }