Changeset View
Changeset View
Standalone View
Standalone View
src/mediaplayer.h
Show All 24 Lines | 191 | #endif | |||
---|---|---|---|---|---|
214 | void setMute(bool mute); | 214 | void setMute(bool mute); | ||
215 | 215 | | |||
216 | /// Set the fade percentage, between 0 (muted) and 1.0 (no fade) | 216 | /// Set the fade percentage, between 0 (muted) and 1.0 (no fade) | ||
217 | void setAudioFade(qreal fade); | 217 | void setAudioFade(qreal fade); | ||
218 | 218 | | |||
219 | /// \param name name of the output to set | 219 | /// \param name name of the output to set | ||
220 | /// \returns \c true when setting was successful, \c false otherwise | 220 | /// \returns \c true when setting was successful, \c false otherwise | ||
221 | bool setAudioOutput(const QByteArray &name) | 221 | bool setAudioOutput(const QByteArray &name) | ||
222 | { return libvlc_audio_output_set(m_player, name.data()) == 0; } | 222 | { | ||
223 | mOutputName = name; | ||||
224 | return libvlc_audio_output_set(m_player, name.constData()) == 0; | ||||
225 | } | ||||
223 | 226 | | |||
224 | /** | 227 | /** | ||
225 | * Set audio output device by name. | 228 | * Set audio output device by name. | ||
226 | * \param outputName the aout name (pulse, alsa, oss, etc.) | 229 | * \param outputName the aout name (pulse, alsa, oss, etc.) | ||
227 | * \param deviceName the output name (aout dependent) | 230 | * \param deviceName the output name (aout dependent) | ||
228 | */ | 231 | */ | ||
229 | void setAudioOutputDevice(const QByteArray &outputName, const QByteArray &deviceName) | 232 | void setAudioOutputDevice(const QByteArray &outputName, const QByteArray &deviceName) | ||
230 | { libvlc_audio_output_device_set(m_player, outputName.data(), deviceName.data()); } | 233 | { | ||
234 | // According to comments at https://forum.videolan.org/viewtopic.php?t=98766 | ||||
235 | // the output device needs to be set after the media is set: that is, after | ||||
236 | // the call to libvlc_media_player_set_media() in MediaPlayer::setMedia(). | ||||
237 | // So we save away the 'outputName' and 'deviceName' parameters here and | ||||
238 | // set them in MediaPlayer::setMedia() if provided. | ||||
239 | mOutputName = outputName; | ||||
240 | mDeviceName = deviceName; | ||||
241 | | ||||
242 | // Set them here anyway to cover any other possible usage scenarios. | ||||
243 | libvlc_audio_output_device_set(m_player, outputName.constData(), deviceName.constData()); | ||||
244 | } | ||||
231 | 245 | | |||
232 | int audioTrack() const | 246 | int audioTrack() const | ||
233 | { return libvlc_audio_get_track(m_player); } | 247 | { return libvlc_audio_get_track(m_player); } | ||
234 | 248 | | |||
235 | libvlc_track_description_t * audioTrackDescription() const | 249 | libvlc_track_description_t * audioTrackDescription() const | ||
236 | { return libvlc_audio_get_track_description(m_player); } | 250 | { return libvlc_audio_get_track_description(m_player); } | ||
237 | 251 | | |||
238 | bool setAudioTrack(int track); | 252 | bool setAudioTrack(int track); | ||
239 | 253 | | |||
240 | void setCdTrack(int track); | 254 | void setCdTrack(int track); | ||
241 | 255 | | |||
242 | #if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 0, 0)) | 256 | #if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 2, 0, 0)) | ||
243 | void setEqualizer(libvlc_equalizer_t *equalizer); | 257 | void setEqualizer(libvlc_equalizer_t *equalizer); | ||
244 | #endif | 258 | #endif | ||
245 | 259 | | |||
260 | private: | ||||
261 | QByteArray mOutputName; | ||||
262 | QByteArray mDeviceName; | ||||
263 | | ||||
246 | signals: | 264 | signals: | ||
247 | void lengthChanged(qint64 length); | 265 | void lengthChanged(qint64 length); | ||
248 | void seekableChanged(bool seekable); | 266 | void seekableChanged(bool seekable); | ||
249 | void stateChanged(MediaPlayer::State state); | 267 | void stateChanged(MediaPlayer::State state); | ||
250 | void timeChanged(qint64 time); | 268 | void timeChanged(qint64 time); | ||
251 | void bufferChanged(int percent); | 269 | void bufferChanged(int percent); | ||
252 | 270 | | |||
253 | /** Emitted when the vout availability has changed */ | 271 | /** Emitted when the vout availability has changed */ | ||
Show All 24 Lines |