public static IRecorder GetRecorder(RecorderType recorderType) { IRecorder recorder; switch (recorderType) { case RecorderType.File: recorder = new FileRecorder(); break; case RecorderType.Console: recorder = new ConsoleRecorder(); break; case RecorderType.Remote: recorder = new RemoteRecorder(); break; default: recorder = null; break; } return(recorder); }
public void CloseRecorder(RecorderType type) { if (m_RecorderDic.TryGetValue(type, out var recorder)) { recorder.DoDispose(); m_RecorderDic.Remove(type); } }
/// <summary> /// Returns the state of recorder device. /// </summary> /// <exception cref="ArgumentException"><paramref name="type"/> is invalid.</exception> /// <since_tizen> 4 </since_tizen> public static RecorderDeviceState GetDeviceState(RecorderType type) { ValidationUtil.ValidateEnum(typeof(RecorderType), type, nameof(type)); Native.GetDeviceState(type, out var state).ThrowIfError("Failed to get device state"); return(state); }
public static IRecorder Create(RecorderType type, string name) { switch (type) { case RecorderType.File: return(new FileRecorder(name)); default: throw new ArgumentException("Invalid recorder type.", "type"); } }
/// <summary> /// 创建录制 /// </summary> /// <returns></returns> public virtual MediaRecorder CreateRecorder(RecorderType recorderType, string path) { //存在录制,直接返回现有录制 if (this.Recorder is object) { return(this.Recorder); } var record = new MediaRecorder(this.MediaInfo, path, recorderType); this.Recorder = record; return(this.Recorder); }
public void OpenRecorder(RecorderType type) { if (m_RecorderDic.ContainsKey(type)) { return; } IRecorder recorder = GPerfRecorderFactory.GetRecorder(type); if (recorder != null) { recorder.DoStart(); m_RecorderDic.Add(type, recorder); } }
private void SetDrive(int driveIndex) { switch (fActiveFormat) { case RecordType.afMusic: if ((driveIndex > fMusicRecorders.Count) || (driveIndex < 0)) { throw new XPBurnException(String.Format(Resource.CantSetDriver, driveIndex.ToString())); } fActiveRecorder = (IDiscRecorder)fMusicRecorders[driveIndex]; break; case RecordType.afData: if ((driveIndex > fDataRecorders.Count) || (driveIndex < 0)) { throw new XPBurnException(String.Format(Resource.CantSetDriver, driveIndex.ToString())); } fActiveRecorder = (IDiscRecorder)fDataRecorders[driveIndex]; break; } fCancel = false; fBurnerDrive = driveIndex; fActiveRecorder.GetDisplayNames(out fVendor, out fProductID, out fRevision); int typeCode; fActiveRecorder.GetRecorderType(out typeCode); switch (typeCode) { case 0x1: fRecorderType = RecorderType.rtCDR; break; case 0x2: fRecorderType = RecorderType.rtCDRW; break; } }
internal MediaRecorder(MediaInfo mediaInfo, string filePath, RecorderType type = RecorderType.Flv) { this.MediaInfo = mediaInfo; this.FilePath = filePath; this.RecorderType = type; switch (type) { case RecorderType.Flv: { this._id = PInvoke.ZLMediaKitMethod.mk_flv_recorder_create(); if (this._id == IntPtr.Zero) { throw new Exception("创建录制失败"); } var result = PInvoke.ZLMediaKitMethod.mk_flv_recorder_start(_id, mediaInfo.VHost, mediaInfo.App, mediaInfo.StreamId, this.FilePath); //录制开始 if (result == 0) { this.StartTime = DateTime.Now; this._flvRecorder = true; } //录制失败,打开文件失败或该RtmpMediaSource不存在 else if (result == -1) { throw new Exception("录制失败,打开文件失败或该RtmpMediaSource不存在"); } } break; case RecorderType.Mp4: case RecorderType.Hls: { var result = PInvoke.ZLMediaKitMethod.mk_recorder_start((int)this.RecorderType, this.MediaInfo.VHost, this.MediaInfo.App, this.MediaInfo.StreamId, this.FilePath); if (result == 1) { this.StartTime = DateTime.Now; } } break; default: throw new NotSupportedException("不支持的录制类型"); } }
private static string SetSubType(ActorType type, XElement xmlSubType) { string subType = xmlSubType.Value; switch (type) { case ActorType.Port: PortType portType = (PortType)Enum.Parse(typeof(PortType), xmlSubType.Value); break; case ActorType.Process: case ActorType.Prompt: break; case ActorType.Recorder: RecorderType recorderType = (RecorderType)Enum.Parse(typeof(RecorderType), xmlSubType.Value); break; default: throw new NotImplementedException(); } return(subType); }
internal RecorderDeviceStateChangedEventArgs(RecorderType type, RecorderDeviceState state) { Type = type; DeviceState = state; }
/// <summary> /// Creates an ActiveRecorder within the TQF /// </summary> /// <param name="name">Unique name for the ActiveRecorder</param> public static void Create(RecorderType type, string name) { Create(RecorderFactory.Create(type, name)); }
protected GPerfHandleRecorder(RecorderType type) : base(type) { }
protected GPerfIntervalRecorder(RecorderType type) : base(type) { }
protected GPerfRecorder(RecorderType type) { Type = type; }
internal static extern RecorderErrorCode GetDeviceState(RecorderType type, out RecorderDeviceState state);
public Recorder RegisterRecorder(RecorderType type) { return(new Recorder()); }