Delete unreached code and unused function. 82/100682/3
authorSeokHoon Lee <andy.shlee@samsung.com>
Tue, 29 Nov 2016 03:24:12 +0000 (12:24 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Tue, 29 Nov 2016 08:20:14 +0000 (17:20 +0900)
Load default value without ini file.
Fix failure for setting attribute on 64bit environment

[Version] 0.0.9
[Profile] Common
[Issue Type] Code refactoring
[Dependency module] N/A[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20161128.2]

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: I549d25086300286c776b5e965bc7da1bc8240ba7

packaging/libmm-streamrecorder.spec
src/include/mm_streamrecorder_recorder.h
src/mm_streamrecorder_attribute.c
src/mm_streamrecorder_gstdispatch.c
src/mm_streamrecorder_ini.c
src/mm_streamrecorder_internal.c
src/mm_streamrecorder_recorder.c

index 2f59972..9a6cd9f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-streamrecorder
 Summary:    Media Stream Recorder library
-Version:    0.0.8
+Version:    0.0.9
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
index f4f74db..20a27b0 100644 (file)
@@ -140,53 +140,6 @@ int _mmstreamrecorder_destroy_recorder_pipeline(MMHandleType handle);
 // COMMAND
 int _mmstreamrecorder_video_command(MMHandleType handle, int command);
 
-/**
- * This function creates audio pipeline for audio recording.
- *
- * @param[in]  handle          Handle of streamrecorder.
- * @return     This function returns MM_ERROR_NONE on success, or others on failure.
- * @remarks
- * @see                _mmstreamrecorder_destroy_audio_pipeline()
- *
- */
-int _mmstreamrecorder_create_audio_pipeline(MMHandleType handle);
-
-/**
- * This function destroy audio pipeline.
- *
- * @param[in]  handle          Handle of streamrecorder.
- * @return     void
- * @remarks
- * @see                _mmstreamrecorder_destroy_pipeline()
- *
- */
-void _mmstreamrecorder_destroy_audio_pipeline(MMHandleType handle);
-
-/**
- * This function runs command for audio recording.
- *
- * @param[in]  handle          Handle of streamrecorder.
- * @param[in]  command         audio recording command.
- * @return     This function returns MM_ERROR_NONE on success, or others on failure.
- * @remarks
- * @see
- *
- */
-int _mmstreamrecorder_audio_command(MMHandleType handle, int command);
-
-/**
- * This function handles EOS(end of stream) when audio recording is finished.
- *
- * @param[in]  handle          Handle of streamrecorder.
- * @return     This function returns TRUE on success, or FALSE on failure.
- * @remarks
- * @see
- *
- */
-int _mmstreamrecorder_audio_handle_eos(MMHandleType handle);
-
-int _mmstreamrecorder_create_audiop_with_encodebin(MMHandleType handle);
-
 int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size);
 int _mmstreamrecorder_push_audiostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size);
 
