[bug PyQt 5.15.2] segmentation fault using QVideoFilterRunnable
Phil Thompson
phil at riverbankcomputing.com
Wed Feb 17 17:37:28 GMT 2021
On 17/02/2021 17:14, Adrian Fiergolski wrote:
> On 17.02.2021 17:48, Phil Thompson wrote:
>> On 17/02/2021 16:32, Adrian Fiergolski wrote:
>>> On 11.02.2021 11:36, Phil Thompson wrote:
>>>> On 11/02/2021 09:55, Adrian Fiergolski wrote:
>>>>> On 11.02.2021 at 10:48, Phil Thompson wrote:
>>>>>> On 11/02/2021 09:19, Adrian Fiergolski wrote:
>>>>>>> On 10.02.2021 at 23:09, Phil Thompson wrote:
>>>>>>>> On 10/02/2021 17:53, Adrian Fiergolski wrote:
>>>>>>>>> On 10.02.2021 18:35, Phil Thompson wrote:
>>>>>>>>>> On 10/02/2021 16:30, Adrian Fiergolski wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I am getting segmentation fault using QVideoFilterRunnable. I
>>>>>>>>>>> try to
>>>>>>>>>>> follow the example from the documentation.
>>>>>>>>>>>
>>>>>>>>>>> I am enclosing the testcase and the log from the debugger
>>>>>>>>>>> (gdb).
>>>>>>>>>>>
>>>>>>>>>>> My setup: yocto (with meta-qt5 gatesgarth, PyQt 5.15.2)
>>>>>>>>>>> running on
>>>>>>>>>>> Cortex A-53, kernel 5.4).
>>>>>>>>>>>
>>>>>>>>>>> I got the same issue with PyQt 5.13.2 on my embedded
>>>>>>>>>>> platform. The
>>>>>>>>>>> problem is reproducible on a PC (running Ubuntu 20.04 with
>>>>>>>>>>> installed
>>>>>>>>>>> qt5-default and pyqt5-dev).
>>>>>>>>>>>
>>>>>>>>>>> Once the filter is commented out (case.qml:17), everything
>>>>>>>>>>> runs
>>>>>>>>>>> smoothly.
>>>>>>>>>>>
>>>>>>>>>>> Do you know any workaround for that? I need to process data
>>>>>>>>>>> from a
>>>>>>>>>>> camera in OpenCV (I wanted to do it the
>>>>>>>>>>> QVideoFilterRunnable:run)
>>>>>>>>>>> and
>>>>>>>>>>> paint the resulting processed frame.
>>>>>>>>>>
>>>>>>>>>> I suspect that this needs hard-coded support for
>>>>>>>>>> QVideoFilterRunnable
>>>>>>>>>> in the same way that PyQt supports QValidator in QML.
>>>>>>>>>>
>>>>>>>>>> There is no workaround that I'm aware of.
>>>>>>>>>
>>>>>>>>> Hi Phil,
>>>>>>>>>
>>>>>>>>> Thank you for your reply. I am new to Qt. Could you elaborate
>>>>>>>>> on
>>>>>>>>> your
>>>>>>>>> answer?
>>>>>>>>
>>>>>>>> I'm not sure what you mean - PyQt would need to be enhanced to
>>>>>>>> support
>>>>>>>> this particular use case.
>>>>>>>>
>>>>>>>> Phil
>>>>>>>
>>>>>>> So which use case of QVideoFilterRunnable and
>>>>>>> QAbstractVideoFilter is
>>>>>>> currently supported in PyQt?
>>>>>>
>>>>>> Using them from QML.
>>>>>>
>>>>>> Phil
>>
>> My apologies, I misread your question. Using them from QML is *not*
>> currently supported (because of the need to hard-code support for
>> QVideoFilterRunnable).
>>
>>>>> Could you point please to some example? Would it be still possible
>>>>> to
>>>>> execute python from this QML object which would do manipulations
>>>>> with
>>>>> the frame (OpenCV) and return a new frame to QML
>>>>> QVideoFilterRunnable?
>>>>
>>>> Sorry, I've never used OpenCV or video filters in Qt.
>>>>
>>>> Phil
>>>
>>> Was anybody able to reproduce the bug? Has any bug ticket been
>>> created?
>>>
>>> In the documentation [1] I find information that:
>>>
>>> "QAbstractVideoFilter is meant to be subclassed. The subclasses are
>>> then
>>> registered to the QML engine, so they can be used as a QML type."
>>>
>>> Thus, how could I use QAbstractVideoFilter in QML as Phill suggested?
>>
>> If QVideoFilterRunnable can only be used from QML (I'm not familiar
>> with every part of the Qt API), then you can't use it to do what you
>> want with PyQt.
>>
>> Phil
> Phil, sorry, but your reply is not clear to me. Could you elaborate it
> a
> bit on them, please?
>
> According to the documentation link I shared [1], both,
> QVideoFilterRunnable and QAbstractVideoFilter can be used not only from
> QML, but also from C++. Documentation gives C++ examples how to use
> them. Why they can't be used in PyQt then? By adding printout to my
> test
> case, I see that __init__ of QAbstractVideoFilter() is called properly.
> Though execution never gets to createFilterRunnable(). Is it clear why?
>
> Adrian
>
> [1]https://doc.qt.io/qt-5/qabstractvideofilter.html
I said *if* they can only be used from QML then you have a problem. If
they can be used from C++ as well then you might be Ok.
However the documentation you refer to does *not* say that they can be
used from C++. The C++ code is setting things up so that the filter can
be used from QML.
Phil
More information about the PyQt
mailing list