static void _playback_stopped_cb(void *data, Evas_Object *o, void *event_info) { printf("Emotion playback stopped.\n"); emotion_object_play_set(o, EINA_FALSE); emotion_object_position_set(o, 0); }
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 _eio_load_xattr_done(void *data, Eio_File *handler, double xattr_double) { Smart_Data *sd = data; emotion_object_position_set(evas_object_smart_parent_get(sd->obj), xattr_double); evas_object_smart_callback_call(evas_object_smart_parent_get(sd->obj), SIG_POSITION_LOAD_SUCCEED, NULL); _eio_load_xattr_cleanup(sd, handler); }
int enna_mediaplayer_stop(void) { emotion_object_play_set(mp->player, EINA_FALSE); emotion_object_position_set(mp->player, 0); mp->play_state = STOPPED; evas_object_hide(mp->player); evas_object_show(enna->layout); ecore_event_add(ENNA_EVENT_MEDIAPLAYER_STOP, NULL, NULL, NULL); return 0; }
EAPI void _emotion_seek_done(Evas_Object *obj) { Smart_Data *sd; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); if (sd->seeking) { sd->seeking = 0; if (sd->seek) emotion_object_position_set(obj, sd->seek_pos); } }
static void _win_song_set(Win *w, Song *s) { Edje_Message_Int mi; Song *previous; char str[32]; w->play.position = 0.0; w->play.length = 0.0; previous = w->song; w->song = s; if (!s) goto end; if (s->trackno > 0) snprintf(str, sizeof(str), "%d", s->trackno); else str[0] = '\0'; edje_object_part_text_set(w->edje, "ejy.text.trackno", str); edje_object_part_text_set(w->edje, "ejy.text.title", s->title); edje_object_part_text_set(w->edje, "ejy.text.album", s->album); edje_object_part_text_set(w->edje, "ejy.text.artist", s->artist); edje_object_part_text_set(w->edje, "ejy.text.genre", s->genre); mi.val = s->rating; edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_INT, MSG_RATING, &mi); emotion_object_file_set(w->emotion, s->path); emotion_object_position_set(w->emotion, w->play.position); w->play.playing = EINA_TRUE; w->play.playing_last = EINA_FALSE; emotion_object_play_set(w->emotion, EINA_TRUE); emotion_object_audio_volume_set(w->emotion, w->play.volume); end: if ((!w->play.playing) && (w->timer.play_eval)) { ecore_timer_del(w->timer.play_eval); w->timer.play_eval = NULL; } else if ((w->play.playing) && (!w->timer.play_eval)) w->timer.play_eval = ecore_timer_loop_add (0.1, _win_play_eval_timer, w); _win_nowplaying_update(w, previous); _win_play_eval(w); _win_toolbar_eval(w); ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL); ecore_event_add(ENJOY_EVENT_PLAYER_TRACK_CHANGE, NULL, NULL, NULL); }
EAPI void _emotion_open_done(Evas_Object *obj) { Smart_Data *sd; E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); sd->open = 1; if (sd->remember_jump) emotion_object_position_set(obj, sd->remember_jump); if (sd->remember_play != sd->play) emotion_object_play_set(obj, sd->remember_play); evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL); }
//Set the media position in seconds void eclair_position_set(Eclair *eclair, double position) { double media_length; if (!eclair || !eclair->video.video_object) return; media_length = emotion_object_play_length_get(eclair->video.video_object); if (position < 0.0) position = 0.0; else if (position > media_length) position = media_length; eclair->dont_update_progressbar = 1; eclair->seek_to_pos = position; emotion_object_position_set(eclair->video.video_object, eclair->seek_to_pos); }
static void enna_mediaplayer_seek(int value , SEEK_TYPE type) { double new_time, old_time, length; enna_log(ENNA_MSG_EVENT, NULL, "Seeking to: %d%c", value, type == SEEK_ABS_PERCENT ? '%' : 's'); if (mp->play_state == PAUSE || mp->play_state == PLAYING) { Enna_Event_Mediaplayer_Seek_Data *ev; ev = calloc(1, sizeof(Enna_Event_Mediaplayer_Seek_Data)); if (!ev) return; ev->seek_value = value; ev->type = type; if(emotion_object_seekable_get(mp->player)) { if(type == SEEK_ABS_PERCENT) { length = enna_mediaplayer_length_get(); new_time = (value * length) / 100.0; } else if(type == SEEK_ABS_SECONDS) new_time = (double)value; else if(type == SEEK_REL_SECONDS) { old_time = enna_mediaplayer_position_get(); new_time = (double)(value) + old_time; } else new_time = 0; ecore_event_add(ENNA_EVENT_MEDIAPLAYER_SEEK, ev, NULL, NULL); emotion_object_position_set(mp->player, new_time); } else { enna_log(ENNA_MSG_EVENT, NULL, "No Seeking avaible"); } } }
EAPI void emotion_object_last_position_load(Evas_Object *obj) { Smart_Data *sd; const char *tmp; #ifndef HAVE_EIO double xattr; #endif 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->load_xattr) return; EINA_REFCOUNT_REF(sd); sd->load_xattr = eio_file_xattr_double_get(tmp, "user.e.time_seek", _eio_load_xattr_done, _eio_load_xattr_error, sd); #else if (eina_xattr_double_get(tmp, "user.e.time_seek", &xattr)) { emotion_object_position_set(obj, xattr); evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_SUCCEED, NULL); } else { evas_object_smart_callback_call(obj, SIG_POSITION_LOAD_FAILED, NULL); } #endif }
static void _on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info) { Evas_Event_Key_Down *ev = event_info; Evas_Object *em = data; if (!strcmp(ev->keyname, "Return")) { emotion_object_play_set(em, EINA_TRUE); } else if (!strcmp(ev->keyname, "space")) { emotion_object_play_set(em, EINA_FALSE); } else if (!strcmp(ev->keyname, "Escape")) { ecore_main_loop_quit(); } else if (!strcmp(ev->keyname, "t")) { int w, h; emotion_object_size_get(em, &w, &h); fprintf(stderr, "example -> size: %dx%d\n", w, h); } else if (!strcmp(ev->keyname, "s")) { float len, pos; len = emotion_object_play_length_get(em); pos = 0.98 * len; fprintf(stderr, "skipping to position %0.3f\n", pos); emotion_object_position_set(em, pos); } else if (!strcmp(ev->keyname, "1")) { fprintf(stderr, "setting speed to 1.0\n"); emotion_object_play_speed_set(em, 1.0); } else if (!strcmp(ev->keyname, "2")) { fprintf(stderr, "setting speed to 2.0\n"); emotion_object_play_speed_set(em, 2.0); } else if (!strcmp(ev->keyname, "n")) { const char *file; if (!curfile) curfile = filenames; else curfile = eina_list_next(curfile); file = eina_list_data_get(curfile); fprintf(stderr, "playing next file: %s\n", file); emotion_object_file_set(em, file); } else if (!strcmp(ev->keyname, "p")) { const char *file; if (!curfile) curfile = eina_list_last(filenames); else curfile = eina_list_prev(curfile); file = eina_list_data_get(curfile); fprintf(stderr, "playing next file: %s\n", file); emotion_object_file_set(em, file); } else if (!strcmp(ev->keyname, "d")) { evas_object_del(em); } else if (!strcmp(ev->keyname, "l")) { // force frame dropping sleep(5); } else { fprintf(stderr, "unhandled key: %s\n", ev->keyname); } }