[webkit-qt] Integrating QT WebKit into a GStreamer Element.

Stirling Westrup swestrup at gmail.com
Fri May 9 09:34:20 PDT 2014

Not really sure if this question should be posted in this forum or the
GStreamer one. I may re-post it there.

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...

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

Now both QT and GStreamer use glib's context'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.

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:

 gdb --args ./vaal --gst-fatal-warnings  -X -n -g 16X9:1X1:0=:5
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html> <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:

Reading symbols from
(gdb) run
Starting program: /home/reza/workspace/userful-videowall/src/vaal
--gst-fatal-warnings -X -n -g 16X9:1X1:0=:5 http://www.bbc.co.uk
[Thread debugging using libthread_db enabled]
/home/reza/workspace/userful-videowall/src/vaal v0.8.5 is using GStreamer
[New Thread 0x7ffff3da9700 (LWP 712)]
[New Thread 0x7ffff33a8700 (LWP 713)]
Detaching after fork from child process 714.
[New Thread 0x7ffff29a7700 (LWP 715)]
[New Thread 0x7ffff1fa6700 (LWP 716)]
[New Thread 0x7fffe3fff700 (LWP 717)]
[New Thread 0x7ffff15a5700 (LWP 718)]
[New Thread 0x7fffd781a700 (LWP 719)]
[Thread 0x7fffd781a700 (LWP 719) exited]

(vaal:709): GLib-CRITICAL **: g_main_context_push_thread_default: assertion
`acquired_context' failed

#0  0x00007ffff5c92d76 in g_logv () from /usr/lib64/libglib-2.0.so.0
#1  0x00007ffff5c92f33 in g_log () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fffcda484a6 in
QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(_GMainContext*) ()
from /usr/lib64/libQt5Core.so.5
#3  0x00007fffbdef170e in ?? () from
#4  0x00007fffbdef1790 in ?? () from
#5  0x00007fffbdef1660 in ?? () from
#6  0x00007fffbdeb98b6 in ?? () from
#7  0x00007fffbdecab6c in ?? () from
#8  0x00007fffd491324e in QPlatformIntegrationFactory::create(QString
const&, QStringList const&, QString const&) () from
#9  0x00007fffd491e1e7 in
QGuiApplicationPrivate::createPlatformIntegration() () from
#10 0x00007fffd491fa1d in QGuiApplicationPrivate::createEventDispatcher()
() from /usr/lib64/libQt5Gui.so.5
#11 0x00007fffcda02963 in QCoreApplication::init() () from
#12 0x00007fffcda02a95 in
QCoreApplication::QCoreApplication(QCoreApplicationPrivate&) () from
#13 0x00007fffd491f8e9 in
QGuiApplication::QGuiApplication(QGuiApplicationPrivate&) () from
#14 0x00007fffd4fc7652 in QApplication::QApplication(int&, char**, int) ()
from /usr/lib64/libQt5Widgets.so.5
#15 0x00007fffd6c15214 in gst_qapp_wrap_init () at gstqappwrap.cpp:99
#16 gst_qapp_wrap_new () at gstqappwrap.cpp:107
#17 gst_qapp_wrap_ref () at gstqappwrap.cpp:121
#18 0x00007fffd6c15717 in gst_qtweb_src_ipc_init (qtw=0x84a040) at
#19 gst_qtweb_src_init (qtw=0x84a040) at qtwebsrc.cpp:1418
#20 0x00007ffff5f93147 in g_type_create_instance () from
#21 0x00007ffff5f7c4d9 in ?? () from /usr/lib64/libgobject-2.0.so.0
#22 0x00007ffff5f7b9d1 in g_object_newv () from
#23 0x00007ffff5f7c17d in g_object_new_valist () from
#24 0x00007ffff5f7c491 in g_object_new () from
#25 0x00007ffff74095ff in gst_element_factory_create (factory=0x7b1a80,
name=0x4200bb "websrc") at gstelementfactory.c:375
#26 0x0000000000407459 in request_elements (factory=0x62f4d0,
request=0x7fffffffe250, num=2, err=0x7fffffffe408) at vaal.c:597
#27 0x0000000000407ccd in vaal_http_reader_new (vaal=0x62ec00,
uri=0x63b270, err=0x7fffffffe408) at vaal.c:2766
#28 0x000000000040c8d0 in vaal_reader_new (vaal=0x62ec00,
err=0x7fffffffe408) at vaal.c:2860
#29 vaal_source_config (vaal=0x62ec00, err=0x7fffffffe408) at vaal.c:2927
#30 vaal_run (vaal=0x62ec00, err=0x7fffffffe408) at vaal.c:3370
#31 0x000000000040d3b3 in main (argc=<value optimized out>, argv=<value
optimized out>) at vaal.c:3541

I know this isn'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.

Stirling Westrup
Programmer, Entrepreneur.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-qt/attachments/20140509/b36ba280/attachment.html>

More information about the webkit-qt mailing list