diff options
author | Błażej Szczygieł | 2018-05-13 17:09:38 +0200 |
---|---|---|
committer | Błażej Szczygieł | 2018-05-13 17:23:17 +0200 |
commit | 76888c0a739104537ad8e56779a7f2800e7be4d1 (patch) | |
tree | 6c305625ab30293c5c2f80f088e18718ebafc12f | |
parent | f11e1e9f592295d573b46a6679cd3e38cf2c8c53 (diff) | |
download | aur-76888c0a739104537ad8e56779a7f2800e7be4d1.tar.gz |
Another fix for FFmpeg 4.0
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 7 | ||||
-rw-r--r-- | fix-ffmpeg-pixel-formats.diff | 162 |
3 files changed, 170 insertions, 5 deletions
@@ -1,9 +1,9 @@ # Generated by mksrcinfo v8 -# Sun May 13 14:10:10 UTC 2018 +# Sun May 13 15:22:56 UTC 2018 pkgbase = qmplay2 pkgdesc = QMPlay2 is a video and audio player which can play most formats and codecs pkgver = 18.04.01 - pkgrel = 2 + pkgrel = 3 url = http://zaps166.sourceforge.net/?app=QMPlay2 arch = i686 arch = x86_64 @@ -34,8 +34,10 @@ pkgbase = qmplay2 optdepends = game_music_emu-kode54-git: Better chiptune support (less bugs in sound, AUR package) source = https://github.com/zaps166/QMPlay2/releases/download/18.04.01/QMPlay2-src-18.04.01.tar.xz source = ffmpeg4-fix.diff + source = fix-ffmpeg-pixel-formats.diff sha1sums = 923fb924a594181fd5bcf4d5328b867cb28cdf07 sha1sums = d15f53585b9d4f763a93178572b5fc5cdcfbc291 + sha1sums = 07387477489b377882f7632110b7d4c535a5d882 pkgname = qmplay2 @@ -2,7 +2,7 @@ pkgname=qmplay2 pkgver=18.04.01 -pkgrel=2 +pkgrel=3 pkgdesc='QMPlay2 is a video and audio player which can play most formats and codecs' arch=('i686' 'x86_64' 'armv7h' 'armv6h') url='http://zaps166.sourceforge.net/?app=QMPlay2' @@ -11,13 +11,14 @@ depends=('qt5-base' 'qt5-svg' 'qt5-x11extras' 'ffmpeg' 'libass' 'libgl' 'libva' optdepends=('pulseaudio: PulseAudio support' 'game_music_emu-kode54-git: Better chiptune support (less bugs in sound, AUR package)') makedepends=('make' 'gcc' 'pkg-config' 'qt5-tools' 'cmake') -source=("https://github.com/zaps166/QMPlay2/releases/download/${pkgver}/QMPlay2-src-${pkgver}.tar.xz" "ffmpeg4-fix.diff") -sha1sums=(923fb924a594181fd5bcf4d5328b867cb28cdf07 d15f53585b9d4f763a93178572b5fc5cdcfbc291) +source=("https://github.com/zaps166/QMPlay2/releases/download/${pkgver}/QMPlay2-src-${pkgver}.tar.xz" "ffmpeg4-fix.diff" "fix-ffmpeg-pixel-formats.diff") +sha1sums=(923fb924a594181fd5bcf4d5328b867cb28cdf07 d15f53585b9d4f763a93178572b5fc5cdcfbc291 07387477489b377882f7632110b7d4c535a5d882) prepare() { cd $srcdir/QMPlay2-src-$pkgver patch -p1 < ../ffmpeg4-fix.diff + patch -p1 < ../fix-ffmpeg-pixel-formats.diff } build() diff --git a/fix-ffmpeg-pixel-formats.diff b/fix-ffmpeg-pixel-formats.diff new file mode 100644 index 000000000000..01d5a7a002d6 --- /dev/null +++ b/fix-ffmpeg-pixel-formats.diff @@ -0,0 +1,162 @@ +diff --git a/src/modules/FFmpeg/FFDecSW.cpp b/src/modules/FFmpeg/FFDecSW.cpp +index 73462faf..e12aef85 100644 +--- a/src/modules/FFmpeg/FFDecSW.cpp ++++ b/src/modules/FFmpeg/FFDecSW.cpp +@@ -371,7 +371,7 @@ void FFDecSW::setPixelFormat() + const AVPixFmtDescriptor *pixDesc = av_pix_fmt_desc_get(codec_ctx->pix_fmt); + if (!pixDesc) //Invalid pixel format + return; +- dontConvert = supportedPixelFormats.contains((QMPlay2PixelFormat)codec_ctx->pix_fmt); ++ dontConvert = supportedPixelFormats.contains(QMPlay2PixelFormatConvert::fromFFmpeg(codec_ctx->pix_fmt)); + if (dontConvert) + { + chromaShiftW = pixDesc->log2_chroma_w; +@@ -380,14 +380,15 @@ void FFDecSW::setPixelFormat() + } + else for (int i = 0; i < supportedPixelFormats.count(); ++i) + { +- const AVPixFmtDescriptor *supportedPixDesc = av_pix_fmt_desc_get((AVPixelFormat)supportedPixelFormats.at(i)); ++ const AVPixelFormat pixFmt = (AVPixelFormat)QMPlay2PixelFormatConvert::toFFmpeg(supportedPixelFormats.at(i)); ++ const AVPixFmtDescriptor *supportedPixDesc = av_pix_fmt_desc_get(pixFmt); + if (i == 0 || (supportedPixDesc->log2_chroma_w == pixDesc->log2_chroma_w && supportedPixDesc->log2_chroma_h == pixDesc->log2_chroma_h)) + { + //Use first format as default (mostly QMPlay2PixelFormat::YUV420P) and look at next formats, + //otherwise break the loop if found proper format. + chromaShiftW = supportedPixDesc->log2_chroma_w; + chromaShiftH = supportedPixDesc->log2_chroma_h; +- desiredPixFmt = (int)supportedPixelFormats.at(i); ++ desiredPixFmt = pixFmt; + if (i != 0) + break; + } +diff --git a/src/qmplay2/CMakeLists.txt b/src/qmplay2/CMakeLists.txt +index 41dfefb6..5402c75e 100644 +--- a/src/qmplay2/CMakeLists.txt ++++ b/src/qmplay2/CMakeLists.txt +@@ -87,6 +87,7 @@ set(QMPLAY2_SRC + Buffer.cpp + NetworkAccess.cpp + Version.cpp ++ PixelFormats.cpp + YouTubeDL.cpp + Notifies.cpp + NotifiesTray.cpp +diff --git a/src/qmplay2/ImgScaler.cpp b/src/qmplay2/ImgScaler.cpp +index 580bdbe0..106726c2 100644 +--- a/src/qmplay2/ImgScaler.cpp ++++ b/src/qmplay2/ImgScaler.cpp +@@ -34,7 +34,7 @@ bool ImgScaler::create(const VideoFrameSize &size, int newWdst, int newHdst, boo + { + m_srcH = size.height; + m_dstLinesize = newWdst << 2; +- return (m_swsCtx = sws_getCachedContext(m_swsCtx, size.width, m_srcH, isNV12 ? AV_PIX_FMT_NV12 : (AVPixelFormat)size.getFormat(), newWdst, newHdst, AV_PIX_FMT_RGB32, SWS_BILINEAR, nullptr, nullptr, nullptr)); ++ return (m_swsCtx = sws_getCachedContext(m_swsCtx, size.width, m_srcH, isNV12 ? AV_PIX_FMT_NV12 : (AVPixelFormat)QMPlay2PixelFormatConvert::toFFmpeg(size.getFormat()), newWdst, newHdst, AV_PIX_FMT_RGB32, SWS_BILINEAR, nullptr, nullptr, nullptr)); + } + void ImgScaler::scale(const VideoFrame &src, void *dst) + { +diff --git a/src/qmplay2/PixelFormats.cpp b/src/qmplay2/PixelFormats.cpp +new file mode 100644 +index 00000000..3ae7862e +--- /dev/null ++++ b/src/qmplay2/PixelFormats.cpp +@@ -0,0 +1,69 @@ ++/* ++ QMPlay2 is a video and audio player. ++ Copyright (C) 2010-2018 Błażej Szczygieł ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU Lesser General Public License as published ++ by the Free Software Foundation, either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with this program. If not, see <http://www.gnu.org/licenses/>. ++*/ ++ ++#include <PixelFormats.hpp> ++ ++extern "C" ++{ ++ #include <libavutil/pixfmt.h> ++} ++ ++namespace QMPlay2PixelFormatConvert { ++ ++int toFFmpeg(QMPlay2PixelFormat pixFmt) ++{ ++ switch (pixFmt) ++ { ++ case QMPlay2PixelFormat::YUV420P: ++ return AV_PIX_FMT_YUV420P; ++ case QMPlay2PixelFormat::YUV422P: ++ return AV_PIX_FMT_YUV422P; ++ case QMPlay2PixelFormat::YUV444P: ++ return AV_PIX_FMT_YUV444P; ++ case QMPlay2PixelFormat::YUV410P: ++ return AV_PIX_FMT_YUV410P; ++ case QMPlay2PixelFormat::YUV411P: ++ return AV_PIX_FMT_YUV411P; ++ case QMPlay2PixelFormat::YUV440P: ++ return AV_PIX_FMT_YUV440P; ++ default: ++ break; ++ } ++ return AV_PIX_FMT_NONE; ++} ++QMPlay2PixelFormat fromFFmpeg(int pixFmt) ++{ ++ switch (pixFmt) ++ { ++ case AV_PIX_FMT_YUV420P: ++ return QMPlay2PixelFormat::YUV420P; ++ case AV_PIX_FMT_YUV422P: ++ return QMPlay2PixelFormat::YUV422P; ++ case AV_PIX_FMT_YUV444P: ++ return QMPlay2PixelFormat::YUV444P; ++ case AV_PIX_FMT_YUV410P: ++ return QMPlay2PixelFormat::YUV410P; ++ case AV_PIX_FMT_YUV411P: ++ return QMPlay2PixelFormat::YUV411P; ++ case AV_PIX_FMT_YUV440P: ++ return QMPlay2PixelFormat::YUV440P; ++ } ++ return QMPlay2PixelFormat::None; ++} ++ ++} +diff --git a/src/qmplay2/headers/PixelFormats.hpp b/src/qmplay2/headers/PixelFormats.hpp +index 96524564..a32c9ab4 100644 +--- a/src/qmplay2/headers/PixelFormats.hpp ++++ b/src/qmplay2/headers/PixelFormats.hpp +@@ -18,10 +18,14 @@ + + #pragma once + ++#include <QMPlay2Lib.hpp> ++ + #include <QVector> + +-enum class QMPlay2PixelFormat //Compatible with FFmpeg ++enum class QMPlay2PixelFormat + { ++ None = -1, ++ + YUV420P = 0, + YUV422P = 4, + YUV444P = 5, +@@ -32,3 +36,10 @@ enum class QMPlay2PixelFormat //Compatible with FFmpeg + Count = 6 + }; + using QMPlay2PixelFormats = QVector<QMPlay2PixelFormat>; ++ ++namespace QMPlay2PixelFormatConvert { ++ ++QMPLAY2SHAREDLIB_EXPORT int toFFmpeg(QMPlay2PixelFormat pixFmt); ++QMPLAY2SHAREDLIB_EXPORT QMPlay2PixelFormat fromFFmpeg(int pixFmt); ++ ++} |