Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit8_t *data #219

Open
YJCCreateAHistory opened this issue Jan 14, 2025 · 1 comment
Open

unit8_t *data #219

YJCCreateAHistory opened this issue Jan 14, 2025 · 1 comment

Comments

@YJCCreateAHistory
Copy link

Hello, I have a problem now. When I use the following code, I will define a callback function for on_rgba_frame_data. Normally, this data will be a pointer reference. But the data in C++ is normal, and I get a null pointer. Is it the data structure I defined

exports.rtspRgbaCallback = cb => {
  const on_rgba_frame_data = koffi.proto('void on_rgba_frame_data(uint8_t *data, int width, int height)');

  const func = koffi.register((data, width, height) => {
    console.log('decodeData5=================rgba', data, width, height)
    const decodeData5 = new Uint8Array(data.buffer);
    cb({
      data: decodeData5,
      width: width,
      height: width === 1920 ? 1080 : 2160,
    });
  }, koffi.pointer(on_rgba_frame_data))
  try {
    rtsp_player_set_on_rgba_frame_data(rtspPlayer, func);
  } catch(err) {
    console.log(err, '----------------------------------------------------')
  }
};
@YJCCreateAHistory
Copy link
Author

cc:

typedef void (API_CALL* on_rgba_frame_data)(uint8_t* data, int width, int height);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant