valbok / QtAVPlayer

Free and open-source Qt Media Player library based on FFmpeg, for Linux, Windows, macOS, iOS and Android.
MIT License
298 stars 60 forks source link

QML_Video example: Link error using Qt 5.15.15 for Android #410

Closed franNadalesDN closed 1 year ago

franNadalesDN commented 1 year ago

I am trying to build qm_video example for Android using:

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 1 year ago

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

franNadalesDN commented 1 year ago

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 1 year ago

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.