Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube almost fixed for Qt4 version (search & playback work), a minor issue left: advice wanted #776

Open
barracuda156 opened this issue Nov 19, 2024 · 59 comments

Comments

@barracuda156
Copy link

@zaps166 I resurrect the topic, since I found a faster way to debug what was broken (building on Sonoma with Qt5 allowed to reproduce identical failures: turned out, the problem was unrelated to Qt version) and more or less fixed YouTube: searching and playback work.

This branch https://github.com/barracuda156/QMPlay2/commits/18.12.08-qt4/ has the current fixes on top of the last commit which was building with Qt4. (This commit barracuda156@176915e fixes search and this barracuda156@85b4e5a fixes playback, but need a working yt-dlp, see below. Largely these two are trivial backports; the problem was to find them.)

One issue left to solve is support for HD playback (which YouTube has broken recently, and by default everything is 360p). QMPlay2 had is fixed around 21.x.x versions, but related commits are huge and seem to pull in a lot of changes, since they do not apply cleanly.
Could you suggest a minimal change needed to address specifically this issue? AFAIU, already old versions of QMPlay2 can separate video and audio streams, so it boils down to being able to force HD. (Just pointing to the code which needs to be backported is sufficient, I do not ask to make a patch for me.)

It would be nice to get rid of downloaded yt-dlp (which invokes non-existing python3 and therefore fails) and use instead a regular externally-provided dependency, but for this at least an ugly solution is readily available: deleting yt-dlp binary from ~/.qmplay2 and making a symlink to MacPorts one works fine and fixes fetching videos.

P. S. @RJVB Did you have an earlier prototype of your fix for bit-perfect Core Audio which did not use blocks? libdispatch as such is feasible, blocks are no-go at the moment (until GCC addresses the problem, if ever).

@barracuda156
Copy link
Author

barracuda156 commented Nov 19, 2024

I have bisected and found the commit which fixes HD streaming: 2f9281b

Unfortunately, it does not apply, not even dirtily, I need to see what it takes to backport previous changes.

UPD. May be easier than I thought: 2eece63

UPD2. No, it is pretty bad, this is pulled in: f0c0ca0
And it also does not apply cleanly.

@zaps166
Copy link
Owner

zaps166 commented Nov 19, 2024

Do you really need Qt4? What platform are you targeting? Qt 5.6.3 is the last supporting Windows XP (23 years old OS), so maybe this'll be simpler to maintain?

@zaps166
Copy link
Owner

zaps166 commented Nov 19, 2024

It would be nice to get rid of downloaded yt-dlp (which invokes non-existing python3 and therefore fails) and use instead a regular externally-provided dependency, but for this at least an ugly solution is readily available: deleting yt-dlp binary from ~/.qmplay2 and making a symlink to MacPorts one works fine and fixes fetching videos.

You can remove downloader code.

Edit: But don't remember how it was in 2017 😅

@barracuda156
Copy link
Author

MacOS on PowerPC, Qt5 was badly broken by its upstream on several levels (carbon removed, 32-bit support removed, from 5.4 they began using SDK which had no support for the architecture). Add to that they never bothered to test builds with gcc on Apple, so that is also broken here and there.

I would probably consider fixing Qt6 which finally uses a coherent build system, but with X11 backend. This should work, but currently broken even on the latest macOS (again, no testing done).

Qt4 works more or less robustly. Aside of occasional weirdity when it can’t find own plugins nothing really to complain about.
And Qt4 apps have better gui and typically more stable than GTK-based ones.

@zaps166
Copy link
Owner

zaps166 commented Nov 19, 2024

MacOS on PowerPC

That's old machine, wine is also not an option, Linux on PPC probably bad idea, too.

IIRC Qt5 was very good on 5.6.3 (Windows and Linux/X11).

Are you able to build Qt6 with C++17 on PPC MacOS? Does it have up-to-date compilers?

@barracuda156
Copy link
Author

Edit: But don't remember how it was in 2017 😅

Yeah, this can be sorted by patching out whatever tries to fetch it. No big deal. And I can write portfile code which will install symlinks wherever needed.

So my primary concern is that misleadingly small commit, which allows HD video streaming.
If the same change could be applied onto Qt4 branch without rewriting hundreds of LoC, it would be a win. Two other fixes worked fine for every version I tried to build (almost no rebasing even).
This last one looks non-trivial.

@zaps166
Copy link
Owner

zaps166 commented Nov 19, 2024

So I need to compile old code and update it, well...

@barracuda156
Copy link
Author

MacOS on PowerPC
That's old machine,

It is still pretty fast in fact. My only regret is that I cannot have G5 Quad in the laptop form )

OpenBSD has Qt5 on ppc (thanks to using X11 and not a broken cocoa), but then it does not have other stuff which Mac has.

Are you able to build Qt6 with C++17 on PPC MacOS? Does it have up-to-date compilers?

Compilers are there. The problem is Qt quality of code: they in effect hardcode Cocoa-based build on macOS and do not test with gcc. One would think that it should take no more than a configure flag to build Qt against a chosen backend; in reality it fails. With some hacks I fixed building it on Sonoma as +x11 (that is broken atm), but only of the qtbase. PowerPC should be doable, but Apple headers pose a problem there (also no testing with GCC).

@barracuda156
Copy link
Author

So I need to compile old code and update it, well...

@zaps166 It is either start from the branch I referred and backport minimal necessary fix on top of it. Or, as @RJVB suggested, try reverse: borrow YouTube modules from the modern code base, use them in place of old, see if they can be blended into the older version of other components.

What do you think, which approach makes better sense?

The problem now is very localized, up to a specific commit. Does it have a localized solution?

@RJVB
Copy link
Contributor

RJVB commented Nov 19, 2024 via email

@zaps166
Copy link
Owner

zaps166 commented Nov 19, 2024

Btw. I never supported big-endian in QMPlay2, so some part of code might not work properly... x86 is always little-endian, ARM is always set to use little-endian (anybody know big-endian OS for ARM?). Modern PPC also can run in little-endian mode.

how to get Qt6 to build the XCB instead of the Cocoa

Old Mac didn't have Cocoa?

10.5 (or possibly 10.6)

Well, I remember these 😄 It was 15 years ago?


I can check the YT code, but not today for sure 😄

@barracuda156
Copy link
Author

I suspect in some case we would have done fine with gcc and ObjC, if only we added -xobjective-c flag. That was a fix for the recent gegl, suggested by gcc upstream, and it worked normally.

@RJVB
Copy link
Contributor

RJVB commented Nov 19, 2024 via email

@barracuda156
Copy link
Author

anybody know big-endian OS for ARM?

NetBSD has.
Linux can support it, but perhaps one will need its own distro.

Old Mac didn't have Cocoa?

Well, the OS has a framework on this name, but SDK does not support a lot of later features, and the version of ObjC Apple uses is designed with an aim to undermine compatibility. Certain parts of the code cannot be compiled with gcc at all.

I can check the YT code, but not today for sure 😄

That would be super-helpful! Thank you 🙏

(And I am also off for today now.)

@RJVB
Copy link
Contributor

RJVB commented Nov 19, 2024 via email

@barracuda156
Copy link
Author

@zaps166 @RJVB Okay, so just sticking in YT-related components from 21.12.07 into 18.12.08 did not work, since it assumes some new stuff which did not exits (Frame, for example), and it is unclear whether it is sensible to pull over some random components in this manner.

I wonder if it makes a better sense just to fix 21.12.07 (or even a later version) to build with Qt4 instead of trying to backport a lot of later changes into 18.12.08. Apparently QML can be turned off. QJson we got a substitute via QJson4 library, which seems to work just fine.
Are there any major stoppers here? I expect some functionality not to have fallbacks, but as long as it is not essential, it can be just disabled. If some components (say, Mac-specific) cannot be built in their present shape but are more or less independent, those can be forward-ported from 18.12.08.

Alternatives are either @RJVB suggestion to borrow modern YT modules, but perhaps cutting some parts out to avoid backporting a lot of additional stuff, or my initial idea to use my 18.12.08-qt4 branch (which currently has YT fixed, but without HD streaming) and try to fix HD streaming there with as little changes as possible.

@barracuda156
Copy link
Author

After some trial & error, I came to a conclusion that a better candidate would be a version close to those huge changes to the code which are hard to backport. Later ones introduce more incompatibilities and are unneeded to fix YouTube issue anyway.

So I am trying to build 19.09.03.

Initial errors were fixed, then I got stuck at this:

