summaryrefslogtreecommitdiff
path: root/media-video/subtitlecomposer
diff options
context:
space:
mode:
Diffstat (limited to 'media-video/subtitlecomposer')
-rw-r--r--media-video/subtitlecomposer/Manifest3
-rw-r--r--media-video/subtitlecomposer/files/subtitlecomposer-0.7.0-mpv-0.33.patch260
-rw-r--r--media-video/subtitlecomposer/subtitlecomposer-0.7.0.ebuild1
3 files changed, 263 insertions, 1 deletions
diff --git a/media-video/subtitlecomposer/Manifest b/media-video/subtitlecomposer/Manifest
index a41e5af83190..6624ded45369 100644
--- a/media-video/subtitlecomposer/Manifest
+++ b/media-video/subtitlecomposer/Manifest
@@ -1,5 +1,6 @@
+AUX subtitlecomposer-0.7.0-mpv-0.33.patch 8812 BLAKE2B 00f0f9eb715c080b7a3f117f88a2aa69c08e553d3370637a09e27d04efdd01615b1f381a31efc415d0a114a0bfbf1ccf2d4d271377094f9bc20b29992ce953e2 SHA512 fe965b896358b969c6eef9e1a0262a59f6776e6f302da5356f447939992a9755285d95a495bd7acfb75fb28e78053557b0414b80c8315588e2f943545f16517f
AUX subtitlecomposer-0.7.0-tests-optional.patch 242 BLAKE2B 6a3d88a537ad39a151b8a6ac071376eda0d1e5d504e92052b9f55e4693633b47fc2b6986d560bd086adf76630ad24bc3671b88f3bc97f9cb429a9e14ad9376bc SHA512 65f5c8db0c5e99b51600db772c918acb7154c7999bbbbbed18ed859f4defcb70d4f907c02a08d9a7529f3aaf4867d6154b9987fb3528cb100f4daa4466e33e74
AUX subtitlecomposer-0.7.0-valid-desktop-file.patch 1090 BLAKE2B 4491d0bf738fe19374d40b2d278322694a456ac2d11394853653f44351ddf06714143164773eb6597ba4b6f55cf510803231c1241cca20cdc9822d3892f8e646 SHA512 4f2802be511da0b9f132d4368e23c06510fd0c115c8a19f5c05d0e737c355b3c061d290e38370a5992b85a48d77b23949ce3ebf675b9086d585df5be056e358b
DIST subtitlecomposer-0.7.0.tar.gz 1649840 BLAKE2B a60d3917cc9bd8025d75782e850ba2507ab140ffaeff84e995d58994e848ebe4e103a87824a20dd689132235f67102e7fec39bf0f99d827c78883165e01e9fb7 SHA512 b1c71496a2609686946af2377862b86d70e357565646a3de2f158481bc9e397f649d0907499ecd21a193ec07eaf2135b7f5831697e6b20ba6721a743227fbe04
-EBUILD subtitlecomposer-0.7.0.ebuild 1957 BLAKE2B c198a52aab4776e0b17e109366db581339744e5727078cfffac79023032eb36ffe9a05fe0c93ed906d211281f86fea3112a28ce06abb7f0ee7f588b3fa9d10b7 SHA512 7eab20abe42eadd951982890349d1964609cd4092b2b00dad2a07e332e39508877067eaf839d65249647d294e487837d5377fe4ff25532af3132b3636e9467dc
+EBUILD subtitlecomposer-0.7.0.ebuild 2005 BLAKE2B 7ef30553b68f40208e46ca6f3338458d7c3269cf8227b8e965dcfd88ef590e6929e40a334135f83e5f2a69161668cfd2e4eede8a8100aa1915526f0b3e29808e SHA512 147ac6581658b440958fa2df73ac346c5656762a2889bd596c8c5bca99faa101b775771bd62b4567187e1e2edf2b780f567c0932f72b5d5b27a1edd2f07ae714
MISC metadata.xml 524 BLAKE2B 662474bada941eadcab48ae4432e72af4f786ff61d2bc1db20115e2f70ca4953e01c38fd550cce72908fe5c36077d9e1b240f53e24142c7556802f3a7783d1bd SHA512 c2ef5d88d2b12534ba76ba4949c4ceee405f88b546f3b749704d8f7529d1b19b3ce8b20b18b496203259dcbde74ba7bf948ae9e4fa4601984554f8f0664a6efe
diff --git a/media-video/subtitlecomposer/files/subtitlecomposer-0.7.0-mpv-0.33.patch b/media-video/subtitlecomposer/files/subtitlecomposer-0.7.0-mpv-0.33.patch
new file mode 100644
index 000000000000..a97ab22543bc
--- /dev/null
+++ b/media-video/subtitlecomposer/files/subtitlecomposer-0.7.0-mpv-0.33.patch
@@ -0,0 +1,260 @@
+From d09a3cbc60da86f57d06477dea1a57962a11ffb2 Mon Sep 17 00:00:00 2001
+From: Mladen Milinkovic <maxrd2@smoothware.net>
+Date: Mon, 8 Jul 2019 20:19:03 +0200
+Subject: [PATCH] MPV player config options aren't hardcoded anymore.
+
+---
+ src/videoplayerplugins/mpv/mpvbackend.cpp | 37 ++++++-
+ src/videoplayerplugins/mpv/mpvbackend.h | 8 +-
+ .../mpv/mpvconfigwidget.cpp | 102 ++++++++++++++++--
+ src/videoplayerplugins/mpv/mpvconfigwidget.h | 8 ++
+ 4 files changed, 139 insertions(+), 16 deletions(-)
+
+diff --git a/src/videoplayerplugins/mpv/mpvbackend.cpp b/src/videoplayerplugins/mpv/mpvbackend.cpp
+index d85a56c..9fdcd95 100644
+--- a/src/videoplayerplugins/mpv/mpvbackend.cpp
++++ b/src/videoplayerplugins/mpv/mpvbackend.cpp
+@@ -33,8 +33,6 @@
+ #include <KMessageBox>
+
+ using namespace SubtitleComposer;
+-using namespace mpv;
+-using namespace mpv::qt;
+
+ MPVBackend::MPVBackend()
+ : PlayerBackend(),
+@@ -218,6 +216,37 @@ MPVBackend::mpvEventHandle(mpv_event *event)
+ }
+ }
+
++static QVariant
++node_to_variant(const mpv_node *node)
++{
++ switch(node->format) {
++ case MPV_FORMAT_STRING:
++ return QVariant(QString::fromUtf8(node->u.string));
++ case MPV_FORMAT_FLAG:
++ return QVariant(static_cast<bool>(node->u.flag));
++ case MPV_FORMAT_INT64:
++ return QVariant(static_cast<qlonglong>(node->u.int64));
++ case MPV_FORMAT_DOUBLE:
++ return QVariant(node->u.double_);
++ case MPV_FORMAT_NODE_ARRAY: {
++ mpv_node_list *list = node->u.list;
++ QVariantList qlist;
++ for(int n = 0; n < list->num; n++)
++ qlist.append(node_to_variant(&list->values[n]));
++ return QVariant(qlist);
++ }
++ case MPV_FORMAT_NODE_MAP: {
++ mpv_node_list *list = node->u.list;
++ QVariantMap qmap;
++ for(int n = 0; n < list->num; n++)
++ qmap.insert(QString::fromUtf8(list->keys[n]), node_to_variant(&list->values[n]));
++ return QVariant(qmap);
++ }
++ default: // MPV_FORMAT_NONE, unknown values (e.g. future extensions)
++ return QVariant();
++ }
++}
++
+ void
+ MPVBackend::updateTextData(const mpv_event_property *prop)
+ {
+@@ -230,7 +259,7 @@ MPVBackend::updateTextData(const mpv_event_property *prop)
+ if(val.format != MPV_FORMAT_NODE_MAP)
+ continue;
+
+- const QMap<QString, QVariant> &map = mpv::qt::node_to_variant(&val).toMap();
++ const QMap<QString, QVariant> &map = node_to_variant(&val).toMap();
+
+ if(map[QStringLiteral("type")].toString() != QStringLiteral("sub")
+ || map[QStringLiteral("external")].toBool() == true)
+@@ -269,7 +298,7 @@ MPVBackend::updateAudioData(const mpv_event_property *prop)
+ if(val.format != MPV_FORMAT_NODE_MAP)
+ continue;
+
+- const QMap<QString, QVariant> &map = mpv::qt::node_to_variant(&val).toMap();
++ const QMap<QString, QVariant> &map = node_to_variant(&val).toMap();
+
+ if(map[QStringLiteral("type")].toString() != QStringLiteral("audio"))
+ continue;
+diff --git a/src/videoplayerplugins/mpv/mpvbackend.h b/src/videoplayerplugins/mpv/mpvbackend.h
+index d0edf2e..5e19fa1 100644
+--- a/src/videoplayerplugins/mpv/mpvbackend.h
++++ b/src/videoplayerplugins/mpv/mpvbackend.h
+@@ -23,7 +23,7 @@
+
+ #include "videoplayer/playerbackend.h"
+
+-#include <mpv/qthelper.hpp>
++#include <mpv/client.h>
+
+ #include <QWidget>
+ #include <QString>
+@@ -76,14 +76,10 @@ signals:
+ protected slots:
+ void onMPVEvents();
+
+-protected:
+- void setupProcessArgs(const QString &filePath);
+-
++private:
+ void mpvEventHandle(mpv_event *event);
+-
+ static void wakeup(void *ctx);
+
+-private:
+ void updateTextData(const mpv_event_property *prop);
+ void updateAudioData(const mpv_event_property *prop);
+ void updateVideoData();
+diff --git a/src/videoplayerplugins/mpv/mpvconfigwidget.cpp b/src/videoplayerplugins/mpv/mpvconfigwidget.cpp
+index 78458f8..6958141 100644
+--- a/src/videoplayerplugins/mpv/mpvconfigwidget.cpp
++++ b/src/videoplayerplugins/mpv/mpvconfigwidget.cpp
+@@ -20,6 +20,11 @@
+
+ #include "mpvconfigwidget.h"
+
++#include <locale>
++#include <mpv/client.h>
++
++#include "scconfig.h"
++
+ using namespace SubtitleComposer;
+
+ MPVConfigWidget::MPVConfigWidget(QWidget *parent)
+@@ -27,14 +32,99 @@ MPVConfigWidget::MPVConfigWidget(QWidget *parent)
+ {
+ setupUi(this);
+
+- kcfg_mpvVideoOutput->addItems(QString("vdpau vaapi opengl opengl-hq sdl xv wayland x11 null").split(' '));
+- kcfg_mpvVideoOutput->setProperty("kcfg_property", QByteArray("currentText"));
++ // FIXME: libmpv requires LC_NUMERIC category to be set to "C".. is there some nicer way to do this?
++ std::setlocale(LC_NUMERIC, "C");
++ m_mpv = mpv_create();
++ mpv_request_log_messages(m_mpv, "info");
++ if(mpv_initialize(m_mpv) >= 0) {
++ getHelpResponse(); // make sure there are no log messages
++ static QStringList bad = {
++ QStringLiteral("libmpv"),
++ QStringLiteral("null"),
++ QStringLiteral("image"),
++ QStringLiteral("tct"),
++ QStringLiteral("caca"),
++ QStringLiteral("pcm"),
++ };
++
++ mpv_set_property_string(m_mpv, "vo", "help");
++ for(QString row : getHelpResponse()) {
++ int pos = row.indexOf(QChar(' '));
++ if(pos == -1)
++ continue;
++ const QString name = row.left(pos);
++ if(bad.contains(name))
++ continue;
++ row.insert(pos, "\t-");
++ if(SCConfig::mpvVideoOutput() == name)
++ kcfg_mpvVideoOutput->setCurrentIndex(kcfg_mpvHwDecode->count());
++ kcfg_mpvVideoOutput->addItem(row, name);
++ }
++ kcfg_mpvVideoOutput->setProperty("kcfg_property", QByteArray("currentData"));
++
++ mpv_set_property_string(m_mpv, "hwdec", "help");
++ kcfg_mpvHwDecode->addItem(QStringLiteral("auto\t- Choose best HW decoder"), QStringLiteral("auto"));
++ for(QString row : getHelpResponse()) {
++ int pos = row.indexOf(QChar(' '));
++ if(pos == -1)
++ continue;
++ const QString name = row.left(pos);
++ const QString lastName = kcfg_mpvHwDecode->itemData(kcfg_mpvHwDecode->count() - 1).toString();
++ if(lastName == name || bad.contains(name))
++ continue;
++ if(SCConfig::mpvHwDecode() == name)
++ kcfg_mpvHwDecode->setCurrentIndex(kcfg_mpvHwDecode->count());
++ kcfg_mpvHwDecode->addItem(name, name);
++ }
++ kcfg_mpvHwDecode->setProperty("kcfg_property", QByteArray("currentData"));
++
++ mpv_set_property_string(m_mpv, "ao", "help");
++ for(QString row : getHelpResponse()) {
++ int pos = row.indexOf(QChar(' '));
++ if(pos == -1)
++ continue;
++ const QString name = row.left(pos);
++ if(bad.contains(name))
++ continue;
++ row.insert(pos, "\t-");
++ if(SCConfig::mpvAudioOutput() == name)
++ kcfg_mpvAudioOutput->setCurrentIndex(kcfg_mpvHwDecode->count());
++ kcfg_mpvAudioOutput->addItem(row, name);
++ }
++ kcfg_mpvAudioOutput->setProperty("kcfg_property", QByteArray("currentData"));
+
+- kcfg_mpvHwDecode->addItems(QString("auto vdpau vaapi vaapi-copy").split(' '));
+- kcfg_mpvHwDecode->setProperty("kcfg_property", QByteArray("currentText"));
++ mpv_detach_destroy(m_mpv);
++ } else {
++ kcfg_mpvVideoOutput->addItems(QString("vdpau vaapi opengl opengl-hq sdl xv wayland x11 null").split(' '));
++ kcfg_mpvVideoOutput->setProperty("kcfg_property", QByteArray("currentText"));
+
+- kcfg_mpvAudioOutput->addItems(QString("pulse alsa oss portaudio jack null").split(' '));
+- kcfg_mpvAudioOutput->setProperty("kcfg_property", QByteArray("currentText"));
++ kcfg_mpvHwDecode->addItems(QString("auto vdpau vaapi vaapi-copy").split(' '));
++ kcfg_mpvHwDecode->setProperty("kcfg_property", QByteArray("currentText"));
++
++ kcfg_mpvAudioOutput->addItems(QString("pulse alsa oss portaudio jack null").split(' '));
++ kcfg_mpvAudioOutput->setProperty("kcfg_property", QByteArray("currentText"));
++ }
++}
++
++const QStringList
++MPVConfigWidget::getHelpResponse()
++{
++ QStringList res;
++ while(m_mpv) {
++ mpv_event *event = mpv_wait_event(m_mpv, .1);
++ if(event->event_id == MPV_EVENT_LOG_MESSAGE) {
++ mpv_event_log_message *msg = reinterpret_cast<mpv_event_log_message *>(event->data);
++ if(msg->log_level == MPV_LOG_LEVEL_INFO && strcmp(msg->prefix, "cplayer") == 0) {
++ QString row = QString::fromUtf8(msg->text).simplified();
++ if(row.endsWith(QChar(':')))
++ continue;
++ res << row;
++ }
++ } else if(event->event_id == MPV_EVENT_NONE) {
++ break;
++ }
++ }
++ return res;
+ }
+
+ MPVConfigWidget::~MPVConfigWidget()
+diff --git a/src/videoplayerplugins/mpv/mpvconfigwidget.h b/src/videoplayerplugins/mpv/mpvconfigwidget.h
+index f4105d7..775b507 100644
+--- a/src/videoplayerplugins/mpv/mpvconfigwidget.h
++++ b/src/videoplayerplugins/mpv/mpvconfigwidget.h
+@@ -23,6 +23,8 @@
+
+ #include "ui_mpvconfigwidget.h"
+
++#include <mpv/client.h>
++
+ namespace SubtitleComposer {
+ class MPVConfigWidget : public QWidget, private Ui::MPVConfigWidget
+ {
+@@ -31,6 +33,12 @@ class MPVConfigWidget : public QWidget, private Ui::MPVConfigWidget
+ public:
+ explicit MPVConfigWidget(QWidget *parent = 0);
+ virtual ~MPVConfigWidget();
++
++private:
++ const QStringList getHelpResponse();
++
++private:
++ mpv_handle *m_mpv;
+ };
+ }
+
+--
+2.29.2
diff --git a/media-video/subtitlecomposer/subtitlecomposer-0.7.0.ebuild b/media-video/subtitlecomposer/subtitlecomposer-0.7.0.ebuild
index d5fe989dd52a..6dbfebafa05d 100644
--- a/media-video/subtitlecomposer/subtitlecomposer-0.7.0.ebuild
+++ b/media-video/subtitlecomposer/subtitlecomposer-0.7.0.ebuild
@@ -57,6 +57,7 @@ RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/${P}-tests-optional.patch"
"${FILESDIR}/${P}-valid-desktop-file.patch" # bug 745429
+ "${FILESDIR}/${P}-mpv-0.33.patch" # bug 760006
)
S="${WORKDIR}/SubtitleComposer-${PV}"