git: 75a05b4f4a41 - main - multimedia/mythtv: fix build on powerpc64

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 13 Sep 2022 17:14:29 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=75a05b4f4a413f512754e51d5ecdfb6d1523dec8

commit 75a05b4f4a413f512754e51d5ecdfb6d1523dec8
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-09-13 17:04:48 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-09-13 17:04:48 +0000

    multimedia/mythtv: fix build on powerpc64
    
    Error:
    libswscale/ppc/yuv2rgb_altivec.c:452:1: error: call to 'vec_xl' is ambiguous
    DEFCSP420_CVT(yuv2_rgb24, out_rgb24)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    libswscale/ppc/yuv2rgb_altivec.c:353:38: note: expanded from macro 'DEFCSP420_CVT'
                u = (vector signed char) vec_xl(0, ui);                           \
                                         ^~~~~~
    /usr/lib/clang/13.0.0/include/altivec.h:17562:1: note: candidate function
    vec_xl(ptrdiff_t __offset, const unsigned char *__ptr) {
    ^
    
    Additionaly, a merge of https://github.com/MythTV/mythtv/commit/8960641b32f751b8198ace9bbfc3378dac20c061 is necessary.
---
 ...-external_FFmpeg_libswscale_ppc_yuv2rgb__altivec.c | 11 +++++++++++
 .../patch-libs_libmyth_audio_audiooutpututil.cpp      | 14 ++++++++++++++
 .../files/patch-libs_libmyth_audio_eldutils.cpp       | 17 +++++++++++++++++
 .../patch-libs_libmythtv_io_mythavformatwriter.cpp    | 11 +++++++++++
 ...h-libs_libmythtv_recorders_NuppelVideoRecorder.cpp | 19 +++++++++++++++++++
 5 files changed, 72 insertions(+)

diff --git a/multimedia/mythtv/files/patch-external_FFmpeg_libswscale_ppc_yuv2rgb__altivec.c b/multimedia/mythtv/files/patch-external_FFmpeg_libswscale_ppc_yuv2rgb__altivec.c
new file mode 100644
index 000000000000..d9938c7f7fc5
--- /dev/null
+++ b/multimedia/mythtv/files/patch-external_FFmpeg_libswscale_ppc_yuv2rgb__altivec.c
@@ -0,0 +1,11 @@
+--- external/FFmpeg/libswscale/ppc/yuv2rgb_altivec.c.orig	2022-09-13 01:58:14 UTC
++++ external/FFmpeg/libswscale/ppc/yuv2rgb_altivec.c
+@@ -284,7 +284,7 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector s
+  * ------------------------------------------------------------------------------
+  */
+ 
+-#if !HAVE_VSX
++#if !HAVE_VSX && !defined(__clang__)
+ static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr)
+ {
+     const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset);
diff --git a/multimedia/mythtv/files/patch-libs_libmyth_audio_audiooutpututil.cpp b/multimedia/mythtv/files/patch-libs_libmyth_audio_audiooutpututil.cpp
new file mode 100644
index 000000000000..8b3a653f828e
--- /dev/null
+++ b/multimedia/mythtv/files/patch-libs_libmyth_audio_audiooutpututil.cpp
@@ -0,0 +1,14 @@
+--- libs/libmyth/audio/audiooutpututil.cpp.orig	2022-08-13 16:59:56 UTC
++++ libs/libmyth/audio/audiooutpututil.cpp
+@@ -212,9 +212,9 @@ char *AudioOutputUtil::GeneratePinkFrames(char *frames
+                     static_cast<float>(0x03fffffff);
+                 int32_t ires = res;
+                 if (bits == 16)
+-                    *samp16++ = qToLittleEndian<int16_t>(ires >> 16);
++                    *samp16++ = qToLittleEndian<qint16>(ires >> 16);
+                 else
+-                    *samp32++ = qToLittleEndian<int32_t>(ires);
++                    *samp32++ = qToLittleEndian<qint32>(ires);
+             }
+             else
+             {
diff --git a/multimedia/mythtv/files/patch-libs_libmyth_audio_eldutils.cpp b/multimedia/mythtv/files/patch-libs_libmyth_audio_eldutils.cpp
new file mode 100644
index 000000000000..b88b52454706
--- /dev/null
+++ b/multimedia/mythtv/files/patch-libs_libmyth_audio_eldutils.cpp
@@ -0,0 +1,17 @@
+--- libs/libmyth/audio/eldutils.cpp.orig	2022-08-13 16:59:56 UTC
++++ libs/libmyth/audio/eldutils.cpp
+@@ -257,11 +257,11 @@ int eld::update_eld(const char *buf, int size)
+     m_e.aud_synch_delay = GRAB_BITS(buf, 6, 0, 8) * 2;
+     m_e.spk_alloc       = GRAB_BITS(buf, 7, 0, 7);
+ 
+-    m_e.port_id         = qFromLittleEndian<uint64_t>(buf + 8);
++    m_e.port_id         = qFromLittleEndian<quint64>(buf + 8);
+ 
+     /* not specified, but the spec's tendency is little endian */
+-    m_e.manufacture_id  = qFromLittleEndian<uint16_t>(buf + 16);
+-    m_e.product_id      = qFromLittleEndian<uint16_t>(buf + 18);
++    m_e.manufacture_id  = qFromLittleEndian<quint16>(buf + 16);
++    m_e.product_id      = qFromLittleEndian<quint16>(buf + 18);
+ 
+     if (ELD_FIXED_BYTES + mnl > size)
+     {
diff --git a/multimedia/mythtv/files/patch-libs_libmythtv_io_mythavformatwriter.cpp b/multimedia/mythtv/files/patch-libs_libmythtv_io_mythavformatwriter.cpp
new file mode 100644
index 000000000000..75264d47e3b0
--- /dev/null
+++ b/multimedia/mythtv/files/patch-libs_libmythtv_io_mythavformatwriter.cpp
@@ -0,0 +1,11 @@
+--- libs/libmythtv/io/mythavformatwriter.cpp.orig	2022-08-13 16:59:56 UTC
++++ libs/libmythtv/io/mythavformatwriter.cpp
+@@ -270,7 +270,7 @@ int MythAVFormatWriter::WriteAudioFrame(unsigned char 
+ #if (Q_BYTE_ORDER == Q_BIG_ENDIAN)
+     auto buf16 = reinterpret_cast<uint16_t *>(Buffer);
+     for (int i = 0; i < m_audioChannels * m_audioFrameSize; i++)
+-        buf16[i] = qFromLittleEndian<uint16_t>(buf16[i]);
++        buf16[i] = qFromLittleEndian<quint16>(buf16[i]);
+ #endif
+ 
+     AVCodecContext *avctx   = m_codecMap.GetCodecContext(m_audioStream);
diff --git a/multimedia/mythtv/files/patch-libs_libmythtv_recorders_NuppelVideoRecorder.cpp b/multimedia/mythtv/files/patch-libs_libmythtv_recorders_NuppelVideoRecorder.cpp
new file mode 100644
index 000000000000..0bfd90950486
--- /dev/null
+++ b/multimedia/mythtv/files/patch-libs_libmythtv_recorders_NuppelVideoRecorder.cpp
@@ -0,0 +1,19 @@
+--- libs/libmythtv/recorders/NuppelVideoRecorder.cpp.orig	2022-08-13 16:59:56 UTC
++++ libs/libmythtv/recorders/NuppelVideoRecorder.cpp
+@@ -16,6 +16,7 @@
+ #include <cmath>
+ 
+ #include <QStringList>
++#include <QtEndian>
+ 
+ #include <iostream>
+ 
+@@ -2558,7 +2559,7 @@ void NuppelVideoRecorder::WriteAudio(unsigned char *bu
+ #if (Q_BYTE_ORDER == Q_BIG_ENDIAN)
+         auto buf16 = reinterpret_cast<uint16_t *>(buf);
+         for (int i = 0; i < m_audioChannels * sample_cnt; i++)
+-            buf16[i] = qToLittleEndian<uint16_t>(buf16[i]);
++            buf16[i] = qToLittleEndian<quint16>(buf16[i]);
+ #endif
+         if (m_audioChannels == 2)
+         {