[ 27%] Building CXX object src/qmplay2/CMakeFiles/libqmplay2.dir/qrc_languages.cxx.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/build/src/qmplay2 && /opt/local/bin/ccache /opt/local/bin/g++-mp-14 -DQMPLAY2SHAREDLIB_LIBRARY -DQMPLAY2_LIBASS -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_USE_FAST_OPERATOR_PLUS -DQ_OS_MACOS -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -Dlibqmplay2_EXPORTS -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/build/src/qmplay2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/QMPlay2-19.09.03/src/qmplay2 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/build/src/qmplay2/libqmplay2_autogen/include -I/opt/local/include -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/fribidi -I/opt/local/include/freetype2 -I/opt/local/include/libpng16 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/QMPlay2-19.09.03/src/qmplay2/headers -isystem /opt/local/libexec/qt4/include -isystem /opt/local/libexec/qt4/include/QtGui -isystem /opt/local/libexec/qt4/include/QtCore -isystem /opt/local/libexec/qt4/share/mkspecs/default -Wall -Wno-deprecated-declarations -pipe -Os -std=gnu++11 -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -arch ppc -mmacosx-version-min=10.6 -fPIC   -I/opt/local/include/QJson4 -MD -MT src/qmplay2/CMakeFiles/libqmplay2.dir/qrc_languages.cxx.o -MF CMakeFiles/libqmplay2.dir/qrc_languages.cxx.o.d -o CMakeFiles/libqmplay2.dir/qrc_languages.cxx.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/build/src/qmplay2/qrc_languages.cxx
[ 28%] Linking CXX shared library libqmplay2.dylib
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_multimedia_QMPlay2/QMPlay2/work/build/src/qmplay2 && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/libqmplay2.dir/link.txt --verbose=ON
Undefined symbols:
  "__ZN12NetworkReply8finishedEv", referenced from:
      __ZN16NetworkReplyPriv3runEv in NetworkAccess.cpp.o
  "__ZTV12NetworkReply", referenced from:
      __ZTV12NetworkReply$non_lazy_ptr in NetworkAccess.cpp.o
     (maybe you meant: __ZTV12NetworkReply$non_lazy_ptr)
  "__ZN7InDockW7resizedEii", referenced from:
      __ZN7InDockW11resizeEventEP12QResizeEvent in InDockW.cpp.o
  "__ZTV6Slider", referenced from:
      __ZTV6Slider$non_lazy_ptr in Slider.cpp.o
     (maybe you meant: __ZTV6Slider$non_lazy_ptr)
  "__ZTV8LineEdit", referenced from:
      __ZTV8LineEdit$non_lazy_ptr in LineEdit.cpp.o
     (maybe you meant: __ZTV8LineEdit$non_lazy_ptr)
  "__ZN14LineEditButton16staticMetaObjectE", referenced from:
      __ZN14LineEditButton16staticMetaObjectE$non_lazy_ptr in LineEdit.cpp.o
     (maybe you meant: __ZN14LineEditButton16staticMetaObjectE$non_lazy_ptr)
  "__ZN12NetworkReply16downloadProgressEii", referenced from:
      __ZN16NetworkReplyPriv3runEv in NetworkAccess.cpp.o
  "__ZN6Slider13mousePositionEi", referenced from:
      __ZN6Slider14mouseMoveEventEP11QMouseEvent in Slider.cpp.o
  "__ZN9IPCServer13newConnectionEP9IPCSocket", referenced from:
      __ZN9IPCServer18socketAcceptActiveEv in IPC_Unix.cpp.o
  "__ZTV11ColorButton", referenced from:
      __ZTV11ColorButton$non_lazy_ptr in ColorButton.cpp.o
     (maybe you meant: __ZTV11ColorButton$non_lazy_ptr)
  "__ZTV9IPCSocket", referenced from:
      __ZTV9IPCSocket$non_lazy_ptr in IPC_Unix.cpp.o
     (maybe you meant: __ZTV9IPCSocket$non_lazy_ptr)
  "__ZN11ColorButton12colorChangedEv", referenced from:
      __ZN11ColorButton15openColorDialogEv in ColorButton.cpp.o
  "__ZTV14LineEditButton", referenced from:
      __ZTV14LineEditButton$non_lazy_ptr in LineEdit.cpp.o
     (maybe you meant: __ZTV14LineEditButton$non_lazy_ptr)
  "__ZN14LineEditButton7clickedEv", referenced from:
      __ZN14LineEditButton15mousePressEventEP11QMouseEvent in LineEdit.cpp.o
  "__ZTV7InDockW", referenced from:
      __ZTV7InDockW$non_lazy_ptr in InDockW.cpp.o
     (maybe you meant: __ZTV7InDockW$non_lazy_ptr)
  "__ZN7InDockW13hasCoverImageEb", referenced from:
      __ZN7InDockW15setCustomPixmapERK7QPixmap in InDockW.cpp.o
  "__ZN8LineEdit18clearButtonClickedEv", referenced from:
      __ZN8LineEdit9clearTextEv in LineEdit.cpp.o
  "__ZTV9IPCServer", referenced from:
      __ZTV9IPCServer$non_lazy_ptr in IPC_Unix.cpp.o
     (maybe you meant: __ZTV9IPCServer$non_lazy_ptr)
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
/opt/local/bin/g++-mp-14 -Wall -Wno-deprecated-declarations -pipe -Os -std=gnu++11 -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6 -dynamiclib -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names -o libqmplay2.dylib -install_name /opt/local/lib/libqmplay2.dylib CMakeFiles/libqmplay2.dir/libqmplay2_autogen/mocs_compilation.cpp.o CMakeFiles/libqmplay2.dir/QMPlay2Core.cpp.o CMakeFiles/libqmplay2.dir/Functions.cpp.o CMakeFiles/libqmplay2.dir/Settings.cpp.o CMakeFiles/libqmplay2.dir/Module.cpp.o CMakeFiles/libqmplay2.dir/ModuleParams.cpp.o CMakeFiles/libqmplay2.dir/ModuleCommon.cpp.o CMakeFiles/libqmplay2.dir/Playlist.cpp.o CMakeFiles/libqmplay2.dir/Reader.cpp.o CMakeFiles/libqmplay2.dir/Demuxer.cpp.o CMakeFiles/libqmplay2.dir/Decoder.cpp.o CMakeFiles/libqmplay2.dir/VideoFilters.cpp.o CMakeFiles/libqmplay2.dir/VideoFilter.cpp.o CMakeFiles/libqmplay2.dir/DeintFilter.cpp.o CMakeFiles/libqmplay2.dir/AudioFilter.cpp.o CMakeFiles/libqmplay2.dir/Writer.cpp.o CMakeFiles/libqmplay2.dir/QMPlay2Extensions.cpp.o CMakeFiles/libqmplay2.dir/LineEdit.cpp.o CMakeFiles/libqmplay2.dir/Slider.cpp.o CMakeFiles/libqmplay2.dir/QMPlay2OSD.cpp.o CMakeFiles/libqmplay2.dir/InDockW.cpp.o CMakeFiles/libqmplay2.dir/LibASS.cpp.o CMakeFiles/libqmplay2.dir/ColorButton.cpp.o CMakeFiles/libqmplay2.dir/ImgScaler.cpp.o CMakeFiles/libqmplay2.dir/SndResampler.cpp.o CMakeFiles/libqmplay2.dir/VideoWriter.cpp.o CMakeFiles/libqmplay2.dir/SubsDec.cpp.o CMakeFiles/libqmplay2.dir/VideoFrame.cpp.o CMakeFiles/libqmplay2.dir/StreamInfo.cpp.o CMakeFiles/libqmplay2.dir/DockWidget.cpp.o CMakeFiles/libqmplay2.dir/PacketBuffer.cpp.o CMakeFiles/libqmplay2.dir/Buffer.cpp.o CMakeFiles/libqmplay2.dir/NetworkAccess.cpp.o CMakeFiles/libqmplay2.dir/Version.cpp.o CMakeFiles/libqmplay2.dir/PixelFormats.cpp.o CMakeFiles/libqmplay2.dir/YouTubeDL.cpp.o CMakeFiles/libqmplay2.dir/Notifies.cpp.o CMakeFiles/libqmplay2.dir/NotifiesTray.cpp.o CMakeFiles/libqmplay2.dir/MkvMuxer.cpp.o CMakeFiles/libqmplay2.dir/IPC_Unix.cpp.o CMakeFiles/libqmplay2.dir/qrc_languages.cxx.o  -Wl,-rpath,/opt/local/lib /opt/local/libexec/qt4/lib/libQtCore.dylib /opt/local/libexec/qt4/lib/libQtGui.dylib -lQJson4 -lavformat -lavcodec -lswscale -lavutil -lswresample -lass /opt/local/libexec/qt4/lib/libQtCore.dylib
make[2]: *** [src/qmplay2/libqmplay2.dylib] Error 1

