Coder Social home page Coder Social logo

Comments (5)

xiangshengjye avatar xiangshengjye commented on June 23, 2024

去看下海康的NET_DVR_SetESRealPlayCallBack接口

from zlmediakit.

TonyWang8904 avatar TonyWang8904 commented on June 23, 2024

去看下海康的NET_DVR_SetESRealPlayCallBack接口

使用海康的NET_DVR_SetESRealPlayCallBack接口

hcNetSDK.NET_DVR_SetESRealPlayCallBack(lPreviewHandle , mfPlayESCallBack, null);

在回调函数中打印信息

static class MFPlayESCallBack implements HCNetSDK.FPlayESCallBack {  
      public void invoke(int lPlayHandle, HCNetSDK.NET_DVR_PACKET_INFO_EX struPackInfo, Pointer pUser) {  
          log.info("包类型:{}", struPackInfo.dwPacketType);  
      }  
  } 

得到结果

2024-04-12 18:16:24.171 [Thread-13] INFO  com.service.HCPlayService:114 - 包类型:0
2024-04-12 18:16:24.211 [Thread-14] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.212 [Thread-15] INFO  com.service.HCPlayService:114 - 包类型:0
2024-04-12 18:16:24.212 [Thread-16] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.217 [Thread-17] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.257 [Thread-18] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.286 [Thread-19] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.326 [Thread-20] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.366 [Thread-21] INFO  com.service.HCPlayService:114 - 包类型:70780800
2024-04-12 18:16:24.417 [Thread-22] INFO  com.service.HCPlayService:114 - 包类型:70780800

直接将回调函数中的流输出到MediaSource

MK_FRAME mkFrame = ZLM_API.mk_frame_create(0, 0, 0, struPackInfo.pPacketBuffer, struPackInfo.dwPacketSize, null, null);
 ZLM_API.mk_media_input_frame(mkMedia, mkFrame);

抛出异常

java.lang.Error: Invalid memory access
	at com.sun.jna.Native.invokePointer(Native Method)
	at com.sun.jna.Function.invokePointer(Function.java:497)
	at com.sun.jna.Function.invoke(Function.java:450)
	at com.sun.jna.Function.invoke(Function.java:361)
	at com.sun.jna.Library$Handler.invoke(Library.java:270)
	at com.sun.proxy.$Proxy72.mk_frame_create(Unknown Source)

无法进行流播放

from zlmediakit.

xia-chu avatar xia-chu commented on June 23, 2024

NET_DVR_SetESRealPlayCallBack回调 可能就不是H264 你先保存264文件 看看能否播放

from zlmediakit.

TonyWang8904 avatar TonyWang8904 commented on June 23, 2024

NET_DVR_SetESRealPlayCallBack回调 可能就不是H264 你先保存264文件 看看能否播放

已解决,Java版SDK的接口文件存在问题,替换后再次使用NET_DVR_SetESRealPlayCallBack就好了
多谢

from zlmediakit.

TheBestRicardoMLu avatar TheBestRicardoMLu commented on June 23, 2024

我也是存在和你一样的问题,你能把你使用的SDK接口文件发我一下吗?感谢

from zlmediakit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.