1 /*****************************************************************************
2 * VLC backend for the Phonon library *
3 * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
4 * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
5 * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
7 * This program is free software; you can redistribute it and/or *
8 * modify it under the terms of the GNU Lesser General Public *
9 * License as published by the Free Software Foundation; either *
10 * version 3 of the License, or (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15 * Lesser General Public License for more details. *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License along with this package; if not, write to the Free Software *
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
20 *****************************************************************************/
22 #include "audiooutput.h"
23 #include "devicemanager.h"
26 #include "mediaobject.h"
27 #include "vlcmediaobject.h"
29 #include "vlcloader.h"
35 AudioOutput::AudioOutput(Backend *p_back, QObject * p_parent)
44 AudioOutput::~AudioOutput()
48 qreal AudioOutput::volume() const
53 void AudioOutput::setVolume(qreal volume)
56 libvlc_audio_set_volume(vlc_instance, (int)(f_volume * 100), vlc_exception);
59 emit volumeChanged(f_volume);
63 int AudioOutput::outputDevice() const
68 bool AudioOutput::setOutputDevice(int device)
70 if (i_device == device)
73 const QList<AudioDevice> deviceList = p_backend->deviceManager()->audioOutputDevices();
74 if (device >= 0 && device < deviceList.size()) {
77 const QByteArray deviceName = deviceList.at(device).vlcId;
78 libvlc_audio_output_set(vlc_instance, (char *) deviceList.at(device).vlcId.data());
79 qDebug() << "set aout " << deviceList.at(device).vlcId.data();
80 // if (deviceName == DEFAULT_ID) {
81 // libvlc_audio_device_set(p_vlc_instance, DEFAULT, vlc_exception);
82 // vlcExceptionRaised();
83 // } else if (deviceName.startsWith(ALSA_ID)) {
84 // qDebug() << "setting ALSA " << deviceList.at(device).hwId.data();
85 // libvlc_audio_device_set(p_vlc_instance, ALSA, vlc_exception);
86 // vlcExceptionRaised();
87 // libvlc_audio_alsa_device_set(p_vlc_instance,
88 // deviceList.at(device).hwId,
90 // vlcExceptionRaised();
96 #if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
97 bool AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice & device)
104 } // Namespace Phonon::VLC