From: Gilbok Lee Date: Mon, 11 Nov 2019 08:34:44 +0000 (+0900) Subject: [0.6.208] Clean up _mmplayer_do_video_capture() function X-Git-Tag: submit/tizen_5.5/20191118.044645^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c9758c6ec590921f2534f7611a890363e1f35be;p=platform%2Fcore%2Fmultimedia%2Flibmm-player.git [0.6.208] Clean up _mmplayer_do_video_capture() function Change-Id: I31e3b857d3605b3c362b76062eee81464e3c7990 --- diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 67e6699..1ec3577 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -1,6 +1,6 @@ Name: libmm-player Summary: Multimedia Framework Player Library -Version: 0.6.207 +Version: 0.6.208 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_capture.c b/src/mm_player_capture.c index dd24c0d..45c638a 100644 --- a/src/mm_player_capture.c +++ b/src/mm_player_capture.c @@ -139,40 +139,32 @@ _mmplayer_do_video_capture(MMHandleType hplayer) pad = gst_element_get_static_pad(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "sink"); - if (player->state != MM_PLAYER_STATE_PLAYING) { - if (player->state == MM_PLAYER_STATE_PAUSED) { - // get last buffer from video sink - GstSample *sample = NULL; - - gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, 5 * GST_SECOND); //5 seconds - g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "last-sample", &sample, NULL); - - if (sample) { - GstBuffer *buf = NULL; - buf = gst_sample_get_buffer(sample); - if (buf) { - if (__mmplayer_get_video_frame_from_buffer(player, pad, buf) != MM_ERROR_NONE) - ret = MM_ERROR_PLAYER_INTERNAL; - } else { - LOGW("failed to get video frame"); - } - gst_sample_unref(sample); + if (player->state == MM_PLAYER_STATE_PLAYING) { + /* register probe */ + player->video_capture_cb_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, + __mmplayer_video_capture_probe, player, NULL); + } else if (player->state == MM_PLAYER_STATE_PAUSED) { + // get last buffer from video sink + GstSample *sample = NULL; + + gst_element_get_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, NULL, NULL, 5 * GST_SECOND); + g_object_get(player->pipeline->videobin[MMPLAYER_V_SINK].gst, "last-sample", &sample, NULL); + + if (sample) { + GstBuffer *buf = gst_sample_get_buffer(sample); + if (buf) { + if (__mmplayer_get_video_frame_from_buffer(player, pad, buf) != MM_ERROR_NONE) + ret = MM_ERROR_PLAYER_INTERNAL; + } else { + LOGW("failed to get video frame"); } - gst_object_unref(GST_OBJECT(pad)); - pad = NULL; - return ret; - } else { - LOGW("invalid state(%d) to capture", player->state); - gst_object_unref(GST_OBJECT(pad)); - pad = NULL; - return MM_ERROR_PLAYER_INVALID_STATE; + gst_sample_unref(sample); } + } else { + LOGW("invalid state(%d) to capture", player->state); + ret = MM_ERROR_PLAYER_INVALID_STATE; } - /* register probe */ - player->video_capture_cb_probe_id = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, - __mmplayer_video_capture_probe, player, NULL); - gst_object_unref(GST_OBJECT(pad)); pad = NULL;