I am developing on a desktop as a host and the target is an iMX6 board. The OS for both is Ubuntu. I have ported the qmlvideofx example provided by Qt as a base application. From here, I want to add a QAbstractVideoFilter so that I can access the frames in the QMediaPlayer. I have two kits with this project, the Desktop Qt GCC 64bit (host) and an apalis-imx6 (target).
.h
#ifndef VIDEOFILTERTOSATELLITE_H
#define VIDEOFILTERTOSATELLITE_H
#include <QObject>
#include <QAbstractVideoFilter>
#include <QVideoFilterRunnable>
#include <QDebug>
#include <QSize>
class VideoFilterToSatellite;
class VideoFilterToSatelliteRunnable : public QVideoFilterRunnable
{
public:
VideoFilterToSatelliteRunnable ( VideoFilterToSatellite* parent = 0 );
~VideoFilterToSatelliteRunnable ();
QVideoFrame run ( QVideoFrame *input,
const QVideoSurfaceFormat &surfaceFormat,
RunFlags flags ) Q_DECL_OVERRIDE;
private:
VideoFilterToSatellite* m_filterParent;
};
class VideoFilterToSatellite : public QAbstractVideoFilter
{
Q_OBJECT
public:
explicit VideoFilterToSatellite ( QAbstractVideoFilter *parent = 0 );
QVideoFilterRunnable* createFilterRunnable ();
};
#endif // VIDEOFILTERTOSATELLITE_H
#ifndef VIDEOFILTERTOSATELLITE_H
#define VIDEOFILTERTOSATELLITE_H
#include <QObject>
#include <QAbstractVideoFilter>
#include <QVideoFilterRunnable>
#include <QDebug>
#include <QSize>
class VideoFilterToSatellite;
class VideoFilterToSatelliteRunnable : public QVideoFilterRunnable
{
public:
VideoFilterToSatelliteRunnable ( VideoFilterToSatellite* parent = 0 );
~VideoFilterToSatelliteRunnable ();
QVideoFrame run ( QVideoFrame *input,
const QVideoSurfaceFormat &surfaceFormat,
RunFlags flags ) Q_DECL_OVERRIDE;
private:
VideoFilterToSatellite* m_filterParent;
};
class VideoFilterToSatellite : public QAbstractVideoFilter
{
Q_OBJECT
public:
explicit VideoFilterToSatellite ( QAbstractVideoFilter *parent = 0 );
QVideoFilterRunnable* createFilterRunnable ();
};
#endif // VIDEOFILTERTOSATELLITE_H
To copy to clipboard, switch view to plain text mode
.cpp
#include "VideoFilterToSatellite.h"
VideoFilterToSatellite::VideoFilterToSatellite ( QAbstractVideoFilter *parent )
: QAbstractVideoFilter ( parent ) {}
QVideoFilterRunnable* VideoFilterToSatellite::createFilterRunnable ()
{
return reinterpret_cast<QVideoFilterRunnable*>( new VideoFilterToSatelliteRunnable ( this ) );
}
VideoFilterToSatelliteRunnable::VideoFilterToSatelliteRunnable ( VideoFilterToSatellite* parent )
: m_filterParent ( parent ) {}
VideoFilterToSatelliteRunnable::~VideoFilterToSatelliteRunnable() {}
QVideoFrame VideoFilterToSatelliteRunnable::run ( QVideoFrame *input,
const QVideoSurfaceFormat &surfaceFormat,
RunFlags flags )
{
Q_UNUSED ( surfaceFormat );
Q_UNUSED ( flags );
if (!input->isValid())
return *input;
// future work
return *input;
}
#include "VideoFilterToSatellite.h"
VideoFilterToSatellite::VideoFilterToSatellite ( QAbstractVideoFilter *parent )
: QAbstractVideoFilter ( parent ) {}
QVideoFilterRunnable* VideoFilterToSatellite::createFilterRunnable ()
{
return reinterpret_cast<QVideoFilterRunnable*>( new VideoFilterToSatelliteRunnable ( this ) );
}
VideoFilterToSatelliteRunnable::VideoFilterToSatelliteRunnable ( VideoFilterToSatellite* parent )
: m_filterParent ( parent ) {}
VideoFilterToSatelliteRunnable::~VideoFilterToSatelliteRunnable() {}
QVideoFrame VideoFilterToSatelliteRunnable::run ( QVideoFrame *input,
const QVideoSurfaceFormat &surfaceFormat,
RunFlags flags )
{
Q_UNUSED ( surfaceFormat );
Q_UNUSED ( flags );
if (!input->isValid())
return *input;
// future work
return *input;
}
To copy to clipboard, switch view to plain text mode
.pro
TEMPLATE = app
TARGET = MCS_Host
QT += qml quick multimedia network
CONFIG += c++11
CONFIG += qml_debug
SOURCES += main.cpp \
filereader.cpp \
NetworkServer.cpp \
NetworkThread.cpp \
VideoFilterToSatellite.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
filereader.h \
NetworkServer.h \
NetworkThread.h \
trace.h \
VideoFilterToSatellite.h
TEMPLATE = app
TARGET = MCS_Host
QT += qml quick multimedia network
CONFIG += c++11
CONFIG += qml_debug
SOURCES += main.cpp \
filereader.cpp \
NetworkServer.cpp \
NetworkThread.cpp \
VideoFilterToSatellite.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
HEADERS += \
filereader.h \
NetworkServer.h \
NetworkThread.h \
trace.h \
VideoFilterToSatellite.h
To copy to clipboard, switch view to plain text mode
main.cpp
... includes ...
#include "VideoFilterToSatellite.h"
int main(int argc, char *argv[])
{
qputenv
( "QT_IM_MODULE",
QByteArray ( "qtvirtualkeyboard" ) );
qSetMessagePattern ( "\033[34m%{function}[%{line}]:\033[0m %{message}" );
QGuiApplication app ( argc, argv );
qmlRegisterType<VideoFilterToSatellite>("VideoFilter.ToSatellite", 1, 0, "VideoFilterToSatellite" );
QQuickView viewer;
viewer.show ();
// Delay invocation of init until the event loop has started, to work around
// a GL context issue on Harmattan: without this, we get the following error
// when the first ShaderEffectItem is created:
// "QGLShaderProgram::addShader: Program and shader are not associated with same context"
QMetaObject::invokeMethod ( rootObject,
"init", Qt
::QueuedConnection );
return app.exec();
}
... includes ...
#include "VideoFilterToSatellite.h"
int main(int argc, char *argv[])
{
qputenv ( "QT_IM_MODULE", QByteArray ( "qtvirtualkeyboard" ) );
qSetMessagePattern ( "\033[34m%{function}[%{line}]:\033[0m %{message}" );
QGuiApplication app ( argc, argv );
qmlRegisterType<VideoFilterToSatellite>("VideoFilter.ToSatellite", 1, 0, "VideoFilterToSatellite" );
QQuickView viewer;
viewer.setSource ( QUrl ( QLatin1String ( "qrc:/qml/qmlvideofx/Main.qml" ) ) );
viewer.show ();
// Delay invocation of init until the event loop has started, to work around
// a GL context issue on Harmattan: without this, we get the following error
// when the first ShaderEffectItem is created:
// "QGLShaderProgram::addShader: Program and shader are not associated with same context"
QMetaObject::invokeMethod ( rootObject, "init", Qt::QueuedConnection );
return app.exec();
}
To copy to clipboard, switch view to plain text mode
If I run this code on the desktop, it all works. If I run it on the target, it immediately segfaults in dl-debug.c on line 46 dl_debug_initialize. If I take out the filter, everything works on both platforms. I am missing something and am unsure where to go from here. Thanks for any pointers.
Bookmarks