Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Dealing with licensing: enable or disable a plugin if user has no a license for it

Answered

Comments

6 comments

  • Permanently deleted user

    Regarding licenses - unfortunately, the plugin cannot prevent itself from being enabled on a camera, and different pixel formats are not supported either.

    Note: you can also use Plugin Diagnostic Event to inform users of a problem, in case they ignored the message in the settings.

    Another alternative is to request raw data and move decoding to your side (this way you can also use some pipeline that decodes on GPU, for example), but probably that's much harder to implement.

     

    We will think of a better solution for your problem, but for now, there is no optimal solution.

    0
  • Hendrik Baekeland

    Thanks Eugeny,

    Could you please help me with a frame decoding? I already asked about it here https://support.networkoptix.com/hc/en-us/community/posts/360048911014-How-to-decode-compressed-frame-

    What are 'compressed frames', are there more or less detailed description? I tried to decode them with ffmpeg code based on this https://stackoverflow.com/questions/25431413/decode-compressed-frame-to-memory-using-libav-avcodec-decode-video2 but didn't succeed with it.

    I see that there is 'data' and 'extraData' in compressed frames but I don't know how to process them. Are there anything I can start with?

    0
  • Permanently deleted user

    Shortly speaking, compressed frames are raw data received from the camera. Usually, it is h264 video, but also can be h265 or MJPEG. 

    If you are using Nvidia Jetson hardware, the recommended way is to use DeepStream - it is a GStreamer pipeline that utilizes embedded GPU resources for decoding and AI processing at the same time. 

    Unfortunately, we don't have any examples for DeepStream, though.

    0
  • Hendrik Baekeland

    Hello Evgeny,

    Are there any working examples?

    Right now I tried to write all available data to one file and read it.

    I wasn't able to read it with gstreamer, mpv and ffplay. ffplay says "could not find codec parameters"

    I understand that in theory I should use "extradata" and "codec". But I can't figure out codec because I get "28" instead of MIME type when I call "videoFrame->codec()", and I can't get extradata because "videoFrame->context()" returns nullptr. (I'm using DW 4.1.0.3140)

    It may be that I have an error in my code right now but what I'm supposed to do with "extradata" even if I get it? How can I use `data` and `extradata` for stream decoding, in any way, not necessarily with Deepstream?

    0
  • Andrey Terentyev
    • Network Optix team

    Hello Hendrik,

    Let me give some technical details in this regard:

    > I develop a plugin. User must have a license for using this plugin. I'm checking a license key in the DeviceAgent and if it's correct and user can enable a plugin on one more camera then plugin just works.

    "enabling a plugin on a camera" means creating a DeviceAgent class instance for a camera.

    If the plugin is not enabled on a camera, there is no DeviceAgent class instance yet and no method can be invoked.
    When the GUI client opens the "Plugins" for the first time it displays device agent settings model supplied by Engine manifest.
    When the OK or Apply button is pressed, settings values are passed to the Server and then to the DeviceAgent class instance being created. That means the  DeviceAgent::DeviceAgent() constructor is invoked.
    So, you can check the license key in the constructor and set an internal flag.
    After DeviceAgent instance has been created the DeviceAgent::settingsReceived() and getPluginSideSettings() are called.
    If flag signals the invalid license you could override DeviceAgent manifest, i.e. settings model and the settings values. For example, return an empty section with the title "Not enough licenses" in order the text is displayed with large font.
    When a plugin is enabled and its settings are going to be opened in GUI, the getPluginSideSettings() is invoked on the Server. You can check the license flag here, as well, and return manipulated manifest, which will be displayed in GUI.


    Thus, a plugin remains enabled and is seen as enabled, but can't function without a valid license. The message  "Not enough licenses" is visible to the User in the plugin settings dialog.
    In addition to the message you can trigger a Diagnostics Event to make the user to pay attention to the problem.

    0
  • Hendrik Baekeland

    Thank you for your answer Andrey,
    It's more detailed and technical description of what I've done and it may help to someone with the same issue.

    0

Please sign in to leave a comment.