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