index 9d8fbe3..ce9a771 100644 (file)
@@ -846,9 +846,13 @@ int _mmstreamrecorder_set_attributes(MMHandleType handle, char **err_attr_name,
 {
        MMHandleType attrs = 0;
        int ret = MM_ERROR_NONE;
+       va_list var_args_copy;
 
        mmf_return_val_if_fail(handle, MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT);
 
+       /* copy var_args to keep original var_args */
+       va_copy(var_args_copy, var_args);
+
        attrs = MMF_STREAMRECORDER_ATTRS(handle);
        if (!attrs) {
                _mmstreamrec_dbg_err("handle 0x%x, attrs is NULL, attr name [%s]", handle, attribute_name);
@@ -859,8 +863,11 @@ int _mmstreamrecorder_set_attributes(MMHandleType handle, char **err_attr_name,
 
        _mmstreamrec_dbg_err("__mmstreamrecorder_check_valid_pair handle 0x%x, attr name [%s] , ret = %d", handle, attribute_name, ret);
 
-       if (ret == MM_ERROR_NONE)
-               ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args);
+       if (ret == MM_ERROR_NONE) {
+               /* In 64bit environment, unexpected result is returned if var_args is used again. */
+               ret = mm_attrs_set_valist(attrs, err_attr_name, attribute_name, var_args_copy);
+       }
+       va_end(var_args_copy);
 
        _mmstreamrec_dbg_err("mm_attrs_set_valist handle 0x%x, attr name [%s] , ret = %d", handle, attribute_name, ret);
        return ret;
index e53c821..d572501 100644 (file)
@@ -752,17 +752,10 @@ gboolean _mmstreamrecorder_pipeline_cb_message(GstBus *bus, GstMessage *message,
                        sc = MMF_STREAMRECORDER_SUBCONTEXT(hstreamrecorder);
                        mmf_return_val_if_fail(sc, TRUE);
 
-                       /*if (hstreamrecorder->type != MM_STREAMRECORDER_MODE_AUDIO) { */
                        mmf_return_val_if_fail(sc->info_video, TRUE);
                        if (sc->info_video->b_commiting) {
                                _mmstreamrecorder_video_handle_eos((MMHandleType) hstreamrecorder);
                        }
-                       /*} else {
-                          mmf_return_val_if_fail(sc->info_audio, TRUE);
-                          if (sc->info_audio->b_commiting) {
-                          _mmstreamrecorder_audio_handle_eos((MMHandleType)hstreamrecorder);
-                          }
-                          } */
 
                        sc->bget_eos = TRUE;
 
index 240e0ae..d5125e4 100644 (file)
@@ -86,12 +86,6 @@ int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t *ini)
        /* first, try to load existing ini file */
        dict = iniparser_load(MM_STREAMRECORDER_INI_DEFAULT_PATH);
 
-       /* if no file exists. create one with set of default values */
-       if (!dict) {
-               _mmstreamrec_dbg_err("No ini file found. \n");
-               return MM_ERROR_FILE_NOT_FOUND;
-       }
-
        /* get ini values */
        memset(ini, 0, sizeof(mm_streamrecorder_ini_t));
 
@@ -176,13 +170,16 @@ int _mm_streamrecorder_ini_load(mm_streamrecorder_ini_t *ini)
                ini->video_frame_wait_time = DEFAULT_VIDEO_FRAME_WAIT_TIME;
 
                /*supported attributes*/
+               __get_element_list(ini, (char *)DEFAULT_SUPPORTED_HEIGHT, KEYWORD_VIDEO_HEIGHT);
+               __get_element_list(ini, (char *)DEFAULT_SUPPORTED_WIDTH, KEYWORD_VIDEO_WIDTH);
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_AUDIO_ENCODERS, KEYWORD_AUDIO_ENCODERS);
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_VIDEO_ENCODERS, KEYWORD_VIDEO_ENCODERS);
                __get_element_list(ini, (char *)DEFAULT_SUPPORTED_FILE_FORMATS, KEYWORD_FILE_FORMATS);
        }
 
        /* free dict as we got our own structure */
-       iniparser_freedict(dict);
+       if(dict)
+               iniparser_freedict(dict);
 
        /* dump structure */
        _mmstreamrec_dbg_log("[Stream Recorder initial setting][Start]");
