Esempio n. 1
0
        /// <summary>
        /// Implements PlugInBase.Start
        /// Sets up the autocropper
        /// and sets GUIGraphicsContext.autoCropper
        /// to point to this object.
        /// </summary>
        public override void Start()
        {
            Log.Debug("AutoCropper: Start()");
            instance = this;

            analyzer = new FrameAnalyzer();

            // Load settings, if returns false,
            // none of autocropper modes are allowed
            // so we dont do anything
            if (!LoadSettings())
            {
                return;
            }

            GUIGraphicsContext.autoCropper = this;

            lastSettings = new CropSettings(0, 0, 0, 0);
            int topMemLengthInFrames    = (int)(topMemLength / (sampleInterval / 1000.0f));
            int bottomMemLengthInFrames = (int)(bottomMemLength / (sampleInterval / 1000.0f));
            int leftMemLengthInFrames   = (int)(leftMemLength / (sampleInterval / 1000.0f));
            int rightMemLengthInFrames  = (int)(rightMemLength / (sampleInterval / 1000.0f));

            Log.Debug("AutoCropper: Top memory is " + topMemLengthInFrames + " sampleinterval " + sampleInterval +
                      " mem length " + topMemLength);
            Log.Debug("AutoCropper: Bottom memory is " + bottomMemLengthInFrames + " sampleinterval " + sampleInterval +
                      " mem length " + bottomMemLength);
            Log.Debug("AutoCropper: Left memory is " + leftMemLengthInFrames + " sampleinterval " + sampleInterval +
                      " mem length " + leftMemLength);
            Log.Debug("AutoCropper: Right memory is " + rightMemLengthInFrames + " sampleinterval " + sampleInterval +
                      " mem length " + rightMemLength);
            topCropAvg    = new MovingAverage(topMemLengthInFrames, 0);
            bottomCropAvg = new MovingAverage(bottomMemLengthInFrames, 0);
            leftCropAvg   = new MovingAverage(leftMemLengthInFrames, 0);
            rightCropAvg  = new MovingAverage(rightMemLengthInFrames, 0);

            // start the thread that will execute the actual cropping
            Thread t = new Thread(new ThreadStart(instance.Worker));

            t.IsBackground = true;
            t.Priority     = ThreadPriority.BelowNormal;
            t.Name         = "AutoCropThread";
            t.Start();

            // register to handle playback events so we can wake
            // the above thread when playback starts
            if (useForMyVideos)
            {
                g_Player.PlayBackStarted += OnVideoStarted;
            }
        }
Esempio n. 2
0
    /// <summary>
    /// Implements PlugInBase.Start
    /// Sets up the autocropper
    /// and sets GUIGraphicsContext.autoCropper
    /// to point to this object.
    /// </summary>
    public override void Start()
    {
      Log.Debug("AutoCropper: Start()");
      instance = this;

      analyzer = new FrameAnalyzer();

      // Load settings, if returns false,
      // none of autocropper modes are allowed
      // so we dont do anything
      if (!LoadSettings())
      {
        return;
      }

      GUIGraphicsContext.autoCropper = this;

      lastSettings = new CropSettings(0, 0, 0, 0);
      int topMemLengthInFrames = (int)(topMemLength / (sampleInterval / 1000.0f));
      int bottomMemLengthInFrames = (int)(bottomMemLength / (sampleInterval / 1000.0f));
      int leftMemLengthInFrames = (int)(leftMemLength / (sampleInterval / 1000.0f));
      int rightMemLengthInFrames = (int)(rightMemLength / (sampleInterval / 1000.0f));
      Log.Debug("AutoCropper: Top memory is " + topMemLengthInFrames + " sampleinterval " + sampleInterval +
                " mem length " + topMemLength);
      Log.Debug("AutoCropper: Bottom memory is " + bottomMemLengthInFrames + " sampleinterval " + sampleInterval +
                " mem length " + bottomMemLength);
      Log.Debug("AutoCropper: Left memory is " + leftMemLengthInFrames + " sampleinterval " + sampleInterval +
                " mem length " + leftMemLength);
      Log.Debug("AutoCropper: Right memory is " + rightMemLengthInFrames + " sampleinterval " + sampleInterval +
                " mem length " + rightMemLength);
      topCropAvg = new MovingAverage(topMemLengthInFrames, 0);
      bottomCropAvg = new MovingAverage(bottomMemLengthInFrames, 0);
      leftCropAvg = new MovingAverage(leftMemLengthInFrames, 0);
      rightCropAvg = new MovingAverage(rightMemLengthInFrames, 0);

      // start the thread that will execute the actual cropping
      Thread t = new Thread(new ThreadStart(instance.Worker));
      t.IsBackground = true;
      t.Priority = ThreadPriority.BelowNormal;
      t.Name = "AutoCropThread";
      t.Start();

      // register to handle playback events so we can wake
      // the above thread when playback starts
      if (useForMyVideos)
      {
        g_Player.PlayBackStarted += OnVideoStarted;
      }
    }