using namespace tizen_media_audio;
-static const char* STREAM_NAME_INPUT = "CAPTURE";
static const char* STREAM_NAME_INPUT_LOW_LATENCY = "LOW LATENCY CAPTURE";
+static const char* STREAM_NAME_INPUT_MID_LATENCY = "MID LATENCY CAPTURE";
static const char* STREAM_NAME_INPUT_HIGH_LATENCY = "HIGH LATENCY CAPTURE";
static const char* STREAM_NAME_INPUT_VOIP = "VOIP CAPTURE";
+static const char* STREAM_NAME_INPUT_DEFAULT = "DEFAULT CAPTURE";
-static const char* STREAM_NAME_OUTPUT = "PLAYBACK";
static const char* STREAM_NAME_OUTPUT_LOW_LATENCY = "LOW LATENCY PLAYBACK";
+static const char* STREAM_NAME_OUTPUT_MID_LATENCY = "MID LATENCY PLAYBACK";
static const char* STREAM_NAME_OUTPUT_HIGH_LATENCY = "HIGH LATENCY PLAYBACK";
static const char* STREAM_NAME_OUTPUT_VOIP = "VOIP PLAYBACK";
-
-static const char* STREAM_LATENCY_LOW = "low";
-static const char* STREAM_LATENCY_MID = "mid";
-static const char* STREAM_LATENCY_HIGH = "high";
-static const char* STREAM_LATENCY_VOIP = "voip";
-
-
-CPulseStreamSpec::CPulseStreamSpec() throw (CAudioError) :
- __mLatency(STREAM_LATENCY_INPUT_MID),
+static const char* STREAM_NAME_OUTPUT_DEFAULT = "DEFAULT PLAYBACK";
+static const char* STREAM_NAME_OUTPUT_DEFAULT_ASYNC = "DEFAULT PLAYBACK ASYNC";
+
+static const char* STREAM_LATENCY_LOW = "low";
+static const char* STREAM_LATENCY_MID = "mid";
+static const char* STREAM_LATENCY_HIGH = "high";
+static const char* STREAM_LATENCY_VOIP = "voip";
+static const char* STREAM_LATENCY_DEFAULT = "default";
+static const char* STREAM_LATENCY_DEFAULT_ASYNC = "default-async";
+
+//LCOV_EXCL_START
+CPulseStreamSpec::CPulseStreamSpec():
+ __mLatency(EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT),
__mStreamName(NULL) {
__adjustSpec();
}
+//LCOV_EXCL_STOP
-CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo) throw (CAudioError) :
+CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo) :
__mLatency(latency),
__mAudioInfo(audioInfo),
__mStreamName(NULL) {
__adjustSpec();
}
-CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo, int customLatency) throw (CAudioError) :
+//LCOV_EXCL_START
+CPulseStreamSpec::CPulseStreamSpec(EStreamLatency latency, CAudioInfo& audioInfo, int customLatency) :
__mLatency(latency),
__mAudioInfo(audioInfo),
__mStreamName(NULL) {
__adjustSpec();
}
+//LCOV_EXCL_STOP
CPulseStreamSpec::~CPulseStreamSpec() {
}
-void CPulseStreamSpec::__adjustSpec() throw (CAudioError) {
+void CPulseStreamSpec::__adjustSpec() {
// Sets a sampleRate
__mSampleSpec.rate = __mAudioInfo.getSampleRate();
// Convert channels for PA
- switch (__mAudioInfo.getChannel()) {
- case CAudioInfo::CHANNEL_MONO:
- __mSampleSpec.channels = 1;
- break;
-
- case CAudioInfo::CHANNEL_STEREO:
- default:
- __mSampleSpec.channels = 2;
- break;
- }
+ __mSampleSpec.channels = static_cast<uint8_t>(__mAudioInfo.getChannel());
// Convert format for PA
switch (__mAudioInfo.getSampleType()) {
- case CAudioInfo::SAMPLE_TYPE_U8:
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_U8:
__mSampleSpec.format = PA_SAMPLE_U8;
break;
- case CAudioInfo::SAMPLE_TYPE_S16_LE:
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_S16_LE:
+ __mSampleSpec.format = PA_SAMPLE_S16LE;
+ break;
+
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_S24_LE:
+ __mSampleSpec.format = PA_SAMPLE_S24LE;
+ break;
+
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_S24_32_LE:
+ __mSampleSpec.format = PA_SAMPLE_S24_32LE;
+ break;
+
+ case CAudioInfo::ESampleType::SAMPLE_TYPE_S32_LE:
+ __mSampleSpec.format = PA_SAMPLE_S32LE;
+ break;
+
default:
__mSampleSpec.format = PA_SAMPLE_S16LE;
break;
}
// Sets channelmap
- pa_channel_map_init_auto(&__mChannelMap, __mSampleSpec.channels, PA_CHANNEL_MAP_ALSA);
+ pa_channel_map_init_extend(&__mChannelMap, __mSampleSpec.channels, PA_CHANNEL_MAP_ALSA);
// Sets stream name
switch (__mLatency) {
- case STREAM_LATENCY_OUTPUT_MID:
- __mStreamName = STREAM_NAME_OUTPUT;
+//LCOV_EXCL_START
+ case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
+ __mStreamName = STREAM_NAME_INPUT_LOW_LATENCY;
break;
- case STREAM_LATENCY_OUTPUT_HIGH:
- __mStreamName = STREAM_NAME_OUTPUT_HIGH_LATENCY;
+ case EStreamLatency::STREAM_LATENCY_INPUT_MID:
+ __mStreamName = STREAM_NAME_INPUT_MID_LATENCY;
+ break;
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_HIGH:
+ __mStreamName = STREAM_NAME_INPUT_HIGH_LATENCY;
break;
- case STREAM_LATENCY_OUTPUT_LOW:
+ case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
+ __mStreamName = STREAM_NAME_INPUT_VOIP;
+ break;
+//LCOV_EXCL_STOP
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
+ __mStreamName = STREAM_NAME_INPUT_DEFAULT;
+ break;
+
+//LCOV_EXCL_START
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
__mStreamName = STREAM_NAME_OUTPUT_LOW_LATENCY;
break;
- case STREAM_LATENCY_OUTPUT_VOIP:
- __mStreamName = STREAM_NAME_OUTPUT_VOIP;
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_MID:
+ __mStreamName = STREAM_NAME_OUTPUT_MID_LATENCY;
break;
- case STREAM_LATENCY_INPUT_HIGH:
- __mStreamName = STREAM_NAME_INPUT_HIGH_LATENCY;
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_HIGH:
+ __mStreamName = STREAM_NAME_OUTPUT_HIGH_LATENCY;
break;
- case STREAM_LATENCY_INPUT_LOW:
- __mStreamName = STREAM_NAME_INPUT_LOW_LATENCY;
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
+ __mStreamName = STREAM_NAME_OUTPUT_VOIP;
break;
+//LCOV_EXCL_STOP
- case STREAM_LATENCY_INPUT_VOIP:
- __mStreamName = STREAM_NAME_INPUT_VOIP;
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
+ __mStreamName = STREAM_NAME_OUTPUT_DEFAULT;
break;
- case STREAM_LATENCY_INPUT_MID:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC:
+ __mStreamName = STREAM_NAME_OUTPUT_DEFAULT_ASYNC;
+ break;
+
+//LCOV_EXCL_START
default:
- __mStreamName = STREAM_NAME_INPUT;
+ AUDIO_IO_LOGW("Invalid __mLatency[%d]", static_cast<int>(__mLatency));
break;
}
+//LCOV_EXCL_STOP
}
CPulseStreamSpec::EStreamLatency CPulseStreamSpec::getStreamLatency() {
const char* latency;
switch (__mLatency) {
- case STREAM_LATENCY_INPUT_LOW:
- case STREAM_LATENCY_OUTPUT_LOW:
+//LCOV_EXCL_START
+ case EStreamLatency::STREAM_LATENCY_INPUT_LOW:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_LOW:
latency = STREAM_LATENCY_LOW;
break;
- case STREAM_LATENCY_INPUT_MID:
- case STREAM_LATENCY_OUTPUT_MID:
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_MID:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_MID:
latency = STREAM_LATENCY_MID;
break;
- case STREAM_LATENCY_INPUT_HIGH:
- case STREAM_LATENCY_OUTPUT_HIGH:
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_HIGH:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_HIGH:
latency = STREAM_LATENCY_HIGH;
break;
- case STREAM_LATENCY_INPUT_VOIP:
- case STREAM_LATENCY_OUTPUT_VOIP:
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_VOIP:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_VOIP:
latency = STREAM_LATENCY_VOIP;
break;
+//LCOV_EXCL_STOP
+
+ case EStreamLatency::STREAM_LATENCY_INPUT_DEFAULT:
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT:
+ latency = STREAM_LATENCY_DEFAULT;
+ break;
+
+ case EStreamLatency::STREAM_LATENCY_OUTPUT_DEFAULT_ASYNC:
+ latency = STREAM_LATENCY_DEFAULT_ASYNC;
+ break;
+
+//LCOV_EXCL_START
default:
- latency = STREAM_LATENCY_MID;
+ AUDIO_IO_LOGW("Invalid __mLatency[%d]", static_cast<int>(__mLatency));
+ latency = STREAM_LATENCY_DEFAULT;
break;
+//LCOV_EXCL_STOP
}
return latency;
}
-CAudioInfo CPulseStreamSpec::getAudioInfo() {
+CAudioInfo& CPulseStreamSpec::getAudioInfo() {
return __mAudioInfo;
}