Add audio role API to QMediaPlayer.
Change-Id: Ia5e3e2fe714f10b6aad62f0a4801c607905c7e0d Task-number: QTBUG-41054 Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
This commit is contained in:
@@ -42,6 +42,7 @@ static void qRegisterAudioMetaTypes()
|
||||
qRegisterMetaType<QAudio::Error>();
|
||||
qRegisterMetaType<QAudio::State>();
|
||||
qRegisterMetaType<QAudio::Mode>();
|
||||
qRegisterMetaType<QAudio::Role>();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
|
||||
@@ -83,6 +84,26 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
|
||||
\value AudioInput audio input device
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QAudio::Role
|
||||
|
||||
This enum describes the role of an audio stream.
|
||||
|
||||
\value UnknownRole The role is unknown or undefined
|
||||
\value MusicRole Music
|
||||
\value VideoRole Soundtrack from a movie or a video
|
||||
\value VoiceCommunicationRole Voice communications, such as telephony
|
||||
\value AlarmRole Alarm
|
||||
\value NotificationRole Notification, such as an incoming e-mail or a chat request
|
||||
\value RingtoneRole Ringtone
|
||||
\value AccessibilityRole For accessibility, such as with a screen reader
|
||||
\value SonificationRole Sonification, such as with user interface sounds
|
||||
\value GameRole Game audio
|
||||
|
||||
\since 5.6
|
||||
\sa QMediaPlayer::setAudioRole()
|
||||
*/
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug dbg, QAudio::Error error)
|
||||
{
|
||||
@@ -143,6 +164,45 @@ QDebug operator<<(QDebug dbg, QAudio::Mode mode)
|
||||
}
|
||||
return dbg;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, QAudio::Role role)
|
||||
{
|
||||
QDebugStateSaver saver(dbg);
|
||||
dbg.nospace();
|
||||
switch (role) {
|
||||
case QAudio::UnknownRole:
|
||||
dbg << "UnknownRole";
|
||||
break;
|
||||
case QAudio::AccessibilityRole:
|
||||
dbg << "AccessibilityRole";
|
||||
break;
|
||||
case QAudio::AlarmRole:
|
||||
dbg << "AlarmRole";
|
||||
break;
|
||||
case QAudio::GameRole:
|
||||
dbg << "GameRole";
|
||||
break;
|
||||
case QAudio::MusicRole:
|
||||
dbg << "MusicRole";
|
||||
break;
|
||||
case QAudio::NotificationRole:
|
||||
dbg << "NotificationRole";
|
||||
break;
|
||||
case QAudio::RingtoneRole:
|
||||
dbg << "RingtoneRole";
|
||||
break;
|
||||
case QAudio::SonificationRole:
|
||||
dbg << "SonificationRole";
|
||||
break;
|
||||
case QAudio::VideoRole:
|
||||
dbg << "VideoRole";
|
||||
break;
|
||||
case QAudio::VoiceCommunicationRole:
|
||||
dbg << "VoiceCommunicationRole";
|
||||
break;
|
||||
}
|
||||
return dbg;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -51,12 +51,26 @@ namespace QAudio
|
||||
enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
|
||||
enum State { ActiveState, SuspendedState, StoppedState, IdleState };
|
||||
enum Mode { AudioInput, AudioOutput };
|
||||
|
||||
enum Role {
|
||||
UnknownRole,
|
||||
MusicRole,
|
||||
VideoRole,
|
||||
VoiceCommunicationRole,
|
||||
AlarmRole,
|
||||
NotificationRole,
|
||||
RingtoneRole,
|
||||
AccessibilityRole,
|
||||
SonificationRole,
|
||||
GameRole
|
||||
};
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Error error);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::State state);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Mode mode);
|
||||
Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug dbg, QAudio::Role role);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
@@ -64,5 +78,6 @@ QT_END_NAMESPACE
|
||||
Q_DECLARE_METATYPE(QAudio::Error)
|
||||
Q_DECLARE_METATYPE(QAudio::State)
|
||||
Q_DECLARE_METATYPE(QAudio::Mode)
|
||||
Q_DECLARE_METATYPE(QAudio::Role)
|
||||
|
||||
#endif // QAUDIO_H
|
||||
|
||||
Reference in New Issue
Block a user