diff options
-rw-r--r-- | configure.ac | 38 | ||||
-rw-r--r-- | packaging/edje_multisense_plugin.spec | 3 | ||||
-rw-r--r-- | src/tizen_sound_player/Makefile.am | 2 | ||||
-rw-r--r-- | src/tizen_sound_player/tizen_sound_player.c | 100 |
4 files changed, 92 insertions, 51 deletions
diff --git a/configure.ac b/configure.ac index 9056022..44e3cd5 100644 --- a/configure.ac +++ b/configure.ac @@ -100,18 +100,18 @@ fi # Dependencies for the library PKG_CHECK_MODULES([MINIMAL], [ - eina >= 1.0.0 - eet >= 1.4.0 + eina >= 1.6.99 + eet >= 1.6.99 ]) PKG_CHECK_MODULES([MULTISENSE_PLUGIN], [ - edje >= 1.0.0 + ecore >= 1.7.99 mm-sound >= 1.0 remix >= 0.2.4 ]) -requirement_edje_multisense_plugin="edje >= 1.0.0 mm-sound >= 1.0 ${requirement_edje_multisense_plugin}" +requirement_edje_multisense_plugin="ecore >= 1.7.99 mm-sound >= 1.0 ${requirement_edje_multisense_plugin}" AC_DEFINE(EAPI, __attribute__ ((visibility("default"))), "Public API Visibility") @@ -134,36 +134,6 @@ AM_CONDITIONAL(HAVE_LIB_REMIX, test "x${HAVE_LIB_REMIX}" = xyes) MULTISENSE_PLUGIN_CFLAGS="${MULTISENSE_PLUGIN_CFLAGS}" MULTISENSE_PLUGIN_LIBS="${MULTISENSE_PLUGIN_LIBS}" -PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.21, - HAVE_LIBSNDFILE1="yes", HAVE_LIBSNDFILE1="no") - -if test "$HAVE_LIBSNDFILE1" = "yes" ; then - AC_DEFINE([HAVE_LIBSNDFILE1], [], [Define if libsndfile version 1 found]) - AC_SUBST(SNDFILE_LIBS) - AC_SUBST(SNDFILE_CFLAGS) -else - AC_CHECK_LIB(sndfile, sf_open, HAVE_LIBSNDFILE1="maybe") - if test "$HAVE_LIBSNDFILE1" = "maybe" ; then - AC_MSG_ERROR([ -*** -*** libsndfile-1.0.21 or greater seems to exist on your system, however -*** the pkg-config tool cannot find its build information. -*** -*** Please set your PKG_CONFIG_PATH environment variable to include the -*** directory in which sndfile.pc was installed. For example, sndfile.pc -*** is installed in /usr/local/lib/pkgconfig by default; if that is the -*** case do: -*** -*** export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" -*** -*** then run this ./configure again. If you configured libsndfile with a -*** different --prefix option, replace /usr/local above with that prefix. -*** -]) - fi -fi -AM_CONDITIONAL(HAVE_LIBSNDFILE1, test "x${HAVE_LIBSNDFILE1}" = xyes) - ### Checks for header files AC_CHECK_HEADERS([locale.h]) diff --git a/packaging/edje_multisense_plugin.spec b/packaging/edje_multisense_plugin.spec index 22534a8..237eb21 100644 --- a/packaging/edje_multisense_plugin.spec +++ b/packaging/edje_multisense_plugin.spec @@ -8,10 +8,9 @@ License: LGPLv2.1 Source0: %{name}-%{version}.tar.gz Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig -BuildRequires: pkgconfig(edje) +BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(remix) -BuildRequires: pkgconfig(sndfile) %description EDJE & libremix Plugins for TIZEN sound/tone play diff --git a/src/tizen_sound_player/Makefile.am b/src/tizen_sound_player/Makefile.am index c481a10..e1eb4ca 100644 --- a/src/tizen_sound_player/Makefile.am +++ b/src/tizen_sound_player/Makefile.am @@ -15,4 +15,4 @@ lib_LTLIBRARIES = libtizen_sound_player.la libtizen_sound_player_la_SOURCES = tizen_sound_player.c libtizen_sound_player_la_LDFLAGS = -module -version-info 1:0:0 -libtizen_sound_player_la_LIBADD = $(REMIX_LIBS) -lmmfsound -lsndfile +libtizen_sound_player_la_LIBADD = $(REMIX_LIBS) -lmmfsound diff --git a/src/tizen_sound_player/tizen_sound_player.c b/src/tizen_sound_player/tizen_sound_player.c index 6882005..3a79b7c 100644 --- a/src/tizen_sound_player/tizen_sound_player.c +++ b/src/tizen_sound_player/tizen_sound_player.c @@ -6,12 +6,10 @@ */ #include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include <mm_sound.h> #include <remix/remix.h> #include <Eina.h> +#include <Ecore.h> #ifdef HAVE_LIBSNDFILE #include <sndfile.h> #endif @@ -30,6 +28,7 @@ int _edje_multisense_default_log_dom = -1; #define STREAM_PLAYER_BUFFERLEN 2048 #define DEFAULT_FORMAT MMSOUND_PCM_S16_LE +#define TIMEOUT_FOR_MM_HANDLER 10 typedef struct _RemixPlayerData RemixPlayerData; typedef short PLAYER_PCM; @@ -42,7 +41,9 @@ struct _RemixPlayerData { RemixPCM max_value; RemixEnv *env; RemixBase *base; + Ecore_Timer *timeout; int snd_on; + int tch_snd_on; unsigned int buffer_size; int stereo; int frequency; @@ -103,7 +104,10 @@ _vconf_noti_key_changed_cb(keynode_t *node, void *data) if (strcmp(keyname, VCONFKEY_SETAPPL_SOUND_STATUS_BOOL) == 0) player->snd_on = vconf_keynode_get_bool(node); - else if (strcmp(keyname, VCONFKEY_SYSMAN_EARJACK) == 0) + if (strcmp(keyname, VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL) == 0) + player->tch_snd_on = vconf_keynode_get_bool(node); + + if (strcmp(keyname, VCONFKEY_SYSMAN_EARJACK) == 0) { int ear_jack = vconf_keynode_get_int(node); if (ear_jack == VCONFKEY_SYSMAN_EARJACK_REMOVED) @@ -143,17 +147,28 @@ remix_player_init (RemixEnv *env, RemixBase *base, CDSet *parameters) player_data->buffer_size = 0; player_data->max_value = (RemixPCM) SHRT_MAX / 2; - remix_player_reset_device (env, (RemixBase *)base); - base = remix_player_optimise (env, base); player_data->env = env; player_data->base = base; - if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &player_data->snd_on) < 0) + + if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, + &player_data->snd_on) < 0) WRN("\nFail to get VCONFKEY_SETAPPL_SOUND_STATUS_BOOL boolean value"); - if (vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL,_vconf_noti_key_changed_cb, player_data) < 0) + if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, + &player_data->tch_snd_on) < 0) + WRN("\nFail to get VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL boolean value"); + + if (vconf_notify_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, + _vconf_noti_key_changed_cb, player_data) < 0) + WRN("\nFail to register VCONFKEY_SETAPPL_SOUND_STATUS_BOOL key callback"); + + if (vconf_notify_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, + _vconf_noti_key_changed_cb, player_data) < 0) WRN("\nFail to register VCONFKEY_SETAPPL_SOUND_STATUS_BOOL key callback"); - if (vconf_notify_key_changed(VCONFKEY_SYSMAN_EARJACK, _vconf_noti_key_changed_cb, player_data) < 0) + + if (vconf_notify_key_changed(VCONFKEY_SYSMAN_EARJACK, + _vconf_noti_key_changed_cb, player_data) < 0) WRN("\nFail to register VCONFKEY_SYSMAN_EARJACK key callback"); return base; @@ -174,9 +189,14 @@ remix_player_destroy (RemixEnv *env, RemixBase *base) { RemixPlayerData *player_data = remix_base_get_instance_data(env, base); - if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL,_vconf_noti_key_changed_cb) < 0) + if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, + _vconf_noti_key_changed_cb) < 0) WRN("\nFail to unregister VCONFKEY_SETAPPL_SOUND_STATUS_BOOL key callback"); - if (vconf_ignore_key_changed(VCONFKEY_SYSMAN_EARJACK, _vconf_noti_key_changed_cb) < 0) + if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, + _vconf_noti_key_changed_cb) < 0) + WRN("\nFail to unregister VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL key callback"); + if (vconf_ignore_key_changed(VCONFKEY_SYSMAN_EARJACK, + _vconf_noti_key_changed_cb) < 0) WRN("\nFail to unregister VCONFKEY_SYSMAN_EARJACK key callback"); if(player_data->handle) @@ -184,6 +204,7 @@ remix_player_destroy (RemixEnv *env, RemixBase *base) mm_sound_pcm_play_stop(player_data->handle); mm_sound_pcm_play_close(player_data->handle); } + if (player_data->timeout) ecore_timer_del(player_data->timeout); if(player_data->playbuffer) free(player_data->playbuffer); free (player_data); return 0; @@ -276,7 +297,7 @@ remix_player_process (RemixEnv *env, RemixBase *base, RemixCount count, RemixCount remaining = count, processed = 0, n, nn, nr_channels; RemixPlayerData *player_data = remix_base_get_instance_data(env, base); - if (!player_data->snd_on) return count; + if ((!player_data->snd_on) || (!player_data->tch_snd_on)) return count; nr_channels = remix_stream_nr_channels (env, input); if (nr_channels == 1 && player_data->stereo == 0) @@ -321,12 +342,63 @@ remix_player_seek (RemixEnv *env, RemixBase *base, RemixCount count) return count; } +static Eina_Bool +_remix_mm_handle_close(void *data) +{ + RemixPlayerData *player_data = data; + + if ((!player_data) && (!player_data->handle)) return ECORE_CALLBACK_CANCEL; + + mm_sound_pcm_play_stop(player_data->handle); + mm_sound_pcm_play_close(player_data->handle); + player_data->handle = NULL; + player_data->timeout = NULL; + + return ECORE_CALLBACK_CANCEL; +} + static int remix_player_flush (RemixEnv *env, RemixBase *base) { + int old_buffer_size; RemixPlayerData *player_data = remix_base_get_instance_data(env, base); - remix_player_reset_device (env, base); - return 0; + + if (player_data->timeout) ecore_timer_del(player_data->timeout); + player_data->timeout = ecore_timer_add(TIMEOUT_FOR_MM_HANDLER, + _remix_mm_handle_close, player_data); + + if (player_data->handle) return 0; + + old_buffer_size = player_data->buffer_size; + player_data->buffer_size = mm_sound_pcm_play_open_no_session(&player_data->handle, + player_data->frequency, + player_data->channel, + DEFAULT_FORMAT, + VOLUME_TYPE_SYSTEM); + if(mm_sound_pcm_play_start(player_data->handle) < 0) + { + remix_set_error (env, REMIX_ERROR_SYSTEM); + return -1; + } + + if(player_data->buffer_size < 0) + { + remix_set_error (env, REMIX_ERROR_SYSTEM); + return -1; + } + + if( old_buffer_size < player_data->buffer_size) + { + if( player_data->playbuffer ) free(player_data->playbuffer); + player_data->playbuffer = calloc(sizeof(PLAYER_PCM), player_data->buffer_size); + if(!player_data->playbuffer) + { + remix_set_error (env, REMIX_ERROR_SYSTEM); + return -1; + } + } + + return 0; } static struct _RemixMethods _remix_player_methods = { |