I am writing a video sink for Flutter.
The sink accepts only opengl textures (FN).
these are my caps:
"video/x-raw(memory:GLMemory),
format={RGBA},
width=[1,2147483647],
height=[1,2147483647],
framerate=[0/1,2147483647/1]"
And this is my pipeline setup:
let flsink = utils::make_element("fluttertexturesink", None)?;
let fl_config = sink::FlutterConfig::new(id, engine_handle, tx, sendable_fl_txt);
let fl_imp = flsink.downcast_ref::<FlutterTextureSink>().unwrap().imp();
fl_imp.set_fl_config(fl_config);
let glsink = gst::ElementFactory::make("glsinkbin")
.property("sink", &flsink)
.build()
.expect("Fatal: Unable to create glsink");
let pipeline = gst::ElementFactory::make("playbin3")
.property("video-sink", &glsink)
.property("uri", uri)
.build()
.unwrap();
thread::spawn(move || {
pipeline
.set_state(gst::State::Playing)
.expect("Unable to set the pipeline to the `Playing` state");
let bus = pipeline.bus().unwrap();
for msg in bus.iter() {
trace!(gst::CAT_DEFAULT, "Message: {:?}", msg.view());
match msg.view() {
gst::MessageView::Eos(..) => {
info!("End of stream");
break;
}
gst::MessageView::Error(err) => {
error!(
"Error from {:?}: {} ({:?})",
err.src().map(|s| s.path_string()),
err.error(),
err.debug()
);
break;
}
_ => (),
}
}
});
logs
25-02-03T19:08:52.527Z DEBUG [rust_lib_my_app::core::fluttersink::sink] Advertising GL context to gstreamer pipeline
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::platform::linux] Creating new GL context for engine handle: 1125899906842625
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::platform::linux] Creating new GL context for engine handle: 1125899906842625
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::platform::linux] Creating GL context for window: 0x61e8ff7608e0
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::platform::linux] Creating GL context for display: Display { inner: TypedObjectRef { inner: 0x61e8ff6a8800, type: GdkX11Display } }
2025-02-03T19:08:52.527Z INFO [rust_lib_my_app::core::platform::linux] Initializing GL for X11 backend and display
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::fluttersink::sink] GL context: GLContext { inner: TypedObjectRef { inner: 0x61e900570940, type: GstGLWrappedContext } }
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::fluttersink::sink] GL context advertised to gstreamer pipeline
2025-02-03T19:08:52.527Z TRACE [rust_lib_my_app::core::fluttersink::sink] transition changed: NullToReady
2025-02-03T19:08:52.541Z TRACE [rust_lib_my_app::core::fluttersink::sink] transition changed: ReadyToPaused
2025-02-03T19:08:52.553Z TRACE [rust_lib_my_app::core::fluttersink::sink] Stream start StreamStart { seqnum: Seqnum(81), running-time-offset: 0, structure: Some(GstEventStreamStart { stream-id: (gchararray) "8fbf97c789c995df8bfc6faee8bc231b84ea7991d9ecb87c1aea151029ee11e8/001", flags: (GstStreamFlags) ((GstStreamFlags) GST_STREAM_FLAG_NONE), group-id: (guint) 1, stream: (GstStream) (GstStream) 8fbf97c789c995df8bfc6faee8bc231b84ea7991d9ecb87c1aea151029ee11e8/001, urisourcebin-parsed-data: (gboolean) TRUE }), stream-id: "8fbf97c789c995df8bfc6faee8bc231b84ea7991d9ecb87c1aea151029ee11e8/001", stream-flags: StreamFlags(0x0), group-id: Some(GroupId(1)), stream: Some(Stream { inner: TypedObjectRef { inner: 0x74cb70148480, type: GstStream } }) }
Update:
If I use playbin
and not playbin3
this is the error
2025-02-03T19:41:16.787Z TRACE [rust_lib_my_app::core::fluttersink::sink] transition changed: NullToReady
(my_app:547164): GLib-GIO-WARNING **: 21:41:26.466: ../../../gio/gtlsconnection.c:393: invalid property id 12 for "protocol-version" of type 'GParamEnum' in 'GTlsClientConnectionGnutls'
(my_app:547164): GLib-GIO-WARNING **: 21:41:26.466: ../../../gio/gtlsconnection.c:393: invalid property id 13 for "ciphersuite-name" of type 'GParamString' in 'GTlsClientConnectionGnutls'
2025-02-03T19:41:26.789Z TRACE [rust_lib_my_app::core::fluttersink::sink] transition changed: ReadyToNull