public int AddLayerStruct <T>(string layerName, OeipLayerType layerType, T t) where T : struct { int layerIndex = OeipHelper.addPiepLayer(PipeId, layerName, layerType, IntPtr.Zero); UpdateParametStruct(layerIndex, t); return(layerIndex); }
public void SetMediaId(int id) { this.MediaId = id; OeipHelper.setReadOperateAction(this.MediaId, onOperateDelegate); OeipHelper.setVideoDataAction(this.MediaId, onVideoFrameDelegate); OeipHelper.setAudioDataAction(this.MediaId, onAudioFrameDelegate); }
public void PushAudioFrame(ref OeipAudioFrame audioFrame) { if (!IsOpen) { return; } OeipHelper.pushAudio(MediaId, ref audioFrame); }
public virtual bool RunPipe() { if (!bSetInput) { return(false); } return(OeipHelper.runPipe(PipeId)); }
public int GetFormat() { if (!IsInit) { return(-1); } return(OeipHelper.getFormat(this.Id)); }
public void SetFormat(int index) { if (!IsInit) { return; } OeipHelper.setFormat(Id, index); }
public bool Open() { if (!IsInit) { return(false); } return(OeipHelper.openDevice(Id)); }
public void Close() { if (!IsInit) { return; } OeipHelper.closeDevice(Id); }
public void PushVideoFrame(ref OeipVideoFrame videoFrame) { if (!IsOpen) { return; } OeipHelper.pushVideo(MediaId, ref videoFrame); }
public int FindFormatIndex(int width, int height, int fps = 30) { if (!IsInit) { return(-1); } return(OeipHelper.findFormatIndex(Id, width, height, fps)); }
public void SetDevice(OeipDeviceInfo oeipDevice) { this.Id = oeipDevice.id; this.DeviceId = oeipDevice.deviceId; this.DeviceName = oeipDevice.deviceName; this.GetCameraFormatList(this.Id); OeipHelper.setDeviceDataAction(this.Id, onReviceDelegate); OeipHelper.setDeviceEventAction(this.Id, onEventDelegate); }
protected override void Init() { onLogDelegate = new OnLogDelegate(OnLogHandle); OeipHelper.setLogAction(onLogDelegate); OeipHelper.initOeip(); this.GetCameras(); LiveCtx.liveMode = OeipLiveMode.OIEP_FFMPEG; LiveCtx.bLoopback = 0; LiveCtx.liveServer = "http://127.0.0.1:6110";//"http://129.211.40.225:6110" "http://127.0.0.1:6110" }
/// <summary> /// 有些结构用不了unmanaged,请用这个方法 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="layerIndex"></param> /// <param name="t"></param> /// <returns></returns> public unsafe bool UpdateParametStruct <T>(int layerIndex, T t) where T : struct { int length = Marshal.SizeOf(typeof(T)); //auto recycle byte * numbers = stackalloc byte[length]; IntPtr ptr = new IntPtr(numbers); Marshal.StructureToPtr(t, ptr, false); bool bResult = OeipHelper.updatePipeParamet(PipeId, layerIndex, numbers); return(bResult); }
public OeipMediaPlay GetMediaPlay() { int mediaId = OeipHelper.initReadMedia(); if (mediaId < 0) { return(null); } OeipMediaPlay mediaPlay = new OeipMediaPlay(); mediaPlay.SetMediaId(mediaId); return(mediaPlay); }
private void OnOperateHandle(int type, int code) { if (code < 0) { return; } if (type == (int)OeipFFmpegMode.OEIP_DECODER_OPEN) { IsAudiio = OeipHelper.getMediaAudioInfo(MediaId, ref audioInfo); IsVideo = OeipHelper.getMediaVideoInfo(MediaId, ref videoInfo); OnOpenEvent?.Invoke(IsVideo, IsVideo); } }
public OeipMediaOutput GetMediaOutput() { int mediaId = OeipHelper.initWriteMedia(); if (mediaId < 0) { return(null); } OeipMediaOutput mediaPlay = new OeipMediaOutput(); mediaPlay.SetMediaId(mediaId); return(mediaPlay); }
public T CreatePipe <T>(OeipGpgpuType oeipGpgpuType) where T : OeipPipe, new() { int pipeId = OeipHelper.initPipe(oeipGpgpuType); if (pipeId < 0) { return(null); } T pipe = new T(); pipe.SetPipeId(pipeId); //OeipPipes.Add(pipe); return(pipe); }
/// <summary> /// 得到所有Camera /// </summary> private void GetCameras() { OeipDevices.Clear(); int count = OeipHelper.getDeviceCount(); if (count <= 0) { return; } int deviceLenght = Marshal.SizeOf(typeof(OeipDeviceInfo)); var devices = PInvokeHelper.GetPInvokeArray <OeipDeviceInfo>(count, (IntPtr ptr, int pcount) => { OeipHelper.getDeviceList(ptr, pcount); }); OeipDevices = devices.ToList(); }
public List <VideoFormat> GetCameraFormats(int cameraId) { if (cameraId < 0 && cameraId >= OeipDevices.Count) { return(null); } int count = OeipHelper.getFormatCount(cameraId); if (count > 0) { var videoFormats = PInvokeHelper.GetPInvokeArray <VideoFormat>(count, (IntPtr ptr, int pcount) => { OeipHelper.getFormatList(cameraId, ptr, pcount); }); return(videoFormats.ToList()); } return(new List <VideoFormat>()); }
public void Close() { IsOpen = false; OeipHelper.closeWriteMedia(MediaId); }
public void Open(string uri, bool bVideo, bool bAudio) { IsOpen = OeipHelper.openWriteMedia(MediaId, uri, bVideo, bAudio) >= 0; }
public void SetAudioEncoder(OeipAudioEncoder audioInfo) { OeipHelper.setAudioEncoder(this.MediaId, audioInfo); }
public void SetVideoEncoder(OeipVideoEncoder videoInfo) { OeipHelper.setVideoEncoder(this.MediaId, videoInfo); }
public void SetMediaId(int id) { this.MediaId = id; OeipHelper.setWriteOperateAction(this.MediaId, onOperateDelegate); }
public void Open(string uri, bool bPlayAudio) { IsOpen = OeipHelper.openReadMedia(this.MediaId, uri, bPlayAudio) >= 0; }
public override void Close() { OeipHelper.shutdownOeip(); }
public unsafe bool UpdateParamet <T>(int layerIndex, T t) where T : unmanaged { return(OeipHelper.updatePipeParamet(PipeId, layerIndex, &t)); }
public bool IsEmpty() { return(OeipHelper.emptyPipe(PipeId)); }
public void Close() { IsOpen = false; OeipHelper.closeReadMedia(this.MediaId); }
public int AddLayer(string layerName, OeipLayerType layerType) { return(OeipHelper.addPiepLayer(PipeId, layerName, layerType, IntPtr.Zero)); }