Looks like a commit which moved final from inside classes to classes has broken linking.
Will try reverting that.

@barracuda156
Copy link
Author

So with 19.09.03 most of the code compiles with Qt4 – with huge, but largely mechanical patching (reverting and forward-porting).
It starts breaking badly towards the end of the build, and ironically exactly on what we need: Downloader and YouTube. And here, I am afraid, reverting the an older version cannot work, since that will undo fixes that are required for YouTube to work.

So whether backporting later changes onto otherwise functional Qt4 version is attempted or reverse, forward-porting compat code into the version where YT was largely fixed for Qt5, the core problem is the YouTube module itself.

I give up for today, it took many hours -_-

@barracuda156
Copy link
Author

barracuda156 commented Nov 21, 2024

Just to show that something actually works LOL

qmplay2-2

This is the archaic version with backported fixes, but broken HD streaming. (Offline HD playback works normally.)

19.x.x can still be built, I believe, but needs YouTube module syntax adapted for Qt4. (Not hoping to get later ones building.)

P. S. AFAICT, there are no powerpc-specific issues with this, everything should be reproducible and testable on x86 (in fact even arm64, but Qt4 does not build for it). OS version is likely irrelevant as well.

@RJVB
Copy link
Contributor

RJVB commented Nov 21, 2024 via email

