handle_s *handle = NULL;
/* Check argument here */
- if(MMHandle == NULL) {
+ if (MMHandle == NULL) {
debug_error ("Invalid arguments [tag null]\n");
return MM_ERROR_INVALID_ARGUMENT;
}
*MMHandle = (MMHandleType)handle;
- if(MMHandle) {
+ if (MMHandle) {
debug_log("MMHandle: 0x%2x", handle);
handle->property->_MMHandle = 0;
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if((in_Filename == NULL) || (strlen (in_Filename) == 0)) {
+ if ((in_Filename == NULL) || (strlen (in_Filename) == 0)) {
debug_error("Invalid Input file");
return MM_ERROR_INVALID_ARGUMENT;
}
- if(videoencoder == MM_VIDEOENCODER_NO_USE && audioencoder == MM_AUDIOENCODER_NO_USE) {
+ if (videoencoder == MM_VIDEOENCODER_NO_USE && audioencoder == MM_AUDIOENCODER_NO_USE) {
debug_error("No encoder resource");
return MM_ERROR_INVALID_ARGUMENT;
}
- if(videoencoder == MM_VIDEOENCODER_H264) {
+ if (videoencoder == MM_VIDEOENCODER_H264) {
debug_error("Can't support encoding to H264");
return MM_ERROR_INVALID_ARGUMENT;
}
/* set element*/
ret = _mm_transcode_set_handle_element(handle, in_Filename, containerformat, videoencoder, audioencoder);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Set element");
return ret;
}
debug_log("%s == %s", handle->property->sourcefile, in_Filename);
- if(0 == strlen(handle->property->sourcefile) || 0 == strcmp(handle->property->sourcefile, in_Filename)) { /* protect the case of changing input file during transcoding */
+ if (0 == strlen(handle->property->sourcefile) || 0 == strcmp(handle->property->sourcefile, in_Filename)) { /* protect the case of changing input file during transcoding */
/* setup */
ret = _mm_setup_pipeline(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Setup Pipeline");
} else{
debug_error("ERROR - Setup Pipeline");
/* video / auido stream */
ret = _mm_transcode_get_stream_info(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Get stream info");
} else{
debug_error("ERROR - Get stream info");
/* create pipeline */
ret = _mm_transcode_create(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Create Pipeline");
} else{
debug_error("ERROR -Create Pipeline");
/*link pipeline */
ret = _mm_transcode_link(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Link pipeline");
} else{
debug_error("ERROR - Link pipeline");
/* flush param */
ret = _mm_transcode_param_flush(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Init parameter");
} else{
debug_error("ERROR - Init parameter");
/* create thread */
ret = _mm_transcode_thread(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Link pipeline");
} else{
debug_error("ERROR - Link pipeline");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(!completed_callback) {
+ if (!completed_callback) {
debug_error("[ERROR] - completed_callback");
return MM_ERROR_INVALID_ARGUMENT;
}
- if(!out_Filename) {
+ if (!out_Filename) {
debug_error("[ERROR] - out_Filename");
return MM_ERROR_INVALID_ARGUMENT;
}
- if(duration < MIN_DURATION && duration !=0) {
+ if (duration < MIN_DURATION && duration !=0) {
debug_error("The minimum seek duration is 1000 msec ");
return MM_ERROR_INVALID_ARGUMENT;
}
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->_MMHandle == 1) { /* check if prepare is called during transcoding */
+ if (handle->property->_MMHandle == 1) { /* check if prepare is called during transcoding */
handle_param_s *param = g_new0 (handle_param_s, 1);
- if(param) {
+ if (param) {
/*g_value_init (param, G_TYPE_INT);*/
debug_log("[param] 0x%2x", param);
}
/* set parameter*/
ret = _mm_transcode_set_handle_parameter(param, resolution_width, resolution_height, fps_value, start_position, duration, seek_mode, out_Filename);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Set parameter");
return ret;
}
ret = _mm_transcode_preset_capsfilter(handle, resolution_width, resolution_height);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Preset Capsfilter");
} else{
debug_error("ERROR - Preset Capsfilter");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->is_busy) {
+ if (handle->property->is_busy) {
debug_log("Cancel - [IS BUSY]");
ret = _mm_transcode_state_change(handle, GST_STATE_NULL);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR - Null Pipeline");
return ret;
}
- if((handle->param) && (strlen(handle->param->outputfile) > 0)) {
+ if ((handle->param) && (strlen(handle->param->outputfile) > 0)) {
unlink(handle->param->outputfile);
debug_log("[Cancel] unlink %s", handle->param->outputfile);
} else {
g_mutex_lock(handle->property->thread_exit_mutex);
handle->property->repeat_thread_exit = TRUE;
- if(handle->property->is_busy) {
+ if (handle->property->is_busy) {
ret = mm_transcode_cancel(MMHandle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Cancel Transcode");
} else{
debug_error("ERROR - Cancel Transcode");
g_mutex_unlock(handle->property->thread_exit_mutex);
handle_param_s *param = g_new0 (handle_param_s, 1);
- if(param) {
+ if (param) {
debug_log("[Try to Push Last Queue]");
g_async_queue_push (handle->property->queue, GINT_TO_POINTER(param));
} else {
}
ret = _mm_transcode_state_change(handle, GST_STATE_NULL);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR - Null Pipeline");
return ret;
} else {
debug_log("SUCCESS - Null Pipeline");
}
- if((handle->param) && (!handle->param->completed)) {
+ if ((handle->param) && (!handle->param->completed)) {
g_cond_signal(handle->property->thread_cond);
debug_log("===> send completed signal <-destroy");
g_mutex_unlock (handle->property->thread_mutex);
debug_log("unlock destory");
- if(strlen(handle->param->outputfile) > 0) {
+ if (strlen(handle->param->outputfile) > 0) {
unlink(handle->param->outputfile);
debug_log("[Cancel] unlink %s", handle->param->outputfile);
}
}
ret = _mm_cleanup_pipeline(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - CleanUp Pipeline");
} else{
debug_error("ERROR - CleanUp Pipeline");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(!containerformat || !videoencoder ||!audioencoder || !current_pos || !duration || !resolution_width || !resolution_height) {
+ if (!containerformat || !videoencoder ||!audioencoder || !current_pos || !duration || !resolution_width || !resolution_height) {
debug_error("[ERROR] - Invalid argument pointer");
return MM_ERROR_INVALID_ARGUMENT;
}
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->current_pos > handle->param->duration) {
+ if (handle->property->current_pos > handle->param->duration) {
*current_pos = handle->param->duration;
} else {
*current_pos = handle->property->current_pos;
{
int idx = 0;
- for(idx = 0; idx < MM_CONTAINER_NUM; idx++) {
- if(type_callback(idx, user_param) == false)
+ for (idx = 0; idx < MM_CONTAINER_NUM; idx++) {
+ if (type_callback(idx, user_param) == false)
{
debug_error("error occured. idx[%d]", idx);
break;
{
int idx = 0;
- for(idx = 0; idx < MM_VIDEOENCODER_H264; idx++) {
- if(type_callback(idx, user_param) == false)
+ for (idx = 0; idx < MM_VIDEOENCODER_H264; idx++) {
+ if (type_callback(idx, user_param) == false)
{
debug_error("error occured. idx[%d]", idx);
break;
{
int idx = 0;
- for(idx = 0; idx < MM_AUDIOENCODER_NO_USE; idx++) {
- if(type_callback(idx, user_param) == false)
+ for (idx = 0; idx < MM_AUDIOENCODER_NO_USE; idx++) {
+ if (type_callback(idx, user_param) == false)
{
debug_error("error occured. idx[%d]", idx);
break;
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->encodebin->encvideopad) {
+ if (handle->encodebin->encvideopad) {
gst_object_unref (GST_OBJECT(handle->encodebin->encvideopad));
handle->encodebin->encvideopad = NULL;
debug_log("Success - gst_object_unref (encvideopad)");
}
- if(handle->encodebin->encaudiopad) {
+ if (handle->encodebin->encaudiopad) {
gst_object_unref (GST_OBJECT(handle->encodebin->encaudiopad));
handle->encodebin->encaudiopad = NULL;
debug_log("Success - gst_object_unref (encaudiopad)");
}
- if(handle->property->caps) {
+ if (handle->property->caps) {
gst_caps_unref (handle->property->caps);
handle->property->caps = NULL;
debug_log("gst_caps_unref");
/* g_thread_exit(handle->thread); */
debug_log("g_thread_exit");
- if(handle->property->thread) {
+ if (handle->property->thread) {
g_thread_join(handle->property->thread);
debug_log("Success - join (thread)");
}
handle->property->bus_watcher = 0;
}
- if(handle->property->queue) {
+ if (handle->property->queue) {
g_async_queue_unref(handle->property->queue);
handle->property->queue = NULL;
debug_log("Success - g_async_queue_unref(queue)");
}
- if(handle->property->thread_mutex) {
+ if (handle->property->thread_mutex) {
g_mutex_free (handle->property->thread_mutex);
handle->property->thread_mutex = NULL;
debug_log("Success - free (thread_mutex)");
}
- if(handle->property->thread_cond) {
+ if (handle->property->thread_cond) {
g_cond_free (handle->property->thread_cond);
handle->property->thread_cond = NULL;
debug_log("Success - free (thread_cond)");
}
- if(handle->property->thread_exit_mutex) {
+ if (handle->property->thread_exit_mutex) {
g_mutex_free (handle->property->thread_exit_mutex);
handle->property->thread_exit_mutex = NULL;
debug_log("Success - free (thread_exit_mutex)");
}
/* release videopad */
- if(handle->decoder_vidp->decvideosinkpad) {
+ if (handle->decoder_vidp->decvideosinkpad) {
gst_object_unref(GST_OBJECT(handle->decoder_vidp->decvideosinkpad));
handle->decoder_vidp->decvideosinkpad = NULL;
debug_log("Success - gt_object_unref (decvideosinkpad)");
}
- if(handle->decoder_vidp->decvideosrcpad) {
+ if (handle->decoder_vidp->decvideosrcpad) {
gst_object_unref(GST_OBJECT(handle->decoder_vidp->decvideosrcpad));
handle->decoder_vidp->decvideosrcpad = NULL;
debug_log("Success - gst_object_unref (decvideosrcpad)");
}
- if(handle->decoder_vidp->srcdecvideopad) {
+ if (handle->decoder_vidp->srcdecvideopad) {
gst_object_unref (GST_OBJECT(handle->decoder_vidp->srcdecvideopad));
handle->decoder_vidp->srcdecvideopad = NULL;
debug_log("Success - gst_object_unref (srcdecvideopad)");
}
- if(handle->decoder_vidp->sinkdecvideopad) {
+ if (handle->decoder_vidp->sinkdecvideopad) {
gst_object_unref (GST_OBJECT(handle->decoder_vidp->sinkdecvideopad));
handle->decoder_vidp->sinkdecvideopad = NULL;
debug_log("Success - gst_object_unref (sinkdecvideopad)");
}
/* release audiopad */
- if(handle->decoder_audp->decaudiosinkpad) {
+ if (handle->decoder_audp->decaudiosinkpad) {
gst_object_unref (GST_OBJECT(handle->decoder_audp->decaudiosinkpad));
handle->decoder_audp->decaudiosinkpad = NULL;
debug_log("Success - gst_object_unref (decaudiosinkpad)");
}
- if(handle->decoder_audp->decaudiosrcpad) {
+ if (handle->decoder_audp->decaudiosrcpad) {
gst_object_unref (GST_OBJECT(handle->decoder_audp->decaudiosrcpad));
handle->decoder_audp->decaudiosrcpad=NULL;
debug_log("Success - gst_object_unref (decaudiosrcpad)");
}
- if(handle->decoder_audp->srcdecaudiopad) {
+ if (handle->decoder_audp->srcdecaudiopad) {
gst_object_unref (GST_OBJECT(handle->decoder_audp->srcdecaudiopad));
handle->decoder_audp->srcdecaudiopad = NULL;
debug_log("Success - gst_object_unref (srcdecaudiopad)");
}
- if(handle->decoder_audp->sinkdecaudiopad) {
+ if (handle->decoder_audp->sinkdecaudiopad) {
gst_object_unref (GST_OBJECT(handle->decoder_audp->sinkdecaudiopad));
handle->decoder_audp->sinkdecaudiopad = NULL;
debug_log("Success - gst_object_unref (sinkdecaudiopad)");
}
- if(_mm_cleanup_encodebin(handle) != MM_ERROR_NONE) {
+ if (_mm_cleanup_encodebin(handle) != MM_ERROR_NONE) {
debug_error("ERROR -Play Pipeline");
return FALSE;
} else {
debug_log("Success -clean encodebin");
}
- if(handle->property->sink_elements) {
+ if (handle->property->sink_elements) {
g_list_free (handle->property->sink_elements);
handle->property->sink_elements = NULL;
debug_log("Success - g_list_free (sink_elements)");
}
- if(handle->pipeline) {
+ if (handle->pipeline) {
gst_object_unref (handle->pipeline);
handle->pipeline = NULL;
debug_log("Success - gst_object_unref (pipeline)");
}
- if(handle->property->audio_cb_probe_id) {
+ if (handle->property->audio_cb_probe_id) {
g_source_remove (handle->property->audio_cb_probe_id);
handle->property->audio_cb_probe_id = 0;
debug_log("g_source_remove (audio_cb_probe_id)");
}
- if(handle->property->video_cb_probe_id) {
+ if (handle->property->video_cb_probe_id) {
g_source_remove (handle->property->video_cb_probe_id);
handle->property->video_cb_probe_id = 0;
debug_log("g_source_remove (video_cb_probe_id)");
}
- if(handle->property->progrss_event_id) {
+ if (handle->property->progrss_event_id) {
g_source_remove (handle->property->progrss_event_id);
handle->property->progrss_event_id = 0;
debug_log("g_source_remove (progrss_event_id)");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) {
+ if (handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) {
debug_log("[MM_AUDIOENCODER_NO_USE] fakesink create");
handle->decoder_audp->audiofakesink = gst_element_factory_make ("fakesink", "audiofakesink");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) {
+ if (handle->property->audioencoder == MM_AUDIOENCODER_NO_USE) {
debug_log("[MM_AUDIOENCODER_NO_USE] fakesink pad create");
gst_bin_add_many (GST_BIN (handle->decoder_audp->decaudiobin), handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->audiofakesink, NULL);
- if(!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->audiofakesink, NULL)) {
+ if (!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->audiofakesink, NULL)) {
debug_error("[Audio Output Bin] gst_element_link_many failed");
return MM_ERROR_TRANSCODE_INTERNAL;
}
handle->decoder_audp->sinkdecaudiopad = gst_element_get_static_pad (handle->decoder_audp->decaudiobin, "decbin_audiosink"); /* get sink audiopad of decodebin */
} else {
gst_bin_add_many (GST_BIN (handle->decoder_audp->decaudiobin), handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->valve, handle->decoder_audp->aconv, handle->decoder_audp->resample, handle->decoder_audp->audflt, NULL);
- if(!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->valve, handle->decoder_audp->aconv, handle->decoder_audp->resample, handle->decoder_audp->audflt, NULL)) {
+ if (!gst_element_link_many(handle->decoder_audp->decsinkaudioqueue, handle->decoder_audp->valve, handle->decoder_audp->aconv, handle->decoder_audp->resample, handle->decoder_audp->audflt, NULL)) {
debug_error("[Audio Output Bin] gst_element_link_many failed");
return MM_ERROR_TRANSCODE_INTERNAL;
}
handle->decoder_audp->sinkdecaudiopad = gst_element_get_static_pad (handle->decoder_audp->decaudiobin, "decbin_audiosink"); /* get sink audiopad of decodebin */
handle->decoder_audp->srcdecaudiopad = gst_element_get_static_pad (handle->decoder_audp->decaudiobin, "decbin_audiosrc"); /* get src audiopad of decodebin */
- handle->property->audio_cb_probe_id = gst_pad_add_probe (handle->decoder_audp->sinkdecaudiopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_audio_output_stream_probe, handle, NULL);
+ handle->property->audio_cb_probe_id = gst_pad_add_probe (handle->decoder_audp->sinkdecaudiopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_audio_output_stream_probe, handle, NULL);
debug_log("audio_cb_probe_id: %d", handle->property->audio_cb_probe_id); /* must use sinkpad (sinkpad => srcpad) for normal resized video buffer*/
}
}
gst_bin_add_many(GST_BIN(handle->decoder_vidp->decvideobin), handle->decoder_vidp->decsinkvideoqueue, handle->decoder_vidp->videoscale, handle->decoder_vidp->videorate, handle->decoder_vidp->vidflt, NULL);
- if(!gst_element_link_many(handle->decoder_vidp->decsinkvideoqueue, handle->decoder_vidp->videoscale, handle->decoder_vidp->videorate, handle->decoder_vidp->vidflt, NULL)) {
+ if (!gst_element_link_many(handle->decoder_vidp->decsinkvideoqueue, handle->decoder_vidp->videoscale, handle->decoder_vidp->videorate, handle->decoder_vidp->vidflt, NULL)) {
debug_error("[Video Output Bin] gst_element_link_many failed");
return MM_ERROR_TRANSCODE_INTERNAL;
}
}
ret = _mm_filesrc_pipeline_create(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Create filesrc pipeline");
} else{
debug_error("ERROR -Create filesrc pipeline");
return ret;
}
- if(handle->property->has_audio_stream) {
+ if (handle->property->has_audio_stream) {
ret = _mm_decode_audio_output_create(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Create audiobin pipeline: 0x%2x",handle->decoder_audp->decaudiobin);
} else{
debug_error("ERROR - Create audiobin pipeline");
}
}
- if(handle->property->has_video_stream) {
+ if (handle->property->has_video_stream) {
ret = _mm_decode_video_output_create(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Create videobin pipeline: 0x%2x",handle->decoder_vidp->decvideobin);
} else{
debug_error("ERROR -Create videobin pipeline");
}
ret = _mm_decodebin_pipeline_create(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - Create decodebin pipeline");
} else{
debug_error("ERROR - Create decodebin pipeline");
}
ret=_mm_filesrc_decodebin_link(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - _mm_filesrc_decodebin_link");
} else{
debug_error("ERROR - _mm_filesrc_decodebin_link");
return ret;
}
- if(handle->property->has_audio_stream) {
+ if (handle->property->has_audio_stream) {
ret = _mm_decode_audio_output_link(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - _mm_decode_audio_output_link");
} else{
debug_error("ERROR - _mm_decode_audio_output_link");
}
}
- if(handle->property->has_video_stream) {
+ if (handle->property->has_video_stream) {
ret=_mm_decode_video_output_link(handle);
- if(ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE) {
debug_log("Success - _mm_decode_video_output_link");
} else{
debug_error("ERROR - _mm_decode_video_output_link");
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->videoencoder != MM_VIDEOENCODER_NO_USE && handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
+ if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE && handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
ret = _mm_encodebin_set_video_property(handle);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Setup encodebin video property");
return ret;
}
ret = _mm_encodebin_set_audio_property(handle);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Setup encodebin audio property");
return ret;
}
- } else if(handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) {
+ } else if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) {
ret = _mm_encodebin_set_video_property(handle);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Setup encodebin video property");
return ret;
}
- } else if(handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
+ } else if (handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
handle->encodebin->encodebin_profile = 1;
debug_log("[AUDIO ONLY ENCODE]");
ret = _mm_encodebin_set_audio_property(handle);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Setup encodebin video property");
return ret;
}
debug_log("[Encodebin Profile: %d]", handle->encodebin->encodebin_profile);
ret = _mm_encodebin_set_property(handle);
- if(ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("ERROR -Setup encodebin property");
return ret;
}
/* Add encodebin to pipeline */
gst_bin_add(GST_BIN(handle->pipeline), handle->encodebin->encbin);
- if(handle->property->has_video_stream) {
- if(handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) {
+ if (handle->property->has_video_stream) {
+ if (handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) {
handle->encodebin->encvideopad = gst_element_get_request_pad(handle->encodebin->encbin, "video");
- if(handle->encodebin->encvideopad) {
+ if (handle->encodebin->encvideopad) {
debug_log("encvideopad: 0x%2x", handle->encodebin->encvideopad);
gst_pad_link(handle->decoder_vidp->srcdecvideopad, handle->encodebin->encvideopad);
} else {
}
}
- if(handle->property->has_audio_stream) {
- if(handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
+ if (handle->property->has_audio_stream) {
+ if (handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) {
handle->encodebin->encaudiopad = gst_element_get_request_pad(handle->encodebin->encbin, "audio");
- if(handle->encodebin->encaudiopad) {
+ if (handle->encodebin->encaudiopad) {
debug_log("encaudiopad: 0x%2x", handle->encodebin->encaudiopad);
- gst_pad_link(handle->decoder_audp->srcdecaudiopad, handle->encodebin->encaudiopad);
+ gst_pad_link(handle->decoder_audp->srcdecaudiopad, handle->encodebin->encaudiopad);
} else {
debug_error("error encaudiopad");
return MM_ERROR_TRANSCODE_INTERNAL;
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->has_audio_stream) {
+ if (handle->property->has_audio_stream) {
/* Audio */
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ARS)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ARS)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), ARS, 0, NULL);
debug_log("[AUDIO RESAMPLE] encbin set auto-audio-resample");
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACON)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACON)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), ACON, 1, NULL);
debug_log("encbin set auto-audio-convert");
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), AENC)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), AENC)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), AENC, handle->property->aenc, NULL);
debug_log("[AUDIOENCODER] encbin set [%s: %s]",AENC, handle->property->aenc);
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_strcmp0(handle->property->aenc, AACENC) == 0) {
+ if (g_strcmp0(handle->property->aenc, AACENC) == 0) {
g_object_set(G_OBJECT(gst_bin_get_by_name(GST_BIN(handle->encodebin->encbin), "audio_encode")), AACCOMPLIANCE, AACCOMPLIANCELEVEL, NULL);
}
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), PROFILE)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), PROFILE)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), PROFILE, handle->encodebin->encodebin_profile, NULL);
debug_log("encbin set profile");
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), MUX)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), MUX)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), MUX, handle->property->mux, NULL);
debug_log("[MUX] encbin set [%s: %s]", MUX, handle->property->mux);
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(handle->property->has_video_stream) {
+ if (handle->property->has_video_stream) {
/* Video */
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACS)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), ACS)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), ACS, 0, NULL);
debug_log("[AUTO COLORSPACE] encbin set auto-colorspace");
} else {
return MM_ERROR_TRANSCODE_INTERNAL;
}
- if(g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), VENC)) {
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(handle->encodebin->encbin)), VENC)) {
g_object_set(G_OBJECT(handle->encodebin->encbin), VENC, handle->property->venc, NULL);
debug_log("[VIDEOENCODER] encbin set [%s: %s]", VENC, handle->property->venc);
} else {
}
handle->filesink = gst_element_factory_make ("filesink", "filesink");
- debug_log("[sync]");
- g_object_set (G_OBJECT (handle->filesink), "sync", TRUE, NULL);
- g_object_set (G_OBJECT (handle->filesink), "async", FALSE, NULL);
if (!handle->filesink) {
debug_error("filesink element could not be created");
return MM_ERROR_TRANSCODE_INTERNAL;
}
+ debug_log("[sync]");
+ g_object_set (G_OBJECT (handle->filesink), "sync", TRUE, NULL);
+ g_object_set (G_OBJECT (handle->filesink), "async", FALSE, NULL);
+
return ret;
}
gst_bin_add(GST_BIN(handle->pipeline), handle->filesink);
/* link encodebin and filesink */
- if(!gst_element_link(handle->encodebin->encbin, handle->filesink)) {
+ if (!gst_element_link(handle->encodebin->encbin, handle->filesink)) {
debug_error("gst_element_link [encbin ! filesink] failed");
return MM_ERROR_TRANSCODE_INTERNAL;
} else {
/* Add element(filesrc, decodebin)*/
gst_bin_add_many(GST_BIN(handle->pipeline), handle->filesrc, handle->decodebin, NULL);
- if(!gst_element_link_many(handle->filesrc, handle->decodebin, NULL)) {
+ if (!gst_element_link_many(handle->filesrc, handle->decodebin, NULL)) {
debug_error("gst_element_link_many src ! decbin failed");
return MM_ERROR_TRANSCODE_INTERNAL;
}
if (!handle) {
debug_error("[ERROR] - handle");
- return GST_PAD_PROBE_REMOVE;
+ return GST_PAD_PROBE_REMOVE;
}
if (!handle->property) {
debug_error("[ERROR] - handle property");
- return GST_PAD_PROBE_REMOVE;
+ return GST_PAD_PROBE_REMOVE;
}
gint64 start_pos_ts = handle->param->start_pos * G_GINT64_CONSTANT(1000000);
- if(GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) {
- if(0 == handle->property->AUDFLAG++) {
+ if (GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) {
+ if (0 == handle->property->AUDFLAG++) {
_mm_transcode_audio_capsfilter(gst_pad_get_current_caps (pad), handle); /* Need to audio caps converting when amrnbenc*/ /* Not drop buffer with 'return FALSE'*/
- if(handle->param->seeking) {
+ if (handle->param->seeking) {
debug_log("[AUDIO BUFFER TIMESTAMP] ([%"G_GUINT64_FORMAT"])", start_pos_ts);
GST_BUFFER_TIMESTAMP (GST_PAD_PROBE_INFO_BUFFER(info)) = start_pos_ts;
}
}
}
- return GST_PAD_PROBE_OK;
+ return GST_PAD_PROBE_OK;
}
GstAutoplugSelectResult
}
if(g_strrstr(caps_str, "video")) {
+ if(g_strrstr(feature_name, "omx")) {
+ /* emit autoplug-select to see what we should do with it. */
+ debug_log("SKIP HW Codec");
+ return GST_AUTOPLUG_SELECT_SKIP;
+ }
handle->property->videodecodename = (char*)malloc(sizeof(char) * ENC_BUFFER_SIZE);
if(handle->property->videodecodename == NULL) {
debug_error("videodecodename is NULL");
return FALSE;
}
- if(!handle->property->repeat_thread_exit) { /* To avoid gst_element_query_position bs */
- if (gst_element_query_position (handle->pipeline, fmt, &pos)) {
+ if (!handle->property->repeat_thread_exit) { /* To avoid gst_element_query_position bs */
+ if (gst_element_query_position (handle->pipeline, fmt, &pos)) {
unsigned long current_pos =(unsigned long)(GST_TIME_AS_MSECONDS(pos));
- if(handle->param->seeking == FALSE) {
+ if (handle->param->seeking == FALSE) {
handle->property->current_pos = current_pos;
handle->property->real_duration= handle->property->total_length;
- } else if(handle->param->seeking == TRUE) {
+ } else if (handle->param->seeking == TRUE) {
handle->property->current_pos = current_pos - handle->param->start_pos;
- if(handle->param->duration != 0) {
- if(handle->param->start_pos + handle->param->duration > handle->property->total_length) {
+ if (handle->param->duration != 0) {
+ if (handle->param->start_pos + handle->param->duration > handle->property->total_length) {
handle->property->real_duration = handle->property->total_length - handle->param->start_pos;
} else {
handle->property->real_duration = handle->param->duration;
}
- } else if(handle->param->duration == 0) { /* seek to origin file length */
+ } else if (handle->param->duration == 0) { /* seek to origin file length */
handle->property->real_duration = handle->property->total_length - handle->param->start_pos;
}
}
- if(handle->property->current_pos <= handle->property->real_duration) {
- if(handle->property->current_pos == 0 && handle->param->printed > 2) { /* 2 = 1000 / 500 minimum printed cnt for last buffer */
+ if (handle->property->current_pos <= handle->property->real_duration) {
+ if (handle->property->current_pos == 0 && handle->param->printed > 2) { /* 2 = 1000 / 500 minimum printed cnt for last buffer */
handle->property->current_pos = handle->property->real_duration;
}
- if(handle->property->progress_cb) {
- if(0 == handle->param->printed) {/* for first buffer */
+ if( handle->property->progress_cb) {
+ if (0 == handle->param->printed) {/* for first buffer */
handle->property->current_pos = 0;
}
handle->property->progress_cb(handle->property->current_pos, handle->property->real_duration, handle->property->progress_cb_param);
if (!handle) {
debug_error("[ERROR] - handle");
- return GST_PAD_PROBE_REMOVE;
+ return GST_PAD_PROBE_REMOVE;
}
if (!handle->property) {
debug_error("[ERROR] - handle property");
- return GST_PAD_PROBE_REMOVE;
+ return GST_PAD_PROBE_REMOVE;
}
gint64 start_pos_ts = handle->param->start_pos * G_GINT64_CONSTANT(1000000);
- if(GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) {
- if(0 == handle->property->VIDFLAG++) {
+ if (GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) {
+ if (0 == handle->property->VIDFLAG++) {
_mm_transcode_video_capsfilter(gst_pad_get_current_caps (pad), handle); /* Not drop buffer with 'return FALSE'*/
if(handle->param->seeking) {
break;
}
- if(gst_element_query_duration (handle->pipeline, fmt, &total_length) && handle->property->total_length == 0) {
+ if (gst_element_query_duration (handle->pipeline, fmt, &total_length) && handle->property->total_length == 0) {
debug_log("[GST_MESSAGE_ASYNC_DONE] Total Duration: %" G_GUINT64_FORMAT " ", total_length);
handle->property->total_length = (unsigned long)(GST_TIME_AS_MSECONDS(total_length));
}
}
memset(handle->param->outputfile, 0, BUFFER_SIZE);
- strncpy(handle->param->outputfile, param->outputfile, strlen(param->outputfile) - 1);
+ strncpy(handle->param->outputfile, param->outputfile, strlen(param->outputfile));
handle->param->seeking = param->seeking;
handle->param->async_done = FALSE;
debug_log("Input Width: [%d] Input Hieght: [%d] Output Width: [%d], Output Height: [%d]", handle->property->in_width, handle->property->in_height, handle->param->resolution_width, handle->param->resolution_height);
g_object_set (G_OBJECT (handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple(handle->property->mime,
- "format", G_TYPE_STRING, handle->property->format,
+ "format", G_TYPE_STRING, handle->property->format,
"width", G_TYPE_INT, handle->param->resolution_width,
"height", G_TYPE_INT, handle->param->resolution_height,
"framerate", GST_TYPE_FRACTION, handle->property->fps_n, handle->property->fps_d,
const gchar* format = gst_structure_get_string(_str, "format");
strncpy(handle->property->format, format, sizeof(handle->property->format));
+ handle->property->format[sizeof(handle->property->format)-1] = '\0';
+
switch (gst_video_format_from_string(handle->property->format)) {
- case GST_VIDEO_FORMAT_I420:
- case GST_VIDEO_FORMAT_RGB:
- case GST_VIDEO_FORMAT_NV12:
- debug_log("format: %s", handle->property->format);
- break;
+ case GST_VIDEO_FORMAT_I420:
+ case GST_VIDEO_FORMAT_RGB:
+ case GST_VIDEO_FORMAT_NV12:
+ debug_log("format: %s", handle->property->format);
+ break;
- case GST_VIDEO_FORMAT_UNKNOWN:
- if (strcmp(handle->property->format, "SN12") == 0 || strcmp(handle->property->format, "ST12") == 0) {
- debug_log("format: %s", handle->property->format);
- }
- break;
+ case GST_VIDEO_FORMAT_UNKNOWN:
+ if (strcmp(handle->property->format, "SN12") == 0 || strcmp(handle->property->format, "ST12") == 0) {
+ debug_log("format: %s", handle->property->format);
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
if(!gst_structure_get_int(_str, "width", &handle->property->in_width) || !gst_structure_get_int(_str, "height", &handle->property->in_height)) {
handle->property->sourcefile = malloc(sizeof(char) * BUFFER_SIZE);
if(handle->property->sourcefile) {
memset(handle->property->sourcefile, 0, BUFFER_SIZE);
- strncpy(handle->property->sourcefile, in_Filename, strlen (in_Filename) - 1);
+ strncpy(handle->property->sourcefile, in_Filename, strlen (in_Filename));
+ debug_log("%s", handle->property->sourcefile);
} else {
debug_error("[ERROR] malloc fail of sourcefile");
return MM_ERROR_TRANSCODE_INTERNAL;
return MM_ERROR_TRANSCODE_NO_FREE_SPACE;
}
memset(param->outputfile, 0, BUFFER_SIZE);
- strncpy(param->outputfile, out_Filename, strlen (out_Filename) - 1);
+ strncpy(param->outputfile, out_Filename, strlen (out_Filename));
debug_log("%s(%d)", param->outputfile, strlen (out_Filename));
debug_log("output file name: %s", param->outputfile);
} else {