Fix improper errno handling
[platform/core/multimedia/libmm-sound.git] / mm_sound_pa_client.c
index de0cb33..c060761 100644 (file)
@@ -45,7 +45,6 @@ typedef struct _mm_sound_handle_t {
 
        int period;     /* open api retrun value. */
 
-       unsigned int stream_idx;
        int source_type;
 } mm_sound_handle_t;
 
@@ -187,17 +186,6 @@ int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec *
                break;
        }
 
-       /* Set volume type of stream */
-       if (volume_config > 0) {
-               debug_log("setting gain type");
-               prop_vol_type = 0;      /* not used, set it system(0) temporarily */
-
-               /* Set gain type of stream */
-               prop_gain_type = (volume_config >> 8) & 0x000000FF;
-
-               pa_proplist_setf(proplist, PA_PROP_MEDIA_TIZEN_GAIN_TYPE, "%d", prop_gain_type);
-       }
-
        if (stream_index != -1) {
                char stream_index_s[11];
                debug_msg("Set stream index [%d]", stream_index);
@@ -277,7 +265,7 @@ int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec *
                attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
                attr.maxlength = -1;
                attr.fragsize = 0;
-               debug_msg("rate(%d), samplesize(%d), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
+               debug_msg("rate(%d), samplesize(%zu), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
 
                debug_msg("prebuf(%d), minreq(%d), tlength(%d), maxlength(%d), fragsize(%d)", attr.prebuf, attr.minreq, attr.tlength,
                                  attr.maxlength, attr.fragsize);
@@ -378,11 +366,6 @@ int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec *
        handle->handle = mm_sound_handle_mgr.handle_count;
        ATOMIC_INC(&mm_sound_handle_mgr.lock, mm_sound_handle_mgr.handle_count);        // 0 is not used
 
-       if (0 > pa_simple_get_stream_index(s, &handle->stream_idx, &err)) {
-               debug_msg("Can not get stream index %s", pa_strerror(err));
-               err = MM_ERROR_SOUND_INTERNAL;
-               goto fail;
-       }
        mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
 
        if (handle->handle == 0) {
@@ -391,9 +374,9 @@ int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec *
        }
 
        debug_msg
-               ("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), stream_idx(%d), s(%p), source_type(%d)",
+               ("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), s(%p), source_type(%d)",
                 handle->handle, handle->mode, handle->volume_type, handle->gain_type, handle->rate, handle->channels, ss->format,
-                handle->stream_idx, handle->s, handle->source_type);
+                handle->s, handle->source_type);
 
        if (proplist)
                pa_proplist_free(proplist);
@@ -428,11 +411,6 @@ int mm_sound_pa_write(const int handle, void *buf, const int size)
        CHECK_HANDLE_RANGE(handle);
        GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
 
-#ifdef __STREAM_DEBUG__
-       debug_msg("phandle(%p) s(%p), handle(%d), rate(%d), ch(%d) stream_idx(%d), buf(%p), size(%d)",
-                         phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx.buf, size);
-#endif
-
        if (phandle == NULL) {
                debug_msg("phandle is null");
                return MM_ERROR_SOUND_INTERNAL;
@@ -460,8 +438,8 @@ int mm_sound_pa_close(const int handle)
                return MM_ERROR_SOUND_INTERNAL;
        }
 
-       debug_msg("phandle(%p) s(%p), handle(%d), rate(%d), ch(%d) stream_idx(%d)",
-                         phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx);
+       debug_msg("phandle(%p) s(%p), handle(%d), rate(%d), ch(%d)",
+                         phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels);
 
        switch (phandle->mode) {
        case HANDLE_MODE_OUTPUT:
@@ -481,7 +459,7 @@ int mm_sound_pa_close(const int handle)
        pa_simple_free(phandle->s);
        phandle->s = NULL;
 
-       debug_msg("leave: handle[%d] stream_index[%d]", handle, phandle->stream_idx);
+       debug_msg("leave: handle[%d]", handle);
 
        mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
        if (phandle != NULL) {