valbok/QtAVPlayer

QML_Video example: Link error using Qt 5.15.15 for Android

franNadalesDN opened this issue · 3 comments

I am trying to build qm_video example for Android using:

  • Qt 5.15.15
  • NDK 23.2
  • SDK 33
  • Target architecture: arm64-v8a

I have following linker error:

ld: error: undefined symbol: QDeclarativeVideoOutput::videoSurface() const

referenced by main.cpp:85 (..\qml_video\main.cpp:85)
ld: error: undefined symbol: QDeclarativeVideoOutput::sourceRectChanged()
referenced by main.cpp:87 (..\qml_video\main.cpp:87)

Any idea about how to solve it?

valbok commented

Hi, thanks for contributing, do you have QT+=multimedia in pro?

Hi, yes.pro conatined multimedia since I was using qml_video example from main branch.

Anyway I think I found a solution.

It seems something was wrong in my environment that does not like this section in QtAVPlayer.pri:

    QT += core-private
    PRIVATE_HEADERS += $$PWD/qavhwdevice_mediacodec_p.h
    SOURCES += $$PWD/qavhwdevice_mediacodec.cpp $$PWD/qavandroidsurfacetexture.cpp

#    equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
#        LIBS += -L$$(AVPLAYER_ANDROID_LIB_ARMEABI_V7A)

#    equals(ANDROID_TARGET_ARCH, arm64-v8a): \
#        LIBS += -L$$(AVPLAYER_ANDROID_LIB_ARMEABI_V8A)

#    equals(ANDROID_TARGET_ARCH, x86): \
#        LIBS += -L$$(AVPLAYER_ANDROID_LIB_X86)

#    equals(ANDROID_TARGET_ARCH, x86_64): \
#        LIBS += -L$$(AVPLAYER_ANDROID_LIB_X86_64)
}```

Solution was to remove linker commands.
valbok commented

Thanks, I suggested to use
AVPLAYER_ANDROID_LIB_* exports to define path to the ffmpeg libs, and hardcoded in QtAVPlayer.pri to use them like LIBS += -L$$(AVPLAYER_ANDROID_LIB_ARMEABI_V7A)
Anyway you will have to provide correct paths to link against ffmpeg and also don't forget to deploy the libs together with your apps.