ea7kir
April 12, 2025, 4:19pm
1
I’m trying to rewrite the example appsrc so I can build out the pipeline later, but I don’t think I’m doing it correctly as I get ERROR! couldn’t find Property. Please help me, so I can move on.
appsrc, err := gst.NewElement("appsrc")
if err != nil {
return nil, err
}
videoInfo := video.NewInfo().WithFormat(video.FormatRGBA, width, height)
if err := appsrc.SetProperty("appsrc", videoInfo); err != nil {
return nil, err
}
appsrc.SetProperty("callbacks", &app.SourceCallbacks{
NeedDataFunc: func(self *app.Source, _ uint) {
buffer := gst.NewBufferWithSize(videoInfo.Size())
bytes := produceImageFrame()
buffer.Map(gst.MapWrite).WriteData(bytes)
buffer.Unmap()
self.PushBuffer(buffer)
},
})
philn
April 13, 2025, 8:49am
2
There is no appsrc property in appsrc. I suspect you meant to set the caps property from the video info.
ea7kir
April 13, 2025, 10:17am
3
Exactly. Do you happen to know the correct name, or is this not the way to set the intended format?
ea7kir
April 13, 2025, 11:03am
4
@philn - by trial-and-error, this also doesn’t work
videoInfo := video.NewInfo().WithFormat(video.FormatRGBA, width, height)
if err := appsrc.Set("caps", videoInfo); err != nil {
return nil, err
}
ERROR! invalid type gpointer for property caps
tpm
April 13, 2025, 11:47am
5
I would recommend using GstApp library API such as GstAppSrc.set_caps() instead.
ea7kir
April 13, 2025, 12:14pm
6
tpm:
I would recommend using
Are suggesting Python instead of Go and the go-gst bindings?
tpm
April 13, 2025, 12:51pm
7
Ah, sorry, no. I just picked the bindings that will look most like what it might look like in your case.
I assume go-gst has bindings for the the GstApp library from gst-plugins-base?
I assume go-gst has bindings for the the GstApp library from gst-plugins-base?
It does: app package - github.com/go-gst/go-gst/gst/app - Go Packages
Although heads up: some function signatures might change because I’m in the middle of reworking the bindings and generating them from the GIR files.
@ea7kir the caps property needs a GstCaps*
as a value. The bound go type is the *gst.Caps
object. You’ll need to call ToCaps()
on the video info.
video package - github.com/go-gst/go-gst/gst/video - Go Packages Which wraps gst_video_info_to_caps
1 Like
ea7kir
April 13, 2025, 2:56pm
10
Thank you @RSWillli , that part is now working, although I used .Set because there isn’t a .SetCaps function. Next problem is with setting gst.ClockTimeNone.
appsrc, err := gst.NewElement("appsrc")
if err != nil {
fmt.Println("FAILED #1")
return nil, err
}
videoInfo := video.NewInfo().WithFormat(video.FormatRGBA, width, height)
if err := appsrc.Set("caps", videoInfo.ToCaps()); err != nil {
fmt.Println("FAILED #2")
return nil, err
}
if err := appsrc.SetProperty("format", gst.ClockTimeNone); err != nil {
fmt.Println("FAILED #3")
return nil, err
}
if err := appsrc.SetProperty("callbacks", &app.SourceCallbacks{
NeedDataFunc: func(self *app.Source, _ uint) {
buffer := gst.NewBufferWithSize(videoInfo.Size())
bytes := produceImageFrame()
buffer.Map(gst.MapWrite).WriteData(bytes)
buffer.Unmap()
self.PushBuffer(buffer)
},
}); err != nil {
fmt.Println("FAILED #4")
return nil, err
}
FAILED #3
ERROR! unable to perform type conversion: Type not implemented
ea7kir
April 14, 2025, 5:48pm
11
To get started with a real world application, a few real world examples would help. So, after 3 weeks of getting nowhere, I have no choice but to abandon all hope and hand in the towel. I’m sorry, but Go was designed to be idiomatic - go-gst is not.