@barracuda156
Copy link
Author

@RJVB I will try. I think there is no issue in handling HD streams as long as QMPlay is able to extract those from the web. For example, HD playback worked for YT via Smtube earlier (without my recent fixes), until YT broken that from their end (from what i understand, now it is required to handle video and audio streams separately, and that is broken at the moment). What did not work earlier was YouTube searching, which now works.

@RJVB
Copy link
Contributor

RJVB commented Nov 21, 2024 via email

@barracuda156
Copy link
Author

@RJVB I got an idea, let me try building 19.09.03 with problematic stuff disabled first. If that works and I get a functional app, then it arguably makes a better sense to fix YT there (in that case the problem is different in fact, though with the same module: it is trivial to backport 1–2 commits onto 19.09.03, since it postdates the major rewrite of the code, but it is needed to make it build with Qt4 – just that one module, the rest I can handle).
If 19.09.03 without optional modules remains unusable or less stable than my early Qt4 version, then perhaps rather backport YT-specific fixes onto that and leave everything else as is.

@RJVB
Copy link
Contributor

RJVB commented Nov 21, 2024 via email

@zaps166
Copy link
Owner

zaps166 commented Nov 21, 2024

No big-endian issues?

Also is it possible to run OpenGL in QMPlay2 there?

@barracuda156
Copy link
Author

barracuda156 commented Nov 21, 2024

No big-endian issues?

At least nothing obvious (which likely implies nothing serous). With multimedia apps, in my experience, incorrect handling of endianness makes them defunct (hiss instead of audio output, visibly wrong colors with video).
No complaints of this sort in regard of QMPlay2. For the playback QMPlay2 works amazingly well (even the archaic version built with Qt4) – unlike vlc, mpv and a few other players which I tried.

I did not test it yet with high-res audio (largely because of a habit to use different apps with video and audio), but I will try it shortly.

The only issue with a general functionality which I observe on my powerpc system is a crash on quit (i.e. when I quit the app, it crashes instead; but not otherwise). I do not think this is anything about powerpc; most likely my patches have an issue, or otherwise the SDK of 10a190. It also could be that it was a passing issue with QMPlay2 back then, since I picked the commit to start from based on what worked better for the build, which may not coincide with better stability.

Also is it possible to run OpenGL in QMPlay2 there?

Do you mean build QMPlay2 itself with OpenGL enabled? It may be tricky to test, since the last time we discussed the matter here, the build was failing on OpenGL components, so I just disabled it since then.

Will it be sensible to build it against mesa? I suspect Apple-provided OpenGL is just too old, and nothing much can be done about that.

@RJVB
Copy link
Contributor

RJVB commented Nov 21, 2024 via email

@RJVB
Copy link
Contributor

RJVB commented Nov 21, 2024 via email

@zaps166
Copy link
Owner

zaps166 commented Nov 22, 2024

Good that it works with big-endian. I don't do many operations on bytes directly.

Will it be sensible to build it against mesa? I suspect Apple-provided OpenGL is just too old, and nothing much can be done about that

