meta-digi/meta-digi-dey/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad-1.4.5/0003-glimagesink-Add-fps-pr...

70 lines
2.1 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 29da042a43dd49e1fb821afd8f6d5d63ad0f9f07 Mon Sep 17 00:00:00 2001
From: Jian <Jian.Li@freescale.com>
Date: Mon, 27 Apr 2015 17:42:36 +0800
Subject: [PATCH 1/3] [glimagesink] Add fps print in glimagesink
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream Status: Inappropriate [i.MX specific]
Signed-off-by: Jian <Jian.Li@freescale.com>
---
ext/gl/gstglimagesink.c | 12 ++++++++++++
ext/gl/gstglimagesink.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
index d3cacce..3c0c6b3 100644
--- a/ext/gl/gstglimagesink.c
+++ b/ext/gl/gstglimagesink.c
@@ -304,6 +304,7 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink)
glimage_sink->redisplay_texture = 0;
glimage_sink->cropmeta = NULL;
glimage_sink->videometa = NULL;
+ glimage_sink->frame_showed = 0;
g_mutex_init (&glimage_sink->drawing_lock);
}
@@ -611,6 +612,15 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition)
break;
}
case GST_STATE_CHANGE_READY_TO_NULL:
+ {
+ GstClockTime run_time = gst_element_get_start_time (GST_ELEMENT (glimage_sink));
+ if (run_time > 0) {
+ g_print ("Total showed frames (%lld), playing for (%"GST_TIME_FORMAT"), fps (%.3f).\n",
+ glimage_sink->frame_showed, GST_TIME_ARGS (run_time),
+ (gfloat)GST_SECOND * glimage_sink->frame_showed / run_time);
+ }
+ }
+
break;
default:
break;
@@ -827,6 +837,8 @@ gst_glimage_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
return GST_FLOW_ERROR;
}
+ glimage_sink->frame_showed ++;
+
return GST_FLOW_OK;
/* ERRORS */
diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h
index 1805e94..5990457 100644
--- a/ext/gl/gstglimagesink.h
+++ b/ext/gl/gstglimagesink.h
@@ -85,6 +85,8 @@ struct _GstGLImageSink
GstVideoCropMeta *cropmeta;
GstVideoMeta *videometa;
+ guint64 frame_showed;
+
#if GST_GL_HAVE_GLES2
GstGLShader *redisplay_shader;
GLint redisplay_attr_position_loc;
--
1.7.9.5