| 1 | /* |
| 2 | Copyright (C) 2005-2019 Mario Stephan <[email protected]> |
| 3 | This library is free software; you can redistribute it and/or modify |
| 4 | it under the terms of the GNU Lesser General Public License as published |
| 5 | by the Free Software Foundation; either version 2.1 of the License, or |
| 6 | (at your option) any later version. |
| 7 | This program is distributed in the hope that it will be useful, |
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | GNU General Public License for more details. |
| 11 | You should have received a copy of the GNU Lesser General Public License |
| 12 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 13 | */ |
| 14 | |
| 15 | #include <QtGui> |
| 16 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= 0x050000 |
| 17 | #include <QtConcurrent/QtConcurrent> |
| 18 | #else |
| 19 | #include <QtConcurrentRun> |
| 20 | #endif |
| 21 | |
| 22 | #if defined(Q_OS_DARWIN) |
| 23 | #include <CoreAudio/AudioHardware.h> |
| 24 | #include <CoreAudio/CoreAudio.h> |
| 25 | #elif defined(Q_OS_WIN32) |
| 26 | #include <dsound.h> |
| 27 | #elif defined(Q_OS_UNIXcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qsystemdetection.h:201:11`!) |
| 28 | #include <alsa/asoundlib.h> |
| 29 | #endif |
| 30 | |
| 31 | #include "monitorplayer.h"cxx . . $ `<file>/src/monitorplayer.h`/ |
| 32 | |
| 33 | void MonitorPlayercxx . . $ MonitorPlayer#::sync_set_statecxx . . $ MonitorPlayer#sync_set_state(db0fd986d64b302f).(GstElement* element, GstState state) |
| 34 | { |
| 35 | GstStateChangeReturn res; |
| 36 | res = gst_element_set_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(element), state); |
| 37 | if (res == GST_STATE_CHANGE_FAILURE) |
| 38 | return; |
| 39 | if (res == GST_STATE_CHANGE_ASYNC) { |
| 40 | GstState state; |
| 41 | res = gst_element_get_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(element), &state, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 1000000000 /*GST_CLOCK_TIME_NONE*/); |
| 42 | if (res == GST_STATE_CHANGE_FAILURE || res == GST_STATE_CHANGE_ASYNC) |
| 43 | return; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void cb_newpad_mpcxx . . $ cb_newpad_mp(dde4ed65bff788c3).(GstElement* src, |
| 48 | GstPad* new_pad, |
| 49 | gpointer data) |
| 50 | { |
| 51 | MonitorPlayercxx . . $ MonitorPlayer#* instance = (MonitorPlayercxx . . $ MonitorPlayer#*)data; |
| 52 | instance->newpadcxx . . $ MonitorPlayer#newpad(dde4ed65bff788c3).(src, new_pad, data); |
| 53 | } |
| 54 | |
| 55 | void MonitorPlayercxx . . $ MonitorPlayer#::newpadcxx . . $ MonitorPlayer#newpad(dde4ed65bff788c3).(GstElement* src, |
| 56 | GstPad* new_pad, |
| 57 | gpointer data) |
| 58 | { |
| 59 | GstCaps* caps; |
| 60 | GstStructure* str; |
| 61 | GstPad* sink_pad; |
| 62 | |
| 63 | /* only link once */ |
| 64 | GstElement* bin = gst_bin_get_by_name(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), "convert"); |
| 65 | sink_pad = gst_element_get_static_pad(bin, "sink"); |
| 66 | |
| 67 | gst_object_unref(bin); |
| 68 | |
| 69 | if (GST_PAD_IS_LINKEDcxx . . $ `<external>/7973622949010654678/gstpad.h:1036:9`!(sink_pad)) { |
| 70 | g_object_unref(sink_pad); |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | /* check media type */ |
| 75 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 76 | caps = gst_pad_query_caps(new_pad, nullptr); |
| 77 | #else |
| 78 | caps = gst_pad_get_caps(new_pad); |
| 79 | #endif |
| 80 | str = gst_caps_get_structure(caps, 0); |
| 81 | if (!g_strrstr(gst_structure_get_name(str), "audio")) { |
| 82 | gst_caps_unref(caps); |
| 83 | gst_object_unref(sink_pad); |
| 84 | return; |
| 85 | } |
| 86 | gst_caps_unref(caps); |
| 87 | |
| 88 | /* link'n'play */ |
| 89 | gst_pad_link(new_pad, sink_pad); |
| 90 | } |
| 91 | |
| 92 | struct MonitorPlayerPrivatecxx . . $ MonitorPlayerPrivate# { |
| 93 | QFutureWatchercxx . . $ QFutureWatcher#<void> watchercxx . . $ MonitorPlayerPrivate#watcher.; |
| 94 | QMutexcxx . . $ QMutex# mutexcxx . . $ MonitorPlayerPrivate#mutex.; |
| 95 | bool isStartedcxx . . $ MonitorPlayerPrivate#isStarted.; |
| 96 | bool isLoadedcxx . . $ MonitorPlayerPrivate#isLoaded.; |
| 97 | bool isDisabledcxx . . $ MonitorPlayerPrivate#isDisabled.; |
| 98 | QStringcxx . . $ QString# errorcxx . . $ MonitorPlayerPrivate#error.; |
| 99 | QStringcxx . . $ QString# deviceNamecxx . . $ MonitorPlayerPrivate#deviceName.; |
| 100 | QStringcxx . . $ QString# deviceIDcxx . . $ MonitorPlayerPrivate#deviceID.; |
| 101 | QMapcxx . . $ QMap#<QStringcxx . . $ QString#, QStringcxx . . $ QString#> devicescxx . . $ MonitorPlayerPrivate#devices.; |
| 102 | uintcxx . . $ uint# lengthcxx . . $ MonitorPlayerPrivate#length.; |
| 103 | uintcxx . . $ uint# positioncxx . . $ MonitorPlayerPrivate#position.; |
| 104 | dsDevicecxx . . $ dsDevice# devcxx . . $ MonitorPlayerPrivate#dev.; |
| 105 | double rms_lcxx . . $ MonitorPlayerPrivate#rms_l.; |
| 106 | double rms_rcxx . . $ MonitorPlayerPrivate#rms_r.; |
| 107 | }; |
| 108 | |
| 109 | MonitorPlayercxx . . $ MonitorPlayer#::MonitorPlayercxx . . $ MonitorPlayer#MonitorPlayer(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 110 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 111 | , pcxx . . $ MonitorPlayer#p.(new MonitorPlayerPrivatecxx . . $ MonitorPlayerPrivate#) |
| 112 | , pipelinecxx . . $ MonitorPlayer#pipeline.(nullptr) |
| 113 | , buscxx . . $ MonitorPlayer#bus.(nullptr) |
| 114 | , Gstartcxx . . $ MonitorPlayer#Gstart.(0) |
| 115 | , Glengthcxx . . $ MonitorPlayer#Glength.(0) |
| 116 | { |
| 117 | pcxx . . $ MonitorPlayer#p.->isStartedcxx . . $ MonitorPlayerPrivate#isStarted. = false; |
| 118 | pcxx . . $ MonitorPlayer#p.->isLoadedcxx . . $ MonitorPlayerPrivate#isLoaded. = false; |
| 119 | readDevicescxx . . $ MonitorPlayer#readDevices(49f6e7a06ebc5aa8).(); |
| 120 | pcxx . . $ MonitorPlayer#p.->deviceIDcxx . . $ MonitorPlayerPrivate#deviceID. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). defaultDeviceIDcxx . . $ MonitorPlayer#defaultDeviceID(4365c3963150523e).(); |
| 121 | |
| 122 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(&pcxx . . $ MonitorPlayer#p.->watchercxx . . $ MonitorPlayerPrivate#watcher., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(finished()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(loadThreadFinished())); |
| 123 | } |
| 124 | |
| 125 | MonitorPlayercxx . . $ MonitorPlayer#::~cxx . . $ MonitorPlayer#`~MonitorPlayer`(ced63f7c635d850d).MonitorPlayercxx . . $ MonitorPlayer#() |
| 126 | { |
| 127 | cleanupcxx . . $ MonitorPlayer#cleanup(49f6e7a06ebc5aa8).(); |
| 128 | delete pcxx . . $ MonitorPlayer#p.; |
| 129 | pcxx . . $ MonitorPlayer#p. = nullptr; |
| 130 | } |
| 131 | |
| 132 | GstBusSyncReply MonitorPlayercxx . . $ MonitorPlayer#::bus_cbcxx . . $ MonitorPlayer#bus_cb(42d5341555275e83).(GstBus* bus, GstMessage* msg, gpointer data) |
| 133 | { |
| 134 | Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(bus); |
| 135 | |
| 136 | MonitorPlayercxx . . $ MonitorPlayer#* instance = (MonitorPlayercxx . . $ MonitorPlayer#*)data; |
| 137 | instance->messageReceivedcxx . . $ MonitorPlayer#messageReceived(5d052221dcf2e2ca).(msg); |
| 138 | return GST_BUS_PASS; |
| 139 | } |
| 140 | |
| 141 | void MonitorPlayercxx . . $ MonitorPlayer#::cleanupcxx . . $ MonitorPlayer#cleanup(49f6e7a06ebc5aa8).() |
| 142 | { |
| 143 | if (pipelinecxx . . $ MonitorPlayer#pipeline.) |
| 144 | sync_set_statecxx . . $ MonitorPlayer#sync_set_state(db0fd986d64b302f).(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_NULL); |
| 145 | if (buscxx . . $ MonitorPlayer#bus.) |
| 146 | gst_object_unref(buscxx . . $ MonitorPlayer#bus.); |
| 147 | if (pipelinecxx . . $ MonitorPlayer#pipeline.) |
| 148 | gst_object_unref(G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`!(pipeline)); |
| 149 | } |
| 150 | |
| 151 | bool MonitorPlayercxx . . $ MonitorPlayer#::preparecxx . . $ MonitorPlayer#prepare(c9857a73d68e59ba).() |
| 152 | { |
| 153 | // Init Gst |
| 154 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " " |
| 155 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "START"; |
| 156 | QStringcxx . . $ QString# caps_valuecxx . . $ QString#QString(ced63f7c635d850d).; |
| 157 | |
| 158 | gst_init(nullptr, nullptr); |
| 159 | |
| 160 | //prepare |
| 161 | GstElement *src, *conv, *resample, *sink, *level, *vol; |
| 162 | GstCaps* caps; |
| 163 | pipelinecxx . . $ MonitorPlayer#pipeline. = gst_pipeline_new("pipeline"); |
| 164 | buscxx . . $ MonitorPlayer#bus. = gst_pipeline_get_bus(GST_PIPELINEcxx . . $ `<external>/5957108602191937761/gstpipeline.h:32:9`!(pipeline)); |
| 165 | src = gst_element_factory_make("uridecodebin", "source"); |
| 166 | |
| 167 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 168 | caps_value =cxx . . $ QString#`operator=`(d02845eef0c33901). "audio/x-raw"; |
| 169 | #else |
| 170 | caps_value = "audio/x-raw-int"; |
| 171 | #endif |
| 172 | caps = gst_caps_new_simple(caps_value.toLatin1cxx . . $ QString#toLatin1(ef52b713090bc85a).().datacxx . . $ QByteArray#data(41208ce6ca65dd58).(), |
| 173 | "channels", G_TYPE_INTcxx . . $ `<external>/9567554376676449156/gtype.h:105:9`!, 2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 174 | g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`!(src, "pad-added", G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`!(cb_newpad_mp), this); |
| 175 | |
| 176 | conv = gst_element_factory_make("audioconvert", "convert"); |
| 177 | vol = gst_element_factory_make("volume", "volume"); |
| 178 | resample = gst_element_factory_make("audioresample", "resample"); |
| 179 | level = gst_element_factory_make("level", "level"); |
| 180 | |
| 181 | #if defined(Q_OS_DARWIN) |
| 182 | sink = gst_element_factory_make("osxaudiosink", "sink"); |
| 183 | g_object_set(sink, "device", 0, NULL); |
| 184 | //g_object_set (sink, "volume", 9.5, NULL); |
| 185 | #elif defined(Q_OS_WIN32) |
| 186 | sink = gst_element_factory_make("directsoundsink", "sink"); |
| 187 | g_object_set(sink, "device", NULL, NULL); |
| 188 | //g_object_set (sink, "volume", 99.5, NULL); |
| 189 | #elif defined(Q_OS_UNIXcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qsystemdetection.h:201:11`!) |
| 190 | sink = gst_element_factory_make("alsasink", "sink"); |
| 191 | g_object_set(sink, "device", "default", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 192 | //g_object_set (sink, "volume", 0.5, NULL); |
| 193 | #else |
| 194 | sink = gst_element_factory_make("fakesink", "sink"); |
| 195 | g_object_set(sink, "device", NULL, NULL); |
| 196 | #endif |
| 197 | |
| 198 | gst_bin_add_many(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), src, conv, resample, level, vol, sink, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 199 | gst_element_link(conv, resample); |
| 200 | gst_element_link_filtered(resample, level, caps); |
| 201 | gst_element_link(level, vol); |
| 202 | gst_element_link(vol, sink); |
| 203 | |
| 204 | gst_element_set_state(src, GST_STATE_NULL); |
| 205 | |
| 206 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 207 | gst_bus_set_sync_handler(buscxx . . $ MonitorPlayer#bus., bus_cbcxx . . $ MonitorPlayer#bus_cb(42d5341555275e83)., this, nullptr); |
| 208 | #else |
| 209 | gst_bus_set_sync_handler(bus, bus_cb, this); |
| 210 | #endif |
| 211 | |
| 212 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " " |
| 213 | <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "END"; |
| 214 | |
| 215 | return pipelinecxx . . $ MonitorPlayer#pipeline.; |
| 216 | } |
| 217 | |
| 218 | bool MonitorPlayercxx . . $ MonitorPlayer#::readycxx . . $ MonitorPlayer#ready(c9857a73d68e59ba).() |
| 219 | { |
| 220 | return pipelinecxx . . $ MonitorPlayer#pipeline.; |
| 221 | } |
| 222 | |
| 223 | void MonitorPlayercxx . . $ MonitorPlayer#::opencxx . . $ MonitorPlayer#open(fe09fe9c2ffe9947).(QUrlcxx . . $ QUrl# url) |
| 224 | { |
| 225 | if (pcxx . . $ MonitorPlayer#p.->isDisabledcxx . . $ MonitorPlayerPrivate#isDisabled.) { |
| 226 | return; |
| 227 | } |
| 228 | // To avoid delays, load track in another thread |
| 229 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). ":" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). parentWidgetcxx . . $ QWidget#parentWidget(27f420ad5cce8994).()->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " url=" <<cxx . . $ `operator<<`(56a6a0968dd55378). url; |
| 230 | QFuturecxx . . $ QFuture#<void> future = QtConcurrentcxx . . $ QtConcurrent/::runcxx . . $ QtConcurrent/run(99327172cea463ca).(this, &MonitorPlayercxx . . $ MonitorPlayer#::asyncOpencxx . . $ MonitorPlayer#asyncOpen(fe09fe9c2ffe9947)., url); |
| 231 | pcxx . . $ MonitorPlayer#p.->watchercxx . . $ MonitorPlayerPrivate#watcher..setFuturecxx . . $ QFutureWatcher#setFuture(73d5e5205acf64c9).(future); |
| 232 | } |
| 233 | |
| 234 | void MonitorPlayercxx . . $ MonitorPlayer#::asyncOpencxx . . $ MonitorPlayer#asyncOpen(fe09fe9c2ffe9947).(QUrlcxx . . $ QUrl# url) |
| 235 | { |
| 236 | pcxx . . $ MonitorPlayer#p.->mutexcxx . . $ MonitorPlayerPrivate#mutex..lockcxx . . $ QMutex#lock(ced63f7c635d850d).(); |
| 237 | pcxx . . $ MonitorPlayer#p.->lengthcxx . . $ MonitorPlayerPrivate#length. = 0; |
| 238 | pcxx . . $ MonitorPlayer#p.->isLoadedcxx . . $ MonitorPlayerPrivate#isLoaded. = false; |
| 239 | pcxx . . $ MonitorPlayer#p.->errorcxx . . $ MonitorPlayerPrivate#error. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 240 | |
| 241 | sync_set_statecxx . . $ MonitorPlayer#sync_set_state(db0fd986d64b302f).(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_NULL); |
| 242 | |
| 243 | GstElement* src = gst_bin_get_by_name(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), "source"); |
| 244 | g_object_set(G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`!(src), "uri", (const char*)url.toStringcxx . . $ QUrl#toString(632475ebea3355f1).().toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 245 | |
| 246 | sync_set_statecxx . . $ MonitorPlayer#sync_set_state(db0fd986d64b302f).(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_PAUSED); |
| 247 | setPositioncxx . . $ MonitorPlayer#setPosition(c7ea15d6df5a9ba6).(QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0)); |
| 248 | |
| 249 | gst_object_unref(src); |
| 250 | pcxx . . $ MonitorPlayer#p.->mutexcxx . . $ MonitorPlayerPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 251 | } |
| 252 | |
| 253 | void MonitorPlayercxx . . $ MonitorPlayer#::loadThreadFinishedcxx . . $ MonitorPlayer#loadThreadFinished(49f6e7a06ebc5aa8).() |
| 254 | { |
| 255 | // async load in MonitorPlayerGst done |
| 256 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). ":" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). parentWidgetcxx . . $ QWidget#parentWidget(27f420ad5cce8994).()->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).(); |
| 257 | pcxx . . $ MonitorPlayer#p.->isLoadedcxx . . $ MonitorPlayerPrivate#isLoaded. = true; |
| 258 | if (pcxx . . $ MonitorPlayer#p.->isStartedcxx . . $ MonitorPlayerPrivate#isStarted.) { |
| 259 | playcxx . . $ MonitorPlayer#play(49f6e7a06ebc5aa8).(); |
| 260 | } |
| 261 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! loadFinishedcxx . . $ MonitorPlayer#loadFinished(49f6e7a06ebc5aa8).(); |
| 262 | } |
| 263 | |
| 264 | void MonitorPlayercxx . . $ MonitorPlayer#::playcxx . . $ MonitorPlayer#play(49f6e7a06ebc5aa8).() |
| 265 | { |
| 266 | |
| 267 | pcxx . . $ MonitorPlayer#p.->isStartedcxx . . $ MonitorPlayerPrivate#isStarted. = true; |
| 268 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). ":" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). parentWidgetcxx . . $ QWidget#parentWidget(27f420ad5cce8994).()->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).(); |
| 269 | if (pcxx . . $ MonitorPlayer#p.->isLoadedcxx . . $ MonitorPlayerPrivate#isLoaded.) { |
| 270 | gst_element_set_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_PLAYING); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | void MonitorPlayercxx . . $ MonitorPlayer#::stopcxx . . $ MonitorPlayer#stop(49f6e7a06ebc5aa8).() |
| 275 | { |
| 276 | pcxx . . $ MonitorPlayer#p.->isStartedcxx . . $ MonitorPlayerPrivate#isStarted. = false; |
| 277 | gst_element_set_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_READY); |
| 278 | } |
| 279 | |
| 280 | void MonitorPlayercxx . . $ MonitorPlayer#::pausecxx . . $ MonitorPlayer#pause(49f6e7a06ebc5aa8).() |
| 281 | { |
| 282 | if (isPlayingcxx . . $ MonitorPlayer#isPlaying(c9857a73d68e59ba).()) { |
| 283 | pcxx . . $ MonitorPlayer#p.->isStartedcxx . . $ MonitorPlayerPrivate#isStarted. = false; |
| 284 | gst_element_set_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_PAUSED); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | bool MonitorPlayercxx . . $ MonitorPlayer#::closecxx . . $ MonitorPlayer#close(c9857a73d68e59ba).() |
| 289 | { |
| 290 | gst_element_set_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), GST_STATE_NULL); |
| 291 | return true; |
| 292 | } |
| 293 | |
| 294 | void MonitorPlayercxx . . $ MonitorPlayer#::setPositioncxx . . $ MonitorPlayer#setPosition(c7ea15d6df5a9ba6).(QTimecxx . . $ QTime# position) |
| 295 | { |
| 296 | int time_milliseconds = QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0).msecsTocxx . . $ QTime#msecsTo(f0e9a70846cde960).(position); |
| 297 | gint64 time_nanoseconds = (time_milliseconds * GST_MSECONDcxx . . $ `<external>/3702184213503130145/gstclock.h:109:9`!); |
| 298 | gst_element_seek(pipelinecxx . . $ MonitorPlayer#pipeline., 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, |
| 299 | GST_SEEK_TYPE_SET, time_nanoseconds, |
| 300 | GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONEcxx . . $ `<external>/3702184213503130145/gstclock.h:73:9`!); |
| 301 | pcxx . . $ MonitorPlayer#p.->positioncxx . . $ MonitorPlayerPrivate#position. = time_milliseconds; |
| 302 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! positionChangedcxx . . $ MonitorPlayer#positionChanged(49f6e7a06ebc5aa8).(); |
| 303 | } |
| 304 | |
| 305 | QTimecxx . . $ QTime# MonitorPlayercxx . . $ MonitorPlayer#::positioncxx . . $ MonitorPlayer#position(bd2fc2b92108c576).() |
| 306 | { |
| 307 | if (pipelinecxx . . $ MonitorPlayer#pipeline.) { |
| 308 | |
| 309 | gint64 value = 0; |
| 310 | |
| 311 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 312 | if (gst_element_query_position(pipelinecxx . . $ MonitorPlayer#pipeline., GST_FORMAT_TIME, &value)) { |
| 313 | #else |
| 314 | GstFormat fmt = GST_FORMAT_TIME; |
| 315 | if (gst_element_query_position(pipeline, &fmt, &value)) { |
| 316 | #endif |
| 317 | pcxx . . $ MonitorPlayer#p.->positioncxx . . $ MonitorPlayerPrivate#position. = static_cast<uintcxx . . $ uint#>((value / GST_MSECONDcxx . . $ `<external>/3702184213503130145/gstclock.h:109:9`!)); |
| 318 | return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0).addMSecscxx . . $ QTime#addMSecs(902e6118dfa1a226).(pcxx . . $ MonitorPlayer#p.->positioncxx . . $ MonitorPlayerPrivate#position.); // nanosec -> msec |
| 319 | } |
| 320 | return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0).addMSecscxx . . $ QTime#addMSecs(902e6118dfa1a226).(pcxx . . $ MonitorPlayer#p.->positioncxx . . $ MonitorPlayerPrivate#position.); // nanosec -> msec |
| 321 | } |
| 322 | return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0); |
| 323 | } |
| 324 | |
| 325 | QTimecxx . . $ QTime# MonitorPlayercxx . . $ MonitorPlayer#::lengthcxx . . $ MonitorPlayer#length(bd2fc2b92108c576).() |
| 326 | { |
| 327 | gint64 value = 0; |
| 328 | |
| 329 | if (pcxx . . $ MonitorPlayer#p.->lengthcxx . . $ MonitorPlayerPrivate#length. == 0 && pipelinecxx . . $ MonitorPlayer#pipeline.) { |
| 330 | |
| 331 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 332 | if (gst_element_query_duration(pipelinecxx . . $ MonitorPlayer#pipeline., GST_FORMAT_TIME, &value)) { |
| 333 | #else |
| 334 | GstFormat fmt = GST_FORMAT_TIME; |
| 335 | if (gst_element_query_duration(pipeline, &fmt, &value)) { |
| 336 | #endif |
| 337 | pcxx . . $ MonitorPlayer#p.->lengthcxx . . $ MonitorPlayerPrivate#length. = static_cast<uintcxx . . $ uint#>((value / GST_MSECONDcxx . . $ `<external>/3702184213503130145/gstclock.h:109:9`!)); |
| 338 | } |
| 339 | } |
| 340 | return QTimecxx . . $ QTime#QTime(748afa4755bc9595).(0, 0).addMSecscxx . . $ QTime#addMSecs(902e6118dfa1a226).(pcxx . . $ MonitorPlayer#p.->lengthcxx . . $ MonitorPlayerPrivate#length.); // nanosec -> msec |
| 341 | } |
| 342 | |
| 343 | double MonitorPlayercxx . . $ MonitorPlayer#::volumecxx . . $ MonitorPlayer#volume(31fa7155c10fdd13).() |
| 344 | { |
| 345 | gdouble vol = 0; |
| 346 | |
| 347 | GstElement* volume = gst_bin_get_by_name(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), "volume"); |
| 348 | g_object_get(G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`!(volume), "volume", &vol, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 349 | gst_object_unref(volume); |
| 350 | |
| 351 | return vol; |
| 352 | } |
| 353 | |
| 354 | void MonitorPlayercxx . . $ MonitorPlayer#::setVolumecxx . . $ MonitorPlayer#setVolume(ba8836b59fb42830).(double v) |
| 355 | { |
| 356 | gdouble vol = 1.00 * v; |
| 357 | GstElement* volume = gst_bin_get_by_name(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), "volume"); |
| 358 | g_object_set(G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`!(volume), "volume", vol, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 359 | gst_object_unref(volume); |
| 360 | } |
| 361 | |
| 362 | void MonitorPlayercxx . . $ MonitorPlayer#::disablecxx . . $ MonitorPlayer#disable(49f6e7a06ebc5aa8).() |
| 363 | { |
| 364 | pcxx . . $ MonitorPlayer#p.->isDisabledcxx . . $ MonitorPlayerPrivate#isDisabled. = true; |
| 365 | } |
| 366 | |
| 367 | void MonitorPlayercxx . . $ MonitorPlayer#::enablecxx . . $ MonitorPlayer#enable(49f6e7a06ebc5aa8).() |
| 368 | { |
| 369 | pcxx . . $ MonitorPlayer#p.->isDisabledcxx . . $ MonitorPlayerPrivate#isDisabled. = false; |
| 370 | } |
| 371 | |
| 372 | bool MonitorPlayercxx . . $ MonitorPlayer#::isDisabledcxx . . $ MonitorPlayer#isDisabled(c9857a73d68e59ba).() |
| 373 | { |
| 374 | return pcxx . . $ MonitorPlayer#p.->isDisabledcxx . . $ MonitorPlayerPrivate#isDisabled.; |
| 375 | } |
| 376 | |
| 377 | double MonitorPlayercxx . . $ MonitorPlayer#::levelLeftcxx . . $ MonitorPlayer#levelLeft(31fa7155c10fdd13).() |
| 378 | { |
| 379 | return pcxx . . $ MonitorPlayer#p.->rms_lcxx . . $ MonitorPlayerPrivate#rms_l.; |
| 380 | } |
| 381 | |
| 382 | double MonitorPlayercxx . . $ MonitorPlayer#::levelRightcxx . . $ MonitorPlayer#levelRight(31fa7155c10fdd13).() |
| 383 | { |
| 384 | return pcxx . . $ MonitorPlayer#p.->rms_rcxx . . $ MonitorPlayerPrivate#rms_r.; |
| 385 | } |
| 386 | |
| 387 | bool MonitorPlayercxx . . $ MonitorPlayer#::mediaPlayablecxx . . $ MonitorPlayer#mediaPlayable(c9857a73d68e59ba).() |
| 388 | { |
| 389 | GstState st; |
| 390 | gst_element_get_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), &st, 0, 0); |
| 391 | //qDebug()<<gst_element_state_get_name(st); |
| 392 | return (st != GST_STATE_NULL); |
| 393 | } |
| 394 | |
| 395 | bool MonitorPlayercxx . . $ MonitorPlayer#::isPlayingcxx . . $ MonitorPlayer#isPlaying(c9857a73d68e59ba).() |
| 396 | { |
| 397 | GstState st; |
| 398 | gst_element_get_state(GST_ELEMENTcxx . . $ `<external>/7744406149854824820/gstelement.h:198:9`!(pipeline), &st, 0, 0); |
| 399 | return (st == GST_STATE_PLAYING); |
| 400 | } |
| 401 | |
| 402 | QStringListcxx . . $ QStringList# MonitorPlayercxx . . $ MonitorPlayer#::outputDevicescxx . . $ MonitorPlayer#outputDevices(669a05bc42dd57cc).() |
| 403 | { |
| 404 | QStringListcxx . . $ QStringList# outListcxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 405 | QMapIteratorcxx . . $ QMapIterator#<QStringcxx . . $ QString#, QStringcxx . . $ QString#> icxx . . $ QMapIterator#QMapIterator(1d85e448f11cafa).(pcxx . . $ MonitorPlayer#p.->devicescxx . . $ MonitorPlayerPrivate#devices.); |
| 406 | while (i.hasNextcxx . . $ QMapIterator#hasNext(50ce9a9e25b4a850).()) { |
| 407 | i.nextcxx . . $ QMapIterator#next(5c754f5fbc3bb3d6).(); |
| 408 | outList <<cxx . . $ QStringList#`operator<<`(85116071a693d053). i.valuecxx . . $ QMapIterator#value(bdbd05d619d62250).(); |
| 409 | } |
| 410 | |
| 411 | return outList; |
| 412 | } |
| 413 | |
| 414 | QStringcxx . . $ QString# MonitorPlayercxx . . $ MonitorPlayer#::outputDeviceNamecxx . . $ MonitorPlayer#outputDeviceName(4365c3963150523e).() |
| 415 | { |
| 416 | return pcxx . . $ QString#QString(132dd6869045752b).->deviceNamecxx . . $ MonitorPlayerPrivate#deviceName.; |
| 417 | } |
| 418 | |
| 419 | QStringcxx . . $ QString# MonitorPlayercxx . . $ MonitorPlayer#::outputDeviceIDcxx . . $ MonitorPlayer#outputDeviceID(4365c3963150523e).() |
| 420 | { |
| 421 | return pcxx . . $ QString#QString(132dd6869045752b).->deviceIDcxx . . $ MonitorPlayerPrivate#deviceID.; |
| 422 | } |
| 423 | |
| 424 | void MonitorPlayercxx . . $ MonitorPlayer#::setOutputDevicecxx . . $ MonitorPlayer#setOutputDevice(7df51288a9ebd664).(QStringcxx . . $ QString# deviceName) |
| 425 | { |
| 426 | // for Mac device is DeviceID |
| 427 | QMapIteratorcxx . . $ QMapIterator#<QStringcxx . . $ QString#, QStringcxx . . $ QString#> icxx . . $ QMapIterator#QMapIterator(1d85e448f11cafa).(pcxx . . $ MonitorPlayer#p.->devicescxx . . $ MonitorPlayerPrivate#devices.); |
| 428 | while (i.hasNextcxx . . $ QMapIterator#hasNext(50ce9a9e25b4a850).()) { |
| 429 | i.nextcxx . . $ QMapIterator#next(5c754f5fbc3bb3d6).(); |
| 430 | if (i.valuecxx . . $ QMapIterator#value(bdbd05d619d62250).() ==cxx . . $ `operator==`(5bc2975d2d751687). deviceName) { |
| 431 | pcxx . . $ MonitorPlayer#p.->deviceIDcxx . . $ MonitorPlayerPrivate#deviceID. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). i.keycxx . . $ QMapIterator#key(ea465e50d690edfe).(); |
| 432 | pcxx . . $ MonitorPlayer#p.->deviceNamecxx . . $ MonitorPlayerPrivate#deviceName. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). i.valuecxx . . $ QMapIterator#value(bdbd05d619d62250).(); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Monitor setDevice to DeviceID:" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). pcxx . . $ MonitorPlayer#p.->deviceIDcxx . . $ MonitorPlayerPrivate#deviceID. <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " DevicenName:" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). pcxx . . $ MonitorPlayer#p.->deviceNamecxx . . $ MonitorPlayerPrivate#deviceName.; |
| 437 | |
| 438 | GstElement* sink = gst_bin_get_by_name(GST_BINcxx . . $ `<external>/18072804031300516349/gstbin.h:37:9`!(pipeline), "sink"); |
| 439 | #if defined(Q_OS_WIN32) |
| 440 | g_object_set(sink, "device", p->deviceID.toLatin1().data(), NULL); |
| 441 | #elif defined(Q_OS_DARWIN) |
| 442 | g_object_set(sink, "device", p->deviceID.toInt(), NULL); |
| 443 | #elif defined(Q_OS_UNIXcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qsystemdetection.h:201:11`!) |
| 444 | g_object_set(sink, "device", QStringcxx . . $ QString#QString(85c52e162fed56f9).("hw:%1").argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ MonitorPlayer#p.->deviceIDcxx . . $ MonitorPlayerPrivate#deviceID.).toLatin1cxx . . $ QString#toLatin1(7c2073558a834e49).().datacxx . . $ QByteArray#data(41208ce6ca65dd58).(), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 445 | #endif |
| 446 | gst_object_unref(sink); |
| 447 | } |
| 448 | |
| 449 | #if defined(Q_OS_WIN32) |
| 450 | BOOL CALLBACK DSEnumProc(LPGUID lpGUID, const WCHAR* lpszDesc, |
| 451 | const WCHAR* lpszDrvName, void* ctx) |
| 452 | { |
| 453 | if (lpGUID) { |
| 454 | QList<dsDevice>* l = reinterpret_cast<QList<dsDevice>*>(ctx); |
| 455 | *l << dsDevice(QString::fromUtf16(reinterpret_cast<const ushort*>(lpszDesc)), QUuid(*lpGUID)); |
| 456 | } |
| 457 | |
| 458 | return (true); |
| 459 | } |
| 460 | #endif |
| 461 | |
| 462 | QStringcxx . . $ QString# MonitorPlayercxx . . $ MonitorPlayer#::defaultDeviceIDcxx . . $ MonitorPlayer#defaultDeviceID(4365c3963150523e).() |
| 463 | { |
| 464 | #if defined(Q_OS_WIN32) |
| 465 | GUID guid; |
| 466 | //DSDEVID_DefaultVoicePlayback="{DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03}" |
| 467 | const GUID defaultguid = QUuid("{DEF00000-9C6D-47ED-AAF1-4DDA8F2B5C03}"); |
| 468 | if (GetDeviceID(&defaultguid, &guid) == DS_OK) { |
| 469 | return QUuid(guid).toString(); |
| 470 | } else |
| 471 | return QString(); |
| 472 | #elif defined(Q_OS_DARWIN) |
| 473 | return QString("0"); |
| 474 | #elif defined(Q_OS_UNIXcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qsystemdetection.h:201:11`!) |
| 475 | return QStringcxx . . $ QString#QString(85c52e162fed56f9).("0"); |
| 476 | #endif |
| 477 | } |
| 478 | |
| 479 | void MonitorPlayercxx . . $ MonitorPlayer#::readDevicescxx . . $ MonitorPlayer#readDevices(49f6e7a06ebc5aa8).() |
| 480 | { |
| 481 | #if defined(Q_OS_WIN32) |
| 482 | p->devices.clear(); |
| 483 | QList<dsDevice> qlOutput; |
| 484 | |
| 485 | DirectSoundEnumerate(DSEnumProc, reinterpret_cast<void*>(&qlOutput)); |
| 486 | |
| 487 | foreach (dev, qlOutput) { |
| 488 | p->devices.insert(dev.second.toString(), dev.first); |
| 489 | } |
| 490 | |
| 491 | #elif defined(Q_OS_DARWIN) |
| 492 | UInt32 dataSize = 0; |
| 493 | AudioObjectPropertyAddress propertyAddress; |
| 494 | propertyAddress.mSelector = kAudioHardwarePropertyDevices; |
| 495 | propertyAddress.mScope = kAudioDevicePropertyScopeOutput; |
| 496 | propertyAddress.mElement = kAudioObjectPropertyElementMaster; |
| 497 | |
| 498 | OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize); |
| 499 | if (kAudioHardwareNoError != status) { |
| 500 | qDebug() << "Unable to get number of audio devices. Error: " << status; |
| 501 | } |
| 502 | |
| 503 | UInt32 deviceCount = dataSize / sizeof(AudioDeviceID); |
| 504 | |
| 505 | AudioDeviceID* audioDevices = (AudioDeviceID*)malloc(dataSize); |
| 506 | |
| 507 | status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices); |
| 508 | if (kAudioHardwareNoError != status) { |
| 509 | qDebug() << "AudioObjectGetPropertyData failed when getting device IDs. Error:" << status; |
| 510 | free(audioDevices), audioDevices = NULL; |
| 511 | return; |
| 512 | } |
| 513 | |
| 514 | p->devices.clear(); |
| 515 | |
| 516 | for (UInt32 i = 0; i < deviceCount; i++) { |
| 517 | CFStringRef deviceName = NULL; |
| 518 | propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; // probe for Inputstream |
| 519 | if (AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, &deviceName) != noErr) { |
| 520 | dataSize = sizeof(deviceName); |
| 521 | propertyAddress.mSelector = kAudioDevicePropertyDeviceNameCFString; |
| 522 | propertyAddress.mScope = kAudioDevicePropertyScopeOutput; |
| 523 | |
| 524 | status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, &deviceName); |
| 525 | QString devName = CFStringGetCStringPtr(deviceName, CFStringGetSystemEncoding()); |
| 526 | p->devices.insert(QString::number(audioDevices[i]), devName.trimmed()); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | free(audioDevices); |
| 531 | #elif defined(Q_OS_UNIXcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qsystemdetection.h:201:11`!) |
| 532 | int idx = 0; |
| 533 | char* name; |
| 534 | |
| 535 | while (snd_card_get_name(idx, &name) == 0) { |
| 536 | pcxx . . $ MonitorPlayer#p.->devicescxx . . $ MonitorPlayerPrivate#devices..insertcxx . . $ QMap#insert(929a1ed410fe8423).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(idx), QStringcxx . . $ QString#QString(85c52e162fed56f9).(name)); |
| 537 | idx++; |
| 538 | } |
| 539 | #endif |
| 540 | } |
| 541 | |
| 542 | void MonitorPlayercxx . . $ MonitorPlayer#::messageReceivedcxx . . $ MonitorPlayer#messageReceived(5d052221dcf2e2ca).(GstMessage* message) |
| 543 | { |
| 544 | |
| 545 | switch (GST_MESSAGE_TYPEcxx . . $ `<external>/18276506559737325656/gstmessage.h:230:9`!(message)) { |
| 546 | case GST_MESSAGE_ERROR: { |
| 547 | if (pcxx . . $ MonitorPlayer#p.->errorcxx . . $ MonitorPlayerPrivate#error. ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). "") { |
| 548 | GError* err; |
| 549 | gchar* debug; |
| 550 | gst_message_parse_error(message, &err, &debug); |
| 551 | pcxx . . $ MonitorPlayer#p.->errorcxx . . $ MonitorPlayerPrivate#error. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). "Error #" +cxx . . $ operator+(c75c3ae4eb9af1a8). QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(err->codecxx . . $ _GError#code.) +cxx . . $ operator+(3d22f08efddf8107). " in module " +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(err->domaincxx . . $ _GError#domain.) +cxx . . $ operator+(3d22f08efddf8107). "\n" +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#::fromUtf8cxx . . $ QString#fromUtf8(5ac70cc0fa2a874e).(err->messagecxx . . $ _GError#message.); |
| 552 | if (err->codecxx . . $ _GError#code. == 6 && err->domaincxx . . $ _GError#domain. == 851) { |
| 553 | pcxx . . $ MonitorPlayer#p.->errorcxx . . $ MonitorPlayerPrivate#error. +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "\nMay be you should to install gstreamerX.XX-plugins-ugly or gstreamerX.XX-plugins-bad"; |
| 554 | } |
| 555 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Gstreamer error:" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). pcxx . . $ MonitorPlayer#p.->errorcxx . . $ MonitorPlayerPrivate#error.; |
| 556 | g_error_free(err); |
| 557 | g_free(debug); |
| 558 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! errorcxx . . $ MonitorPlayer#error(49f6e7a06ebc5aa8).(); |
| 559 | } |
| 560 | break; |
| 561 | } |
| 562 | case GST_MESSAGE_EOS: { |
| 563 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). ":" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). parentWidgetcxx . . $ QWidget#parentWidget(27f420ad5cce8994).()->objectNamecxx . . $ QObject#objectName(6ef7b6c27b00b43d).() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " End of track reached"; |
| 564 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! finishcxx . . $ MonitorPlayer#finish(49f6e7a06ebc5aa8).(); |
| 565 | break; |
| 566 | } |
| 567 | case GST_MESSAGE_STATE_CHANGED: { |
| 568 | GstState old_state, new_state; |
| 569 | gst_message_parse_state_changed(message, &old_state, &new_state, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 570 | switch (new_state) { |
| 571 | case GST_STATE_PAUSED: |
| 572 | case GST_STATE_NULL: |
| 573 | pcxx . . $ MonitorPlayer#p.->rms_lcxx . . $ MonitorPlayerPrivate#rms_l. = pcxx . . $ MonitorPlayer#p.->rms_rcxx . . $ MonitorPlayerPrivate#rms_r. = 0; |
| 574 | default: |
| 575 | break; |
| 576 | } |
| 577 | break; |
| 578 | } |
| 579 | |
| 580 | case GST_MESSAGE_ELEMENT: { |
| 581 | const GstStructure* s = gst_message_get_structure(message); |
| 582 | const gchar* src_name = GST_MESSAGE_SRC_NAMEcxx . . $ `<external>/18276506559737325656/gstmessage.h:278:9`!(message); |
| 583 | |
| 584 | if (strcmp(src_name, "level") == 0) { |
| 585 | gint channels; |
| 586 | gdouble peak_dB; |
| 587 | gdouble rms; |
| 588 | gint i; |
| 589 | |
| 590 | #ifdef GST_API_VERSION_1cxx . . $ `<built-in>:482:9`! |
| 591 | const GValue* array_val; |
| 592 | GValueArray* peak_arr; |
| 593 | |
| 594 | array_val = gst_structure_get_value(s, "peak"); |
| 595 | peak_arr = (GValueArray*)g_value_get_boxed(array_val); |
| 596 | channels = peak_arr->n_valuescxx . . $ _GValueArray#n_values.; |
| 597 | |
| 598 | for (i = 0; i < channels; ++i) { |
| 599 | peak_dB = g_value_get_double(peak_arr->valuescxx . . $ _GValueArray#values. + i); |
| 600 | #else |
| 601 | const GValue* list; |
| 602 | const GValue* value; |
| 603 | |
| 604 | list = gst_structure_get_value(s, "peak"); |
| 605 | channels = gst_value_list_get_size(list); |
| 606 | |
| 607 | for (i = 0; i < channels; ++i) { |
| 608 | list = gst_structure_get_value(s, "peak"); |
| 609 | value = gst_value_list_get_value(list, i); |
| 610 | peak_dB = g_value_get_double(value); |
| 611 | #endif |
| 612 | /* converting from dB to normal gives us a value between 0.0 and 1.0 */ |
| 613 | rms = pow(10, peak_dB / 20); |
| 614 | if (i == 0) |
| 615 | pcxx . . $ MonitorPlayer#p.->rms_lcxx . . $ MonitorPlayerPrivate#rms_l. = rms; |
| 616 | else |
| 617 | pcxx . . $ MonitorPlayer#p.->rms_rcxx . . $ MonitorPlayerPrivate#rms_r. = rms; |
| 618 | } |
| 619 | } |
| 620 | |
| 621 | } break; |
| 622 | default: |
| 623 | break; |
| 624 | } |
| 625 | } |