Пример #1
0
 public HardDiskCache(ScreenRecordingOptions options)
 {
     Options = options;
     Helpers.CreateDirectoryFromFilePath(Options.OutputPath);
     fsCache   = new FileStream(Options.OutputPath, FileMode.Create, FileAccess.Write, FileShare.Read);
     indexList = new List <LocationInfo>();
 }
Пример #2
0
        public ScreenRecorder(ScreenRecordOutput outputType, ScreenRecordingOptions options, Screenshot screenshot, Rectangle captureRectangle)
        {
            if (string.IsNullOrEmpty(options.OutputPath))
            {
                throw new Exception("Screen recorder cache path is empty.");
            }

            FPS              = options.FPS;
            DurationSeconds  = options.Duration;
            CaptureRectangle = captureRectangle;
            CachePath        = options.OutputPath;
            OutputType       = outputType;

            Options = options;

            switch (OutputType)
            {
            default:
            case ScreenRecordOutput.FFmpeg:
                FileHelpers.CreateDirectoryFromFilePath(Options.OutputPath);
                ffmpeg                        = new FFmpegCLIManager(Options.FFmpeg.FFmpegPath);
                ffmpeg.ShowError              = true;
                ffmpeg.EncodeStarted         += OnRecordingStarted;
                ffmpeg.EncodeProgressChanged += OnEncodingProgressChanged;
                break;

            case ScreenRecordOutput.GIF:
                imgCache = new HardDiskCache(Options);
                break;
            }

            this.screenshot = screenshot;
        }
Пример #3
0
        public FFmpegOptionsForm(ScreenRecordingOptions options)
        {
            Options = options;

            InitializeComponent();
            ShareXResources.ApplyTheme(this);

            eiFFmpeg.ObjectType = typeof(FFmpegOptions);
            cbVideoCodec.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegVideoCodec>());
            cbAudioCodec.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegAudioCodec>());
            cbx264Preset.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegPreset>());
            cbGIFStatsMode.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegPaletteGenStatsMode>());
            cbNVENCPreset.Items.AddRange(Helpers.GetEnums <FFmpegNVENCPreset>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
            cbGIFDither.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegPaletteUseDither>());
            cbAMFUsage.Items.AddRange(Helpers.GetEnums <FFmpegAMFUsage>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
            cbAMFQuality.Items.AddRange(Helpers.GetEnums <FFmpegAMFQuality>().Select(x => $"{x} ({x.GetDescription()})").ToArray());
            cbQSVPreset.Items.AddRange(Helpers.GetEnumDescriptions <FFmpegQSVPreset>());
        }