Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android
-
Your question is confusing me. The quote says QtMultimedia does not support GStreamer... I read that is it being impossible to make work. Maybe I'm being too technical (since this is a legal matter, not a technical one).
Anyway, LGPL is vastly misunderstood. In actual fact you are allowed to link or statically include something LGPL just fine, the hard requirement is that whatever it is you ship can have its LGPL-ed library replaced by someone that is interested in doing so.
So, if you ship open source code, you can do anything.
If, on the other hand, you ship closed source stuff then compiling the LGPL stuff statically stops any interested user from replacing it with a fixed or changed version and that is not allowed. -
in Android, there is a limition on the NUMBER of .so files loaded in your process. The limit is usually set to 128. GStreamer has quite a few. Your app may have some other libs as well. If the number of so libs in your app is below the limit, you can go with gstreamer dynamically. Otherwise, you have to link gstreamer statically. That is the reason why the prebuilt gstreamer for Android has only static libs.
-
@TomZ said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
The quote says QtMultimedia does not support GStreamer...
No, they say they do not support it BY DEFAULT. And there's mentioning LGPL and static linking. And that raised question for me how to use GStreamer in proprietary application, where I can't link library LGPL statically. And maybe there's another way.
-
@JoeCFD said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
The limit is usually set to 128.
That is the reason why the prebuilt gstreamer for Android has only static libs.
Thanks! That explains it.
But I wonder, if
Qt/5.15.10/gcc_64/plugins/mediaservice/libgstmediaplayer.so
would have GStreamer linked statically, and our application links thatlibgstmediaplayer.so
dynamically on runtime, maybe that could overcome LGPL compatibility issues? -
@Talkless said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
No, they say they do not support it BY DEFAULT. And there's mentioning LGPL and static linking.
Ahh, I see. Yeah, you are probably right.
So, the understanding now is that its technically possible to use gstreamer if you build it yourself and turn off all the parts you do not need, or if you build it all as static. But the latter may not be legal.
@Talkless said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
But I wonder
What license is your Qt? The answer here depends on you being a paying customer or not. And seeing as you are using a release that is not available open source, the library you use is basically the same as your app. Closed source.
-
@TomZ said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
What license is your Qt? The answer here depends on you being a paying customer or not. And seeing as you are using a release that is not available open source, the library you use is basically the same as your app. Closed source.
Qt for Small Business (mentioned in OP). I guess you're right, QtMultimedia plugin would be of the same license, good point.
Alternative would be to use
qmlsink
from GStreamer (https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/qt/qmlsink/main.cpp).SSetup it inside LGPL library, with wrapper that would implement gstreamer pipelines as Qt5 Multimedia does, make it statically link all needed GStreamer plugins, and link that LGPL-licensed (mentioning it in the "About" UI, with ability to download it) utility library dynamically into app, and ditch QtMultimedia.
Anyway, to wrap around:
It's not imperative that GStreamer must be static on Andorid, it's just default linking mode due to .so count limitations on that platform. There's ways to overcome it - it depends on required plugin count and licensing.
-
Putting aside the LGPL question for a second, what are the steps to even do this? At the moment I'm more concerned if it is even technically possible to use QtMultimedia on Android with GStreamer.
by configuring Qt with the -gstreamer option.
This seems to imply that I need to build Qt from source myself? That is, following the documentation here, and adding
-gstreamer
? https://doc.qt.io/qt-5/android-building.html#configuring-and-building-on-linuxAnyway, I did that, and the resulting qt-install directory does indeed contain some promising looking stuff that isn't present in the default install. For one example, my newly built Qt contains
include/QtMultimediaGstTools/
.However compiling my test application with that new kit still doesn't display anything in the
VideoOutput
. I've omitted the nonessential parts below, but the exact same application displays the test pattern just fine when compiled for Linux. The application log now showsE MediaPlayerNative: error (1, -2147483648)
, which Andoid's documentation says is a "low-level hardware error".import QtMultimedia 5.15 ... MediaPlayer { source: "gst-pipeline: videotestsrc ! qtvideosink" ...
Am I doing something wrong? Or am I completely misunderstanding the aforementioned documentation here? Do I need to do something with the "register plugins" part? If so, which plugins are required for QtMultimedia's
qtvideosink
? -
Well nevermind. Not sure how I happened across this thread before several others. Using some other advice I stumbled across in other threads, I was able to successfully make some changes and run the example application in [qt-sources]/qtmultimedia/examples/multimedia/video/android/android.pro.
I'll probably make a followup post somewhere else or somehow document what I've learned about the process in a bit. Its been a journey figuring this out... :/
-
@stewythe2nd said in Understanding Qt documentation about using QtMultimedia with LGPL GStreamer on Android:
Its been a journey figuring this out... :/
Yeah totally I believe you :-D . Would be very nice of you to share your experience.
-
-
Sorry, I didn't realize someone had actually replied to this old thread. We determined it wasn't worth it and just used GStreamer directly (in C code, with the qmlglsink plugin). If I remember correctly, when I was trying the QtMultimedia route, after all my trouble, I was just barely able to get the basic example to work. As soon as I tried pulling in some other gstreamer elements to parse actual RTSP or other types, I had other library errors. Probably needed to link against more plugins or something. And it just wasn't worth the hassle to figure out the rest, especially considering I had to rebuild Qt from source every time I wanted to try. Not to mention the fact that even if I was successful, building Qt from source creates a serious challenge to our development workflow. We'd either have to host our custom built Qt somewhere, or just have every developer build from source themselves.
Plus since then we've encountered some requirements that required pipeline manipulation that I don't think would have been possible through the QtMultimedia interface anyway. We've had to do some dynamic pipeline stuff that you really need to be able to write C code for.
Tl;dr don't bother with QtMultimedia GStreamer on Android. Its either not possible or not worth the trouble.