If system and driver can't handle OpenGL 2.x, there's nothing you can do. Very old QMPlay2 supported older OpenGL 1.x, but if it doesn't have non-power-of-2 and doesn't have multi-texturing extensions, the performance will be very bad.

@barracuda156
Copy link
Author

barracuda156 commented Nov 22, 2024

If system and driver can't handle OpenGL 2.x, there's nothing you can do. Very old QMPlay2 supported older OpenGL 1.x, but if it doesn't have non-power-of-2 and doesn't have multi-texturing extensions, the performance will be very bad.

@zaps166 Perhaps OpenGL 1 is still better than no OpenGL at all? Not sure how intertwined is OpenGL module with the rest of the codebase, but if not much, I can probably restore v. 1 into Qt4-based branch.

UPD. Wait, Leopard should support OpenGL 2.1: https://en.wikipedia.org/wiki/Mac_OS_X_Leopard

Leopard’s OpenGL stack has been updated to version 2.1

On 10.6 it will be roughly the same, since later updates are not available, and forward-ported version from Leopard works better than the original.

@barracuda156
Copy link
Author

I will revisit OpenGL issue then. As long as OpenGL 2.1 is sufficient, fixing compilation is likely a matter of reverting some later commits, but the core functionality can be preserved.

@barracuda156
Copy link
Author

I will also go carefully through instances where I added quick hacks initially, and instead forward-port compat code from commits where it was changed to Qt5 syntax.
This is for 19.09.03 version; original 18.12.08 is more or less coherent in the tree references above (but without HD streaming of YT, obviously).

I will share a tree for 19.09.03-qt4 once it is in a usable shape. Hope to sort this out in some hours.

@barracuda156
Copy link
Author

Minimal 19.09.03 is building with Qt4 now, launches with GUI, sound works, playlist works, no video LOL
This should be fixable (I think I had the same problem when I was fixing 17.x.x back then, which was fixed successfully).

YouTube module (that is, newer one from 19.09.03) does not build, as of now.
OpenGL will need to use "old" widgets (preset in Qt4 tree here), modifying CMakeLists accordingly and possibly some fixups.
BTW, the build finds mesa's GL, not Apple one.

@barracuda156
Copy link
Author

It looks like the app is processing the video normally (judging from working audio, info re video in real time and load on CPU), but something just prevents it from being output into the window.

@zaps166 Could you say what specifically is responsible for the output of video signal? If I could narrow down the scope of where to look, fixing this will likely be much faster.

@RJVB
Copy link
Contributor

RJVB commented Nov 23, 2024 via email

@RJVB
Copy link
Contributor

RJVB commented Nov 23, 2024 via email

@barracuda156
Copy link
Author

On Saturday November 23 2024 04:27:52 Sergey Fedorov wrote:

It looks like the app is processing the video normally (judging from working audio, info re video in real time and load on CPU), but something just prevents it from being output into the window.

Is the "Enable Video" item in the Playback menu enabled?

I believe so, but I will verify again.

I went through my patches to the old version and also searched through the older source for all instances of Qt4-related fallbacks, and perhaps I did not miss anything. But the codebase changes quite a bit, so something may need a fallback which never existed in the first place. Bisecting won’t really work to track the problem here, since I need to patch every version for it to even build, and I am not sure that the issue is not introduced by the patches )

@barracuda156
Copy link
Author

@RJVB As a quick update: I have built a hacked 19.09.03 with Qt4 on Catalina and there is no video output either. So at least this is not powerpc issue and most likely not an SDK issue either. Video is enabled in settings, so it is either an error in patches or an incompatibility with Qt4 in the original code which patches did not address.

@RJVB
Copy link
Contributor

RJVB commented Nov 23, 2024 via email

@barracuda156
Copy link
Author

On Saturday November 23 2024 09:40:43 Sergey Fedorov wrote:

Video is enabled in settings, so it is either an error in patches or an incompatibility with Qt4 in the original code which patches did not address.

Do you have a Qt4 version that does play video?

Yes, of course. The one I added to MacPorts works fine, and the tree I posted a link here has YT search fixed as well (with offline video working normally).

Issues with no video are observed only with a significantly newer version which I am trying to fix in a hope that YouTube HD playback comes as a bonus. This one never even built with Qt4 before.

@RJVB
Copy link
Contributor

RJVB commented Nov 23, 2024 via email

@barracuda156
Copy link
Author

