diff options
author | James McDonnell <jmcdonnell@blackberry.com> | 2017-03-23 15:36:51 -0400 |
---|---|---|
committer | James McDonnell <jmcdonnell@blackberry.com> | 2017-03-28 14:26:09 +0000 |
commit | 684456d8fbdb80d621e3c4838544c2878e3f2a43 (patch) | |
tree | 794b73f6251764aa7952041e45a74e258b41166b /src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp | |
parent | 883df8dfda760fdbe850303383ba098887abbf62 (diff) |
Implement QAudioRoleControl for QNX
The system must provide a JSON file that maps Qt audio roles to
the system's audio types. This is necessary because QNX doesn't
dictate the audio types that a system must use. Anyone creating
a QNX system is free to define whatever audio types they deem to
be appropriate for that system.
Set the audio role for the Qt player example to VideoRole and
added code to dump the supported audio roles.
Change-Id: I34d2c5da0033f69b9dd476a0eadccf3d87d07bfd
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp')
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp index 5cd3bc3d2..b07a18f4f 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp @@ -36,6 +36,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include "mmrendereraudiorolecontrol.h" #include "mmrenderermediaplayercontrol.h" #include "mmrenderermetadatareadercontrol.h" #include "mmrendererplayervideorenderercontrol.h" @@ -197,6 +198,17 @@ void MmRendererMediaPlayerControl::attach() return; } + if (m_audioId != -1 && m_audioRoleControl) { + QString audioType = qnxAudioType(m_audioRoleControl->audioRole()); + QByteArray latin1AudioType = audioType.toLatin1(); + if (!audioType.isEmpty() && latin1AudioType == audioType) { + strm_dict_t *dict = strm_dict_new(); + dict = strm_dict_set(dict, "audio_type", latin1AudioType.constData()); + if (mmr_output_parameters(m_context, m_audioId, dict) != 0) + emitMmError("mmr_output_parameters: Setting audio_type failed"); + } + } + const QByteArray resourcePath = resourcePathForUrl(m_media.canonicalUrl()); if (resourcePath.isEmpty()) { detach(); @@ -561,6 +573,11 @@ void MmRendererMediaPlayerControl::setMetaDataReaderControl(MmRendererMetaDataRe m_metaDataReaderControl = metaDataReaderControl; } +void MmRendererMediaPlayerControl::setAudioRoleControl(MmRendererAudioRoleControl *audioRoleControl) +{ + m_audioRoleControl = audioRoleControl; +} + void MmRendererMediaPlayerControl::setMmPosition(qint64 newPosition) { if (newPosition != 0 && newPosition != m_position) { |