| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp`/ |
| 2 | |
| 3 | #include "gui/mediaplayer/libmpv/libmpvbackend.h"cxx . . $ `<file>/src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.h`/ |
| 4 | |
| 5 | #include "3rd-party/boolinq/boolinq.h"cxx . . $ `<file>/src/librssguard/3rd-party/boolinq/boolinq.h`/ |
| 6 | #include "definitions/definitions.h"cxx . . $ `<file>/src/librssguard/definitions/definitions.h`/ |
| 7 | #include "gui/mediaplayer/libmpv/libmpvwidget.h"cxx . . $ `<file>/src/librssguard/gui/mediaplayer/libmpv/libmpvwidget.h`/ |
| 8 | #include "gui/mediaplayer/libmpv/qthelper.h"cxx . . $ `<file>/src/librssguard/gui/mediaplayer/libmpv/qthelper.h`/ |
| 9 | #include "miscellaneous/settings.h"cxx . . $ `<file>/src/librssguard/miscellaneous/settings.h`/ |
| 10 | #include "miscellaneous/textfactory.h"cxx . . $ `<file>/src/librssguard/miscellaneous/textfactory.h`/ |
| 11 | |
| 12 | #include <clocale> |
| 13 | #include <sstream> |
| 14 | #include <stdexcept> |
| 15 | |
| 16 | #include <QDir> |
| 17 | #include <QJsonArray> |
| 18 | #include <QJsonDocument> |
| 19 | #include <QKeyEvent> |
| 20 | #include <QLayout> |
| 21 | |
| 22 | #define EVENT_CODE_FScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:22:9`! 2 |
| 23 | #define EVENT_CODE_VOLUMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:23:9`! 3 |
| 24 | #define EVENT_CODE_DURATIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:24:9`! 4 |
| 25 | #define EVENT_CODE_MUTEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:25:9`! 5 |
| 26 | #define EVENT_CODE_POSITIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:26:9`! 6 |
| 27 | #define EVENT_CODE_SPEEDcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:27:9`! 7 |
| 28 | #define EVENT_CODE_SEEKABLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:28:9`! 8 |
| 29 | #define EVENT_CODE_TRACKScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:29:9`! 9 |
| 30 | #define EVENT_CODE_PAUSEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:30:9`! 10 |
| 31 | #define EVENT_CODE_IDLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:31:9`! 11 |
| 32 | #define EVENT_CODE_STOPcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:32:9`! 12 |
| 33 | |
| 34 | #define CONFIG_MAIN_NAMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:34:9`! "mpv.conf" |
| 35 | #define CONFIG_INPUT_NAMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:35:9`! "input.conf" |
| 36 | |
| 37 | LibMpvBackendcxx . . $ LibMpvBackend#::LibMpvBackendcxx . . $ LibMpvBackend#LibMpvBackend(6dcc3d71cdf236c8).(Applicationcxx . . $ Application#* app, QWidgetcxx . . $ QWidget#* parent) |
| 38 | : PlayerBackendcxx . . $ PlayerBackend#(app, parent), m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer.(nullptr), m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle.(nullptr) { |
| 39 | installEventFiltercxx . . $ QObject#installEventFilter(749de1b6ae65bddd).(this); |
| 40 | loadSettingscxx . . $ LibMpvBackend#loadSettings(49f6e7a06ebc5aa8).(); |
| 41 | |
| 42 | m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. = mpv_create(); |
| 43 | m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer. = new LibMpvWidgetcxx . . $ LibMpvWidget#LibMpvWidget(ebd8094c89bd912f).(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., this); |
| 44 | |
| 45 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. == nullptr) { |
| 46 | qFatalcxx . . $ `<external>/7280663963939302026/qlogging.h:172:9`!("cannot create mpv instance"); |
| 47 | } |
| 48 | |
| 49 | setMouseTrackingcxx . . $ QWidget#setMouseTracking(b45ddcbc8423892c).(true); |
| 50 | layoutcxx . . $ QWidget#layout(5761b17781c20cfb).()->addWidgetcxx . . $ QLayout#addWidget(108f35f7aa7f3cf9).(m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer.); |
| 51 | m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer.->bindcxx . . $ LibMpvWidget#bind(49f6e7a06ebc5aa8).(); |
| 52 | |
| 53 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "msg-level", "all=v"); |
| 54 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "config", "yes"); |
| 55 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "script-opts", "osc-idlescreen=no"); |
| 56 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "hwdec", "auto"); |
| 57 | |
| 58 | #if defined(MEDIAPLAYER_LIBMPV_OPENGLcxx . . $ `<built-in>:499:9`!) |
| 59 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "vo", "libmpv"); |
| 60 | #endif |
| 61 | |
| 62 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "osd-playing-msg", "${media-title}"); |
| 63 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "osc", "yes"); |
| 64 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "input-cursor", "yes"); |
| 65 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "idle", "yes"); |
| 66 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "save-position-on-quit", "no"); |
| 67 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "no-resume-playback", "yes"); |
| 68 | |
| 69 | #if !defined(NDEBUGcxx . . $ `<built-in>:531:9`!) |
| 70 | mpv_set_option_string(m_mpvHandle, "terminal", "yes"); |
| 71 | #endif |
| 72 | |
| 73 | if (!m_customConfigFoldercxx . . $ LibMpvBackend#m_customConfigFolder..isEmptycxx . . $ QString#isEmpty(3482b152b9333168).()) { |
| 74 | QByteArraycxx . . $ QByteArray# cfg_folder = QDircxx . . $ QDir#::toNativeSeparatorscxx . . $ QDir#toNativeSeparators(fd988a2ab94d906b).(m_customConfigFoldercxx . . $ LibMpvBackend#m_customConfigFolder.).toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).(); |
| 75 | |
| 76 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "config-dir", cfg_folder.constDatacxx . . $ QByteArray#constData(ba32b354807b2b81).()); |
| 77 | } |
| 78 | else { |
| 79 | mpv_set_option_string(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "input-default-bindings", "yes"); |
| 80 | } |
| 81 | |
| 82 | // Observe some properties. |
| 83 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_FScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:22:9`!, "fullscreen", MPV_FORMAT_FLAG); |
| 84 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_VOLUMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:23:9`!, "volume", MPV_FORMAT_INT64); |
| 85 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_DURATIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:24:9`!, "duration", MPV_FORMAT_INT64); |
| 86 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_MUTEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:25:9`!, "mute", MPV_FORMAT_FLAG); |
| 87 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_POSITIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:26:9`!, "time-pos", MPV_FORMAT_INT64); |
| 88 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_SPEEDcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:27:9`!, "speed", MPV_FORMAT_DOUBLE); |
| 89 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_SEEKABLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:28:9`!, "seekable", MPV_FORMAT_FLAG); |
| 90 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_PAUSEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:30:9`!, "pause", MPV_FORMAT_FLAG); |
| 91 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_IDLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:31:9`!, "idle-active", MPV_FORMAT_FLAG); |
| 92 | mpv_observe_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_TRACKScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:29:9`!, "track-list", MPV_FORMAT_NODE); |
| 93 | |
| 94 | // From this point on, the wakeup function will be called. The callback |
| 95 | // can come from any thread, so we use the QueuedConnection mechanism to |
| 96 | // relay the wakeup in a thread-safe way. |
| 97 | connectcxx . . $ QObject#connect(dad3a9587f3dce3c).(m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer., |
| 98 | &LibMpvWidgetcxx . . $ LibMpvWidget#::launchMpvEventscxx . . $ LibMpvWidget#launchMpvEvents(49f6e7a06ebc5aa8)., |
| 99 | this, |
| 100 | &LibMpvBackendcxx . . $ LibMpvBackend#::onMpvEventscxx . . $ LibMpvBackend#onMpvEvents(49f6e7a06ebc5aa8)., |
| 101 | Qtcxx . . $ Qt/::ConnectionTypecxx . . $ Qt/ConnectionType#::QueuedConnectioncxx . . $ Qt/QueuedConnection.); |
| 102 | |
| 103 | if (mpv_initialize(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle.) < 0) { |
| 104 | qFatalcxx . . $ `<external>/7280663963939302026/qlogging.h:172:9`!("cannot create mpv instance"); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | void LibMpvBackendcxx . . $ LibMpvBackend#::destroyHandlecxx . . $ LibMpvBackend#destroyHandle(49f6e7a06ebc5aa8).() { |
| 109 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 110 | mpv_terminate_destroy(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle.); |
| 111 | m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. = nullptr; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void LibMpvBackendcxx . . $ LibMpvBackend#::loadSettingscxx . . $ LibMpvBackend#loadSettings(49f6e7a06ebc5aa8).() { |
| 116 | if (m_appcxx . . $ PlayerBackend#m_app.->settingscxx . . $ Application#settings(951936487a2d9252).()->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(VideoPlayer), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(VideoPlayer::MpvUseCustomConfigFolder)).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()) { |
| 117 | m_customConfigFoldercxx . . $ LibMpvBackend#m_customConfigFolder. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). |
| 118 | m_appcxx . . $ PlayerBackend#m_app.->replaceUserDataFolderPlaceholdercxx . . $ Application#replaceUserDataFolderPlaceholder(f6736f2569bd2ccc).(m_appcxx . . $ PlayerBackend#m_app.->settingscxx . . $ Application#settings(951936487a2d9252).() |
| 119 | ->valuecxx . . $ Settings#value(8f1f29a69568d71a).(GROUPcxx . . $ `src/librssguard/miscellaneous/settings.h:32:9`!(VideoPlayer), SETTINGcxx . . $ `src/librssguard/miscellaneous/settings.h:30:9`!(VideoPlayer::MpvCustomConfigFolder)) |
| 120 | .toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).()); |
| 121 | |
| 122 | installCustomConfigcxx . . $ LibMpvBackend#installCustomConfig(3520e46b33348bf6).(m_customConfigFoldercxx . . $ LibMpvBackend#m_customConfigFolder.); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | LibMpvBackendcxx . . $ LibMpvBackend#::~cxx . . $ LibMpvBackend#`~LibMpvBackend`(ced63f7c635d850d).LibMpvBackendcxx . . $ LibMpvBackend#() { |
| 127 | m_mpvContainercxx . . $ LibMpvBackend#m_mpvContainer.->destroyHandlecxx . . $ LibMpvWidget#destroyHandle(49f6e7a06ebc5aa8).(); |
| 128 | destroyHandlecxx . . $ LibMpvBackend#destroyHandle(49f6e7a06ebc5aa8).(); |
| 129 | } |
| 130 | |
| 131 | void LibMpvBackendcxx . . $ LibMpvBackend#::handleMpvEventcxx . . $ LibMpvBackend#handleMpvEvent(b9dce96345afb4de).(mpv_event* event) { |
| 132 | switch (event->event_id) { |
| 133 | case MPV_EVENT_PROPERTY_CHANGE: { |
| 134 | mpv_event_property* prop = (mpv_event_property*)event->data; |
| 135 | processPropertyChangecxx . . $ LibMpvBackend#processPropertyChange(8be7d8bcb3b9e5e1).(prop, event->reply_userdata); |
| 136 | break; |
| 137 | } |
| 138 | |
| 139 | case MPV_EVENT_FILE_LOADED: |
| 140 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ PlayerBackend#statusChanged(3520e46b33348bf6).(trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("File loaded")); |
| 141 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::PlayingStatecxx . . $ PlayerBackend#PlaybackState#PlayingState.); |
| 142 | break; |
| 143 | |
| 144 | case MPV_EVENT_END_FILE: { |
| 145 | mpv_event_end_file* end_file = (mpv_event_end_file*)event->data; |
| 146 | processEndFilecxx . . $ LibMpvBackend#processEndFile(573e80a994163dfe).(end_file); |
| 147 | break; |
| 148 | } |
| 149 | |
| 150 | case MPV_EVENT_COMMAND_REPLY: |
| 151 | break; |
| 152 | |
| 153 | case MPV_EVENT_VIDEO_RECONFIG: |
| 154 | break; |
| 155 | |
| 156 | case MPV_EVENT_LOG_MESSAGE: { |
| 157 | mpv_event_log_message* msg = (mpv_event_log_message*)event->data; |
| 158 | processLogMessagecxx . . $ LibMpvBackend#processLogMessage(556ac0a923de6713).(msg); |
| 159 | } |
| 160 | |
| 161 | case MPV_EVENT_SHUTDOWN: { |
| 162 | // destroyHandle(); |
| 163 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! closedcxx . . $ PlayerBackend#closed(49f6e7a06ebc5aa8).(); |
| 164 | break; |
| 165 | } |
| 166 | |
| 167 | default: |
| 168 | // Ignore uninteresting or unknown events. |
| 169 | break; |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | const char* LibMpvBackendcxx . . $ LibMpvBackend#::mpvDecodeStringcxx . . $ LibMpvBackend#mpvDecodeString(a13b10ad2ba26221).(void* data) const { |
| 174 | return *(char**)data; |
| 175 | } |
| 176 | |
| 177 | bool LibMpvBackendcxx . . $ LibMpvBackend#::mpvDecodeBoolcxx . . $ LibMpvBackend#mpvDecodeBool(e995ef3b941ef3c3).(void* data) const { |
| 178 | return mpvDecodeIntcxx . . $ LibMpvBackend#mpvDecodeInt(e7407983581ad42b).(data) != 0; |
| 179 | } |
| 180 | |
| 181 | int LibMpvBackendcxx . . $ LibMpvBackend#::mpvDecodeIntcxx . . $ LibMpvBackend#mpvDecodeInt(e7407983581ad42b).(void* data) const { |
| 182 | return *(int*)data; |
| 183 | } |
| 184 | |
| 185 | double LibMpvBackendcxx . . $ LibMpvBackend#::mpvDecodeDoublecxx . . $ LibMpvBackend#mpvDecodeDouble(1e28b3af6ab831f7).(void* data) const { |
| 186 | return *(double*)data; |
| 187 | } |
| 188 | |
| 189 | QStringcxx . . $ QString# LibMpvBackendcxx . . $ LibMpvBackend#::mpvEncodeKeyboardButtoncxx . . $ LibMpvBackend#mpvEncodeKeyboardButton(3f3c3d0e9c0eb37f).(int btn) const { |
| 190 | return QStringcxx . . $ QString#QString(f2c90172ce699d92).((cxx . . $ QChar#QChar(93d577a3e9528307).QCharcxx . . $ QChar#)btn); |
| 191 | } |
| 192 | |
| 193 | QStringcxx . . $ QString# LibMpvBackendcxx . . $ LibMpvBackend#::errorToStringcxx . . $ LibMpvBackend#errorToString(f73f89f8794ac07e).(mpv_error error) const { |
| 194 | switch (mpv_error(error)) { |
| 195 | case mpv_error::MPV_ERROR_EVENT_QUEUE_FULL: |
| 196 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("App restart required"); |
| 197 | |
| 198 | case mpv_error::MPV_ERROR_NOMEM: |
| 199 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Out of memory"); |
| 200 | |
| 201 | case mpv_error::MPV_ERROR_UNINITIALIZED: |
| 202 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Not initialized yet"); |
| 203 | |
| 204 | case mpv_error::MPV_ERROR_INVALID_PARAMETER: |
| 205 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Invalid parameter"); |
| 206 | |
| 207 | case mpv_error::MPV_ERROR_OPTION_NOT_FOUND: |
| 208 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Option not found"); |
| 209 | |
| 210 | case mpv_error::MPV_ERROR_OPTION_FORMAT: |
| 211 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Option badly formatted"); |
| 212 | |
| 213 | case mpv_error::MPV_ERROR_OPTION_ERROR: |
| 214 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Cannot set option"); |
| 215 | |
| 216 | case mpv_error::MPV_ERROR_PROPERTY_NOT_FOUND: |
| 217 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Property does not existing"); |
| 218 | |
| 219 | case mpv_error::MPV_ERROR_PROPERTY_FORMAT: |
| 220 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Property badly formatted"); |
| 221 | |
| 222 | case mpv_error::MPV_ERROR_PROPERTY_UNAVAILABLE: |
| 223 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Property N/A"); |
| 224 | |
| 225 | case mpv_error::MPV_ERROR_PROPERTY_ERROR: |
| 226 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Cannot set property"); |
| 227 | |
| 228 | case mpv_error::MPV_ERROR_COMMAND: |
| 229 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Cannot run command"); |
| 230 | |
| 231 | case mpv_error::MPV_ERROR_LOADING_FAILED: |
| 232 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Loading failed"); |
| 233 | |
| 234 | case mpv_error::MPV_ERROR_AO_INIT_FAILED: |
| 235 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Cannot initialize audio"); |
| 236 | |
| 237 | case mpv_error::MPV_ERROR_VO_INIT_FAILED: |
| 238 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Cannot initialize video"); |
| 239 | |
| 240 | case mpv_error::MPV_ERROR_NOTHING_TO_PLAY: |
| 241 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Not a media file"); |
| 242 | |
| 243 | case mpv_error::MPV_ERROR_UNKNOWN_FORMAT: |
| 244 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Unknown file format"); |
| 245 | |
| 246 | case mpv_error::MPV_ERROR_UNSUPPORTED: |
| 247 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Unsupported file format"); |
| 248 | |
| 249 | case mpv_error::MPV_ERROR_NOT_IMPLEMENTED: |
| 250 | default: |
| 251 | return trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Unknown error (%1)").argcxx . . $ QString#arg(ed67e9a87de2cd4e).(error); |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | void LibMpvBackendcxx . . $ LibMpvBackend#::onMpvEventscxx . . $ LibMpvBackend#onMpvEvents(49f6e7a06ebc5aa8).() { |
| 256 | while (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 257 | mpv_event* event = mpv_wait_event(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0); |
| 258 | |
| 259 | if (event->event_id == MPV_EVENT_NONE) { |
| 260 | break; |
| 261 | } |
| 262 | |
| 263 | handleMpvEventcxx . . $ LibMpvBackend#handleMpvEvent(b9dce96345afb4de).(event); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | void LibMpvBackendcxx . . $ LibMpvBackend#::processEndFilecxx . . $ LibMpvBackend#processEndFile(573e80a994163dfe).(mpv_event_end_file* end_file) { |
| 268 | switch (end_file->reason) { |
| 269 | case MPV_END_FILE_REASON_STOP: |
| 270 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ PlayerBackend#statusChanged(3520e46b33348bf6).(trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("Stopped")); |
| 271 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::StoppedStatecxx . . $ PlayerBackend#PlaybackState#StoppedState.); |
| 272 | break; |
| 273 | |
| 274 | case MPV_END_FILE_REASON_EOF: |
| 275 | case MPV_END_FILE_REASON_QUIT: |
| 276 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! statusChangedcxx . . $ PlayerBackend#statusChanged(3520e46b33348bf6).(trcxx . . $ LibMpvBackend#tr(75d9f1c324b4579d).("File ended")); |
| 277 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::StoppedStatecxx . . $ PlayerBackend#PlaybackState#StoppedState.); |
| 278 | break; |
| 279 | |
| 280 | case MPV_END_FILE_REASON_ERROR: |
| 281 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! errorOccurredcxx . . $ PlayerBackend#errorOccurred(3520e46b33348bf6).(errorToStringcxx . . $ LibMpvBackend#errorToString(f73f89f8794ac07e).(mpv_error(end_file->error))); |
| 282 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::StoppedStatecxx . . $ PlayerBackend#PlaybackState#StoppedState.); |
| 283 | break; |
| 284 | |
| 285 | case MPV_END_FILE_REASON_REDIRECT: |
| 286 | default: |
| 287 | break; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | void LibMpvBackendcxx . . $ LibMpvBackend#::processTrackscxx . . $ LibMpvBackend#processTracks(bd3d01ac66d986b4).(const QJsonDocumentcxx . . $ QJsonDocument#& json) { |
| 292 | QVariantListcxx . . $ QVariantList# vars = json.arraycxx . . $ QJsonDocument#array(98974f179f8308bf).().toVariantListcxx . . $ QJsonArray#toVariantList(a208304be85d9b76).(); |
| 293 | auto linq = boolinqcxx . . $ boolinq/::fromcxx . . $ boolinq/from(1a44d082b2747720).(vars); |
| 294 | |
| 295 | bool any_audio_track = linq.anycxx . . $ boolinq/Linq#any(992a0234366b9b4f).([cxx . . $ std/function#function(bdc3712e480e4d04).](const QVariantcxx . . $ QVariant#& var) { |
| 296 | return var.toHashcxx . . $ QVariant#toHash(556033a494fe4eb9).().valuecxx . . $ QHash#value(5f65a9ee2c9899ff).("type"cxx . . $ QString#QString(85c52e162fed56f9).) ==cxx . . $ `operator==`(55b3085064498b6d). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("audio"); |
| 297 | }); |
| 298 | |
| 299 | bool any_video_track = linq.anycxx . . $ boolinq/Linq#any(992a0234366b9b4f).([cxx . . $ std/function#function(bdc3712e480e4d04).](const QVariantcxx . . $ QVariant#& var) { |
| 300 | return var.toHashcxx . . $ QVariant#toHash(556033a494fe4eb9).().valuecxx . . $ QHash#value(5f65a9ee2c9899ff).("type"cxx . . $ QString#QString(85c52e162fed56f9).) ==cxx . . $ `operator==`(55b3085064498b6d). QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!("video"); |
| 301 | }); |
| 302 | |
| 303 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! audioAvailablecxx . . $ PlayerBackend#audioAvailable(b45ddcbc8423892c).(any_audio_track); |
| 304 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! videoAvailablecxx . . $ PlayerBackend#videoAvailable(b45ddcbc8423892c).(any_video_track); |
| 305 | } |
| 306 | |
| 307 | void LibMpvBackendcxx . . $ LibMpvBackend#::processPropertyChangecxx . . $ LibMpvBackend#processPropertyChange(8be7d8bcb3b9e5e1).(mpv_event_property* prop, uint64_tcxx . . $ uint64_t# property_code) { |
| 308 | if (prop == nullptr || prop->data == nullptr) { |
| 309 | return; |
| 310 | } |
| 311 | |
| 312 | switch (property_code) { |
| 313 | case EVENT_CODE_FScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:22:9`!: |
| 314 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! fullscreenChangedcxx . . $ PlayerBackend#fullscreenChanged(b45ddcbc8423892c).(mpvDecodeBoolcxx . . $ LibMpvBackend#mpvDecodeBool(e995ef3b941ef3c3).(prop->data)); |
| 315 | break; |
| 316 | |
| 317 | case EVENT_CODE_VOLUMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:23:9`!: { |
| 318 | int volume = mpvDecodeIntcxx . . $ LibMpvBackend#mpvDecodeInt(e7407983581ad42b).(prop->data); |
| 319 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! volumeChangedcxx . . $ PlayerBackend#volumeChanged(d4f767463ce0a6b3).(volume); |
| 320 | break; |
| 321 | } |
| 322 | |
| 323 | case EVENT_CODE_POSITIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:26:9`!: { |
| 324 | int pos = mpvDecodeIntcxx . . $ LibMpvBackend#mpvDecodeInt(e7407983581ad42b).(prop->data); |
| 325 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! positionChangedcxx . . $ PlayerBackend#positionChanged(d4f767463ce0a6b3).(pos); |
| 326 | break; |
| 327 | } |
| 328 | |
| 329 | case EVENT_CODE_DURATIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:24:9`!: { |
| 330 | int dr = mpvDecodeIntcxx . . $ LibMpvBackend#mpvDecodeInt(e7407983581ad42b).(prop->data); |
| 331 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! durationChangedcxx . . $ PlayerBackend#durationChanged(d4f767463ce0a6b3).(dr); |
| 332 | break; |
| 333 | } |
| 334 | |
| 335 | case EVENT_CODE_IDLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:31:9`!: { |
| 336 | /* |
| 337 | bool idle = mpvDecodeBool(prop->data); |
| 338 | |
| 339 | if (idle) { |
| 340 | emit playbackStateChanged(PlayerBackend::PlaybackState::StoppedState); |
| 341 | } |
| 342 | */ |
| 343 | break; |
| 344 | } |
| 345 | |
| 346 | case EVENT_CODE_PAUSEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:30:9`!: { |
| 347 | bool paused = mpvDecodeBoolcxx . . $ LibMpvBackend#mpvDecodeBool(e995ef3b941ef3c3).(prop->data); |
| 348 | |
| 349 | if (paused) { |
| 350 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::PausedStatecxx . . $ PlayerBackend#PlaybackState#PausedState.); |
| 351 | } |
| 352 | else { |
| 353 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! playbackStateChangedcxx . . $ PlayerBackend#playbackStateChanged(71c215cf23a22c46).(PlayerBackendcxx . . $ PlayerBackend#::PlaybackStatecxx . . $ PlayerBackend#PlaybackState#::PlayingStatecxx . . $ PlayerBackend#PlaybackState#PlayingState.); |
| 354 | } |
| 355 | |
| 356 | break; |
| 357 | } |
| 358 | |
| 359 | case EVENT_CODE_SEEKABLEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:28:9`!: |
| 360 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! seekableChangedcxx . . $ PlayerBackend#seekableChanged(b45ddcbc8423892c).(mpvDecodeBoolcxx . . $ LibMpvBackend#mpvDecodeBool(e995ef3b941ef3c3).(prop->data)); |
| 361 | break; |
| 362 | |
| 363 | case EVENT_CODE_SPEEDcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:27:9`!: { |
| 364 | double sp = mpvDecodeDoublecxx . . $ LibMpvBackend#mpvDecodeDouble(1e28b3af6ab831f7).(prop->data); |
| 365 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! speedChangedcxx . . $ PlayerBackend#speedChanged(d4f767463ce0a6b3).(int(sp * 100)); |
| 366 | break; |
| 367 | } |
| 368 | |
| 369 | case EVENT_CODE_TRACKScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:29:9`!: { |
| 370 | if (prop->format == MPV_FORMAT_NODE) { |
| 371 | QVariantcxx . . $ QVariant# v = mpvcxx . . $ mpv/::qtcxx . . $ mpv/qt/::node_to_variantcxx . . $ mpv/qt/node_to_variant(a25eef8ed7d55b25).((mpv_node*)prop->data); |
| 372 | QJsonDocumentcxx . . $ QJsonDocument# d = QJsonDocumentcxx . . $ QJsonDocument#::fromVariantcxx . . $ QJsonDocument#fromVariant(ee761c0132155d43).(v); |
| 373 | |
| 374 | processTrackscxx . . $ LibMpvBackend#processTracks(bd3d01ac66d986b4).(d); |
| 375 | } |
| 376 | |
| 377 | break; |
| 378 | } |
| 379 | |
| 380 | case EVENT_CODE_MUTEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:25:9`!: |
| 381 | emitcxx . . $ `<external>/4830994369567095248/qtmetamacros.h:51:10`! mutedChangedcxx . . $ PlayerBackend#mutedChanged(b45ddcbc8423892c).(mpvDecodeBoolcxx . . $ LibMpvBackend#mpvDecodeBool(e995ef3b941ef3c3).(prop->data)); |
| 382 | break; |
| 383 | |
| 384 | default: |
| 385 | break; |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | void LibMpvBackendcxx . . $ LibMpvBackend#::processLogMessagecxx . . $ LibMpvBackend#processLogMessage(556ac0a923de6713).(mpv_event_log_message* msg) { |
| 390 | stdcxx . . $ std/::stringstreamcxx . . $ std/stringstream# sscxx . . $ std/__cxx11/basic_stringstream#basic_stringstream(49f6e7a06ebc5aa8).; |
| 391 | ss <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "[" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). msg->prefix <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "] " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). msg->level <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ": " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). msg->text; |
| 392 | |
| 393 | appendLogcxx . . $ LibMpvBackend#appendLog(3520e46b33348bf6).(QStringcxx . . $ QString#::fromStdStringcxx . . $ QString#fromStdString(24a2e9bdf24626eb).(ss.strcxx . . $ std/__cxx11/basic_stringstream#str(d33e1a6fd36255f7).())); |
| 394 | } |
| 395 | |
| 396 | void LibMpvBackendcxx . . $ LibMpvBackend#::appendLogcxx . . $ LibMpvBackend#appendLog(3520e46b33348bf6).(const QStringcxx . . $ QString#& text) { |
| 397 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). text; |
| 398 | } |
| 399 | |
| 400 | bool LibMpvBackendcxx . . $ LibMpvBackend#::eventFiltercxx . . $ LibMpvBackend#eventFilter(978aa4af1d030efa).(QObjectcxx . . $ QObject#* watched, QEventcxx . . $ QEvent#* event) { |
| 401 | Q_UNUSEDcxx . . $ `<external>/17563275351362271547/qtpreprocessorsupport.h:20:9`!(watched) |
| 402 | |
| 403 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::ShortcutOverridecxx . . $ QEvent#ShortcutOverride.) { |
| 404 | // NOTE: If user presses key which is application-wide assigned to some |
| 405 | // action, do not propagate the shortcut to application. |
| 406 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 407 | return true; |
| 408 | } |
| 409 | |
| 410 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 411 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::Wheelcxx . . $ QEvent#Wheel. && watched == this) { |
| 412 | auto* mouse_event = dynamic_cast<QWheelEventcxx . . $ QWheelEvent#*>(event); |
| 413 | bool is_up = mouse_event->angleDeltacxx . . $ QWheelEvent#angleDelta(75d69cfbd3c4b2dd).().ycxx . . $ QPoint#y(ea6fe5115c70a13f).() >= 0; |
| 414 | |
| 415 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Wheel:" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(is_up); |
| 416 | |
| 417 | const char* args[] = {"keypress", is_up ? "MOUSE_BTN3" : "MOUSE_BTN4", nullptr}; |
| 418 | |
| 419 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 420 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 421 | return true; |
| 422 | } |
| 423 | |
| 424 | if ((event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonReleasecxx . . $ QEvent#MouseButtonRelease. || event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonPresscxx . . $ QEvent#MouseButtonPress.) && |
| 425 | watched == this) { |
| 426 | bool press = event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonPresscxx . . $ QEvent#MouseButtonPress.; |
| 427 | |
| 428 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Mouse press/release."; |
| 429 | |
| 430 | const char* args[] = {press ? "keydown" : "keyup", "MOUSE_BTN0", nullptr}; |
| 431 | |
| 432 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 433 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 434 | return true; |
| 435 | } |
| 436 | |
| 437 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseButtonDblClickcxx . . $ QEvent#MouseButtonDblClick. && watched == this) { |
| 438 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Mouse double-click."; |
| 439 | |
| 440 | const char* args[] = {"keypress", "MOUSE_BTN0_DBL", nullptr}; |
| 441 | |
| 442 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 443 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 444 | return true; |
| 445 | } |
| 446 | |
| 447 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::MouseMovecxx . . $ QEvent#MouseMove. && watched == this) { |
| 448 | auto* mouse_event = dynamic_cast<QMouseEventcxx . . $ QMouseEvent#*>(event); |
| 449 | auto scaling_ratio = windowcxx . . $ QWidget#window(27f420ad5cce8994).()->devicePixelRatiocxx . . $ QPaintDevice#devicePixelRatio(21b6c25e127938e2).(); |
| 450 | auto position = mouse_event->poscxx . . $ QMouseEvent#pos(75d69cfbd3c4b2dd).() *cxx . . $ `operator*`(27ccde405e664e5e). scaling_ratio; |
| 451 | auto x_str = QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(position.xcxx . . $ QPoint#x(ea6fe5115c70a13f).()).toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).(); |
| 452 | auto y_str = QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(position.ycxx . . $ QPoint#y(ea6fe5115c70a13f).()).toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).(); |
| 453 | const char* x = x_str.constDatacxx . . $ QByteArray#constData(ba32b354807b2b81).(); |
| 454 | const char* y = y_str.constDatacxx . . $ QByteArray#constData(ba32b354807b2b81).(); |
| 455 | |
| 456 | const char* args[] = {"mouse", x, y, nullptr}; |
| 457 | |
| 458 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 459 | } |
| 460 | |
| 461 | if (event->typecxx . . $ QEvent#type(916a8de57f4d422b).() == QEventcxx . . $ QEvent#::Typecxx . . $ QEvent#Type#::KeyReleasecxx . . $ QEvent#KeyRelease.) { |
| 462 | // We catch all keypresses (even from surrounding widgets). |
| 463 | QKeyEventcxx . . $ QKeyEvent#* key_event = dynamic_cast<QKeyEventcxx . . $ QKeyEvent#*>(event); |
| 464 | QStringcxx . . $ QString# keys = |
| 465 | QKeySequencecxx . . $ QKeySequence#QKeySequence(748afa4755bc9595).(key_event->keycxx . . $ QKeyEvent#key(455f465bc33b4cdf).() | key_event->modifierscxx . . $ QKeyEvent#modifiers(bf228902b3e5e63b).()).toStringcxx . . $ QKeySequence#toString(ec3c6f9720e8edf6).(QKeySequencecxx . . $ QKeySequence#::SequenceFormatcxx . . $ QKeySequence#SequenceFormat#::PortableTextcxx . . $ QKeySequence#PortableText.); |
| 466 | QByteArraycxx . . $ QByteArray# byte_named_key = keys.toLocal8Bitcxx . . $ QString#toLocal8Bit(ef52b713090bc85a).(); |
| 467 | |
| 468 | const char* args[] = {"keypress", byte_named_key.constDatacxx . . $ QByteArray#constData(ba32b354807b2b81).(), nullptr}; |
| 469 | |
| 470 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 471 | event->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 472 | return true; |
| 473 | } |
| 474 | } |
| 475 | |
| 476 | return false; |
| 477 | } |
| 478 | |
| 479 | void LibMpvBackendcxx . . $ LibMpvBackend#::playUrlcxx . . $ LibMpvBackend#playUrl(37355d2f77053a23).(const QUrlcxx . . $ QUrl#& url) { |
| 480 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 481 | m_urlcxx . . $ LibMpvBackend#m_url. =cxx . . $ QUrl#`operator=`(5236b30dc3aa36dd). url; |
| 482 | |
| 483 | auto eb = url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).().toLocal8Bitcxx . . $ QString#toLocal8Bit(7c2073558a834e49).(); |
| 484 | const char* css = eb.datacxx . . $ QByteArray#data(41208ce6ca65dd58).(); |
| 485 | const char* args[] = {"loadfile", css, nullptr}; |
| 486 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., 0, args); |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | void LibMpvBackendcxx . . $ LibMpvBackend#::playPausecxx . . $ LibMpvBackend#playPause(49f6e7a06ebc5aa8).() { |
| 491 | int idle; |
| 492 | mpv_get_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "idle-active", MPV_FORMAT_FLAG, &idle); |
| 493 | |
| 494 | if (idle) { |
| 495 | playUrlcxx . . $ LibMpvBackend#playUrl(37355d2f77053a23).(m_urlcxx . . $ LibMpvBackend#m_url.); |
| 496 | } |
| 497 | else { |
| 498 | int paused; |
| 499 | mpv_get_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "pause", MPV_FORMAT_FLAG, &paused); |
| 500 | |
| 501 | paused = paused == 0 ? 1 : 0; |
| 502 | |
| 503 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_PAUSEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:30:9`!, "pause", MPV_FORMAT_FLAG, &paused); |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | void LibMpvBackendcxx . . $ LibMpvBackend#::pausecxx . . $ LibMpvBackend#pause(49f6e7a06ebc5aa8).() { |
| 508 | int in = 1; |
| 509 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_PAUSEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:30:9`!, "pause", MPV_FORMAT_FLAG, &in); |
| 510 | } |
| 511 | |
| 512 | void LibMpvBackendcxx . . $ LibMpvBackend#::stopcxx . . $ LibMpvBackend#stop(49f6e7a06ebc5aa8).() { |
| 513 | const char* args[] = {"stop", nullptr}; |
| 514 | mpv_command_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_STOPcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:32:9`!, args); |
| 515 | } |
| 516 | |
| 517 | void LibMpvBackendcxx . . $ LibMpvBackend#::setPlaybackSpeedcxx . . $ LibMpvBackend#setPlaybackSpeed(d4f767463ce0a6b3).(int speed) { |
| 518 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 519 | double sp = speed / 100.0; |
| 520 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_SPEEDcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:27:9`!, "speed", MPV_FORMAT_DOUBLE, &sp); |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | void LibMpvBackendcxx . . $ LibMpvBackend#::setVolumecxx . . $ LibMpvBackend#setVolume(d4f767463ce0a6b3).(int volume) { |
| 525 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 526 | uint64_tcxx . . $ uint64_t# vol = volume; |
| 527 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_VOLUMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:23:9`!, "volume", MPV_FORMAT_INT64, &vol); |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | void LibMpvBackendcxx . . $ LibMpvBackend#::setPositioncxx . . $ LibMpvBackend#setPosition(d4f767463ce0a6b3).(int position) { |
| 532 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 533 | uint64_tcxx . . $ uint64_t# pos = position; |
| 534 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_POSITIONcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:26:9`!, "time-pos", MPV_FORMAT_INT64, &pos); |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | void LibMpvBackendcxx . . $ LibMpvBackend#::setFullscreencxx . . $ LibMpvBackend#setFullscreen(b45ddcbc8423892c).(bool fullscreen) { |
| 539 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 540 | const char* fs = fullscreen ? "yes" : "no"; |
| 541 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_FScxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:22:9`!, "fullscreen", MPV_FORMAT_STRING, &fs); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | QUrlcxx . . $ QUrl# LibMpvBackendcxx . . $ LibMpvBackend#::urlcxx . . $ LibMpvBackend#url(36d9834fe7321282).() const { |
| 546 | return m_urlcxx . . $ QUrl#QUrl(9a9d0cfaabb61200).; |
| 547 | } |
| 548 | |
| 549 | int LibMpvBackendcxx . . $ LibMpvBackend#::positioncxx . . $ LibMpvBackend#position(455f465bc33b4cdf).() const { |
| 550 | uint64_tcxx . . $ uint64_t# out; |
| 551 | mpv_get_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "time-pos", MPV_FORMAT_INT64, &out); |
| 552 | |
| 553 | return out; |
| 554 | } |
| 555 | |
| 556 | int LibMpvBackendcxx . . $ LibMpvBackend#::durationcxx . . $ LibMpvBackend#duration(455f465bc33b4cdf).() const { |
| 557 | uint64_tcxx . . $ uint64_t# out; |
| 558 | mpv_get_property(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., "duration", MPV_FORMAT_INT64, &out); |
| 559 | |
| 560 | return out; |
| 561 | } |
| 562 | |
| 563 | void LibMpvBackendcxx . . $ LibMpvBackend#::installCustomConfigcxx . . $ LibMpvBackend#installCustomConfig(3520e46b33348bf6).(const QStringcxx . . $ QString#& directory) { |
| 564 | QDircxx . . $ QDir#QDir(3520e46b33348bf6).().mkpathcxx . . $ QDir#mkpath(48f7a61be61bdeff).(directory); |
| 565 | QDircxx . . $ QDir# config_dircxx . . $ QDir#QDir(3520e46b33348bf6).(directory); |
| 566 | |
| 567 | for (const QStringcxx . . $ QString#& cfg_file : QStringListcxx . . $ QList#QList(b6da5b9a9f304025).{QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(CONFIG_MAIN_NAMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:34:9`!), QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(CONFIG_INPUT_NAMEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:35:9`!)}) { |
| 568 | if (!config_dir.existscxx . . $ QDir#exists(f3b39adf77d9c36c).(cfg_file)) { |
| 569 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Copying sample" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(cfg_file) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "to" |
| 570 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACE_DOTcxx . . $ `src/librssguard/definitions/definitions.h:430:9`!(config_dir.absolutePath()); |
| 571 | IOFactorycxx . . $ IOFactory#::copyFilecxx . . $ IOFactory#copyFile(edf9e4f73813982f).(QSLcxx . . $ `src/librssguard/definitions/definitions.h:442:9`!(":/scripts/mpv/%1").argcxx . . $ QString#arg(ad0bca07273edcc2).(cfg_file), config_dir.absoluteFilePathcxx . . $ QDir#absoluteFilePath(5555d9024dcf93fb).(cfg_file)); |
| 572 | } |
| 573 | else { |
| 574 | qDebugNNcxx . . $ `src/librssguard/definitions/definitions.h:413:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). LOGSEC_MPVcxx . . $ `src/librssguard/definitions/definitions.h:175:9`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Configuration file" <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). QUOTE_W_SPACEcxx . . $ `src/librssguard/definitions/definitions.h:432:9`!(cfg_file) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "already exists."; |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | void LibMpvBackendcxx . . $ LibMpvBackend#::setMutedcxx . . $ LibMpvBackend#setMuted(b45ddcbc8423892c).(bool muted) { |
| 580 | if (m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle. != nullptr) { |
| 581 | const char* mtd = muted ? "yes" : "no"; |
| 582 | mpv_set_property_async(m_mpvHandlecxx . . $ LibMpvBackend#m_mpvHandle., EVENT_CODE_MUTEcxx . . $ `src/librssguard/gui/mediaplayer/libmpv/libmpvbackend.cpp:25:9`!, "mute", MPV_FORMAT_STRING, &mtd); |
| 583 | } |
| 584 | } |