I.e. if someone fixes just handling of two separate streams (audio and video) which will fix HD playback on YouTube in this branch, issue is resolved.
https://github.com/barracuda156/QMPlay2/commits/18.12.08-qt4
Bitperfect playback I can backport into it (not yet added), and that’s all I really care about.

I do not know whether there is much to gain with fixing instead a newer version (given that a lot of code must be patched for compatibility with Qt4 to be restored), I just have no idea about YT protocol and extracting video streams from the web, so can’t really rewrite the old code for that, even if needed change is minimal. So I thought that it may be worth trying instead to take a version where YT was fixed, but Qt4 compatibility broken, and fix compatibility.

@barracuda156
Copy link
Author

Hmmm, and what about an amd64 linux, does your hacked v19 show video there?

I don't really have an idea how platform-specific that code is beyond hw-accelerated decoding, but mixing Mesa with native OpenGL can definitely be a reason you're not seeing anything. Actually, you could check the renderer settings. In principle QMPlay2 has a fallback mechanism and I don't know what it would do when it runs out of fallbacks. As I said, I never tried the Qt4 version.

I did not enable OpenGL anywhere in Qt4 builds (whether 18.x or 19.x), as of now, though from looks of things it is possible and perhaps not really hard (but will need to use older code, of course). So this is not something to cause a broken video output in 19.x.
(I have seen odd OpenGL-related freezes with some X11 software, so your suggestion is helpful, but here the problem is different.)

Back then I selected a specific commit for 18.x because it was optimal to minimize patching while getting a newer version than Qt4 branch here had. So with that version forward-porting some chunks of code was rather transparent and largely amounted to copy-pasting some ifdefs and getting rid of some bits of unneeded Cocoa.
With 19.x this does not work this way, since support even for earlier Qt5 was already dropped, the code has been rewritten substantially and got a lot of Qt5-specific syntax. It is not hugely surprising that I did not get it working correctly in two days. I am sure it is doable with some trial and error, bisecting and digging into documentation, but it would be helpful to know where to look (since the issue is quite specific now).

@barracuda156
Copy link
Author

barracuda156 commented Nov 24, 2024

@RJVB I will try rebuilding today, I noticed now that in a couple of possibly relevant places I patched something incorrectly (i.e. at least inconsistently with what worked earlier in 18.x.x).

UPD. That made no change LOL

@barracuda156
Copy link
Author

@RJVB On a positive note, I got tired that I cannot test anything Qt4 on Apple Silicon, and fixed Qt4 build on arm64.

@RJVB
Copy link
Contributor

RJVB commented Nov 25, 2024 via email

@barracuda156
Copy link
Author

@zaps166 Video in 19.09.03 now works, @toreonify has found what has broken that for Qt4.

So if you find time to look at YT module, 19.09.03 can be used as the base, which is past the huge rewrite in f0c0ca0 commit (two subsequent fixes should be easily portable, but the issue there is new signal/slots syntax used for handling audio/video streams).

@zaps166
Copy link
Owner

zaps166 commented Dec 8, 2024

Btw. Do you want to create a PR to a new branch here?

@barracuda156
Copy link
Author

Btw. Do you want to create a PR to a new branch here?

@zaps166 Yeah, sure. Do you want to make it as a new branch or just update existing Qt4 one? While I largely kept changes compatible with Qt5, realistically it will be a Qt4-only thing, since with Qt5 one can build a newer version.

And then, the question is whether we use 18.x or 19.x?

At the moment 18.x is more complete (YT works, though without HD) and better tested, but a) it got a lot of archaic stuff (old modules which, I believe, are meaningless now, since related services are no more) and b) I do not know if it is possible to fix YT HD playback there without a substantial rewrite of YT module (and if such rewrite is required, then perhaps rather use 19.x).
In turn, 19.x is potentially better (being more up-to-date), but only video playback itself works now, YT module does not build (needs at least fixes for signal/slot stuff which was introduced in Qt5 syntax), MediaBrowser perhaps cannot be fixed after a move from C++ to QML/JS (can be disabled, of course), build status of other modules unknown.

Given that aside of YT and bit-perfect CoreAudio other optional modules are not practically usable in 18.x anyway (i.e. while MediaBrowser builds, it does not do anything, and likewise Radio or Textowo), this is not a concern in terms of version preference, but YT itself is.

@zaps166
Copy link
Owner

zaps166 commented Dec 9, 2024

And then, the question is whether we use 18.x or 19.x?

I don't remember which version was on the qt4 branch. I think - newer - better, but if it's too much work - maybe not?

