Commit 9459ccb6 authored by Ludovic Fauvet's avatar Ludovic Fauvet

background playback: restore video

parent eb00f044
......@@ -79,6 +79,7 @@ struct playback_service
bool b_auto_exit;
bool b_restart_emotion;
bool b_video_background;
minicontrol *p_minicontrol;
double i_last_notification_pos;
......@@ -668,6 +669,7 @@ playback_service_stop_notify(playback_service *p_ps, bool b_notify)
playback_service_pause(p_ps);
emotion_object_file_set(p_ps->p_e, NULL);
p_ps->b_started = false;
p_ps->b_video_background = false;
ps_release_lock(p_ps);
sound_manager_unset_session_interrupted_cb();
......@@ -971,5 +973,28 @@ playback_service_enable_background_playback(playback_service *p_ps)
if (!playback_service_set_context(p_ps, PLAYLIST_CONTEXT_AUDIO))
LOGE("Switching from video context to audio failed");
p_ps->b_video_background = true;
playback_service_start(p_ps, time);
}
void
playback_service_disable_background_playback(playback_service *p_ps)
{
if (p_ps->i_ctx != PLAYLIST_CONTEXT_AUDIO || p_ps->b_video_background == false)
return;
p_ps->b_video_background = false;
playback_service_stop(p_ps);
}
bool
playback_service_is_background_playback(playback_service *p_ps)
{
return p_ps->b_video_background;
}
const char*
playback_service_current_file_path_get(playback_service *p_ps)
{
return emotion_object_file_get(p_ps->p_e);
}
......@@ -199,4 +199,13 @@ playback_service_set_play_speed(playback_service *p_ps, double rate);
void
playback_service_enable_background_playback(playback_service *p_ps);
void
playback_service_disable_background_playback(playback_service *p_ps);
bool
playback_service_is_background_playback(playback_service *p_ps);
const char*
playback_service_current_file_path_get(playback_service *p_ps);
#endif /* PLAYBACK_SERVICE_H */
......@@ -1155,7 +1155,24 @@ audio_player_show_fullscreen(audio_player *mpd)
static void
audio_player_fullscreen_edge_cb(void *data, Evas_Object *o, const char *emission, const char *source)
{
audio_player_show_fullscreen(data);
audio_player *mpd = data;
if (playback_service_is_background_playback(mpd->p_ps))
{
// Background playback, switch back to video
double time = playback_service_get_time(mpd->p_ps);
char *path = strdup(playback_service_current_file_path_get(mpd->p_ps));
if (!path)
return;
playback_service_disable_background_playback(mpd->p_ps);
intf_video_player_play(mpd->intf, path, time);
free(path);
}
else
{
// Audio, show the advanced view
audio_player_show_fullscreen(mpd);
}
}
static void
......
......@@ -338,7 +338,7 @@ intf_on_emotion_restart_cb(void *data)
}
void
intf_video_player_play(interface *intf, const char *psz_path)
intf_video_player_play(interface *intf, const char *psz_path, double time)
{
audio_player_stop(intf->p_mini_player);
......@@ -350,7 +350,7 @@ intf_video_player_play(interface *intf, const char *psz_path)
/* Hide the title bar of the naviframe */
elm_naviframe_item_title_enabled_set(it, EINA_FALSE, EINA_TRUE);
video_player_start(intf->video_player->p_view_sys, psz_path);
video_player_start(intf->video_player->p_view_sys, psz_path, time);
/* We want fullscreen */
elm_win_indicator_opacity_set(intf->win, ELM_WIN_INDICATOR_TRANSPARENT);
......
......@@ -89,7 +89,7 @@ intf_show_previous_view(interface *);
/* Video and Audio players */
void
intf_video_player_play(interface *intf, const char *psz_path);
intf_video_player_play(interface *intf, const char *psz_path, double time);
void
intf_start_audio_player(interface *intf, Eina_Array *array, int pos);
......
......@@ -59,7 +59,7 @@ list_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
if (dd->is_file)
{
/* Start the playback of the given file */
intf_video_player_play(dd->dv->p_intf, dd->file_path);
intf_video_player_play(dd->dv->p_intf, dd->file_path, 0);
}
else
{
......
......@@ -84,7 +84,7 @@ stream_view_play(view_sys *p_sys, const char *psz_path)
}
play:
intf_video_player_play(p_sys->p_intf, psz_path);
intf_video_player_play(p_sys->p_intf, psz_path, 0);
if (rc == SQLITE_DONE || rc == SQLITE_OK)
{
......
......@@ -56,7 +56,7 @@ genlist_item_selected_cb(void *data, Evas_Object *obj, void *event_info)
{
list_view_item *p_view_item = (list_view_item*)data;
intf_video_player_play(p_view_item->p_list_sys->p_intf, p_view_item->p_media_item->psz_path);
intf_video_player_play(p_view_item->p_list_sys->p_intf, p_view_item->p_media_item->psz_path, 0);
}
static void
......
......@@ -359,7 +359,7 @@ ps_on_playpause_cb(playback_service *p_ps, void *p_user_data, bool b_playing)
}
bool
video_player_start(view_sys *p_sys, const char* file_path)
video_player_start(view_sys *p_sys, const char* file_path, double time)
{
/* Screen orientation */
if (elm_win_wm_rotation_supported_get(p_sys->win)) {
......@@ -444,7 +444,7 @@ video_player_start(view_sys *p_sys, const char* file_path)
playback_service_set_context(p_sys->p_ps, PLAYLIST_CONTEXT_VIDEO);
playback_service_list_append(p_sys->p_ps, p_mi);
playback_service_start(p_sys->p_ps, 0);
playback_service_start(p_sys->p_ps, time);
elm_object_signal_emit(p_sys->layout, "hub_background,show", "");
return true;
......
......@@ -33,7 +33,7 @@ interface_view*
create_video_player(interface *, playback_service *p_ps, Evas_Object *parent);
bool
video_player_start(view_sys*, const char*);
video_player_start(view_sys*, const char*, double);
void
destroy_video_player(interface_view *);
......
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