Ignore:
Timestamp:
Jan 24, 2017, 12:41:54 PM (9 years ago)
Author:
Silvan Scherrer
Message:

SMPlayer: update trunk to version 17.1.0

Location:
smplayer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • smplayer/trunk

  • smplayer/trunk/src/deviceinfo.cpp

    r181 r188  
    11/*  smplayer, GUI front-end for mplayer.
    2     Copyright (C) 2006-2016 Ricardo Villalba <[email protected]>
     2    Copyright (C) 2006-201 Ricardo Villalba <[email protected]>
    33
    44    This program is free software; you can redistribute it and/or modify
     
    2222#include <QFile>
    2323#include <QSettings>
     24
    2425
    2526#ifdef Q_OS_WIN
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
    2693
    2794DeviceList DeviceInfo::retrieveDevices(DeviceType type) {
     
    71138        return l;
    72139}
     140
    73141
    74142DeviceList DeviceInfo::dsoundDevices() {
     
    82150#else
    83151
     152
     153
     154
     155
     156
     157
     158
     159
     160
     161
     162
     163
     164
     165
     166
     167
     168
     169
     170
     171
     172
     173
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
    84200DeviceList DeviceInfo::alsaDevices() {
    85201        qDebug("DeviceInfo::alsaDevices");
     
    127243        return l;
    128244}
    129 
     245#endif
     246
     247#ifdef USE_XV_ADAPTORS
    130248DeviceList DeviceInfo::xvAdaptors() {
    131249        qDebug("DeviceInfo::xvAdaptors");
     
    171289        return l;
    172290}
    173 
     291#endif
     292#endif
     293
     294#if MPV_AUDIO_DEVICES
     295QString DeviceInfo::mpv_bin;
     296
     297#if USE_MPV_ALSA_DEVICES
     298DeviceList DeviceInfo::mpvAlsaDevices() {
     299        static DeviceList l;
     300        if (!l.isEmpty()) return l;
     301        l = mpvAudioDevices("alsa");
     302        return l;
     303}
     304#endif
     305
     306#if USE_MPV_WASAPI_DEVICES
     307DeviceList DeviceInfo::mpvWasapiDevices() {
     308        static DeviceList l;
     309        if (!l.isEmpty()) return l;
     310        l = mpvAudioDevices("wasapi");
     311        return l;
     312}
     313#endif
     314       
     315DeviceList DeviceInfo::mpvAudioDevices(const QString & filter) {
     316        DeviceList l;
     317        if (!mpv_bin.isEmpty()) l = mpvAudioDevices(mpv_bin, filter);
     318        return l;
     319}
     320
     321DeviceList DeviceInfo::mpvAudioDevices(const QString & mpv_bin, const QString & filter) {
     322        qDebug("DeviceInfo::mpvAudioDevices");
     323
     324        DeviceList l;
     325
     326        QRegExp rx("'" + filter + "\\/(.*)'\\s+\\((.*)\\)");
     327
     328        QProcess p;
     329        p.setProcessChannelMode( QProcess::MergedChannels );
     330
     331        p.start(mpv_bin, QStringList() << "--audio-device=help");
     332
     333        QString device;
     334        QString name;
     335        //int index = 0;
     336
     337        if (p.waitForFinished()) {
     338                QString line;
     339                while (p.canReadLine()) {
     340                        line = QString::fromUtf8(p.readLine().trimmed());
     341                        qDebug() << "DeviceInfo::mpvAudioDevices:" << line;
     342
     343                        if (rx.indexIn(line) > -1 ) {
     344                                device = rx.cap(1);
     345                                name = rx.cap(2);
     346                                qDebug() << "DeviceInfo::mpvAudioDevices: device:" << device << "name:" << name;
     347                                l.append( DeviceData(device, name) );
     348                                //index++;
     349                        }
     350                }
     351        }
     352
     353        return l;
     354}
    174355#endif
    175356
     
    201382}
    202383#endif
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
Note: See TracChangeset for help on using the changeset viewer.