}
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
if (builder_for_in_devices)
g_variant_builder_unref(builder_for_in_devices);
if (builder_for_out_devices)
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGE("failed to UPDATE_FOCUS_STATUS error (%s)", dbus_ret);//LCOV_EXCL_LINE
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
}
}
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("num[%d]", *num);
LEAVE:
- g_variant_iter_free(iter);
- g_variant_unref(result);
+ if (iter)
+ g_variant_iter_free(iter);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
if ((ret = _convert_sample_format_str_to_enum((const char *)format_str, &format_e)) == SOUND_MANAGER_ERROR_NONE)
*format = format_e;
- g_variant_unref(result);
-
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("num[%d]", *num);
LEAVE:
- g_variant_iter_free(iter);
- g_variant_unref(result);
+ if (iter)
+ g_variant_iter_free(iter);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
if ((ret = _convert_sample_rate_to_enum(_rate, &rate_e)) == SOUND_MANAGER_ERROR_NONE)
*rate = rate_e;
- g_variant_unref(result);
-
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
g_variant_get(result, "(b)", &_enabled);
*enabled = (bool)_enabled;
- g_variant_unref(result);
LOGI("enabled[%d]", *enabled);
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
else
*enabled = false;
- g_variant_unref(result);
-
LOGI("enabled[%d]", *enabled);
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
pa_threaded_mainloop_free(pa_info->mainloop);
pa_info->mainloop = NULL;
}
-
- return;
}
int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h)
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
}
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
ret = _convert_sound_manager_error_code(__func__, _convert_dbus_error(err ? err->message : NULL));
if (err)
g_error_free(err);
- if (result)
- g_variant_unref(result);
goto LEAVE;
}
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
- g_variant_unref(result);
if (ret)
goto LEAVE;
}
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
+
return ret;
}
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
ret = _convert_sound_manager_error_code(__func__, _convert_dbus_error(err ? err->message : NULL));
if (err)
g_error_free(err);
- if (result)
+ if (result) {
g_variant_unref(result);
+ result = NULL;
+ }
continue;
}
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
- g_variant_unref(result);
if (ret)
goto LEAVE;
}
LEAVE:
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
+
return ret;
}
LOGI("dbus_ret[%s] ret[0x%x]", dbus_ret, ret);
LEAVE:
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
LEAVE:
if (builder_for_stream_types)
g_variant_builder_unref(builder_for_stream_types);
- g_variant_unref(result);
+ if (result)
+ g_variant_unref(result);
g_object_unref(conn);
return ret;
int g_device_running_cb_id;
static const char *g_device_direction_str[] = {"IN", "OUT", "BOTH"};
-static const char *g_device_state_str[] = {"De-Activated", "Activated"};
static const char *g_device_type_str[] = {"builtin-speaker", "builtin-receiver", "builtin-mic",
"audio-jack", "bt-media", "hdmi",
"forwarding", "usb-audio", "bt-voice",
g_print("sms. Set Media Stream Only\n");
g_print("gar. Get Avoid Resampling\t");
g_print("gms. Get Media Stream Only\n");
- g_print("adcc. Add Device Connenection Changed CB\t\t");
- g_print("rdcc. Remove Device Connenection Changed CB\n");
+ g_print("adcc. Add Device Connection Changed CB\t\t");
+ g_print("rdcc. Remove Device Connection Changed CB\n");
g_print("adrc. Add Device Running Changed CB\t\t");
g_print("rdrc. Remove Device Running Changed CB\n");
g_print("-----------------------------------------------------------------------------------------\n");
else if (g_menu_state == CURRENT_STATUS_SET_SAMPLE_RATE)
g_print("*** input sample rate (0:8kHz, 1:16KHz, 2:22.05kHz, 3:44.1kHz, 4:48kHz, 5:88.2kHz, 6:96kHz, 7:192kHz)\n");
else if (g_menu_state == CURRENT_STATUS_GET_SAMPLE_RATE)
- g_print("*** press enter to get sample ratet\n");
+ g_print("*** press enter to get sample rate\n");
else if (g_menu_state == CURRENT_STATUS_SET_AVOID_RESAMPLING)
g_print("*** input avoid resampling (0:disable, 1:enable)\n");
else if (g_menu_state == CURRENT_STATUS_GET_AVOID_RESAMPLING)
/* If failed to get some property, just give some default value */
void _get_device_props_simple(sound_device_h device, int *id, const char **type, char **name,
- const char **direction, const char **state, int *vendor_id, int *product_id, bool *is_running)
+ const char **direction, bool *is_activated, int *vendor_id, int *product_id, bool *is_running)
{
int ret;
sound_device_type_e _type;
bool running;
*id = -1;
- *vendor_id = -1;
- *product_id = -1;
+ *vendor_id = 0;
+ *product_id = 0;
if ((ret = sound_manager_get_device_type(device, &_type)))
g_print("failed to get device type, ret[0x%x]\n", ret);
if ((ret = sound_manager_get_device_id(device, id)))
g_print("failed to get device id, ret[0x%x]\n", ret);
- if (_type == SOUND_DEVICE_BLUETOOTH_MEDIA || _type == SOUND_DEVICE_BLUETOOTH_VOICE || _type == SOUND_DEVICE_USB_AUDIO) {
- if ((ret = sound_manager_get_device_name(device, name))) {
- g_print("failed to get device name, ret[0x%x]\n", ret);
- *name = NOT_AVAIL;
- }
- if (_type == SOUND_DEVICE_USB_AUDIO) {
- if ((ret = sound_manager_get_device_vendor_id(device, vendor_id)))
- g_print("failed to get device vendor id, ret[0x%x]\n", ret);
- if ((ret = sound_manager_get_device_product_id(device, product_id)))
- g_print("failed to get device product id, ret[0x%x]\n", ret);
- }
- } else {
- *name = "";
+ if ((ret = sound_manager_get_device_name(device, name))) {
+ g_print("failed to get device name, ret[0x%x]\n", ret);
+ *name = NOT_AVAIL;
+ }
+
+ if (_type == SOUND_DEVICE_USB_AUDIO) {
+ if ((ret = sound_manager_get_device_vendor_id(device, vendor_id)))
+ g_print("failed to get device vendor id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_product_id(device, product_id)))
+ g_print("failed to get device product id, ret[0x%x]\n", ret);
}
if ((ret = sound_manager_get_device_io_direction(device, &_direc))) {
if ((ret = sound_manager_get_device_state(device, &_state))) {
g_print("failed to get device state, ret[0x%x]\n", ret);
- *state = NOT_AVAIL;
+ *is_activated = false;
} else {
- *state = g_device_state_str[_state];
+ *is_activated = (bool)_state;
}
if ((ret = sound_manager_is_device_running(device, &running))) {
void _device_connected_cb(sound_device_h device, bool is_connected, void *user_data)
{
int id = -1;
- int vendor_id = -1;
- int product_id = -1;
+ int vendor_id = 0;
+ int product_id = 0;
char *name;
- const char *type, *direction, *state;
+ const char *type, *direction;
+ bool is_activated = false;
bool is_running = false;
- _get_device_props_simple(device, &id, &type, &name, &direction, &state, &vendor_id, &product_id, &is_running);
+ _get_device_props_simple(device, &id, &type, &name, &direction, &is_activated, &vendor_id, &product_id, &is_running);
- g_print("\n[ Device #%d %20s %s ] %15s : ", id, type, name, is_connected ? "Connected" : "Disconnected");
- g_print(" Direction[ %-4s ] State[ %-12s ] Running[ %d ] VendorID[ %04x ], ProductID[ %04x ]\n",
- direction, state, is_running, vendor_id, product_id);
+ g_print("\n[ Device #%d %-20s ] %15s : ", id, type, is_connected ? "Connected" : "Disconnected");
+ g_print("Direction[%-4s] Activated[%d] Running[%d] Vendor/Product ID[%04x/%04x] Name[%s]\n",
+ direction, is_activated, is_running, vendor_id, product_id, name);
}
void _device_running_changed_cb(sound_device_h device, bool is_running, void *user_data)
{
int id = -1;
- int vendor_id = -1;
- int product_id = -1;
+ int vendor_id = 0;
+ int product_id = 0;
char *name;
- const char *type, *direction, *state;
+ const char *type, *direction;
+ bool is_activated = false;
bool _is_running = false;
- _get_device_props_simple(device, &id, &type, &name, &direction, &state, &vendor_id, &product_id, &_is_running);
+ _get_device_props_simple(device, &id, &type, &name, &direction, &is_activated, &vendor_id, &product_id, &_is_running);
- g_print("\n[ Device #%d %20s %s ] running changed to [ %d ] : ", id, type, name, is_running);
- g_print(" Direction[ %-4s ] State[ %-12s ] Running[ %d ] VendorID[ %04x ], ProductID[ %04x ]\n",
- direction, state, _is_running, vendor_id, product_id);
+ g_print("\n[ Device #%d %-20s ] running changed to [%d] : ", id, type, is_running);
+ g_print("Direction [%-4s] Activated[%d] Running[%d] Vendor/Product ID[%04x/%04x] Name[%s]\n",
+ direction, is_activated, _is_running, vendor_id, product_id, name);
}
void reset_menu_state(void)
int max;
if (convert_sound_type(&type, cmd) == 1) {
if (sound_manager_get_max_volume(type, &max) != SOUND_MANAGER_ERROR_NONE)
- g_print("failt to get max volume\n");
+ g_print("fail to get max volume\n");
else
g_print("the max volume of this type(%d) is %d\n", type, max);
}
int max;
if (convert_sound_type_internal(&type, cmd) == 1) {
if (sound_manager_get_max_volume_internal(type, &max) != SOUND_MANAGER_ERROR_NONE)
- g_print("failt to get max volume\n");
+ g_print("fail to get max volume\n");
else
g_print("the max volume of this type(%d) is %d\n", type, max);
}
sound_device_h device;
int ret = SOUND_MANAGER_ERROR_NONE;
int id = -1;
- int vendor_id = -1;
- int product_id = -1;
+ int vendor_id = 0;
+ int product_id = 0;
char *name;
const char *type;
const char *direction;
- const char *state;
+ bool is_activated;
bool is_running;
unsigned int num;
sound_sample_format_e *formats;
if (!(ret = sound_manager_get_device_list(g_device_mask, &device_list))) {
g_print("success to get current device list\n");
while (!sound_manager_get_next_device(device_list, &device)) {
- _get_device_props_simple(device, &id, &type, &name, &direction, &state, &vendor_id, &product_id, &is_running);
- g_print("[ Device #%d %20s %s ] : ", id, type, name);
- g_print(" Direction[ %-4s ] State[ %-12s ] Running[ %d ] VendorID[ %04x ] ProductID[ %04x ]\n",
- direction, state, is_running, vendor_id, product_id);
+ _get_device_props_simple(device, &id, &type, &name, &direction, &is_activated, &vendor_id, &product_id, &is_running);
+ g_print("[ Device #%d %-20s ] : ", id, type);
+ g_print("Direction[%-4s] Activated[%d] Running[%d] Vendor/Product ID[%04x/%04x] Name[%s] \n",
+ direction, is_activated, is_running, vendor_id, product_id, name);
if (!(ret = sound_manager_get_supported_sample_formats(device, &formats, &num))) {
+ g_print(" => [ ");
while (num--)
g_print("format(%u) ", formats[num]);
- g_print("are supported.\n");
+ g_print("] is(are) supported.\n");
free(formats);
}
if (!(ret = sound_manager_get_supported_sample_rates(device, &rates, &num))) {
+ g_print(" => [ ");
while (num--)
g_print("rate(%u) ", rates[num]);
- g_print("are supported.\n");
+ g_print("] is(are) supported.\n");
free(rates);
}
}