printf("Emotion object started playback.\n");
}
+static void
+_playback_stopped_cb(void *data, Evas_Object *o, void *event_info)
+{
+ emotion_object_play_set(o, EINA_FALSE);
+ emotion_object_position_set(o, 0);
+}
+
static Evas_Object *
_create_emotion_object(Evas *e)
{
evas_object_smart_callback_add(
em, "playback_started", _playback_started_cb, NULL);
+ evas_object_smart_callback_add(
+ em, "playback_stopped", _playback_stopped_cb, NULL);
return em;
}
}
else if (!strcmp(ev->keyname, "s"))
{
- fprintf(stderr, "skipping to position 60\n");
- emotion_object_position_set(em, 60);
+ 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"))
{
enum _Thread_Events {
EM_THREAD_POSITION_CHANGED,
+ EM_THREAD_PLAYBACK_STOPPED,
EM_THREAD_LAST
};
_send_file_set(app);
break;
case libvlc_MediaPlayerEndReached:
- _send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
+ thread_event = EM_THREAD_PLAYBACK_STOPPED;
+ write(app->fd_write, &thread_event, sizeof(thread_event));
break;
}
}
case EM_THREAD_POSITION_CHANGED:
_position_changed(app);
break;
+ case EM_THREAD_PLAYBACK_STOPPED:
+ libvlc_media_player_stop(app->mp);
+ app->playing = 0;
+ _send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
+ break;
}
}