#include <sound_manager_internal.h>
#include "vce.h"
+#include "vc_audio_manager_dlog.h"
#include "vc_audio_manager.h"
case 7: audio_ch = AUDIO_CHANNEL_MULTI_7; break;
case 8: audio_ch = AUDIO_CHANNEL_MULTI_8; break;
default:
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Input channel is not supported. [channel(%d)]", channel);
+ VCAM_LOGE("[ERROR] Input channel is not supported. [channel(%d)]", channel);
return false;
}
audio_sample_type = AUDIO_SAMPLE_TYPE_U8;
break;
default:
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Invalid Audio Type. [type(%d)]", audio_type);
+ VCAM_LOGE("[ERROR] Invalid Audio Type. [type(%d)]", audio_type);
return false;
}
const int FRAME_LENGTH = 160;
const int BUFFER_LENGTH = FRAME_LENGTH * 2;
- if (g_is_recording && nullptr != g_feed_audio_data) {
+ if (g_is_recording) {
unsigned char buffer[BUFFER_LENGTH];
memset(buffer, '\0', BUFFER_LENGTH);
int read_bytes = audio_in_read(g_audio_h, buffer, BUFFER_LENGTH);
if (0 > read_bytes) {
- SLOG(LOG_WARN, LOG_TAG, "[WARNING] Fail to read audio : %d", read_bytes);
+ VCAM_LOGW("[WARNING] Fail to read audio : %d", read_bytes);
return ECORE_CALLBACK_DONE;
}
// TODO: check return value?
- g_feed_audio_data(buffer, read_bytes);
+ if (nullptr != g_feed_audio_data) {
+ g_feed_audio_data(buffer, read_bytes);
+ }
} else {
- SLOG(LOG_DEBUG, LOG_TAG, "[DEBUG] Recording is finished");
+ VCAM_LOGD("[DEBUG] Recording is finished");
return ECORE_CALLBACK_DONE;
}
audio_channel_e audio_ch = AUDIO_CHANNEL_MONO;
audio_sample_type_e audio_sample_type = AUDIO_SAMPLE_TYPE_U8;
- SLOG(LOG_INFO, LOG_TAG, "[Recorder] Audio type(%d) rate(%d) channel(%d)", g_audio_type, g_audio_rate, g_audio_channel);
-
if (false == __convert_audio_channel(g_audio_channel, &audio_ch)) {
return VCE_ERROR_INVALID_PARAMETER;
}
return VCE_ERROR_INVALID_PARAMETER;
}
+ VCAM_LOGI("Audio type(%d), rate(%d), channel(%d)", g_audio_type, g_audio_rate, g_audio_channel);
+
ret = audio_in_create(g_audio_rate, audio_ch, audio_sample_type, &g_audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Rate(%d) Channel(%d) Type(%d)", g_audio_rate, audio_ch, audio_sample_type);
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to create audio handle : %d", ret);
+ VCAM_LOGE("[ERROR] Fail to create audio handle : %d", ret);
+ return VCE_ERROR_OPERATION_FAILED;
}
- if (0 != audio_in_set_sound_stream_info(g_audio_h, stream_info_h)) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to set stream info");
+ ret = audio_in_set_sound_stream_info(g_audio_h, stream_info_h);
+ if (AUDIO_IO_ERROR_NONE != ret) {
+ VCAM_LOGE("[ERROR] Fail to set stream info : %d", ret);
+ audio_in_destroy(g_audio_h);
+ return VCE_ERROR_OPERATION_FAILED;
}
g_audio_source_type = strdup(VCE_AUDIO_ID_NONE);
g_feed_audio_data = callback;
g_is_recording = false;
- return ret;
+ return VCE_ERROR_NONE;
}
int vcd_dependency_deinitialize(void)
{
+ VCAM_LOGI("");
int ret = 0;
if (g_is_recording) {
ret = audio_in_unprepare(g_audio_h);
if (0 != ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to stop audio : %d", ret);
+ VCAM_LOGE("[ERROR] Fail to stop audio : %d", ret);
}
g_is_recording = false;
}
ret = audio_in_destroy(g_audio_h);
if (0 != ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to audio in destroy, ret(%d)", ret);
+ VCAM_LOGE("[ERROR] Fail to audio in destroy, ret(%d)", ret);
}
g_audio_h = nullptr;
int vcd_dependency_set_audio_info(sound_stream_info_h stream_info_h, const char* audio_source_type, vce_audio_type_e type, int rate, int channel)
{
if (nullptr == audio_source_type) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Invalid audio source type.");
+ VCAM_LOGE("[ERROR] Invalid audio source type.");
return VCE_ERROR_INVALID_PARAMETER;
}
if (nullptr == g_audio_h || nullptr == g_audio_source_type) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Audio in handle is not valid.");
+ VCAM_LOGE("[ERROR] Audio in handle is not valid.");
return VCE_ERROR_INVALID_STATE;
}
if (0 == strncmp(g_audio_source_type, audio_source_type, strlen(g_audio_source_type)) ||
(g_audio_type == type && g_audio_rate == rate && g_audio_channel == channel)) {
- SLOG(LOG_INFO, LOG_TAG, "[DEBUG] No changed information");
+ VCAM_LOGI("No changed information");
return VCE_ERROR_NONE;
}
- SLOG(LOG_INFO, LOG_TAG, "[Recorder] New audio type(%d) rate(%d) channel(%d)", type, rate, channel);
+ VCAM_LOGI("New audio type(%d) rate(%d) channel(%d)", type, rate, channel);
audio_in_destroy(g_audio_h);
audio_channel_e audio_ch = AUDIO_CHANNEL_MONO;
int ret = 0;
ret = audio_in_create(rate, audio_ch, audio_sample_type, &g_audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Fail to create audio handle. [ret(%d)]", ret);
+ VCAM_LOGE("[ERROR] Fail to create audio handle. [ret(%d)]", ret);
return ret;
}
if (0 != audio_in_set_sound_stream_info(g_audio_h, stream_info_h)) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Fail to set stream info");
+ VCAM_LOGE("[ERROR] Fail to set stream info");
}
g_audio_type = type;
g_audio_rate = rate;
g_audio_channel = channel;
+ VCAM_LOGI("");
return ret;
}
int vcd_dependency_start_recording(void)
{
+ VCAM_LOGI("");
int ret = 0;
if (nullptr == g_audio_h) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Audio in handle is not valid.");
-
+ VCAM_LOGE("[ERROR] Audio in handle is not valid.");
return VCE_ERROR_INVALID_STATE;
}
ret = audio_in_prepare(g_audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
if (AUDIO_IO_ERROR_SOUND_POLICY == ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Audio is busy.");
+ VCAM_LOGE("[ERROR] Audio is busy.");
} else {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to start audio : %d", ret);
+ VCAM_LOGE("[ERROR] Fail to start audio : %d", ret);
}
return ret;
int vcd_dependency_stop_recording(void)
{
+ VCAM_LOGI("");
int ret = 0;
if (nullptr == g_audio_h) {
- SLOG(LOG_ERROR, LOG_TAG, "[ERROR] Audio in handle is not valid.");
+ VCAM_LOGE("[ERROR] Audio in handle is not valid.");
return VCE_ERROR_INVALID_STATE;
}
ret = audio_in_unprepare(g_audio_h);
if (AUDIO_IO_ERROR_NONE != ret) {
- SLOG(LOG_ERROR, LOG_TAG, "[Recorder ERROR] Fail to stop audio : %d", ret);
+ VCAM_LOGE("[ERROR] Fail to stop audio : %d", ret);
}
return ret;