From: Reynaldo H. Verdejo Pinochet Date: Wed, 30 Aug 2017 00:08:03 +0000 (-0700) Subject: emotion: gst: use proper GStreamer time-unit macros X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2897 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2cf1fd3be9c4da357d962e0525bbbc8eda8008ba;p=platform%2Fupstream%2Fefl.git emotion: gst: use proper GStreamer time-unit macros Summary: Do not harcode numbers that make no immediate sense. Additionally: add some wont-hurt doc note and fix two related typos. Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5145 Signed-off-by: Cedric BAIL --- diff --git a/src/modules/emotion/gstreamer/emotion_gstreamer.c b/src/modules/emotion/gstreamer/emotion_gstreamer.c index caa844e..9719515 100644 --- a/src/modules/emotion/gstreamer/emotion_gstreamer.c +++ b/src/modules/emotion/gstreamer/emotion_gstreamer.c @@ -379,6 +379,9 @@ em_pos_set(void *video, gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); } +/** + * Returns stream duration in seconds + */ static double em_len_get(void *video) { @@ -401,7 +404,7 @@ em_len_get(void *video) if (fmt != GST_FORMAT_TIME) { - DBG("requrested duration in time, but got %s instead.", + DBG("requested duration in time, but got %s instead.", gst_format_get_name(fmt)); goto fallback; } @@ -409,7 +412,7 @@ em_len_get(void *video) if (val <= 0.0) goto fallback; - return val / 1000000000.0; + return GST_TIME_AS_SECONDS(val); fallback: if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE)) @@ -503,6 +506,9 @@ em_fps_get(void *video) return 0.0; } +/** + * Returns stream position in seconds + */ static double em_pos_get(void *video) { @@ -522,12 +528,12 @@ em_pos_get(void *video) if (fmt != GST_FORMAT_TIME) { - ERR("requrested position in time, but got %s instead.", + ERR("requested position in time, but got %s instead.", gst_format_get_name(fmt)); return ev->position; } - ev->position = val / 1000000000.0; + ev->position = GST_TIME_AS_SECONDS(val); return ev->position; }