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);