@@ -262,6 +259,22 @@ void    __get_element_list(mm_streamrecorder_ini_t* ini, gchar* str, int keyword
 
        /* copy list */
        switch (keyword_type) {
+       case KEYWORD_VIDEO_HEIGHT:
+       {
+               for (walk = list; *walk; walk++) {
+                       ini->supported_video_height[i] = atoi(*walk);
+                       i++;
+               }
+               break;
+       }
+       case KEYWORD_VIDEO_WIDTH:
+       {
+               for (walk = list; *walk; walk++) {
+                       ini->supported_video_width[i] = atoi(*walk);
+                       i++;
+               }
+               break;
+       }
        case KEYWORD_AUDIO_ENCODERS:
        {
                for (walk = list; *walk; walk++) {
index b9f6da6..5293609 100644 (file)
@@ -648,7 +648,7 @@ int _mmstreamrecorder_alloc_subcontext(MMHandleType handle)
                goto ALLOC_SUBCONTEXT_FAILED;
        }
 
-       _mmstreamrecorder_alloc_subcontext_audioinfo((MMHandleType) hstreamrecorder);
+       ret = _mmstreamrecorder_alloc_subcontext_audioinfo((MMHandleType) hstreamrecorder);
        if (ret != MM_ERROR_NONE) {
                _mmstreamrec_dbg_err("Failed to allocate subcontext audioinfo");
                goto ALLOC_SUBCONTEXT_FAILED;
index bfd8046..d59cea5 100644 (file)
@@ -1325,520 +1325,6 @@ int _mmstreamrecorder_video_handle_eos(MMHandleType handle)
        return TRUE;
 }
 
-/* AUDIO */
-
-int _mmstreamrecorder_create_audio_pipeline(MMHandleType handle)
-{
-       mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
-       _MMStreamRecorderSubContext *sc = NULL;
-
-       mmf_return_val_if_fail(hstreamrecorder, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
-
-       mmf_return_val_if_fail(sc, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-
-       return _mmstreamrecorder_create_audiop_with_encodebin(handle);
-}
-
-/**
- * This function destroy audio pipeline.
- *
- * @param[in]  handle          Handle of streamrecorder.
- * @return     void
- * @remarks
- * @see                _mmstreamrecorder_destroy_audio_pipeline()
- *
- */
-void _mmstreamrecorder_destroy_audio_pipeline(MMHandleType handle)
-{
-       mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
-       _MMStreamRecorderSubContext *sc = NULL;
-       _MMStreamRecorderAudioInfo *info = NULL;
-       mmf_return_if_fail(hstreamrecorder);
-       sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
-
-       mmf_return_if_fail(sc && sc->info_audio);
-
-       info = sc->info_audio;
-
-       _mmstreamrec_dbg_log("start");
-
-       if (sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst) {
-               _mmstreamrec_dbg_warn("release audio pipeline");
-
-               _mmstreamrecorder_gst_set_state(handle, sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst, GST_STATE_NULL);
-
-               _mmstreamrecorder_remove_all_handlers((MMHandleType) hstreamrecorder, _MMSTREAMRECORDER_HANDLER_CATEGORY_ALL);
-
-               if (info->bMuxing) {
-                       GstPad *reqpad = NULL;
-                       /* FIXME:
-                          Release request pad
-                          The ref_count of mux is always # of streams in here, i don't know why it happens.
-                          So, i unref the mux manually
-                        */
-                       reqpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "audio");
-                       gst_element_release_request_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, reqpad);
-                       gst_object_unref(reqpad);
-
-                       if (GST_IS_ELEMENT(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst) && GST_OBJECT_REFCOUNT(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst) > 1) {
-                               gst_object_unref(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst);
-                       }
-               }
-               gst_object_unref(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst);
-       }
-
-       _mmstreamrec_dbg_log("done");
-
-       return;
-}
-
-int _mmstreamrecorder_create_audiop_with_encodebin(MMHandleType handle)
-{
-       int err = MM_ERROR_NONE;
-       char *aenc_name = NULL;
-       char *mux_name = NULL;
-       char *err_name = NULL;
-       int rec_mode = 0;
-
-       GstBus *bus = NULL;
-       GstPad *srcpad = NULL;
-       GstPad *sinkpad = NULL;
-       GList *element_list = NULL;
-
-       _MMStreamRecorderAudioInfo *info = NULL;
-       mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
-       _MMStreamRecorderSubContext *sc = NULL;
-       /* type_element *aenc_elem = NULL; */
-       /* type_element *mux_elem = NULL; */
-
-       mmf_return_val_if_fail(hstreamrecorder, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
-
-       mmf_return_val_if_fail(sc, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->info_audio, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-
-       info = (_MMStreamRecorderAudioInfo *) sc->info_audio;
-
-       _mmstreamrec_dbg_log("");
-
-       err = mm_streamrecorder_get_attributes(handle, &err_name, MMSTR_RECORDER_MODE, &rec_mode, NULL);
-
-       if (!mux_name || !strcmp(mux_name, "wavenc")) {
-               /* IF MUX in not chosen then record in raw file */
-               _mmstreamrec_dbg_log("Record without muxing.");
-               info->bMuxing = FALSE;
-       } else {
-               _mmstreamrec_dbg_log("Record with mux.");
-               info->bMuxing = TRUE;
-       }
-
-       /* Create GStreamer pipeline */
-       _MMSTREAMRECORDER_PIPELINE_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE, "recorder_pipeline", err);
-
-       err = _mmstreamrecorder_create_audiosrc_bin(handle);
-       if (err != MM_ERROR_NONE)
-               return err;
-
-       if (info->bMuxing) {
-               /* Muxing. can use encodebin. */
-               err = _mmstreamrecorder_create_encodesink_bin((MMHandleType) hstreamrecorder, MM_STREAMRECORDER_ENCBIN_PROFILE_AUDIO);
-               if (err != MM_ERROR_NONE)
-                       return err;
-
-       } else {
-               /* without muxing. can't use encodebin. */
-
-               _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_AQUE, "queue", NULL, element_list, err);
-
-               if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
-                       if (strcmp(hstreamrecorder->ini.name_of_encsink_bin_audio_encoder, "wavenc") != 0) {
-                               _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_CONV, "audioconvert", NULL, element_list, err);
-                       }
-               }
-
-               _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_AENC, aenc_name, NULL, element_list, err);
-
-               _MMSTREAMRECORDER_ELEMENT_MAKE(sc, sc->encode_element, _MMSTREAMRECORDER_ENCSINK_SINK, hstreamrecorder->ini.name_of_encsink_sink, NULL, element_list, err);
-       }
-
-       /* Add and link elements */
-       if (info->bMuxing) {
-               /* IF MUX is indicated create MUX */
-               gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, NULL);
-
-               srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, "src");
-               sinkpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_BIN].gst, "audio_sink0");
-               _MM_GST_PAD_LINK_UNREF(srcpad, sinkpad, err, pipeline_creation_error);
-       } else {
-               /* IF MUX in not chosen then record in raw amr file */
-               if (!strcmp(aenc_name, "wavenc")) {
-                       gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL);
-
-                       if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL)) {
-                               err = MM_ERROR_STREAMRECORDER_GST_LINK;
-                               goto pipeline_creation_error;
-                       }
-               } else {
-                       if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
-                               gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_CONV].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL);
-
-                               if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_CONV].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL)) {
-                                       err = MM_ERROR_STREAMRECORDER_GST_LINK;
-                                       goto pipeline_creation_error;
-                               }
-                       } else {
-                               gst_bin_add_many(GST_BIN(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst), sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL);
-
-                               if (!_MM_GST_ELEMENT_LINK_MANY(sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_BIN].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, NULL)) {
-                                       err = MM_ERROR_STREAMRECORDER_GST_LINK;
-                                       goto pipeline_creation_error;
-                               }
-                       }
-               }
-       }
-
-       if (info->bMuxing) {
-               MMSTREAMRECORDER_SIGNAL_CONNECT(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_MUX].gst, _MMSTREAMRECORDER_HANDLER_AUDIOREC, "pad-added", __mmstreamrecorder_audiorec_pad_added_cb, hstreamrecorder);
-       } else {
-               srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AENC].gst, "src");
-               MMSTREAMRECORDER_ADD_BUFFER_PROBE(srcpad, _MMSTREAMRECORDER_HANDLER_AUDIOREC, __mmstreamrecorder_audio_dataprobe_record, hstreamrecorder);
-               gst_object_unref(srcpad);
-               srcpad = NULL;
-       }
-
-       bus = gst_pipeline_get_bus(GST_PIPELINE(sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst));
-
-       /* register message callback  */
-       hstreamrecorder->pipeline_cb_event_id = gst_bus_add_watch(bus, (GstBusFunc) _mmstreamrecorder_pipeline_cb_message, hstreamrecorder);
-
-       /* set sync callback */
-       gst_bus_set_sync_handler(bus, gst_bus_sync_signal_handler, hstreamrecorder, NULL);
-
-       gst_object_unref(bus);
-       bus = NULL;
-
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
-       }
-
-       return MM_ERROR_NONE;
-
- pipeline_creation_error:
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCODE_MAIN_PIPE);
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_AUDIOSRC_BIN);
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_AQUE);
-       if (rec_mode == MM_STREAMRECORDER_MODE_MEDIABUFFER) {
-               _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_CONV);
-       }
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_AENC);
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_SINK);
-       _MMSTREAMRECORDER_ELEMENT_REMOVE(sc->encode_element, _MMSTREAMRECORDER_ENCSINK_BIN);
-
-       if (element_list) {
-               g_list_free(element_list);
-               element_list = NULL;
-       }
-
-       return err;
-}
-
-int _mmstreamrecorder_audio_command(MMHandleType handle, int command)
-{
-       int cmd = command;
-       int ret = MM_ERROR_NONE;
-       int err = 0;
-       guint64 free_space = 0;
-       guint64 cal_space = 0;
-       char *dir_name = NULL;
-       char *err_attr_name = NULL;
-       guint count = 0;
-       int size = 0;
-
-       GstElement *pipeline = NULL;
-       GstElement *audioSrc = NULL;
-
-       mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
-       _MMStreamRecorderSubContext *sc = NULL;
-       _MMStreamRecorderAudioInfo *info = NULL;
-       _MMStreamRecorderFileInfo *finfo = NULL;
-
-       mmf_return_val_if_fail(hstreamrecorder, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
-
-       mmf_return_val_if_fail(sc, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->info_audio, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       mmf_return_val_if_fail(sc->info_file, MM_ERROR_STREAMRECORDER_NOT_INITIALIZED);
-       pipeline = sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst;
-       info = sc->info_audio;
-       finfo = sc->info_file;
-
-       _mmstreamrec_dbg_log("");
-
-       pipeline = sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst;
-       audioSrc = sc->encode_element[_MMSTREAMRECORDER_AUDIOSRC_SRC].gst;
-       switch (cmd) {
-       case _MM_STREAMRECORDER_CMD_RECORD:
-               /* check status for resume case */
-               {
-                       guint imax_size = 0;
-                       guint imax_time = 0;
-                       char *temp_filename = NULL;
-
-                       if (sc->pipeline_time)
-                               gst_element_set_start_time((GstElement *) GST_PIPELINE(pipeline), sc->pipeline_time);
-
-                       sc->pipeline_time = hstreamrecorder->ini.reset_pause_time;
-
-                       ret = mm_streamrecorder_get_attributes(handle, &err_attr_name, MMSTR_TARGET_MAX_SIZE, &imax_size, MMSTR_TARGET_TIME_LIMIT, &imax_time, MMSTR_FILE_FORMAT, &(finfo->fileformat), MMSTR_FILENAME, &temp_filename, &size, NULL);
-                       if (ret != MM_ERROR_NONE) {
-                               _mmstreamrec_dbg_warn("failed to get attribute. (%s:%x)", err_attr_name, ret);
-                               SAFE_FREE(err_attr_name);
-                               goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-                       }
-
-                       finfo->filename = g_strdup(temp_filename);
-                       if (!finfo->filename) {
-                               _mmstreamrec_dbg_err("STRDUP was failed");
-                               goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-                       }
-
-                       _mmstreamrec_dbg_log("Record start : set file name using attribute - %s\n ", finfo->filename);
-
-                       MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, "location", finfo->filename);
-
-                       sc->ferror_send = FALSE;
-                       sc->ferror_count = 0;
-                       sc->bget_eos = FALSE;
-                       info->filesize = 0;
-
-                       /* set max size */
-                       if (imax_size <= 0)
-                               info->max_size = 0;     /* do not check */
-                       else
-                               info->max_size = ((guint64) imax_size) << 10;   /* to byte */
-
-                       /* set max time */
-                       if (imax_time <= 0)
-                               info->max_time = 0;     /* do not check */
-                       else
-                               info->max_time = ((guint64) imax_time) * 1000;  /* to millisecond */
-
-                       /* TODO : check free space before recording start, need to more discussion */
-                       dir_name = g_path_get_dirname(finfo->filename);
-                       err = _mmstreamrecorder_get_freespace(dir_name, &free_space);
-
-                       _mmstreamrec_dbg_warn("current space for recording - %s : [%" G_GUINT64_FORMAT "]", dir_name, free_space);
-
-                       if (dir_name) {
-                               g_free(dir_name);
-                               dir_name = NULL;
-                       }
-                       cal_space = (guint64)(hstreamrecorder->ini.audio_frame_minimum_space);
-                       cal_space = cal_space + (5 * 1024);
-                       if ((err == -1) || free_space <= cal_space) {
-                               _mmstreamrec_dbg_err("No more space for recording");
-                               return MM_MESSAGE_STREAMRECORDER_NO_FREE_SPACE;
-                       }
-               }
-
-               ret = _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-               if (ret != MM_ERROR_NONE)
-                       goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-
-               break;
-
-       case _MM_STREAMRECORDER_CMD_PAUSE:
-               {
-                       GstClock *l_clock = NULL;
-
-                       if (info->b_commiting) {
-                               _mmstreamrec_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                               return MM_ERROR_STREAMRECORDER_CMD_IS_RUNNING;
-                       }
-
-                       for (count = 0; count <= hstreamrecorder->ini.retrial_count; count++) {
-                               if (info->filesize > 0) {
-                                       break;
-                               } else if (count == hstreamrecorder->ini.retrial_count) {
-                                       _mmstreamrec_dbg_err("Pause fail, wait 200 ms, but file size is %lld", info->filesize);
-                                       return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
-                               } else {
-                                       _mmstreamrec_dbg_warn("Wait for enough audio frame, retry count[%d], file size is %lld", count, info->filesize);
-                               }
-                               usleep(hstreamrecorder->ini.audio_frame_wait_time);
-                       }
-
-                       ret = _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_PAUSED);
-                       if (ret != MM_ERROR_NONE)
-                               goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-
-                       /* FIXME: consider delay. */
-                       l_clock = gst_pipeline_get_clock(GST_PIPELINE(pipeline));
-                       sc->pipeline_time = gst_clock_get_time(l_clock) - gst_element_get_base_time(GST_ELEMENT(pipeline));
-                       break;
-               }
-
-       case _MM_STREAMRECORDER_CMD_CANCEL:
-               if (info->b_commiting) {
-                       _mmstreamrec_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                       return MM_ERROR_STREAMRECORDER_CMD_IS_RUNNING;
-               }
-
-               ret = _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-               if (ret != MM_ERROR_NONE)
-                       goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-
-               if (info->bMuxing) {
-                       MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
-               } else {
-                       MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
-               }
-
-               _mmstreamrecorder_gst_set_state(handle, sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SINK].gst, GST_STATE_NULL);
-
-               sc->pipeline_time = 0;
-               sc->pause_time = 0;
-               sc->isMaxsizePausing = FALSE;
-               sc->isMaxtimePausing = FALSE;
-
-               if (finfo->filename) {
-                       _mmstreamrec_dbg_log("file delete(%s)", finfo->filename);
-                       unlink(finfo->filename);
-                       g_free(finfo->filename);
-                       finfo->filename = NULL;
-               }
-               break;
-
-       case _MM_STREAMRECORDER_CMD_COMMIT:
-               {
-
-                       _mmstreamrec_dbg_log("_MM_STREAMRECORDER_CMD_COMMIT");
-
-                       if (info->b_commiting) {
-                               _mmstreamrec_dbg_warn("now on commiting previous file!!(cmd : %d)", cmd);
-                               return MM_ERROR_STREAMRECORDER_CMD_IS_RUNNING;
-                       } else {
-                               _mmstreamrec_dbg_log("_MM_STREAMRECORDER_CMD_COMMIT : start");
-                               info->b_commiting = TRUE;
-                       }
-
-                       for (count = 0; count <= hstreamrecorder->ini.retrial_count; count++) {
-                               if (info->filesize > 0) {
-                                       break;
-                               } else if (count == hstreamrecorder->ini.retrial_count) {
-                                       _mmstreamrec_dbg_err("Commit fail, waited 200 ms, but file size is %lld", info->filesize);
-                                       info->b_commiting = FALSE;
-                                       return MM_ERROR_STREAMRECORDER_INVALID_CONDITION;
-                               } else {
-                                       _mmstreamrec_dbg_warn("Waiting for enough audio frame, re-count[%d], file size is %lld", count, info->filesize);
-                               }
-                               usleep(hstreamrecorder->ini.audio_frame_wait_time);
-                       }
-
-                       if (audioSrc) {
-                               GstPad *pad = gst_element_get_static_pad(audioSrc, "src");
-                               ret = gst_element_send_event(audioSrc, gst_event_new_eos());
-                               gst_object_unref(pad);
-                               pad = NULL;
-                               /* for pause -> commit case */
-                               /*if (_mmstreamrecorder_get_state((MMHandleType)hstreamrecorder) == MM_STREAMRECORDER_STATE_PAUSED) {
-                                  ret = _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_PLAYING);
-                                  if (ret != MM_ERROR_NONE) {
-                                  goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-                                  }
-                                  } */
-                       }
-
-                       /* wait until finishing EOS */
-                       _mmstreamrec_dbg_log("Start to wait EOS");
-                       if ((ret = _mmstreamrecorder_get_eos_message(handle)) != MM_ERROR_NONE)
-                               goto _ERR_STREAMRECORDER_AUDIO_COMMAND;
-
-                       break;
-               }
-       default:
-               ret = MM_ERROR_STREAMRECORDER_INVALID_ARGUMENT;
-               break;
-       }
-
- _ERR_STREAMRECORDER_AUDIO_COMMAND:
-       return ret;
-}
-
-int _mmstreamrecorder_audio_handle_eos(MMHandleType handle)
-{
-       int err = MM_ERROR_NONE;
-       mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
-       _MMStreamRecorderSubContext *sc = NULL;
-       _MMStreamRecorderAudioInfo *info = NULL;
-       _MMStreamRecorderFileInfo *finfo = NULL;
-       GstElement *pipeline = NULL;
-       _MMStreamRecorderMsgItem msg;
-       MMStreamRecordingReport *report;
-
-       mmf_return_val_if_fail(hstreamrecorder, FALSE);
-       sc = MMF_STREAMRECORDER_SUBCONTEXT(handle);
-
-       mmf_return_val_if_fail(sc, FALSE);
-       mmf_return_val_if_fail(sc->info_audio, FALSE);
-       mmf_return_val_if_fail(sc->info_file, FALSE);
-
-       _mmstreamrec_dbg_err("");
-
-       info = sc->info_audio;
-       finfo = sc->info_file;
-
-       pipeline = sc->encode_element[_MMSTREAMRECORDER_ENCODE_MAIN_PIPE].gst;
-
-       err = _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_READY);
-
-       if (err != MM_ERROR_NONE)
-               _mmstreamrec_dbg_warn("Failed:_MM_STREAMRECORDER_CMD_COMMIT:GST_STATE_READY. err[%x]", err);
-
-       /* Send recording report message to application */
-       msg.id = MM_MESSAGE_STREAMRECORDER_AUDIO_CAPTURED;
-       report = (MMStreamRecordingReport *) g_malloc(sizeof(MMStreamRecordingReport));
-       if (!report) {
-               _mmstreamrec_dbg_err("Recording report fail(%s). Out of memory.", finfo->filename);
-               return FALSE;
-       }
-
-       /* START TAG HERE */
-       /* MM_AUDIO_CODEC_AAC + MM_FILE_FORMAT_MP4 */
-       if (finfo->fileformat == MM_FILE_FORMAT_3GP || finfo->fileformat == MM_FILE_FORMAT_MP4)
-               _mmstreamrecorder_audio_add_metadata_info_m4a(handle);
-       /* END TAG HERE */
-
-       report->recording_filename = g_strdup(finfo->filename);
-       msg.param.data = report;
-
-       _mmstreamrecorder_send_message(handle, &msg);
-
-       if (info->bMuxing) {
-               MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_ENCBIN].gst, "block", FALSE);
-       } else {
-               MMSTREAMRECORDER_G_OBJECT_SET(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_AQUE].gst, "empty-buffers", FALSE);
-       }
-
-       _mmstreamrecorder_gst_set_state(handle, pipeline, GST_STATE_NULL);
-
-       sc->pipeline_time = 0;
-       sc->pause_time = 0;
-       sc->isMaxsizePausing = FALSE;
-       sc->isMaxtimePausing = FALSE;
-
-       g_free(finfo->filename);
-       finfo->filename = NULL;
-
-       _mmstreamrec_dbg_err("_MM_STREAMRECORDER_CMD_COMMIT : end");
-
-       info->b_commiting = FALSE;
-
-       return TRUE;
-}
-
 int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long timestamp, GstBuffer *buffer, int size)
 {
        mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);