Right, but my problem right now is: assuming i have a media module that works(i have one that is not throwing type errors that i want to test in my gui. see below), what is the Chain o’ Widgets to get it to render in a grid?
Gtk.Grid wants a widget when attempting to attach to it, and the media modules are not widgets. I’m guessing i’m supposed to use Gdk.Paintable somehow, but i’m not seeing how from the text on it’s api docs page…
You would have to use a file object with a URI, not a filename. The media stream can then be attached to a GtkVideo with set_media_stream, or to a GtkPicture with set_paintable.
import gintro/[gtk4, gobject, gio, gdk4]
proc activate(app: gtk4.Application) =
let window = newApplicationWindow(app)
let grid = newGrid()
let media_file1 = gtk4.newMediaFileForFile(gio.newGFileForUri("rtsp://admin:passwd@192.168.1.5:554"))
let picture1 = gtk4.newPicture()
gtk4.setPaintable(picture1, cast[gdk4.Paintable](media_file1))
window.defaultSize = (800, 600)
grid.columnSpacing = 25
grid.attach(picture1, 0, -1)
window.setChild(grid)
window.show
proc main =
let app = newApplication("org.gtk.example")
app.connect("activate", activate)
let status = app.run
quit(status)
main()
but it seems that the gtk4.newMediaFileForFile(gio.newGFileForUri("rtsp://admin:passwd@192.168.1.5:554"))
part is not working. I do have the real rtsp stream creds in the actual code. Everything appears to be attached properly, but no rtsp stream plays. I also tried with a gtk4.Video and set_media_stream with the same result. Any ideas?
Hmm, I can’t figure out what’s going on, I tried to do it using this demo rtsp stream and it seems to be playing the audio but I see no video. So it’s half working but there is probably a bug somewhere and I’m not sure how to report it, maybe someone who is really good at reading gstreamer debug logs could figure something out.
I don’t have nim installed but here is my very similar javascript test program I was using:
thanks. i had forgotten about the rtsp stream for testing. the bigbuckbunny rtsp stream works in my example program with the media_file1.play() added (both audio and video), but my ipcam rtsp stream uri does not. the same cam uri that works with gst-launch. so, maybe the gio.newGFileForUri doesn’t like the fact that it’s not a stream of an actual file? i don’t remember/know exactly how that works under the hood, so maybe that’s fool talk.
@ebassi do you know where gtk4 ended up in regards to this?
is there a way/what is the method for directly connecting a playbin pipeline to a widget without cpu copy? It doesn’t look like there’s a way to feed my rtsp ipcam stream to a paintable like newMediaFileForPipeline(), for instance. Or maybe a more manual way that currently works for gtk4? (preferably with no cpu copy)