static void HandleVideoEncoder(MainViewModel ViewModel, StartCmdOptions StartOptions) { if (StartOptions.Encoder == null) return; var video = ViewModel.VideoViewModel; // FFMpeg if (FFMpegService.FFMpegExists && Regex.IsMatch(StartOptions.Encoder, @"^ffmpeg:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(7)); video.SelectedVideoWriterKind = ServiceProvider.Get<FFMpegWriterProvider>(); if (index < video.AvailableVideoSources.Count) video.SelectedVideoWriter = video.AvailableVideoWriters[index]; } // SharpAvi else if (ServiceProvider.FileExists("SharpAvi.dll") && Regex.IsMatch(StartOptions.Encoder, @"^sharpavi:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(9)); video.SelectedVideoWriterKind = ServiceProvider.Get<SharpAviWriterProvider>(); if (index < video.AvailableVideoSources.Count) video.SelectedVideoWriter = video.AvailableVideoWriters[index]; } // Gif else if (StartOptions.Encoder == "gif") { video.SelectedVideoWriterKind = ServiceProvider.Get<GifWriterProvider>(); } }
IVideoWriterItem HandleVideoEncoder(StartCmdOptions StartOptions, out IVideoWriterProvider VideoWriterKind) { var ffmpegExists = FFmpegService.FFmpegExists; var sharpAviWriterProvider = ServiceProvider.Get <SharpAviWriterProvider>(); // FFmpeg if (ffmpegExists && Regex.IsMatch(StartOptions.Encoder, @"^ffmpeg:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(7)); var ffmpegWriterProvider = ServiceProvider.Get <FFmpegWriterProvider>(); var writers = ffmpegWriterProvider.ToArray(); if (index < writers.Length) { VideoWriterKind = ffmpegWriterProvider; return(writers[index]); } } // SharpAvi else if (ServiceProvider.FileExists("SharpAvi.dll") && Regex.IsMatch(StartOptions.Encoder, @"^sharpavi:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(9)); var writers = sharpAviWriterProvider.ToArray(); if (index < writers.Length) { VideoWriterKind = sharpAviWriterProvider; return(writers[index]); } } // Stream else if (ffmpegExists && Regex.IsMatch(StartOptions.Encoder, @"^stream:\S+$")) { var url = StartOptions.Encoder.Substring(7); _settings.FFmpeg.CustomStreamingUrl = url; VideoWriterKind = ServiceProvider.Get <StreamingWriterProvider>(); return(StreamingWriterProvider.GetCustomStreamingCodec()); } // Rolling else if (ffmpegExists && Regex.IsMatch(StartOptions.Encoder, @"^roll:\d+$")) { var duration = int.Parse(StartOptions.Encoder.Substring(5)); VideoWriterKind = ServiceProvider.Get <FFmpegWriterProvider>(); return(new FFmpegRollingWriterItem(duration)); } VideoWriterKind = sharpAviWriterProvider; return(sharpAviWriterProvider.First()); }
void SharpAvi() { var sharpAviExists = ServiceProvider.FileExists("SharpAvi.dll"); WriteLine($"SharpAvi Available: {(sharpAviExists ? "YES" : "NO")}"); WriteLine(); if (!sharpAviExists) { return; } WriteLine("SharpAvi ENCODERS" + Underline); var i = 0; foreach (var codec in _sharpAviWriterProvider) { WriteLine($"{i.ToString().PadRight(2)}: {codec}"); ++i; } WriteLine(); }
public override void Load() { // Webcam Provider Bind <IWebCamProvider>().To <CoreWebCamProvider>().InSingletonScope(); // Singleton View Models Bind <MainViewModel>().ToSelf().InSingletonScope(); Bind <VideoViewModel>().ToSelf().InSingletonScope(); Bind <ProxySettingsViewModel>().ToSelf().InSingletonScope(); Bind <LicensesViewModel>().ToSelf().InSingletonScope(); Bind <FFMpegCodecsViewModel>().ToSelf().InSingletonScope(); Bind <CustomOverlaysViewModel>().ToSelf().InSingletonScope(); Bind <CustomImageOverlaysViewModel>().ToSelf().InSingletonScope(); // Settings Bind <Settings>().ToSelf().InSingletonScope(); // Localization Bind <LanguageManager>().ToMethod(M => LanguageManager.Instance).InSingletonScope(); // Hotkeys Bind <HotKeyManager>().ToSelf().InSingletonScope(); // Image Writers Bind <IImageWriterItem>().To <DiskWriter>().InSingletonScope(); Bind <IImageWriterItem>().To <ClipboardWriter>().InSingletonScope(); Bind <IImageWriterItem>().To <ImgurWriter>().InSingletonScope(); // Video Writer Providers Bind <IVideoWriterProvider>().To <FFMpegWriterProvider>().InSingletonScope(); Bind <IVideoWriterProvider>().To <GifWriterProvider>().InSingletonScope(); Bind <IVideoWriterProvider>().To <StreamingWriterProvider>().InSingletonScope(); Bind <IVideoWriterProvider>().To <DiscardWriterProvider>().InSingletonScope(); // Check if SharpAvi is available if (ServiceProvider.FileExists("SharpAvi.dll")) { Bind <IVideoWriterProvider>().To <SharpAviWriterProvider>().InSingletonScope(); } // Video Source Providers Bind <IVideoSourceProvider>().To <ScreenSourceProvider>().InSingletonScope(); Bind <IVideoSourceProvider>().To <RegionSourceProvider>().InSingletonScope(); Bind <IVideoSourceProvider>().To <WindowSourceProvider>().InSingletonScope(); Bind <IVideoSourceProvider>().To <DeskDuplSourceProvider>().InSingletonScope(); Bind <IVideoSourceProvider>().To <NoVideoSourceProvider>().InSingletonScope(); // Check if Bass is available if (BassAudioSource.Available) { Bind <AudioSource>().To <BassAudioSource>().InSingletonScope(); } else { Bind <AudioSource>().To <NoAudioSource>().InSingletonScope(); } }
void HandleVideoEncoder(StartCmdOptions StartOptions) { if (StartOptions.Encoder == null) { return; } // FFmpeg if (FFmpegService.FFmpegExists && Regex.IsMatch(StartOptions.Encoder, @"^ffmpeg:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(7)); _videoWritersViewModel.SelectedVideoWriterKind = ServiceProvider.Get <FFmpegWriterProvider>(); if (index < _videoWritersViewModel.AvailableVideoWriters.Count) { _videoWritersViewModel.SelectedVideoWriter = _videoWritersViewModel.AvailableVideoWriters[index]; } } // SharpAvi else if (ServiceProvider.FileExists("SharpAvi.dll") && Regex.IsMatch(StartOptions.Encoder, @"^sharpavi:\d+$")) { var index = int.Parse(StartOptions.Encoder.Substring(9)); _videoWritersViewModel.SelectedVideoWriterKind = ServiceProvider.Get <SharpAviWriterProvider>(); if (index < _videoWritersViewModel.AvailableVideoWriters.Count) { _videoWritersViewModel.SelectedVideoWriter = _videoWritersViewModel.AvailableVideoWriters[index]; } } // Gif else if (StartOptions.Encoder == "gif") { _videoWritersViewModel.SelectedVideoWriterKind = ServiceProvider.Get <GifWriterProvider>(); } // Stream else if (FFmpegService.FFmpegExists && Regex.IsMatch(StartOptions.Encoder, @"^stream:\S+$")) { var url = StartOptions.Encoder.Substring(7); _settings.FFmpeg.CustomStreamingUrl = url; _videoWritersViewModel.SelectedVideoWriterKind = ServiceProvider.Get <StreamingWriterProvider>(); _videoWritersViewModel.SelectedVideoWriter = StreamingItem.CustomUrl; } }
public void OnLoad(IBinder Binder) { // Singleton View Models Binder.BindSingleton <MainViewModel>(); Binder.BindSingleton <VideoViewModel>(); Binder.BindSingleton <ProxySettingsViewModel>(); Binder.BindSingleton <LicensesViewModel>(); Binder.BindSingleton <CrashLogsViewModel>(); Binder.BindSingleton <FFmpegCodecsViewModel>(); Binder.BindSingleton <CustomOverlaysViewModel>(); Binder.BindSingleton <CustomImageOverlaysViewModel>(); Binder.BindSingleton <CensorOverlaysViewModel>(); // Settings Binder.BindSingleton <Settings>(); Binder.Bind(() => ServiceProvider.Get <Settings>().Audio); Binder.Bind(() => ServiceProvider.Get <Settings>().FFmpeg); Binder.Bind(() => ServiceProvider.Get <Settings>().Gif); Binder.Bind(() => ServiceProvider.Get <Settings>().Proxy); // Localization Binder.Bind(() => LanguageManager.Instance); // Hotkeys Binder.BindSingleton <HotKeyManager>(); // Image Writers Binder.BindSingleton <DiskWriter>(); Binder.BindSingleton <ClipboardWriter>(); Binder.BindSingleton <ImgurWriter>(); Binder.Bind <IImageWriterItem>(ServiceProvider.Get <DiskWriter>); Binder.Bind <IImageWriterItem>(ServiceProvider.Get <ClipboardWriter>); Binder.Bind <IImageWriterItem>(ServiceProvider.Get <ImgurWriter>); // Video Writer Providers Binder.Bind <IVideoWriterProvider, FFmpegWriterProvider>(); Binder.Bind <IVideoWriterProvider, GifWriterProvider>(); Binder.Bind <IVideoWriterProvider, StreamingWriterProvider>(); #if DEBUG Binder.Bind <IVideoWriterProvider, DiscardWriterProvider>(); #endif // Check if SharpAvi is available if (ServiceProvider.FileExists("SharpAvi.dll")) { Binder.Bind <IVideoWriterProvider, SharpAviWriterProvider>(); } Binder.BindSingleton <WindowPickerItem>(); Binder.BindSingleton <ScreenPickerItem>(); Binder.BindSingleton <FullScreenItem>(); // Video Source Providers Binder.Bind <IVideoSourceProvider, ScreenSourceProvider>(); Binder.Bind <IVideoSourceProvider, RegionSourceProvider>(); Binder.Bind <IVideoSourceProvider, WindowSourceProvider>(); Binder.Bind <IVideoSourceProvider, DeskDuplSourceProvider>(); Binder.Bind <IVideoSourceProvider, NoVideoSourceProvider>(); // Folder Browser Dialog Binder.Bind <IDialogService, DialogService>(); // Clipboard Binder.Bind <IClipboardService, ClipboardService>(); // FFmpeg Log Binder.BindSingleton <FFmpegLog>(); // Check if Bass is available if (BassAudioSource.Available) { Binder.Bind <AudioSource, BassAudioSource>(); } else { Binder.Bind <AudioSource, NoAudioSource>(); } }
static void List() { Banner(); var underline = $"\n{new string('-', 30)}"; #region FFmpeg var ffmpegExists = FFmpegService.FFmpegExists; WriteLine($"FFmpeg Available: {(ffmpegExists ? "YES" : "NO")}"); WriteLine(); if (ffmpegExists) { WriteLine("FFmpeg ENCODERS" + underline); var writerProvider = ServiceProvider.Get <FFmpegWriterProvider>(); var i = 0; foreach (var codec in writerProvider) { WriteLine($"{i.ToString().PadRight(2)}: {codec}"); ++i; } WriteLine(); } #endregion #region SharpAvi var sharpAviExists = ServiceProvider.FileExists("SharpAvi.dll"); WriteLine($"SharpAvi Available: {(sharpAviExists ? "YES" : "NO")}"); WriteLine(); if (sharpAviExists) { WriteLine("SharpAvi ENCODERS" + underline); var writerProvider = ServiceProvider.Get <SharpAviWriterProvider>(); var i = 0; foreach (var codec in writerProvider) { WriteLine($"{i.ToString().PadRight(2)}: {codec}"); ++i; } WriteLine(); } #endregion #region Windows WriteLine("AVAILABLE WINDOWS" + underline); // Window Picker is skipped automatically foreach (var source in Window.EnumerateVisible()) { WriteLine($"{source.Handle.ToString().PadRight(10)}: {source.Title}"); } WriteLine(); #endregion #region Screens WriteLine("AVAILABLE SCREENS" + underline); var j = 0; // First is Full Screen, Second is Screen Picker foreach (var screen in ScreenItem.Enumerate()) { WriteLine($"{j.ToString().PadRight(2)}: {screen.Name}"); ++j; } WriteLine(); #endregion var audio = ServiceProvider.Get <AudioSource>(); WriteLine($"ManagedBass Available: {(audio is BassAudioSource ? "YES" : "NO")}"); WriteLine(); #region Microphones if (audio.AvailableRecordingSources.Count > 0) { WriteLine("AVAILABLE MICROPHONES" + underline); for (var i = 0; i < audio.AvailableRecordingSources.Count; ++i) { WriteLine($"{i.ToString().PadRight(2)}: {audio.AvailableRecordingSources[i]}"); } WriteLine(); } #endregion #region Speaker if (audio.AvailableLoopbackSources.Count > 0) { WriteLine("AVAILABLE SPEAKER SOURCES" + underline); for (var i = 0; i < audio.AvailableLoopbackSources.Count; ++i) { WriteLine($"{i.ToString().PadRight(2)}: {audio.AvailableLoopbackSources[i]}"); } WriteLine(); } #endregion #region Webcams var webcam = ServiceProvider.Get <IWebCamProvider>(); if (webcam.AvailableCams.Count > 1) { WriteLine("AVAILABLE WEBCAMS" + underline); for (var i = 1; i < webcam.AvailableCams.Count; ++i) { WriteLine($"{(i - 1).ToString().PadRight(2)}: {webcam.AvailableCams[i]}"); } WriteLine(); } #endregion }
static void List() { Banner(); var underline = $"\n{new string('-', 30)}"; #region FFmpeg var ffmpegExists = FFMpegService.FFMpegExists; WriteLine($"FFmpeg Available: {(ffmpegExists ? "YES" : "NO")}"); WriteLine(); if (ffmpegExists) { WriteLine("FFmpeg ENCODERS" + underline); var writerProvider = ServiceProvider.Get <FFMpegWriterProvider>(); var i = 0; foreach (var codec in writerProvider) { WriteLine($"{i.ToString().PadRight(2)}: {codec}"); ++i; } WriteLine(); } #endregion #region SharpAvi var sharpAviExists = ServiceProvider.FileExists("SharpAvi.dll"); WriteLine($"SharpAvi Available: {(sharpAviExists ? "YES" : "NO")}"); WriteLine(); if (sharpAviExists) { WriteLine("SharpAvi ENCODERS" + underline); var writerProvider = ServiceProvider.Get <SharpAviWriterProvider>(); var i = 0; foreach (var codec in writerProvider) { WriteLine($"{i.ToString().PadRight(2)}: {codec}"); ++i; } WriteLine(); } #endregion #region Windows WriteLine("AVAILABLE WINDOWS" + underline); var winProvider = ServiceProvider.Get <WindowSourceProvider>(); foreach (var source in winProvider.OfType <WindowItem>()) { WriteLine($"{source.Window.Handle.ToString().PadRight(10)}: {source}"); } WriteLine(); #endregion #region Screens WriteLine("AVAILABLE SCREENS" + underline); var scrProvider = ServiceProvider.Get <ScreenSourceProvider>(); var j = 0; // First is Full Screen foreach (var screen in scrProvider.Skip(1)) { WriteLine($"{j.ToString().PadRight(2)}: {screen}"); ++j; } WriteLine(); #endregion #region MouseKeyHook WriteLine($"MouseKeyHook Available: {(ServiceProvider.Get<MainViewModel>().MouseKeyHookAvailable ? "YES" : "NO")}"); WriteLine(); #endregion var audio = ServiceProvider.Get <AudioSource>(); WriteLine($"ManagedBass Available: {(audio is BassAudioSource ? "YES" : "NO")}"); WriteLine(); #region Microphones if (audio.AvailableRecordingSources.Count > 1) { WriteLine("AVAILABLE MICROPHONES" + underline); for (var i = 1; i < audio.AvailableRecordingSources.Count; ++i) { WriteLine($"{(i - 1).ToString().PadRight(2)}: {audio.AvailableRecordingSources[i]}"); } WriteLine(); } #endregion #region Speaker if (audio.AvailableLoopbackSources.Count > 1) { WriteLine("AVAILABLE SPEAKER SOURCES" + underline); for (var i = 1; i < audio.AvailableLoopbackSources.Count; ++i) { WriteLine($"{(i - 1).ToString().PadRight(2)}: {audio.AvailableLoopbackSources[i]}"); } WriteLine(); } #endregion #region Webcams var webcam = ServiceProvider.Get <IWebCamProvider>(); if (webcam.AvailableCams.Count > 1) { WriteLine("AVAILABLE WEBCAMS" + underline); for (var i = 1; i < webcam.AvailableCams.Count; ++i) { WriteLine($"{(i - 1).ToString().PadRight(2)}: {webcam.AvailableCams[i]}"); } WriteLine(); } #endregion }