<div dir="ltr"><div><div><div>Not really sure if this question should be posted in this forum or the GStreamer one. I may re-post it there.<br><br>In any case, I am writing a GStreamer element to take a URL and use QWebView to render a page to a QImage stored in a GStreamer buffer, 24 times a second. The resulting stream of images being suitable for displaying on a projection TV, capturing in a video file, etc...<br>
<br></div>I have a preliminary version of this written and somewhat working, but I ran into an issue with the fact that QWebView wants to run in the environment of a QApplication, but I have the environment of a GStreamer plugin.<br>
<br></div>Now both QT and GStreamer use glib&#39;s context&#39;s and loops for main program control, but I never found a way to have QWebView be happy running under a bare GStreamer. Instead I wrote a singleton QApplication wrapper that will start an QApp, feeding it bogus argc and argv, provided none has already been started. That way numerous instances of the same plugin can theoretically share a QApp.<br>
<br></div>This scheme seems to work fine if I run the element as part of a GStreamer pipeline, but if I try to run it as part of a pipeline compiled in a GStreamer C program, I get a critical context error like this:<br><br>
 gdb --args ./vaal --gst-fatal-warnings  -X -n -g 16X9:1X1:0=:5 
<a class="" href="http://www.bbc.co.uk">http://www.bbc.co.uk</a>
<br>GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
<br>Copyright (C) 2010 Free Software Foundation, Inc.
<br>License GPLv3+: GNU GPL version 3 or later 
<a class="" href="http://gnu.org/licenses/gpl.html">&lt;http://gnu.org/licenses/gpl.html&gt;</a>
<br>This is free software: you are free to change and redistribute it.
<br>There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
<br>and &quot;show warranty&quot; for details.
<br>This GDB was configured as &quot;x86_64-redhat-linux-gnu&quot;.
<br>For bug reporting instructions, please see:
<br><a class="" href="http://www.gnu.org/software/gdb/bugs/">&lt;http://www.gnu.org/software/gdb/bugs/&gt;</a>...
<br>Reading symbols from /home/reza/workspace/userful-videowall/src/vaal...done.
<br>(gdb) run
<br>Starting program: /home/reza/workspace/userful-videowall/src/vaal 
--gst-fatal-warnings -X -n -g 16X9:1X1:0=:5 <a class="" href="http://www.bbc.co.uk">http://www.bbc.co.uk</a>
<br>[Thread debugging using libthread_db enabled]
<br>/home/reza/workspace/userful-videowall/src/vaal v0.8.5 is using 
GStreamer 1.2.4
<br>[New Thread 0x7ffff3da9700 (LWP 712)]
<br>[New Thread 0x7ffff33a8700 (LWP 713)]
<br>Detaching after fork from child process 714.
<br>[New Thread 0x7ffff29a7700 (LWP 715)]
<br>[New Thread 0x7ffff1fa6700 (LWP 716)]
<br>[New Thread 0x7fffe3fff700 (LWP 717)]
<br>[New Thread 0x7ffff15a5700 (LWP 718)]
<br>[New Thread 0x7fffd781a700 (LWP 719)]
<br>[Thread 0x7fffd781a700 (LWP 719) exited]
<br>
<br>(vaal:709): GLib-CRITICAL **: g_main_context_push_thread_default: 
assertion `acquired_context&#39; failed
<br>
<br>#0  0x00007ffff5c92d76 in g_logv () from /usr/lib64/libglib-2.0.so.0
<br>#1  0x00007ffff5c92f33 in g_log () from /usr/lib64/libglib-2.0.so.0
<br>#2  0x00007fffcda484a6 in 
QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) 
() from /usr/lib64/libQt5Core.so.5
<br>#3  0x00007fffbdef170e in ?? () from 
/usr/lib64/qt5/plugins/platforms/libqxcb.so
<br>#4  0x00007fffbdef1790 in ?? () from 
/usr/lib64/qt5/plugins/platforms/libqxcb.so
<br>#5  0x00007fffbdef1660 in ?? () from 
/usr/lib64/qt5/plugins/platforms/libqxcb.so
<br>#6  0x00007fffbdeb98b6 in ?? () from 
/usr/lib64/qt5/plugins/platforms/libqxcb.so
<br>#7  0x00007fffbdecab6c in ?? () from 
/usr/lib64/qt5/plugins/platforms/libqxcb.so
<br>#8  0x00007fffd491324e in QPlatformIntegrationFactory::create(QString 
const&amp;, QStringList const&amp;, QString const&amp;) () from 
/usr/lib64/libQt5Gui.so.5
<br>#9  0x00007fffd491e1e7 in 
QGuiApplicationPrivate::createPlatformIntegration() () from 
/usr/lib64/libQt5Gui.so.5
<br>#10 0x00007fffd491fa1d in 
QGuiApplicationPrivate::createEventDispatcher() () from 
/usr/lib64/libQt5Gui.so.5
<br>#11 0x00007fffcda02963 in QCoreApplication::init() () from 
/usr/lib64/libQt5Core.so.5
<br>#12 0x00007fffcda02a95 in 
QCoreApplication::QCoreApplication(QCoreApplicationPrivate&amp;) () from 
/usr/lib64/libQt5Core.so.5
<br>#13 0x00007fffd491f8e9 in 
QGuiApplication::QGuiApplication(QGuiApplicationPrivate&amp;) () from 
/usr/lib64/libQt5Gui.so.5
<br>#14 0x00007fffd4fc7652 in QApplication::QApplication(int&amp;, char**, int) 
() from /usr/lib64/libQt5Widgets.so.5
<br>#15 0x00007fffd6c15214 in gst_qapp_wrap_init () at gstqappwrap.cpp:99
<br>#16 gst_qapp_wrap_new () at gstqappwrap.cpp:107
<br>#17 gst_qapp_wrap_ref () at gstqappwrap.cpp:121
<br>#18 0x00007fffd6c15717 in gst_qtweb_src_ipc_init (qtw=0x84a040) at 
qtwebsrc.cpp:1354
<br>#19 gst_qtweb_src_init (qtw=0x84a040) at qtwebsrc.cpp:1418
<br>#20 0x00007ffff5f93147 in g_type_create_instance () from 
/usr/lib64/libgobject-2.0.so.0
<br>#21 0x00007ffff5f7c4d9 in ?? () from /usr/lib64/libgobject-2.0.so.0
<br>#22 0x00007ffff5f7b9d1 in g_object_newv () from 
/usr/lib64/libgobject-2.0.so.0
<br>#23 0x00007ffff5f7c17d in g_object_new_valist () from 
/usr/lib64/libgobject-2.0.so.0
<br>#24 0x00007ffff5f7c491 in g_object_new () from 
/usr/lib64/libgobject-2.0.so.0
<br>#25 0x00007ffff74095ff in gst_element_factory_create (factory=0x7b1a80, 
name=0x4200bb &quot;websrc&quot;) at gstelementfactory.c:375
<br>#26 0x0000000000407459 in request_elements (factory=0x62f4d0, 
request=0x7fffffffe250, num=2, err=0x7fffffffe408) at vaal.c:597
<br>#27 0x0000000000407ccd in vaal_http_reader_new (vaal=0x62ec00, 
uri=0x63b270, err=0x7fffffffe408) at vaal.c:2766
<br>#28 0x000000000040c8d0 in vaal_reader_new (vaal=0x62ec00, 
err=0x7fffffffe408) at vaal.c:2860
<br>#29 vaal_source_config (vaal=0x62ec00, err=0x7fffffffe408) at vaal.c:2927
<br>#30 vaal_run (vaal=0x62ec00, err=0x7fffffffe408) at vaal.c:3370
<br>#31 0x000000000040d3b3 in main (argc=&lt;value optimized out&gt;, argv=&lt;value 
optimized out&gt;) at vaal.c:3541
<br>
<br clear="all"><div><div><div><div><br></div><div>I know this isn&#39;t really enough information to debug the issue, but I have now exhausted what little QT knowledge I started with, and am hoping for any pointers, clues, or ideas that folks might have for building a more robust solution.<br>
</div><div><br>-- <br>Stirling Westrup<br>Programmer, Entrepreneur.<br><a href="https://www.linkedin.com/e/fpf/77228" target="_blank">https://www.linkedin.com/e/fpf/77228</a><br><a href="http://www.linkedin.com/in/swestrup" target="_blank">http://www.linkedin.com/in/swestrup</a><br>
<a href="http://technaut.livejournal.com" target="_blank">http://technaut.livejournal.com</a><br><a href="http://sourceforge.net/users/stirlingwestrup" target="_blank">http://sourceforge.net/users/stirlingwestrup</a>
</div></div></div></div></div>