0

I am using 3rd party lib and .so files with Qt4.8 and QtCreator to develop a standalone desktop software to remotely control video surveillance system. And when I use this function:

NET_DVR_RealPlay_V30(m_rpcurrentdevicedata->getUsrID(),clientinfo,RealDataCallBack,NULL,1);

it returns -1, which means it failed and it prints error info: "Failed to load player SDK". This is strange, because this SDK is already loaded.(I also use this SDK to login system, otherwise I can't even proceed to this step) And I've check these parameters, they are all valid. Other parts of my program seems good.

When I run an example program the manufacturer provides, there's no such error.

I don't have a clue about this error at all. Anyone can provide any hint? Many thanks.

Henry
  • 2,819
  • 3
  • 18
  • 33
  • I don't have specific knowledge of the SDK you are using (I suspect 'SDK' in the error message is referring to the DVR's SDK and not the Qt SDK, btw) -- but my suspicion is that your program is trying to load some shared library file at runtime and not finding it (e.g. because it's not looking in the correct folder or something). Perhaps you can arrange to have strace (or similar) running when you reproduce the fault, and that will show you a failed attempt to open a file, and that would tell you what is going wrong. – Jeremy Friesner Jan 31 '16 at 06:47
  • @JeremyFriesner I checked the .so files before, the .pro file included all of them and they are actually in same folder... – Henry Feb 01 '16 at 02:27
  • That's good, but what if the game is expected an asset in some other location and not finding it? (Note that .so files are usually loaded by the OS at program-start, so if the problem were a missing .so file you would likely not be able to start the program running at all. The fact that the program runs long enough to print an error message suggests that the problem is not a compiler-linked .so file) – Jeremy Friesner Feb 01 '16 at 04:26
  • @JeremyFriesner It indeed doesn't find one of my .so files: `libhcnetsdk.so` . But it looks some folders like `/lib/tls/sse2/`, `/lib/tls/i686/sse2/`, `/lib/cmov/` , `./tls/sse2/` , `/usr/lib/i386-linux-gnu/tls/` ... etc, in total it looks 82 places for the so file and all failed. Do you have any idea? – Henry Feb 06 '16 at 20:32
  • @JeremyFriesner such like this `open("./tls/i686/libhcnetsdk.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)` – Henry Feb 06 '16 at 22:31
  • What paths are in your $LD_LIBRARY_PATH environment variable? – Jeremy Friesner Feb 07 '16 at 05:35
  • @JeremyFriesner It seems that I don't have this environment variable. And I found all these libs (like `libQtCore.so.4`, `libstdc++.so.6`) are actually in directory `/usr/lib/i386-linux-gnu/` , but after I `export` the LD_LIBRARY_PATH to the directory, it still like : `open("./tls/i686/cmov/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)` . I also tried **add a custom .conf file** (http://stackoverflow.com/questions/13428910/how-to-set-the-environmental-variable-ld-library-path-in-linux) but does not work. Any clue...? – Henry Feb 08 '16 at 04:53

1 Answers1

1

I think I found the solution to your problem. I had the same problem, but I used HCNetSDK C# wrapper, and the same error occurred to me. This is the c# code I used to call NET_DVR_RealPlay_V30 function:

 private void TakeVideoForLiveStreaming()
    {
        try
        {
            NET_DVR_CLIENTINFO clientinfo = new NET_DVR_CLIENTINFO();
            clientinfo.hPlayWnd = liveViewPicture.Handle;
            clientinfo.lChannel = ChanelNumber;
            clientinfo.lLinkMode = 0;
            clientinfo.sMultiCastIP = null;
            HikVisionSDKCSharpWrapper.RealDataCallBack_V30 RealData = new HikVisionSDKCSharpWrapper.RealDataCallBack_V30(RealDataCallback);
            IntPtr pUser = new IntPtr();
            RealHandle = HCNetSDK.NET_DVR_RealPlay_V30(UserId, ref clientinfo, RealData, pUser, true);
            if (RealHandle == -1)
            {
                MessageBox.Show(string.Format("Play failed, error code: {0}", HCNetSDK.NET_DVR_GetLastError()));
                return;
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

    public void RealDataCallback(int lRealHandle, uint dwDataType, byte[] pBuffer, uint dwBufSize, IntPtr pUser)
    {
        try
        {

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

On call of this function I had error 64 ("Failed to load player SDK"). What I did, and it seemed to work for me is that I downloaded VSPlayer for Windows V7.2.0 from this link:

http://www.hikvision.com/europe/tools_82.html#prettyPhoto

After I installed this application, I copied all the DLLs that were exported to 'C:\Program Files (x86)\VSPlayer' folder after installation, and pasted them at the same location where my HCNetSDK.dll was located inside of my app. When I run my app again, error disappear and I got my live video inside of my picture box.

Ante Ševo
  • 11
  • 1
  • Hi, I have an important question about this C# wrapper for HCNetSDK. Did you write on your own or did you download it from somewhere? Because I need to write a plugin for Hikvision cameras support and that would be a really great starting point. Thank you. – Sergi Mascaró Dec 14 '18 at 14:18