Revise code
[platform/core/multimedia/libmm-sound.git] / server / mm_sound_mgr_ipc.c
index 89017fe..ec7ac6c 100644 (file)
@@ -49,25 +49,8 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
                           int *codechandle, char *stream_type, int stream_index)
 {
        mmsound_mgr_codec_param_t param = {0,};
-       MMSourceType *source = NULL;
        int ret = MM_ERROR_NONE;
 
-       /* Set source */
-       source = (MMSourceType*)malloc(sizeof(MMSourceType));
-       if (!source) {
-               debug_error("malloc fail!!\n");
-               return MM_ERROR_OUT_OF_MEMORY;
-       }
-
-       ret = mm_source_open_file(filename, source, MM_SOURCE_CHECK_DRM_CONTENTS);
-       if(ret != MM_ERROR_NONE) {
-               debug_error("Fail to open file\n");
-               if (source) {
-                       free(source);
-               }
-               return ret;
-       }
-
        /* Set sound player parameter */
        param.tone = tone;
        param.repeat_count = repeat;
@@ -76,7 +59,7 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
        param.session_type = session_type;
        param.session_options = session_options;
        param.param = (void*)client_pid;
-       param.source = source;
+       param.pfilename = filename;
        param.enable_session = enable_session;
        param.stream_index = stream_index;
        MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
@@ -91,11 +74,6 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
        ret = MMSoundMgrCodecPlay(codechandle, &param);
        if (ret != MM_ERROR_NONE) {
                debug_error("Will be closed a sources, codechandle : 0x%08X\n", *codechandle);
-               mm_source_close(source);
-               if (source) {
-                       free(source);
-                       source = NULL;
-               }
                return ret;
        }
 
@@ -132,45 +110,23 @@ int _MMSoundMgrIpcClearFocus(int pid)
 }
 #endif
 
-int _MMSoundMgrIpcPlayFileWithStreamInfo(charfilename, int repeat, int volume,
+int _MMSoundMgrIpcPlayFileWithStreamInfo(char *filename, int repeat, int volume,
                           int client_pid, int *codechandle, char *stream_type, int stream_index)
 {
        mmsound_mgr_codec_param_t param = {0,};
-       MMSourceType *source = NULL;
        int ret = MM_ERROR_NONE;
 
-       /* Set source */
-       source = (MMSourceType*)malloc(sizeof(MMSourceType));
-       if (!source) {
-               debug_error("malloc fail!!\n");
-               return MM_ERROR_OUT_OF_MEMORY;
-       }
-
-       ret = mm_source_open_file(filename, source, MM_SOURCE_CHECK_DRM_CONTENTS);
-       if(ret != MM_ERROR_NONE) {
-               debug_error("Fail to open file\n");
-               if (source) {
-                       free(source);
-               }
-               return ret;
-       }
-
        /* Set sound player parameter */
        param.repeat_count = repeat;
        param.volume = volume;
        param.param = (void*)client_pid;
-       param.source = source;
+       param.pfilename = filename;
        param.stream_index = stream_index;
        MMSOUND_STRNCPY(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
 
        ret = MMSoundMgrCodecPlayWithStreamInfo(codechandle, &param);
        if (ret != MM_ERROR_NONE) {
                debug_error("Will be closed a sources, codechandle : 0x%08X\n", *codechandle);
-               mm_source_close(source);
-               if (source) {
-                       free(source);
-                       source = NULL;
-               }
                return ret;
        }