Ejemplo n.º 1
0
        public AutoCrop(string filename, UserSettings settings, ref CropInfo cropInfo)
        {
            InitializeComponent();
            try
            {
                this.settings = settings;
                this.cropInfo = cropInfo;
                AviSynthScriptEnvironment asse = new AviSynthScriptEnvironment();
                asc = asse.OpenScriptFile(filename);

                if(asc.HasVideo)
                {
                    System.Drawing.Size s = new Size(asc.VideoWidth, asc.VideoHeight);
                    this.ClientSize = s;                    
                    maxFrames = asc.num_frames;
                    
                    // remove last ~10 minutes
                    if (maxFrames > 30000)
                    {
                        maxFrames -= 15000;
                    }
                    numericUpDownFrame.Maximum = maxFrames;
                    int step = 0;
                    step = maxFrames / nrFrames;
                    curFrame = step;
                    Monitor.Enter(drawLock);
                    bitmap = ReadFrameBitmap(asc, step);
                    bitmapCopy = new Bitmap(bitmap);
                    Monitor.Exit(drawLock);
                }
            }
            catch (Exception ex)
            {
                cropInfo.error = true;
                cropInfo.errorStr = ex.Message;
            }
        }
Ejemplo n.º 2
0
 public AviSynthClip(string func, string arg, AviSynthColorspace forceColorspace, AviSynthScriptEnvironment env)
 {
     try
     {
         _vi         = new AVSDLLVideoInfo();
         _avs        = new IntPtr(0);
         _colorSpace = AviSynthColorspace.Unknown;
         _sampleType = AudioSampleType.Unknown;
         if (0 != dimzon_avs_init_2(ref _avs, func, arg, ref _vi, ref _colorSpace, ref _sampleType, forceColorspace.ToString()))
         {
             string err = getLastError();
             cleanup(false);
             throw new AviSynthException(err);
         }
     }
     catch (Exception ex)
     {
         cleanup(false);
         throw new AviSynthException(ex.Message);
     }
 }
Ejemplo n.º 3
0
        public AviSynthClip(string func, string arg , AviSynthColorspace forceColorspace, AviSynthScriptEnvironment env)
		{
            try
            {
                _vi = new AVSDLLVideoInfo();
                _avs = new IntPtr(0);
                _colorSpace = AviSynthColorspace.Unknown;
                _sampleType = AudioSampleType.Unknown;
                if (0 != dimzon_avs_init_2(ref _avs, func, arg, ref _vi, ref _colorSpace, ref _sampleType, forceColorspace.ToString()))
                {
                    string err = getLastError();
                    cleanup(false);
                    throw new AviSynthException(err);
                }
            }
            catch (Exception ex)
            {
                cleanup(false);
                throw new AviSynthException(ex.Message);
            }
		}