<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Help needed to port qzxing to UT]]></title><description><![CDATA[<p dir="auto">I am currently working on porting my <a href="https://github.com/patrickjane/harbour-scooter" rel="nofollow ugc">SFOS Scooter app</a> to Ubuntu Touch, and I am basically done. The only feature which is missing is the scanning of QR codes.</p>
<p dir="auto">In the app, I am using the <a href="https://github.com/ftylitak/qzxing" rel="nofollow ugc">awesome qzxing library</a>, which allows to use video filters for QR code recognition. Unfortunately, on Ubuntu Touch, it will not work. I have reported the issue already <a href="https://github.com/ftylitak/qzxing/issues/203" rel="nofollow ugc">here</a>, but I'd like to get this over with, so I am asking for your help.</p>
<p dir="auto">The core issue is, that <code>qzxing</code> relies on converting <code>QVideoFrame</code> objects to <code>QImage</code> by mapping the raw data into memory using <code>QVideoFrame::map</code>. However, on Ubuntu Touch, this very function does not work, because the image is saved as OpenGL texture in the QT internals. The same is the case for e.g. Android, which is why there is suggested solutions which can be found on google.<br />
However, I am unable to come up with a working solution, most likely because I am neither familiar with OpenGL, nor with image/video formats.</p>
<p dir="auto">I have asked for help already at <a href="https://stackoverflow.com/questions/68525055/qvideoframemap-fails-on-ubuntu-touch" rel="nofollow ugc">stackoverflow</a> and the <a href="https://forum.qt.io/topic/128837/qvideoframe-map-fails-on-ubuntu-touch" rel="nofollow ugc">qt forum</a>, unfortunately no one answered yet.</p>
<p dir="auto">I am aware that there is a QR code scanning app in the open store, and that I could copy the solution used in that app, however I'd like to stick with qzxing for two reasons:</p>
<ul>
<li>I find the use of video filters to be the more elegant solution</li>
<li>I can maintain a somewhat compatibility to my SFOS app which helps keeping maintainance efforts low</li>
</ul>
<p dir="auto">So if anyone would volunteer to support or maybe knows the solution, please let me know. The relevant code parts would be <a href="https://github.com/ftylitak/qzxing/blob/master/src/QZXingFilter.h#L50" rel="nofollow ugc">here</a>.</p>
<p dir="auto">Maybe I am also missing the obvious, and qzxing can already be used in UT and I'm just missing something, in this case I would also extremely appreciate your help.</p>
]]></description><link>https://forums.ubports.com/topic/6503/help-needed-to-port-qzxing-to-ut</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 19:53:54 GMT</lastBuildDate><atom:link href="https://forums.ubports.com/topic/6503.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 30 Jul 2021 14:35:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Sun, 04 Feb 2024 19:16:58 GMT]]></title><description><![CDATA[<p dir="auto">Just to add to this. While I have not been able to actually process the <code>QVideoFrame</code> yet (meaning I have not been able to covert properly to <code>QImage</code> as all I have is a black image using the <code>QVideoFrame::map</code> or black image with some distortions using the alternate <code>QOpenGLContext</code> method outlined here - while it all says it is valid and not null :crying_face:), I have discovered that in order to use the OpenGL Context one can create <code>QWindow</code> and use its surface like so:</p>
<p dir="auto"><a href="https://github.com/qt/qtmultimedia/blob/5.12/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm#L123" rel="nofollow ugc">https://github.com/qt/qtmultimedia/blob/5.12/src/plugins/avfoundation/mediaplayer/avfvideoframerenderer.mm#L123</a></p>
<p dir="auto">Took me a while to figure out how to use it though as it didn't work for me and was crashing the app right on start when the code was part of a plugin (<code>QObject</code>). Unfortunately I was not able to Google it properly (didn't bump into anything that would say that usage is incorect), however with some luck and a lot of trial and error I found out it works when one creates this in the <code>main.cpp</code> file and then simply replies on the <code>QOpenGLContext::currentContext()</code>.</p>
<p dir="auto">And then considering <code>QVideoFrame::map</code> works on UT as part of the Camera QML object I would presume both methods need to work somehow :(. I am just obviously not doing something properly as it is failing for me as described above ^.</p>
<p dir="auto"><a href="https://github.com/qt/qtmultimedia/blob/5.12/src/multimedia/video/qvideoframe.cpp#L1094" rel="nofollow ugc">https://github.com/qt/qtmultimedia/blob/5.12/src/multimedia/video/qvideoframe.cpp#L1094</a></p>
]]></description><link>https://forums.ubports.com/post/78343</link><guid isPermaLink="true">https://forums.ubports.com/post/78343</guid><dc:creator><![CDATA[zubozrout]]></dc:creator><pubDate>Sun, 04 Feb 2024 19:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Sun, 04 Feb 2024 22:12:56 GMT]]></title><description><![CDATA[<p dir="auto">This is an interesting one. <code>QVideoFrame::map</code> is giving me these:</p>
<pre><code>OpenGL context is not current, cannot map memory.
</code></pre>
<p dir="auto">And when I try to use the <code>QOpenGLContext::currentContext()</code> is doesn't work either. What is more <code>QOpenGLContext::functions()</code> is killing my app (looks like bad memory access?) and that has probably something to do with the fact the context is not defined? I wish I knew more :(, but I also tried creating that context and it didn't have any impact.</p>
<p dir="auto">This is the minimalistic example just added to the Clickable C++ template that crashes for me:</p>
<pre><code>#include &lt;QGuiApplication&gt;
#include &lt;QQmlApplicationEngine&gt;

#include &lt;QOpenGLContext&gt;
#include &lt;QOpenGLFunctions&gt;

int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine(QUrl("qrc:///Main.qml"));

    QOpenGLContext *ctx = QOpenGLContext::currentContext();
    QOpenGLFunctions *f = ctx-&gt;functions();

    return app.exec();
}
</code></pre>
<p dir="auto">Any ideas what could be causing that? My attempts were so far quite futile too <img src="https://forums.ubports.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=e53896fb3af" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title=":(" alt="😞" /><br />
Thanks a mil!</p>
<p dir="auto"><img src="/assets/uploads/files/1706788560921-fb7b90b7-2a60-42aa-8502-9c56c340dc83-obrazek.png" alt="fb7b90b7-2a60-42aa-8502-9c56c340dc83-obrazek.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">EDIT:<br />
<em>I later found out where the <code>QVideoFrame::map</code> error is coming from:<br />
<a href="https://gitlab.com/ubports/development/core/qtubuntu-camera/-/blob/main/src/aalvideorenderercontrol.cpp" rel="nofollow ugc">https://gitlab.com/ubports/development/core/qtubuntu-camera/-/blob/main/src/aalvideorenderercontrol.cpp</a></em></p>
<p dir="auto"><em>As well as how to initialize the OpenGLContext - see per post bellow.</em></p>
]]></description><link>https://forums.ubports.com/post/78291</link><guid isPermaLink="true">https://forums.ubports.com/post/78291</guid><dc:creator><![CDATA[zubozrout]]></dc:creator><pubDate>Sun, 04 Feb 2024 22:12:56 GMT</pubDate></item><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Fri, 30 Jul 2021 19:12:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/s710" aria-label="Profile: s710">@<bdi>s710</bdi></a> said in <a href="/post/53726">Help needed to port qzxing to UT</a>:</p>
<blockquote>
<p dir="auto">This approach is what I wanted to avoid, but probably, it would be the most feasible solution right now, and I might go that route. Thanks for the hint!</p>
</blockquote>
<p dir="auto">Yes. There are some devices which have issues using the <code>VideoFilter</code> method, so I had to do the manual sampling that way instead.</p>
<p dir="auto">Looking at the issue you opened, it might be the same problem as I ran into which forced me to using the manual sampling. The issue is actually in the <code>qtubuntu-camera</code> QPA which we provide so that <code>QtCamera</code> API can use the camera hardware via Android HAL.</p>
]]></description><link>https://forums.ubports.com/post/53746</link><guid isPermaLink="true">https://forums.ubports.com/post/53746</guid><dc:creator><![CDATA[dobey]]></dc:creator><pubDate>Fri, 30 Jul 2021 19:12:04 GMT</pubDate></item><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Fri, 30 Jul 2021 18:43:45 GMT]]></title><description><![CDATA[<p dir="auto">Also, if you're into chats like Telegram, there's a group there for UT app developments (<a href="https://t.me/UbuntuAppDevEN" rel="nofollow ugc">https://t.me/UbuntuAppDevEN</a>). You may (or may not<img src="https://forums.ubports.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=e53896fb3af" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title="😄" alt="😄" />) get faster and better answers there. You can also talk to the developer of authenticator-ng on his experience with qzxing and why he did his approach.</p>
]]></description><link>https://forums.ubports.com/post/53741</link><guid isPermaLink="true">https://forums.ubports.com/post/53741</guid><dc:creator><![CDATA[kugiigi]]></dc:creator><pubDate>Fri, 30 Jul 2021 18:43:45 GMT</pubDate></item><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Fri, 30 Jul 2021 15:15:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: applee">@<bdi>applee</bdi></a> Well, it compiles fine, and runs, however it will not detect anything. As reported in the github issue at qzxing, the lib will report the image buffer to be empty, and the reason for it is what I have described above.</p>
<p dir="auto">Gonna check out authenticator-ng</p>
<p dir="auto">[edit] as per <a href="https://gitlab.com/dobey/authenticator-ng/-/blob/trunk/src/qml/ScanPage.qml" rel="nofollow ugc">https://gitlab.com/dobey/authenticator-ng/-/blob/trunk/src/qml/ScanPage.qml</a> this app does not use a videofilter. Instead, images are taken every 250ms and then passed to qzxing.</p>
<p dir="auto">This approach is what I wanted to avoid, but probably, it would be the most feasible solution right now, and I might go that route. Thanks for the hint!</p>
]]></description><link>https://forums.ubports.com/post/53726</link><guid isPermaLink="true">https://forums.ubports.com/post/53726</guid><dc:creator><![CDATA[s710]]></dc:creator><pubDate>Fri, 30 Jul 2021 15:15:28 GMT</pubDate></item><item><title><![CDATA[Reply to Help needed to port qzxing to UT on Fri, 30 Jul 2021 15:00:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/s710" aria-label="Profile: s710">@<bdi>s710</bdi></a></p>
<p dir="auto">First of all, thanks for the radio app. I'm currently testing/using it and it's great to be able to have access to my favorite radio on my phone.</p>
<p dir="auto">IIRC, Dobey uses qzxing for authenticator-ng.<br />
I'll take a look at his git and borrow some code.<br />
<a href="https://gitlab.com/dobey/authenticator-ng" rel="nofollow ugc">https://gitlab.com/dobey/authenticator-ng</a></p>
<p dir="auto">I think what you're struggling with is pakaging the lib within your click package.</p>
]]></description><link>https://forums.ubports.com/post/53725</link><guid isPermaLink="true">https://forums.ubports.com/post/53725</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Fri, 30 Jul 2021 15:00:00 GMT</pubDate></item></channel></rss>