예제 #1
0
        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);
        }
예제 #2
0
 public void CloseRecorder(RecorderType type)
 {
     if (m_RecorderDic.TryGetValue(type, out var recorder))
     {
         recorder.DoDispose();
         m_RecorderDic.Remove(type);
     }
 }
예제 #3
0
파일: Recorder.cs 프로젝트: yunmiha/TizenFX
        /// <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);
        }
예제 #4
0
        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");
            }
        }
예제 #5
0
        /// <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);
        }
예제 #6
0
        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);
            }
        }
예제 #7
0
        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("不支持的录制类型");
            }
        }
예제 #9
0
        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;
 }
예제 #11
0
 /// <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));
 }
예제 #12
0
 protected GPerfHandleRecorder(RecorderType type) : base(type)
 {
 }
예제 #13
0
 protected GPerfIntervalRecorder(RecorderType type) : base(type)
 {
 }
예제 #14
0
 protected GPerfRecorder(RecorderType type)
 {
     Type = type;
 }
예제 #15
0
 internal static extern RecorderErrorCode GetDeviceState(RecorderType type, out RecorderDeviceState state);
예제 #16
0
 public Recorder RegisterRecorder(RecorderType type)
 {
     return(new Recorder());
 }