YT works, though without HD

This is what I have to look at 😄

while MediaBrowser builds, it does not do anything

MediaBrowser will not work due to JS syntax - old Qt needed older JS syntax in scripts.

@barracuda156
Copy link
Author

@zaps166 Sorry for a delay, we just got internet fixed on 10.6.8, and I need to make some adjustments and rebuilds preparing to switch from 10a190 to 10.6.8.

I will do some testing for 18.x vs 19.x during this weekend, I wanna make sure that if we go with 19.x, no issues are introduced with video playback (19.x needs more adjustments to make it work with Qt4).

Specifically for YT module, in 19.x Qt4 cannot handle this kind of syntax:

QMenu *qualityMenu = new QMenu(this);
int qualityIdx = 0;
for (QAction *act : m_qualityGroup->actions())
{
connect(act, &QAction::triggered, this, [=] {
sets().set("YouTube/QualityPreset", act->text());
});
connect(act, &QAction::toggled, this, [=](bool checked) {
if (checked)
setItags(qualityIdx);
});
act->setCheckable(true);
qualityMenu->addAction(act);
++qualityIdx;
}
qualityMenu->insertSeparator(qualityMenu->actions().at(5));

QMenu *sortByMenu = new QMenu(this);
int sortByIdx = 0;
for (QAction *act : m_sortByGroup->actions())
{
connect(act, &QAction::triggered, this, [=] {
if (m_sortByIdx != sortByIdx)
{
m_sortByIdx = sortByIdx;
sets().set("YouTube/SortBy", m_sortByIdx);
search();
}
});
act->setCheckable(true);
sortByMenu->addAction(act);
++sortByIdx;
}

If those are fixable, then hopefully we can go with a newer version.

@RJVB
Copy link
Contributor

RJVB commented Dec 20, 2024 via email

@barracuda156
Copy link
Author

Re: backporting: is there really no Qt5 version that works for you? It would probably be easier to backport to, say, Qt 5.2 (including things to that Qt version itself) than to backport to Qt 4.8!

@RJVB If you could help me a bit with making your Qt 5.3 port build for powerpc, I am interested to give it another go. Now that we have 10.6.8 (well, not 100% identical to the release, but way closer than 10a190), some things are likely to be easier. However, no clangs, of course, and C++ runtime should remain libstdc++ (while we kinda have libc++, it is outdated, and unlikely to provide significant benefits, while surely gonna break a lot of stuff).

P. S. I am rebuilding everything from scratch on 10.6.8 now, therefore another delay, but work is in the process. Last 48 hrs the Quad is compiling ports, and soon I have Qt4 (hopefully targeting 10.6 SDK).

@RJVB
Copy link
Contributor

RJVB commented Dec 26, 2024 via email

@barracuda156
Copy link
Author

@RJVB By the way, I took this convenient opportunity to try using your Qt-related PGs and ports, and just built Qt4 from your qt4-mac-devel with dropped deployment target override (i.e. building it for 10.6, not 10.5). It worked, at least Qt Designer app starts normally. I will try now building something with that.
If nothing happens to be broken with this, we get 10.6 target and Cocoa on PowerPC.

@barracuda156
Copy link
Author

Upd. Looks like it works neatly, QMPlay2 has built, YT works (no magic here, still low res), and there is no more crash on exit.

@zaps166
Copy link
Owner

zaps166 commented Dec 26, 2024

If you're able to compile Qt 5.3, maybe it's possible to patch and compile Qt 5.15.2...?

@barracuda156
Copy link
Author

If you're able to compile Qt 5.3, maybe it's possible to patch and compile Qt 5.15.2...?

@zaps166 Any Qt5 is a big question still, I need to try that. Above I referred to Qt4, though it seems that it improved after rebuilding for 10.6.8 ppc (this would not help us to fix incompatible syntax, of course, but it may reduce required patching, I hope.)

@RJVB
Copy link
Contributor

RJVB commented Dec 26, 2024

If you're able to compile Qt 5.3, maybe it's possible to patch and compile Qt 5.15.2...?

Maybe possible? Probably. Surely not feasible? Even more likely.

I patched Qt 5.9 to build and function on OS X 10.9 (excluding QtWebEngine which was too complex to bother). That was enough of an exercise that I didn't feel like repeating it for Qt 5.10 but rather backported a number of really-wanna-have new features from 5.10 and I've been backporting client applications since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants