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

I had to adjust some things to build under Archlinux - Nexus/20.X #164

Open
ilikenwf opened this issue Jan 10, 2022 · 21 comments
Open

I had to adjust some things to build under Archlinux - Nexus/20.X #164

ilikenwf opened this issue Jan 10, 2022 · 21 comments

Comments

@ilikenwf
Copy link

I had to roll a couple files back and adjust as below, not sure if this matters, as Arch uses bleeding edge packages sometimes...

diff --git a/src/stream/FFmpegCatchupStream.cpp b/src/stream/FFmpegCatchupStream.cpp
index a47ad8f..dd2e995 100644
--- a/src/stream/FFmpegCatchupStream.cpp
+++ b/src/stream/FFmpegCatchupStream.cpp
@@ -371,7 +371,7 @@ void FFmpegCatchupStream::UpdateCurrentPTS()
 
 bool FFmpegCatchupStream::IsRealTimeStream()
 {
-  if (kodi::addon::GetSettingBoolean("forceRealtimeOffCatchup"))
+  if (kodi::GetSettingBoolean("forceRealtimeOffCatchup"))
     return false;
 
   return m_isRealTimeStream && m_pFormatContext->duration <= 0;
diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp
index 05dbc39..8fd9c00 100644
--- a/src/stream/FFmpegStream.cpp
+++ b/src/stream/FFmpegStream.cpp
@@ -151,7 +151,7 @@ FFmpegStream::FFmpegStream(IManageDemuxPacket* demuxPacketManager, const Propert
   m_dtsAtDisplayTime = STREAM_NOPTS_VALUE;
 
   FFmpegLog::SetLogLevel(AV_LOG_INFO);
-  FFmpegLog::SetEnabled(kodi::addon::GetSettingBoolean("allowFFmpegLogging"));
+  FFmpegLog::SetEnabled(kodi::GetSettingBoolean("allowFFmpegLogging"));
   av_log_set_callback(ff_avutil_log);
 }
 
@@ -181,7 +181,7 @@ bool FFmpegStream::Open(const std::string& streamUrl, const std::string& mimeTyp
     FFmpegLog::SetEnabled(true);
     av_dump_format(m_pFormatContext, 0, CURL::GetRedacted(streamUrl).c_str(), 0);
   }
-  FFmpegLog::SetEnabled(kodi::addon::GetSettingBoolean("allowFFmpegLogging"));
+  FFmpegLog::SetEnabled(kodi::GetSettingBoolean("allowFFmpegLogging"));
 
   return m_opened;
 }
@@ -709,7 +709,7 @@ bool FFmpegStream::Open(bool fileinfo)
   }
 
   // Avoid detecting framerate if our advanced settings says so
-  if (!kodi::addon::GetSettingBoolean("probeForFps"))
+  if (!kodi::GetSettingBoolean("probeForFps"))
     m_pFormatContext->fps_probe_size = 0;
 
   // analyse very short to speed up mjpeg playback start
@@ -924,7 +924,7 @@ bool FFmpegStream::OpenWithFFmpeg(AVInputFormat* iformat, const AVIOInterruptCB&
   if (result < 0)
   {
     // We only process this condition for manifest streams when this setting is disabled
-    if (!kodi::addon::GetSettingBoolean("useFastOpenForManifestStreams") || m_manifestType.empty())
+    if (!kodi::GetSettingBoolean("useFastOpenForManifestStreams") || m_manifestType.empty())
     {
       m_pFormatContext->flags |= AVFMT_FLAG_PRIV_OPT;
       if (avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, &options) < 0)
@@ -1244,7 +1244,7 @@ unsigned int FFmpegStream::HLSSelectProgram()
 {
   unsigned int prog = UINT_MAX;
 
-  int bandwidth = kodi::addon::GetSettingInt("streamBandwidth") * 1000;
+  int bandwidth = kodi::GetSettingInt("streamBandwidth") * 1000;
   if (bandwidth <= 0)
     bandwidth = INT_MAX;
 
@@ -1907,7 +1907,7 @@ DemuxStream* FFmpegStream::AddStream(int streamIdx)
       // }
       case AVMEDIA_TYPE_SUBTITLE:
       {
-        if (pStream->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT && kodi::addon::GetSettingBoolean("enableTeletext"))
+        if (pStream->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT && kodi::GetSettingBoolean("enableTeletext"))
         {
           DemuxStreamTeletext* st = new DemuxStreamTeletext();
           stream = st;
diff --git a/src/stream/TimeshiftBuffer.cpp b/src/stream/TimeshiftBuffer.cpp
index 78e5c1b..9e7f08e 100644
--- a/src/stream/TimeshiftBuffer.cpp
+++ b/src/stream/TimeshiftBuffer.cpp
@@ -20,7 +20,7 @@ using namespace kodi::tools;
 TimeshiftBuffer::TimeshiftBuffer(IManageDemuxPacket* demuxPacketManager)
   : m_demuxPacketManager(demuxPacketManager)
 {
-  m_timeshiftBufferPath = kodi::addon::GetSettingString("timeshiftBufferPath");
+  m_timeshiftBufferPath = kodi::GetSettingString("timeshiftBufferPath");
   if (m_timeshiftBufferPath.empty())
   {
     m_timeshiftBufferPath = DEFAULT_TIMESHIFT_BUFFER_PATH;
@@ -34,9 +34,9 @@ TimeshiftBuffer::TimeshiftBuffer(IManageDemuxPacket* demuxPacketManager)
   if (!kodi::vfs::DirectoryExists(m_timeshiftBufferPath))
     kodi::vfs::CreateDirectory(m_timeshiftBufferPath);
 
-  if (!kodi::addon::CheckSettingBoolean("timeshiftEnableLimit", m_enableOnDiskSegmentLimit))
+  if (!kodi::CheckSettingBoolean("timeshiftEnableLimit", m_enableOnDiskSegmentLimit))
     m_enableOnDiskSegmentLimit = true;
-  float onDiskTotalLengthHours = kodi::addon::GetSettingFloat("timeshiftOnDiskLength");
+  float onDiskTotalLengthHours = kodi::GetSettingFloat("timeshiftOnDiskLength");
   if (onDiskTotalLengthHours <= 0.0f)
     onDiskTotalLengthHours = DEFAULT_TIMESHIFT_SEGMENT_ON_DISK_LENGTH_HOURS;
   int onDiskTotalLengthSeconds = onDiskTotalLengthHours * 60 * 60;


@ilikenwf
Copy link
Author

I also had to adjust the version in addon.xml...but I'm running the git version of Nexus.

@phunkyfish
Copy link
Collaborator

The issue here is that your Kodi source needs to be updated. You have pretty much undone a recent merge which had API changes (kodi:: -> kodi::addon::, was one of those).

I imagine that Arch will start to use the latest soon enough which just means undoing your patch.

@ilikenwf
Copy link
Author

I'm running the latest git version of Kodi itself - I may still have the -dev package that's older or something?

@phunkyfish
Copy link
Collaborator

I'm running the latest git version of Kodi itself - I may still have the -dev package that's older or something?

If you were running the latest git version of kodi then the kodi::addon namespace would have worked.

Note that the master branch of Kodi applies to the Nexus branch of the binary addons.

@daiaji
Copy link

daiaji commented Sep 29, 2023

https://gist.github.com/daiaji/a21877de163585394f58902093ab3631

I also encountered a compilation error.

@phunkyfish
Copy link
Collaborator

Please use a pastesite link instead of adding logs straight into the issue.

What changes did you need to make? Maybe submit them as a PR and I can review them.

@daiaji
Copy link

daiaji commented Sep 29, 2023

After upgrading the version of binutils to 2.41, an error occurred:

src/libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
src/libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
src/libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'
src/libavcodec/x86/mathops.h:125: Error: operand type mismatch for `shr'

I suspect that this patch needs to be applied to the FFmpeg used by inputstream.ffmpegdirect.
However, I don't know how to do this, as the FindFFMPEG.cmake used by inputstream.ffmpegdirect is different from the FindFFMPEG.cmake used by xbmc itself.

It appears that whether it's xbmc itself or inputstream.ffmpegdirect, a patch for FFmpeg is required after the version of binutils exceeds 2.41. I believe this patch should be integrated into the repositories of both xbmc and inputstream.ffmpegdirect.

@daiaji
Copy link

daiaji commented Sep 29, 2023

Frankly speaking, I'm utterly at a loss about what to do now. I've tried patching XBMC and altering FFmpeg, and redirected my download links locally, but damn it, CMake keeps downloading from https://github.com/FFmpeg/FFmpeg/archive/n4.4.tar.gz.

@phunkyfish
Copy link
Collaborator

phunkyfish commented Sep 29, 2023

There should be arch packages to build this. Are there not?

For Linux platforms your system ffmpeg should be used. I.e. you should not need to build it.

@daiaji
Copy link

daiaji commented Sep 29, 2023

https://github.com/daiaji/inputstream.ffmpegdirect/tree/fix
The repair is completed, yet when compiling the AUR package, it appears that the patch, 04-Fixes-assembling-w-binutil-as-2.41.patch, isn't being applied for some unknown reason.

There should be arch packages to build this. Are there not?

For Linux platforms your system ffmpeg should be used. I.e. you should not need to build it.

Even with FFmpeg installed, the compilation script will still download and compile FFmpeg when compiling inputstream.ffmpegdirect.

@phunkyfish
Copy link
Collaborator

phunkyfish commented Sep 29, 2023

But that’s my point, if the build for arch Linux was correctly configured it should use the system ffmpeg. As it’s not, something is not being set up correctly.

I’m afraid I’m not a Linux user so I don’t know what that might be.

@daiaji
Copy link

daiaji commented Sep 29, 2023

ffmpeg -version
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 13.2.1 (GCC) 20230801
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100

It seems that specifying the path of FFmpeg doesn't make much of a difference either.
https://gist.github.com/daiaji/29d7319785eb52773d128d8150007e18

@phunkyfish
Copy link
Collaborator

The path in pkgbuild is for ffmpeg 4.4. Why is it not 6.0?

@daiaji
Copy link

daiaji commented Sep 29, 2023

Can I use 6.0?

usr/lib/
usr/lib/libavcodec.so
usr/lib/libavcodec.so.60
usr/lib/libavcodec.so.60.3.100
usr/lib/libavdevice.so
usr/lib/libavdevice.so.60
usr/lib/libavdevice.so.60.1.100
usr/lib/libavfilter.so
usr/lib/libavfilter.so.9
usr/lib/libavfilter.so.9.3.100
usr/lib/libavformat.so
usr/lib/libavformat.so.60
usr/lib/libavformat.so.60.3.100
usr/lib/libavutil.so
usr/lib/libavutil.so.58
usr/lib/libavutil.so.58.2.100
usr/lib/libpostproc.so
usr/lib/libpostproc.so.57
usr/lib/libpostproc.so.57.1.100
usr/lib/libswresample.so
usr/lib/libswresample.so.4
usr/lib/libswresample.so.4.10.100
usr/lib/libswscale.so
usr/lib/libswscale.so.7
usr/lib/libswscale.so.7.1.100

@phunkyfish
Copy link
Collaborator

phunkyfish commented Sep 29, 2023

Ah, sorry. I see you are building Nexus and Omega. If arch is bleeding edge maybe try bleeding edge kodi 😉

@daiaji
Copy link

daiaji commented Sep 29, 2023

Under what circumstances would the source code under https://github.com/xbmc/repo-binary-addons be compiled?
This situation renders my modifications ineffective.

@phunkyfish
Copy link
Collaborator

It depends how you are building the add-on. You can pass a path to a local clone of the repo. But if you build as as part of the xbmc build it will always download from that repo.

@daiaji
Copy link

daiaji commented Sep 30, 2023

pkgname=kodi-addon-inputstream-ffmpegdirect
pkgver=20.5.0
pkgrel=1
pkgdesc="Inputstream ffmpegdirect kodi plugin"
_koditarget=Nexus
_gitname=inputstream.ffmpegdirect
_kodiver=20.0
        mkdir -p "${_gitname}-${pkgver}-${_koditarget}/build"
        cd "${_gitname}-${pkgver}-${_koditarget}/build"

        cmake \
                -DCMAKE_INSTALL_PREFIX=/usr \
                -DCMAKE_INSTALL_LIBDIR=/usr/lib/kodi \
                -DCMAKE_BUILD_TYPE=Release \
                -DBUILD_SHARED_LIBS=1 \
                -DADDONS_TO_BUILD=${_gitname} \
                -DADDONS_SRC_PREFIX=../.. \
                ../../xbmc-${_kodiver}-${_koditarget}/cmake/addons
        make
}

The build command I used, for some reason, did not use my own modified code during the build.

@phunkyfish
Copy link
Collaborator

phunkyfish commented Sep 30, 2023

But this is building kodi not building the addon itself. If you want to build using a local source from the addon you must use what’s in in the README:

https://github.com/xbmc/inputstream.ffmpegdirect#linux

@daiaji
Copy link

daiaji commented Oct 1, 2023

Linux

  1. git clone --branch master https://github.com/xbmc/xbmc.git
  2. git clone https://github.com/xbmc/inputstream.ffmpegdirect.git
  3. cd inputstream.ffmpegdirect && mkdir build && cd build
  4. cmake -DADDONS_TO_BUILD=inputstream.ffmpegdirect -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/build/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
  5. make

The addon files will be placed in ../../xbmc/build/addons so if you build Kodi from source and run it

directly the addon will be available as a system addon.

It seems like the commands don't have any noticeable differences.

It seems that BUILD_SHARED_LIBS is necessary.

@ilikenwf
Copy link
Author

I just downgrade binutils, build, then you can update binutils again.

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