Commit dc8ce4bf authored by Thomas Guillem's avatar Thomas Guillem

playback_service: create emotion from intf or from the video Evas

parent bd75228c
......@@ -71,7 +71,7 @@ app_create(void *data)
goto error;
/* */
app->p_ps = playback_service_create(app);
app->p_ps = playback_service_create(app, app->p_intf);
if (!app->p_ps)
goto error;
......@@ -110,10 +110,10 @@ app_terminate(void *data)
media_storage_destroy(app->p_ms);
if (app->p_mediaLibrary)
media_library_delete(app->p_mediaLibrary);
if (app->p_intf)
intf_destroy(app->p_intf);
if (app->p_ps)
playback_service_destroy(app->p_ps);
if (app->p_intf)
intf_destroy(app->p_intf);
free(app);
emotion_shutdown();
}
......
......@@ -28,6 +28,7 @@
#include <Emotion.h>
#include "playback_service.h"
#include "ui/interface.h"
#define PLAYLIST_CONTEXT_COUNT (PLAYLIST_CONTEXT_OTHERS + 1)
......@@ -35,12 +36,14 @@ struct playback_service
{
media_list *p_ml_list[PLAYLIST_CONTEXT_COUNT];
media_list *p_ml;
Evas_Object *p_emotion;
Evas_Object *p_ea; /* emotion audio */
Evas_Object *p_ev; /* emotion video */
Evas_Object *p_emotion; /* p_ea or p_ev */
Eina_List *p_cbs_list;
};
playback_service *
playback_service_create(application *p_app)
playback_service_create(application *p_app, interface *p_intf)
{
playback_service *p_ps = calloc(1, sizeof(playback_service));
if (!p_ps)
......@@ -50,14 +53,25 @@ playback_service_create(application *p_app)
{
p_ps->p_ml_list[i] = media_list_create(true);
if (!p_ps->p_ml_list[i])
{
playback_service_destroy(p_ps);
return NULL;
}
goto error;
}
p_ps->p_ml = p_ps->p_ml_list[PLAYLIST_CONTEXT_VIDEO];
p_ps->p_ml = p_ps->p_ml_list[PLAYLIST_CONTEXT_AUDIO];
emotion_init();
p_ps->p_ea = emotion_object_add(intf_get_window(p_intf));
if (!p_ps->p_ea)
goto error;
emotion_object_init(p_ps->p_ea, "libvlc");
emotion_object_video_mute_set(p_ps->p_ea, true);
p_ps->p_emotion = p_ps->p_ea;
return p_ps;
error:
playback_service_destroy(p_ps);
return NULL;
}
void
......@@ -78,6 +92,13 @@ playback_service_destroy(playback_service *p_ps)
eina_list_free(p_ps->p_cbs_list);
p_ps->p_cbs_list = NULL;
if (p_ps->p_ea)
evas_object_del(p_ps->p_ea);
if (p_ps->p_ev)
evas_object_del(p_ps->p_ev);
emotion_shutdown();
free(p_ps);
}
......@@ -126,6 +147,30 @@ playback_service_unregister_callbacks(playback_service *p_ps, void *p_id)
p_ps->p_cbs_list = eina_list_remove(p_ps->p_cbs_list, p_id);
}
int
playback_service_set_evas_video(playback_service *p_ps, Evas *p_evas)
{
if (p_ps->p_ev)
{
evas_object_del(p_ps->p_ev);
p_ps->p_ev = NULL;
}
if (p_evas)
{
p_ps->p_ev = emotion_object_add(p_evas);
if (!p_ps->p_ev)
return -1;
emotion_object_init(p_ps->p_ev, "libvlc");
p_ps->p_emotion = p_ps->p_ev;
}
else
p_ps->p_emotion = p_ps->p_ea;
return 0;
}
int
playback_service_start(playback_service *p_ps)
{
......
......@@ -29,8 +29,8 @@
#include "application.h"
enum PLAYLIST_CONTEXT {
PLAYLIST_CONTEXT_VIDEO,
PLAYLIST_CONTEXT_AUDIO,
PLAYLIST_CONTEXT_VIDEO,
PLAYLIST_CONTEXT_OTHERS,
};
......@@ -44,7 +44,7 @@ struct playback_service_callbacks
};
playback_service *
playback_service_create(application *p_app);
playback_service_create(application *p_app, interface *p_intf);
void
playback_service_destroy(playback_service *p_ps);
......@@ -61,6 +61,9 @@ playback_service_register_callbacks(playback_service *p_ps, playback_service_cal
void
playback_service_unregister_callbacks(playback_service *p_ps, void *p_id);
int
playback_service_set_evas_video(playback_service *p_ps, Evas *p_evas);
int
playback_service_start(playback_service *p_ps);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment