Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 public void SetMediaId(int id)
 {
     this.MediaId = id;
     OeipHelper.setReadOperateAction(this.MediaId, onOperateDelegate);
     OeipHelper.setVideoDataAction(this.MediaId, onVideoFrameDelegate);
     OeipHelper.setAudioDataAction(this.MediaId, onAudioFrameDelegate);
 }
Esempio n. 3
0
 public void PushAudioFrame(ref OeipAudioFrame audioFrame)
 {
     if (!IsOpen)
     {
         return;
     }
     OeipHelper.pushAudio(MediaId, ref audioFrame);
 }
Esempio n. 4
0
 public virtual bool RunPipe()
 {
     if (!bSetInput)
     {
         return(false);
     }
     return(OeipHelper.runPipe(PipeId));
 }
Esempio n. 5
0
 public int GetFormat()
 {
     if (!IsInit)
     {
         return(-1);
     }
     return(OeipHelper.getFormat(this.Id));
 }
Esempio n. 6
0
 public void SetFormat(int index)
 {
     if (!IsInit)
     {
         return;
     }
     OeipHelper.setFormat(Id, index);
 }
Esempio n. 7
0
 public bool Open()
 {
     if (!IsInit)
     {
         return(false);
     }
     return(OeipHelper.openDevice(Id));
 }
Esempio n. 8
0
 public void Close()
 {
     if (!IsInit)
     {
         return;
     }
     OeipHelper.closeDevice(Id);
 }
Esempio n. 9
0
 public void PushVideoFrame(ref OeipVideoFrame videoFrame)
 {
     if (!IsOpen)
     {
         return;
     }
     OeipHelper.pushVideo(MediaId, ref videoFrame);
 }
Esempio n. 10
0
 public int FindFormatIndex(int width, int height, int fps = 30)
 {
     if (!IsInit)
     {
         return(-1);
     }
     return(OeipHelper.findFormatIndex(Id, width, height, fps));
 }
Esempio n. 11
0
 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);
 }
Esempio n. 12
0
        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"
        }
Esempio n. 13
0
        /// <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);
        }
Esempio n. 14
0
        public OeipMediaPlay GetMediaPlay()
        {
            int mediaId = OeipHelper.initReadMedia();

            if (mediaId < 0)
            {
                return(null);
            }
            OeipMediaPlay mediaPlay = new OeipMediaPlay();

            mediaPlay.SetMediaId(mediaId);
            return(mediaPlay);
        }
Esempio n. 15
0
 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);
     }
 }
Esempio n. 16
0
        public OeipMediaOutput GetMediaOutput()
        {
            int mediaId = OeipHelper.initWriteMedia();

            if (mediaId < 0)
            {
                return(null);
            }
            OeipMediaOutput mediaPlay = new OeipMediaOutput();

            mediaPlay.SetMediaId(mediaId);
            return(mediaPlay);
        }
Esempio n. 17
0
        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);
        }
Esempio n. 18
0
        /// <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();
        }
Esempio n. 19
0
        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>());
        }
Esempio n. 20
0
 public void Close()
 {
     IsOpen = false;
     OeipHelper.closeWriteMedia(MediaId);
 }
Esempio n. 21
0
 public void Open(string uri, bool bVideo, bool bAudio)
 {
     IsOpen = OeipHelper.openWriteMedia(MediaId, uri, bVideo, bAudio) >= 0;
 }
Esempio n. 22
0
 public void SetAudioEncoder(OeipAudioEncoder audioInfo)
 {
     OeipHelper.setAudioEncoder(this.MediaId, audioInfo);
 }
Esempio n. 23
0
 public void SetVideoEncoder(OeipVideoEncoder videoInfo)
 {
     OeipHelper.setVideoEncoder(this.MediaId, videoInfo);
 }
Esempio n. 24
0
 public void SetMediaId(int id)
 {
     this.MediaId = id;
     OeipHelper.setWriteOperateAction(this.MediaId, onOperateDelegate);
 }
Esempio n. 25
0
 public void Open(string uri, bool bPlayAudio)
 {
     IsOpen = OeipHelper.openReadMedia(this.MediaId, uri, bPlayAudio) >= 0;
 }
Esempio n. 26
0
 public override void Close()
 {
     OeipHelper.shutdownOeip();
 }
Esempio n. 27
0
 public unsafe bool UpdateParamet <T>(int layerIndex, T t) where T : unmanaged
 {
     return(OeipHelper.updatePipeParamet(PipeId, layerIndex, &t));
 }
Esempio n. 28
0
 public bool IsEmpty()
 {
     return(OeipHelper.emptyPipe(PipeId));
 }
Esempio n. 29
0
 public void Close()
 {
     IsOpen = false;
     OeipHelper.closeReadMedia(this.MediaId);
 }
Esempio n. 30
0
 public int AddLayer(string layerName, OeipLayerType layerType)
 {
     return(OeipHelper.addPiepLayer(PipeId, layerName, layerType, IntPtr.Zero));
 }