#include <sound_manager_internal.h>
#include <mm_sound.h>
+/* These variables will be removed when session features are deprecated. */
+extern int g_stream_info_count;
+extern pthread_mutex_t g_stream_info_count_mutex;
+
int sound_manager_get_max_master_volume(int *max_level)
{
int ret = MM_ERROR_NONE;
SM_NULL_ARG_CHECK(stream_info);
SM_NULL_ARG_CHECK(callback);
+ SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&g_stream_info_count_mutex, MM_ERROR_SOUND_INTERNAL);
+
sound_stream_info_s *stream_h = malloc(sizeof(sound_stream_info_s));
if (!stream_h) {
ret = MM_ERROR_OUT_OF_MEMORY;
ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data);
if (!ret) {
*stream_info = (sound_stream_info_h)stream_h;
+ SM_REF_FOR_STREAM_INFO(g_stream_info_count, ret);
LOGI("stream_h(%p), index(%u), user_cb(%p), ret(0x%x)", stream_h, stream_h->index, stream_h->user_cb, ret);
}
}
free(stream_h);
}
+ SM_LEAVE_CRITICAL_SECTION(&g_stream_info_count_mutex);
+
return _convert_sound_manager_error_code(__func__, ret);
}
#include <sound_manager.h>
#include <sound_manager_internal.h>
+#include <mm_sound.h>
#include <pthread.h>
#include <glib.h>
return TRUE;
}
+/* it will be removed when session features are deprecated. */
+void signal_callback(mm_sound_signal_name_t signal, int value, void *user_data)
+{
+ g_print("*** signal callback is called: signal(%d), value(%d), user_data(%p)\n", signal, value, user_data);
+}
+
int main(int argc, char *argv[])
{
+ unsigned int subscribe_id = 0;
+ int ret = MM_ERROR_NONE;
GIOChannel *stdin_channel;
stdin_channel = g_io_channel_unix_new(0);
g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL);
g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL);
g_loop = g_main_loop_new(NULL, 1);
+ /* subscribe a signal for convering session-focus */
+ /* it will be removed when session features are deprecated. */
+ if ((ret = mm_sound_subscribe_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &subscribe_id, signal_callback, NULL)))
+ g_print("failed to subscribe signal, ret(0x%x)\n", ret);
+
displaymenu();
g_main_loop_run(g_loop);
+ /* it will be removed when session features are deprecated. */
+ if (subscribe_id)
+ mm_sound_unsubscribe_signal(subscribe_id);
+
return 0;
}