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 <cedric@osg.samsung.com>
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2017-08-29 17:08:03 -07:00 committed by Cedric BAIL
parent 835fd7a485
commit 2cf1fd3be9
1 changed files with 10 additions and 4 deletions

View File

@ -379,6 +379,9 @@ em_pos_set(void *video,
gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
} }
/**
* Returns stream duration in seconds
*/
static double static double
em_len_get(void *video) em_len_get(void *video)
{ {
@ -401,7 +404,7 @@ em_len_get(void *video)
if (fmt != GST_FORMAT_TIME) 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)); gst_format_get_name(fmt));
goto fallback; goto fallback;
} }
@ -409,7 +412,7 @@ em_len_get(void *video)
if (val <= 0.0) if (val <= 0.0)
goto fallback; goto fallback;
return val / 1000000000.0; return GST_TIME_AS_SECONDS(val);
fallback: fallback:
if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE)) if (!_emotion_gstreamer_video_pipeline_parse(ev, EINA_FALSE))
@ -503,6 +506,9 @@ em_fps_get(void *video)
return 0.0; return 0.0;
} }
/**
* Returns stream position in seconds
*/
static double static double
em_pos_get(void *video) em_pos_get(void *video)
{ {
@ -522,12 +528,12 @@ em_pos_get(void *video)
if (fmt != GST_FORMAT_TIME) 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)); gst_format_get_name(fmt));
return ev->position; return ev->position;
} }
ev->position = val / 1000000000.0; ev->position = GST_TIME_AS_SECONDS(val);
return ev->position; return ev->position;
} }