EAPI void emotion_object_last_position_save(Evas_Object *obj) { Smart_Data *sd; const char *tmp; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); if (!sd->file) return; if (!strncmp(sd->file, "file://", 7)) tmp = sd->file + 7; else if (!strstr(sd->file, "://")) tmp = sd->file; else return; #ifdef HAVE_EIO if (sd->save_xattr) return; EINA_REFCOUNT_REF(sd); sd->save_xattr = eio_file_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0, _eio_save_xattr_done, _eio_save_xattr_error, sd); #else if (eina_xattr_double_set(tmp, "user.e.time_seek", emotion_object_position_get(obj), 0)) evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_SUCCEED, NULL); else evas_object_smart_callback_call(obj, SIG_POSITION_SAVE_FAILED, NULL); #endif }
//Get the media position in seconds double eclair_position_get(Eclair *eclair) { if (!eclair || !eclair->video.video_object) return 0.0; if (eclair->seek_to_pos < 0.0) return emotion_object_position_get(eclair->video.video_object); else return eclair->seek_to_pos; }
static void utc_emotion_object_last_position_save_load_p(void) { Evas_Object *object = init(); emotion_object_position_set(object, 5.0); emotion_object_last_position_save(object); emotion_object_position_set(object, 7.0); emotion_object_last_position_load(object); double last_position = emotion_object_position_get(object); tet_printf("Last position: %d", last_position); if (5.0 != last_position) { tet_printf("[TET_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__); tet_result(TET_FAIL); return; } tet_printf("[TET_PASS]:: %s[%d] : Test has passed..", __FILE__, __LINE__); tet_result(TET_PASS); }
static void _display_info(Evas_Object *o) { int w, h; printf("playing: %d\n", emotion_object_play_get(o)); printf("meta title: %s\n", emotion_object_meta_info_get(o, EMOTION_META_INFO_TRACK_TITLE)); printf("seek position: %0.3f\n", emotion_object_position_get(o)); printf("play length: %0.3f\n", emotion_object_play_length_get(o)); printf("is seekable: %d\n", emotion_object_seekable_get(o)); emotion_object_size_get(o, &w, &h); printf("video geometry: %dx%d\n", w, h); printf("video width / height ratio: %0.3f\n", emotion_object_ratio_get(o)); printf("\n"); }
static void dvb_obj_frame_decode_cb(void *data, Evas_Object *obj, void *event_info) { double pos, len; char buf[256]; int ph, pm, ps, pf, lh, lm, ls; pos = emotion_object_position_get(obj); len = emotion_object_play_length_get(obj); lh = len / 3600; lm = len / 60 - (lh * 60); ls = len - ((lh * 3600) + (lm * 60)); ph = pos / 3600; pm = pos / 60 - (ph * 60); ps = pos - ((ph * 3600) + (pm * 60)); pf = pos * 100 - (ps * 100) - (pm * 60 * 100) - (ph * 60 * 60 * 100); snprintf(buf, sizeof(buf), "%i:%02i:%02i.%02i / %i:%02i:%02i", ph, pm, ps, pf, lh, lm, ls); // edje_object_part_text_set(o_dvb_bg, "position", buf); }
static void _win_play_eval(Win *w) { Edje_Message_Float_Set *mf; w->play.position = emotion_object_position_get(w->emotion); w->play.length = emotion_object_play_length_get(w->emotion); if ((w->song) && (w->song->length != (int)w->play.length)) db_song_length_set(w->db, w->song, w->play.length); mf = alloca(sizeof(Edje_Message_Float_Set) + sizeof(double)); mf->count = 2; mf->val[0] = w->play.position; mf->val[1] = w->play.length; edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_FLOAT_SET, MSG_POSITION, mf); if (w->play.playing_last == w->play.playing) return; w->play.playing_last = !w->play.playing; _win_play_pause_toggle(w); ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL); }
static void _emotion_position_update_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Enna_View_Player_Video_Data *priv = data; Evas_Object *emotion; Evas_Object *edje; double v; time_t timestamp; struct tm *t; Eina_Strbuf *str; emotion = elm_video_emotion_get(priv->video); _update_time_part(priv->layout, "time_current.text", emotion_object_position_get(emotion)); _update_time_part(priv->layout, "time_duration.text", emotion_object_play_length_get(emotion)); timestamp = time(NULL); timestamp += emotion_object_play_length_get(emotion) - emotion_object_position_get(emotion); t = localtime(×tamp); str = eina_strbuf_new(); eina_strbuf_append_printf(str, "End at %02dh%02d", t->tm_hour, t->tm_min); elm_object_part_text_set(priv->layout, "time_end_at.text", eina_strbuf_string_get(str)); eina_strbuf_free(str); v = emotion_object_position_get(emotion) / emotion_object_play_length_get(emotion);
double enna_mediaplayer_position_get(void) { return emotion_object_position_get(mp->player); }
static void _position_update_cb(void *data, Evas_Object *o, void *event_info) { fprintf(stderr, "smartcb: position_update: %0.3f\n", emotion_object_position_get(o)); }