public RecordingService(ScreenMetadata targetScreen, RegionBlock recordBlock, FourCC codec, int quality)
        {
            Debug.Assert(targetScreen != null);
            Debug.Assert(recordBlock != null);

            this.targetScreen = targetScreen;
            this.recordBlock  = recordBlock;

            videoWriter = new AviWriter($"{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}.avi", 10)
            {
                EmitIndex1 = true
            };

            videoStream      = CreateVideoStream(codec, quality);
            videoStream.Name = "Screencast";

            recordThread = new Thread(RecordScreen)
            {
                Name         = typeof(RecordingService).Name + ".RecordScreen",
                IsBackground = true
            };
        }
 public IRecordingService Create(RegionBlock recordBlock, FourCC codec, int quality)
 {
     return(new RecordingService(metadataService.GetActiveScreens().First(), recordBlock, codec, quality));
 }