void ClassInit(string DefaultOysterAddress,int DefaultOysterConnectionPort,int DefaultOysterFilePort,string DefaultOysterDeviceID,string OysterDeviceFriendlyName, bool ManualConfiguration, RecordOptions.ScreenRecordType RecordType, string WindowTitleToRecord, ScreenEncoder.CapturePerformance ScreenCapturePerformance, RecordOptions.CameraSelection CamerasSelected, int MinutesToRecord, int SecondsToCountdown, string ScreenProfileDirectory, string ScreenWMVDirectory, RecordOptions.PrimaryCamera CameraPrimary) { // System.Reflection.AssemblyTitleAttribute ata = (System.Reflection.AssemblyTitleAttribute) // System.Attribute.GetCustomAttribute(System.Reflection.Assembly.GetAssembly(typeof(DesktopRecorder.RecordOptions)), // typeof(System.Reflection.AssemblyTitleAttribute)); m_RegKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey( @"SOFTWARE\Carver Lab\Oyster\" + CarverLab.Utility.AppInfo.Title); if (m_RegKey == null) { throw new System.ApplicationException("Could not open Carver Lab registry key."); } RegistryInit(DefaultOysterAddress,DefaultOysterConnectionPort,DefaultOysterFilePort,DefaultOysterDeviceID,OysterDeviceFriendlyName,ManualConfiguration, RecordType,WindowTitleToRecord, ScreenCapturePerformance,CamerasSelected,MinutesToRecord,SecondsToCountdown, ScreenProfileDirectory,ScreenWMVDirectory, CameraPrimary); }
void RegistryInit(string DefaultOysterAddress,int DefaultOysterConnectionPort, int DefaultOysterFilePort,string DefaultOysterDeviceID,string OysterDeviceFriendlyName, bool ManualConfiguration, RecordOptions.ScreenRecordType RecordType, string WindowTitleToRecord, ScreenEncoder.CapturePerformance ScreenCapturePerformance, RecordOptions.CameraSelection CamerasSelected, int MinutesToRecord, int SecondsToCountdown, string ScreenProfileDirectory, string ScreenWMVDirectory, RecordOptions.PrimaryCamera CameraPrimary) { m_sDefaultOysterDeviceAddress = (string) m_RegKey.GetValue("DefaultOysterDeviceAddress",DefaultOysterDeviceAddress); m_iDefaultOysterDeviceConnectionPort = (int) m_RegKey.GetValue("DefaultOysterDeviceConnectionPort",DefaultOysterDeviceConnectionPort); m_iDefaultOysterDeviceFilePort = (int) m_RegKey.GetValue("DefaultOysterDeviceFilePort",DefaultOysterDeviceFilePort); m_sDefaultOysterAddress = (string) m_RegKey.GetValue("DefaultOysterAddress",DefaultOysterAddress); m_iDefaultOysterConnectionPort = (int) m_RegKey.GetValue("DefaultOysterConnectionPort",DefaultOysterConnectionPort); m_iDefaultOysterFilePort = (int) m_RegKey.GetValue("DefaultOysterFilePort",DefaultOysterFilePort); m_sDefaultOysterDeviceID = (string) m_RegKey.GetValue("DefaultOysterDeviceID",DefaultOysterDeviceID); m_sOysterDeviceFriendlyName = (string) m_RegKey.GetValue("OysterDeviceFriendlyName",OysterDeviceFriendlyName); m_bManualConfiguration = bool.Parse((string)m_RegKey.GetValue("ManualConfiguration",ManualConfiguration.ToString())); m_ScreenRecordType = (RecordOptions.ScreenRecordType) System.Enum.Parse(typeof(RecordOptions.ScreenRecordType), (string)m_RegKey.GetValue("RecordType",RecordType.ToString())); m_sWindowTitleToRecord = (string) m_RegKey.GetValue("WindowTitleToRecord",WindowTitleToRecord); m_ScreenCapturePerformance = (ScreenEncoder.CapturePerformance) System.Enum.Parse(typeof(ScreenEncoder.CapturePerformance), (string)m_RegKey.GetValue("CapturePerformance",ScreenCapturePerformance.ToString())); m_CameraSelection = (RecordOptions.CameraSelection) System.Enum.Parse(typeof(RecordOptions.CameraSelection), (string)m_RegKey.GetValue("SelectedCamera",CamerasSelected.ToString())); m_iMinutesToRecord = (int)m_RegKey.GetValue("MinutesToRecord",MinutesToRecord); m_iMinutesToCountdown = (int)m_RegKey.GetValue("SecondsToCountdown",SecondsToCountdown); m_sProfileDirectory = (string)m_RegKey.GetValue("ProfileDirectory",ScreenProfileDirectory); m_sProfileDirectory = RemoveTrailingBackslashFromPath(m_sProfileDirectory); m_sWMVDirectory = (string) m_RegKey.GetValue("WMVDirectory",ScreenWMVDirectory); m_sWMVDirectory = RemoveTrailingBackslashFromPath(m_sWMVDirectory); m_PrimaryCamera = (RecordOptions.PrimaryCamera) System.Enum.Parse(typeof(RecordOptions.PrimaryCamera), (string)m_RegKey.GetValue("CameraPrimary",CameraPrimary.ToString())); m_bHasBeenSaved = bool.Parse((string)m_RegKey.GetValue("HasBeenSaved",false.ToString())); }
// string[] CapturePerformanceNames;// = {"Extreme","Very High","High","Medium High","Medium","Low","Very Low"}; public CapturePerformance(ScreenEncoder.CapturePerformance Performance, string Filename) { this.cp = Performance; m_sFilename = Filename; }
public RecordOptions(string DefaultOysterAddress,int DefaultOysterConnectionPort,int DefaultOysterFilePort, string DefaultOysterDeviceID,string OysterDeviceFriendlyName, bool ManualConfiguration, RecordOptions.ScreenRecordType RecordType, string WindowTitleToRecord, ScreenEncoder.CapturePerformance ScreenCapturePerformance, RecordOptions.CameraSelection CamerasSelected, int MinutesToRecord, int SecondsToCountdown, string ScreenProfileDirectory, string ScreenWMVDirectory, RecordOptions.PrimaryCamera CameraPrimary) { ClassInit(DefaultOysterAddress,DefaultOysterConnectionPort,DefaultOysterFilePort,DefaultOysterDeviceID,OysterDeviceFriendlyName,ManualConfiguration,RecordType,WindowTitleToRecord, ScreenCapturePerformance,CamerasSelected,MinutesToRecord,SecondsToCountdown, ScreenProfileDirectory,ScreenWMVDirectory,CameraPrimary); }
public bool SetupEncoder(CapturePerformance ScreenCapturePerformance, ScreenEncoder.CaptureType ScreenCaptureType, params System.Object[] ParameterArray) { string sWMEFile ; switch (ScreenCapturePerformance) { case CapturePerformance.Extreme: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_1000k_30fps.wme"; break; case CapturePerformance.VeryHigh: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_700k_25fps.wme"; break; case CapturePerformance.High: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_341k_15fps.wme"; break; case CapturePerformance.MediumHigh: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_250k_15fps.wme"; break; case CapturePerformance.Medium: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_93k_10fps.wme"; break; case CapturePerformance.Low: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_32k_5fps.wme"; break; case CapturePerformance.VeryLow: sWMEFile = m_sProfileDirectory + "\\" + "ScreenCapture_13k_3fps.wme"; break; default: //log.WriteLog("SignalType must be a valid OysterEncoder.VideoSignalType"); return false; } m_sWMEFilename = sWMEFile; // m_bIsEncoderStreaming = false; // verify that the WMEFilename is exists if (!System.IO.File.Exists(sWMEFile)) { //log.WriteLog(sWMEFile + " does not exist."); return false; } // initialize the Winnov capture card on the specified channel // by setting the source index for both audio and video // initialize the WMEncoder // load the WMEFilename into the WMEncoder m_encoder.Load(sWMEFile); // prepare the WMEncoder // m_encoder.EnableAutoArchive = false; m_encoder.PrepareToEncode(true); // m_videosource2 = (WMEncoderLib.IWMEncVideoSource2) // m_encoder.SourceGroupCollection.Add("SourceGroup").AddSource(WMEncoderLib.WMENC_SOURCE_TYPE.WMENC_VIDEO); // m_videosource2.SetInput("ScreenCap://ScreenCapture1","",""); m_videosource2 = (WMEncoderLib.IWMEncVideoSource2) m_encoder.SourceGroupCollection.Item("Screen") .get_Source(WMEncoderLib.WMENC_SOURCE_TYPE.WMENC_VIDEO,0); m_bag = new PropertyBag.BagInterface(m_videosource2); switch (ScreenCaptureType) { case ScreenEncoder.CaptureType.FullScreen: WriteProperty(ScreenEncoder.CaptureProperty.EntireScreen,true); break; case ScreenEncoder.CaptureType.WindowByHandle: WriteProperty(ScreenEncoder.CaptureProperty.CaptureWindow,(System.IntPtr)((CarverLab.Utility.Window)ParameterArray[0]).hwnd); break; case ScreenEncoder.CaptureType.WindowByName: WriteProperty(ScreenEncoder.CaptureProperty.WindowTitle,(string)((CarverLab.Utility.Window) ParameterArray[0]).WindowText); break; default: break; } // start the WMEncoder streaming //m_encoder.Start(); //m_bIsEncoderStreaming = true; // end routine return true; }
public bool Execute(ScreenEncoder.Command EncoderCommand, params Object[] Params) { m_CurrentCommand = EncoderCommand; m_Params = Params; m_EventExecuteCommandCompleted.Reset(); m_EventExecuteCommand.Set(); m_EventExecuteCommandCompleted.WaitOne(); return m_bExecuteReturnValue; }
private void frmDisplay_OnConnectionError(object sender, string ErrorMessage) { if(m_bRecording && !bConnectionError) { bDontClick = true; bConnectionError = true; mLogger.WriteLog("OnConnectionError Received! ... initiating stop encode."); StopRecording(true); m_encoder.Execute(ScreenEncoder.Command.ExitEncoder,null); m_encoder = null; bConnectionError = false; } //bConnectionError = false; }
private void frmDisplay_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (true /* m_bExitWithoutAsking || System.Windows.Forms.MessageBox.Show(this,"Exit Oyster Desktop Recorder?", "Exiting Recorder ...",System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes*/ ) { if (m_bRecording) { if (m_encoder != null) { StopRecording(true); m_encoder.Execute(ScreenEncoder.Command.ExitEncoder,null); m_encoder = null; } } if (!m_bHidden) { ShowHide(); } this.notifyIcon1.Visible = false; e.Cancel = false; } // else // { // e.Cancel = true; // } }
private void btnStartStop_Click(object sender, System.EventArgs e) { if(bDontClick) return; if (m_bRecording) { System.Diagnostics.Debug.Assert(m_encoder != null,"m_encoder is null when stopping a recording."); StopRecording(true); m_encoder.Execute(ScreenEncoder.Command.ExitEncoder,null); m_encoder = null; } else { bool bRecord = true; frmRecordOptions frm = new frmRecordOptions(); if (!frm.CurrentRecordOptions.HasBeenSaved) { if (frm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { bRecord = false; } } if (bRecord) { System.Diagnostics.Debug.Assert(m_encoder == null,"m_encoder is not null when starting a recording."); m_encoder = new ScreenEncoder(frm.CurrentRecordOptions.ProfileDirectory,frm.CurrentRecordOptions.WMVDirectory); // if (frm.CurrentRecordOptions.SecondsToCountdown != 0) // { // clock.CountDownTime = frm.CurrentRecordOptions.SecondsToCountdown * 1000; // clock.ClockDisplayType = SriClocks.ClockType.CountDown; // clock.DigitalDisplayColor = SriClocks.DigitalColor.WhiteColor; // if (frm.CurrentRecordOptions.MinutesToRecord != 0) // { // m_iCountdownMinutes = frm.CurrentRecordOptions.MinutesToRecord; // } // btnStartStop.Text = "STOP"; // clock.StartTimer(); // m_bWaitingForCountdown = true; // } // else //{ if (m_me.CanRecord) { StartRecording(); } else { System.Windows.Forms.MessageBox.Show(this, "The currently logged in user is not authorized to create recordings.", "Unauthorized User", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } //} //} } } }