示例#1
0
        private bool LoadCacheSceneDetection(string VideoName)
        {
            FileInfo info = new FileInfo(VideoName);

            string cachefile2 = Path.Combine(cacheDir, info.Name + ".cache2");
            if (File.Exists(cachefile2))
            {
                try
                {
                    Config cache = new Config(cachefile2);
                    cache.LoadConfig();
                    if ((cache.GetValue("FileName") == VideoName) && (int.Parse(cache.GetValue("FrameTotal")) == FrameTotal) && (estiloV4.s2d(cache.GetValue("FrameRate")) == videoInfo.FrameRate))
                    {
                        videoInfo.KeyFrames = new ArrayList();
                        ArrayList tempstr = new ArrayList();

                        int nentradas = int.Parse(cache.GetValue("NumEntries"));
                        for (int i = 0; i < nentradas; i++)
                            tempstr.AddRange(cache.GetValueA("SceneEntry" + i));

                        foreach (string s in tempstr)
                            videoInfo.KeyFrames.Add(int.Parse(s));

                    }
                    else return false;
                }
                catch
                {
                    return false;
                }
            }
            else
            {
                string cachefile = Path.Combine(cacheDir, info.Name + ".cache");
                if (!File.Exists(cachefile)) return false;

                try
                {
                    Config cache = new Config(cachefile);
                    cache.LoadConfig();
                    if ((cache.GetValue("FileName") == VideoName) && (int.Parse(cache.GetValue("FrameTotal")) == FrameTotal) &&
                        (estiloV4.s2d(cache.GetValue("FrameRate")) == videoInfo.FrameRate))
                    {
                        videoInfo.KeyFrames = new ArrayList();
                        foreach (string val in cache.GetValueA("Scenes"))
                        {
                            videoInfo.KeyFrames.Add(int.Parse(val));
                        }
                    }
                    else return false;
                }
                catch { return false; }
            }
            return true;
        }
示例#2
0
        private void SaveCacheSceneDetection(string VideoName)
        {
            FileInfo info = new FileInfo(VideoName);
            string cachefile = Path.Combine(cacheDir, info.Name + ".cache2");
            if (File.Exists(cachefile)) File.Delete(cachefile);

            Config cache = new Config(cachefile);

            cache.SetValue("FileName", VideoName);
            cache.SetValue("FrameTotal", FrameTotal.ToString());
            cache.SetValue("FrameRate", estiloV4.d2s(videoInfo.FrameRate));

            int nentradas = videoInfo.KeyFrames.Count / 50;
            if ((videoInfo.KeyFrames.Count % 50) != 0) nentradas++;

            cache.SetValue("NumEntries", nentradas.ToString());
            ArrayList auxKeyF = (ArrayList)videoInfo.KeyFrames.Clone();

            for (int i = 0; i < nentradas; i++)
            {
                if (auxKeyF.Count > 50)
                {
                    cache.SetValueA("SceneEntry" + i, auxKeyF.GetRange(0, 50));
                    auxKeyF.RemoveRange(0, 50);
                }
                else
                {
                    cache.SetValueA("SceneEntry" + i, auxKeyF);
                }
            }

            cache.WriteConfig();
        }
示例#3
0
 private void InitConfigutation()
 {
     config = new Config(configName);
     config.LoadConfig();
 }