valbok / QtAVPlayer

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

QtAvplayer itself compiles on 6.7.1 but C++ code fails #476

Closed chetan-prime closed 2 months ago

chetan-prime commented 3 months ago

Platform: ios OS: MacOS XCode: 15.3 Qt: 6.7.1

An older version of QtAvplayer compiled fine on 6.7.0 but gave errors compiling on 6.7.1. I used the latest version along with 'QtAVPlayer.cmake' including inside it. It compiles fine but while linking the final binary for ios, we get these errors:

Undefined symbols for architecture arm64: "QAVPlayer::audioFrame(QAVAudioFrame const&)", referenced from: QAVPlayerPrivate::doPlayAudio()::$_2::operator()(QAVFrame const&) const in libQtAVPlayer.a[2](qavplayer.cpp.o) LiveVideoPlayer::setVideoSink(QVideoSink*) in libbackend_APP.a[16](LiveVideoPlayer.o) "QAVPlayer::videoFrame(QAVVideoFrame const&)", referenced from: QAVPlayerPrivate::doPlayVideo()::$_1::operator()(QAVFrame const&) const in libQtAVPlayer.a[2](qavplayer.cpp.o) LiveVideoPlayer::setVideoSink(QVideoSink*) in libbackend_APP.a[16](LiveVideoPlayer.o) "QAVPlayer::stateChanged(QAVPlayer::State)", referenced from: QAVPlayerPrivate::setState(QAVPlayer::State) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::errorOccurred(QAVPlayer::Error, QString const&)", referenced from: QAVPlayerPrivate::setError(QAVPlayer::Error, QString const&) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::sourceChanged(QString const&)", referenced from: QAVPlayer::setSource(QString const&, QSharedPointer<QAVIODevice> const&) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::subtitleFrame(QAVSubtitleFrame const&)", referenced from: QAVPlayerPrivate::doPlaySubtitle()::$_3::operator()(QAVSubtitleFrame const&) const in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::durationChanged(long long)", referenced from: QAVPlayerPrivate::setDuration(double) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::seekableChanged(bool)", referenced from: QAVPlayerPrivate::setSeekable(bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::staticMetaObject", referenced from: LiveVideoPlayer::setVideoSink(QVideoSink*) in libbackend_APP.a[16](LiveVideoPlayer.o) QtPrivate::MetaObjectForType<QAVPlayer*, void>::metaObjectFunction(QtPrivate::QMetaTypeInterface const*) in libbackend_APP.a[22](mocs_compilation.o) QMetaTypeIdQObject<QAVPlayer*, 8>::qt_metatype_id() in libbackend_APP.a[22](mocs_compilation.o) "QAVPlayer::mediaStatusChanged(QAVPlayer::MediaStatus)", referenced from: QAVPlayerPrivate::setMediaStatus(QAVPlayer::MediaStatus) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::videoFrameRateChanged(double)", referenced from: QAVPlayerPrivate::setVideoFrameRate(double) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::paused(long long)", referenced from: QAVPlayerPrivate::doStep(PendingMediaStatus, bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::played(long long)", referenced from: QAVPlayerPrivate::doStep(PendingMediaStatus, bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::seeked(long long)", referenced from: QAVPlayerPrivate::doStep(PendingMediaStatus, bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::stepped(long long)", referenced from: QAVPlayerPrivate::doStep(PendingMediaStatus, bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "QAVPlayer::stopped(long long)", referenced from: QAVPlayerPrivate::doStep(PendingMediaStatus, bool) in libQtAVPlayer.a[2](qavplayer.cpp.o) "vtable for QAVAudioOutput", referenced from: QAVAudioOutput::QAVAudioOutput(QObject*) in libQtAVPlayer.a[30](qavaudiooutput.cpp.o) QAVAudioOutput::~QAVAudioOutput() in libQtAVPlayer.a[30](qavaudiooutput.cpp.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for QAVAudioOutputDevice", referenced from: QAVAudioOutputDevice::QAVAudioOutputDevice(QObject*) in libQtAVPlayer.a[31](qavaudiooutputdevice.cpp.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for QAVPlayer", referenced from: QAVPlayer::QAVPlayer(QObject*) in libQtAVPlayer.a[2](qavplayer.cpp.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

LiveVideoPlayer is my custom C++ code that worked fine so far. It is a thin wrapper to QtAvPlayer, URL to file code: https://pastebin.com/7HDErnd5

valbok commented 3 months ago

Thanks for contribution!

I just tested:

qml_video % mkdir build
qml_video % cd build
build % cmake ../ -DQT_AVPLAYER_MULTIMEDIA=ON -DCMAKE_PREFIX_PATH=/opt/Qt/6.7.1/macos/lib/cmake -DCMAKE_LIBRARY_PATH=/opt/homebrew/Cellar/ffmpeg/7.0_1/lib
build % make -j8

And it worked. Could you please compare https://github.com/valbok/QtAVPlayer/blob/master/examples/qml_video/CMakeLists.txt with your cmake?

chetan-prime commented 3 months ago

No problem @valbok, glad if it helped in any way. The compilation of QtAvplayer as a static library(on ios) against 6.7.1 works fine for me & I then copy the headers, library into the Qt 6.7.1 folders.

But the issue comes when I include the QtAvplayer headers & library in my Qt 6.7.1 project. That gives the above errors during linking. This used to work fine on 6.7.0.

mxnt10 commented 3 months ago

Isso deve ser um problema específico do macos. No Arch Linux compila bem com a versão 6.7.1 e ficou até melhor que a versão 6.5.2 do meu sistema.

valbok commented 3 months ago

I used the latest version along with 'QtAVPlayer.cmake' including inside it. It compiles fine but while linking the final binary for ios, we get these errors:

Did you try to compile https://github.com/valbok/QtAVPlayer/blob/master/examples/qml_video/CMakeLists.txt ?

valbok commented 3 months ago

Oh, you might forgot to provide -DQT_AVPLAYER_MULTIMEDIA=ON during cmake? Maybe not, since it should prevent from compiling.

valbok commented 2 months ago

Feel free to reopen if you have still issues.