Skip to content

Add per_buffer metadata as VideoCaptionMeta for ndisink and ndisrc#80

Open
darksidds wants to merge 1 commit into
teltek:masterfrom
darksidds:master
Open

Add per_buffer metadata as VideoCaptionMeta for ndisink and ndisrc#80
darksidds wants to merge 1 commit into
teltek:masterfrom
darksidds:master

Conversation

@darksidds

Copy link
Copy Markdown

No description provided.

@darksidds

Copy link
Copy Markdown
Author

Tested under both Linux and Windows.

@darksidds darksidds mentioned this pull request Oct 22, 2021
Comment thread src/receiver.rs
let c_str_1 = CString::new(s1).expect("CString::new failed");
let view = c_str_1.as_ptr() as *const u8;
unsafe {
gst_buffer_add_video_caption_meta(my_buffer.as_mut_ptr(), GST_VIDEO_CAPTION_TYPE_CEA608_RAW, view, length_of_s1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also safe API for this FWIW

@sdroege

sdroege commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

The caption meta is meant for storing CEA608/708 captions, not arbitrary strings. What kind of metadata is it that you're trying to store here?

You probably want to implement your own GstMeta for this.

@darksidds

Copy link
Copy Markdown
Author

I'm trying to store an arbitrary string. Am I supposed to create a new implementation for GstMeta and call it something like NdiPerFrameMeta?

@sdroege

sdroege commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

Yeah, or with GStreamer 1.20 you can also use the stringly-typed "custom meta" API.

@sdroege

sdroege commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

However there's NDI metadata that maps directly to existing GstMetas, for example for closed captions.

@darksidds

Copy link
Copy Markdown
Author

Yeah, or with GStreamer 1.20 you can also use the stringly-typed "custom meta" API.

Unfortunatelly, GStreamer 1.20 is not out there yet. And probably it would be nice to have a dedicated class for ndi per-buffer metadata. How do you think?

However there's NDI metadata that maps directly to existing GstMetas, for example for closed captions.

Could you please clarify me a couple of things. I would appreciate that a lot:

  1. If NDI metadata is mapped directly to existing GstMetas, then how do I access it in my c++ pipelines?

  2. Let's say I have a GstBuffer object, and I'm trying to iterate all GstMeta objects stored in it. As it's shown below, I use gst_buffer_iterate_meta function and compare gst_meta->info with known gst_meta_get_info("SomeName") or gotten directly from functions like gst_video_caption_meta_get_info(). But if I don't know what implementation of GstMeta to expect, then I can't access it or its fields. So, how do I do that?

while ((gst_meta = gst_buffer_iterate_meta(buffer, &state))) {
    if (gst_meta->info == gst_video_caption_meta_get_info()) {
        auto video_caption = (GstVideoCaptionMeta *) gst_meta;
        // do stuff
    } else if (gst_meta->info == gst_video_time_code_meta_get_info()) {
        auto timecode_meta = (GstVideoTimeCodeMeta *) gst_meta;
        // do stuff
    } else if (gst_meta->info == gst_meta_get_info("GstNdiSrcMeta")) {
        // do stuff
    } 
}
  1. Is there a way to list all registered GstMeta implentations?

@sdroege

sdroege commented Oct 23, 2021

Copy link
Copy Markdown
Contributor
1. If NDI metadata is mapped directly to existing GstMetas, then how do I access it in my c++ pipelines?

By using the relevant GStreamer APIs for those metas. I'm not sure I understand the question :)

2\. Let's say I have a `GstBuffer` object, and I'm trying to iterate all `GstMeta` objects stored in it. As it's shown below, I use `gst_buffer_iterate_meta` function and compare `gst_meta->info` with known `gst_meta_get_info("SomeName")` or gotten directly from functions like `gst_video_caption_meta_get_info()`. But if I don't know what implementation of `GstMeta` to expect, then I can't access it or its fields. So, how do I do that?

You have to know the meta for being able to access its fields. You need to call the corresponding C API or e.g. make use of the public struct definition from the C headers.

Is there a way to list all registered GstMeta implentations?

With some effort, yes. But you can't really do anything with them unless you explicitly know how to handle each.


I think there's some misunderstanding on your side how this API works and is supposed to be used. Maybe I can give some useful suggestion if we take a step back and you explain what exactly you're trying to do.

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

Successfully merging this pull request may close these issues.

2 participants