forked from enlightenment/efl
emotion: reset VLC pipeline on EOS.
NOTE: I gave up and completely restart the child, seems like the only reliable way to do it. SVN revision: 75769
This commit is contained in:
parent
635a17d057
commit
97aec1869f
|
@ -41,3 +41,7 @@
|
||||||
2012-08-10 Sohyun Kim
|
2012-08-10 Sohyun Kim
|
||||||
|
|
||||||
* Fix priority set/get for gstreamer.
|
* Fix priority set/get for gstreamer.
|
||||||
|
|
||||||
|
2012-08-28 Cedric Bail
|
||||||
|
|
||||||
|
* Reset VLC pipeline on EOS.
|
||||||
|
|
|
@ -15,6 +15,7 @@ Fixes:
|
||||||
- stride of all YUV video
|
- stride of all YUV video
|
||||||
- fix race condition in gstreamer render function on shutdown and file set.
|
- fix race condition in gstreamer render function on shutdown and file set.
|
||||||
- fix priority set/get for gstreamer.
|
- fix priority set/get for gstreamer.
|
||||||
|
- reset VLC pipeline on EOS.
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ _play(struct _App *app)
|
||||||
{
|
{
|
||||||
libvlc_time_t new_time = pos * 1000;
|
libvlc_time_t new_time = pos * 1000;
|
||||||
libvlc_media_player_set_time(app->mp, new_time);
|
libvlc_media_player_set_time(app->mp, new_time);
|
||||||
libvlc_media_player_play(app->mp);
|
libvlc_media_player_play(app->mp);
|
||||||
app->playing = 1;
|
app->playing = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,8 +395,8 @@ _file_set(struct _App *app)
|
||||||
fprintf(stderr, "could not open path: \"%s\"\n", app->filename);
|
fprintf(stderr, "could not open path: \"%s\"\n", app->filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
app->mp = libvlc_media_player_new_from_media(app->m);
|
|
||||||
|
|
||||||
|
app->mp = libvlc_media_player_new_from_media(app->m);
|
||||||
if (!app->mp)
|
if (!app->mp)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "could not create new player from media.\n");
|
fprintf(stderr, "could not create new player from media.\n");
|
||||||
|
@ -740,7 +740,6 @@ _process_thread_events(struct _App *app)
|
||||||
_send_cmd(app, EM_RESULT_PLAYBACK_STARTED);
|
_send_cmd(app, EM_RESULT_PLAYBACK_STARTED);
|
||||||
break;
|
break;
|
||||||
case EM_THREAD_PLAYBACK_STOPPED:
|
case EM_THREAD_PLAYBACK_STOPPED:
|
||||||
libvlc_media_player_stop(app->mp);
|
|
||||||
app->playing = 0;
|
app->playing = 0;
|
||||||
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
|
_send_cmd(app, EM_RESULT_PLAYBACK_STOPPED);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -122,6 +122,7 @@ EAPI void _emotion_file_ref_set(Evas_Object *obj, const char *file, int num);
|
||||||
EAPI void _emotion_spu_button_num_set(Evas_Object *obj, int num);
|
EAPI void _emotion_spu_button_num_set(Evas_Object *obj, int num);
|
||||||
EAPI void _emotion_spu_button_set(Evas_Object *obj, int button);
|
EAPI void _emotion_spu_button_set(Evas_Object *obj, int button);
|
||||||
EAPI void _emotion_seek_done(Evas_Object *obj);
|
EAPI void _emotion_seek_done(Evas_Object *obj);
|
||||||
|
EAPI void _emotion_image_reset(Evas_Object *obj);
|
||||||
|
|
||||||
EAPI Eina_Bool _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close);
|
EAPI Eina_Bool _emotion_module_register(const char *name, Emotion_Module_Open open, Emotion_Module_Close close);
|
||||||
EAPI Eina_Bool _emotion_module_unregister(const char *name);
|
EAPI Eina_Bool _emotion_module_unregister(const char *name);
|
||||||
|
|
|
@ -1576,6 +1576,15 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
_emotion_image_reset(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Smart_Data *sd;
|
||||||
|
|
||||||
|
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
|
||||||
|
_emotion_image_data_zero(sd->obj);
|
||||||
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
_emotion_decode_stop(Evas_Object *obj)
|
_emotion_decode_stop(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,19 @@ static struct _default_players players[] = {
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static Eina_Bool _fork_and_exec(Emotion_Generic_Video *ev);
|
||||||
|
static void em_partial_shutdown(Emotion_Generic_Video *ev);
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_player_restart(void *data)
|
||||||
|
{
|
||||||
|
Emotion_Generic_Video *ev = data;
|
||||||
|
|
||||||
|
_fork_and_exec(ev);
|
||||||
|
ev->player_restart = NULL;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
_get_player(const char *name)
|
_get_player(const char *name)
|
||||||
{
|
{
|
||||||
|
@ -107,18 +120,33 @@ _player_send_cmd(Emotion_Generic_Video *ev, int cmd)
|
||||||
ERR("invalid command to player.");
|
ERR("invalid command to player.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (ev->fd_write == -1)
|
||||||
|
{
|
||||||
|
ERR("you should wait for emotion to be ready to take action.");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
if (write(ev->fd_write, &cmd, sizeof(cmd)) < 0) perror("write");
|
if (write(ev->fd_write, &cmd, sizeof(cmd)) < 0) perror("write");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_player_send_int(Emotion_Generic_Video *ev, int number)
|
_player_send_int(Emotion_Generic_Video *ev, int number)
|
||||||
{
|
{
|
||||||
|
if (ev->fd_write == -1)
|
||||||
|
{
|
||||||
|
ERR("you should wait for emotion to be ready to take action.");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
if (write(ev->fd_write, &number, sizeof(number)) < 0) perror("write");
|
if (write(ev->fd_write, &number, sizeof(number)) < 0) perror("write");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_player_send_float(Emotion_Generic_Video *ev, float number)
|
_player_send_float(Emotion_Generic_Video *ev, float number)
|
||||||
{
|
{
|
||||||
|
if (ev->fd_write == -1)
|
||||||
|
{
|
||||||
|
ERR("you should wait for emotion to be ready to take action.");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
if (write(ev->fd_write, &number, sizeof(number)) < 0) perror("write");
|
if (write(ev->fd_write, &number, sizeof(number)) < 0) perror("write");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +589,12 @@ _player_cmd_process(Emotion_Generic_Video *ev)
|
||||||
_emotion_playback_started(ev->obj);
|
_emotion_playback_started(ev->obj);
|
||||||
break;
|
break;
|
||||||
case EM_RESULT_PLAYBACK_STOPPED:
|
case EM_RESULT_PLAYBACK_STOPPED:
|
||||||
|
ev->pos = 0;
|
||||||
_emotion_playback_finished(ev->obj);
|
_emotion_playback_finished(ev->obj);
|
||||||
|
_emotion_decode_stop(ev->obj);
|
||||||
|
|
||||||
|
em_partial_shutdown(ev);
|
||||||
|
ev->player_restart = ecore_idler_add(_player_restart, ev);
|
||||||
break;
|
break;
|
||||||
case EM_RESULT_FRAME_SIZE:
|
case EM_RESULT_FRAME_SIZE:
|
||||||
_player_frame_resize(ev);
|
_player_frame_resize(ev);
|
||||||
|
@ -944,7 +977,7 @@ _player_exec(Emotion_Generic_Video *ev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_fork_and_exec(Evas_Object *obj __UNUSED__, Emotion_Generic_Video *ev)
|
_fork_and_exec(Emotion_Generic_Video *ev)
|
||||||
{
|
{
|
||||||
char shmname[256];
|
char shmname[256];
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -962,7 +995,6 @@ _fork_and_exec(Evas_Object *obj __UNUSED__, Emotion_Generic_Video *ev)
|
||||||
ev->player_data = ecore_event_handler_add(
|
ev->player_data = ecore_event_handler_add(
|
||||||
ECORE_EXE_EVENT_DATA, _player_data_cb, ev);
|
ECORE_EXE_EVENT_DATA, _player_data_cb, ev);
|
||||||
|
|
||||||
|
|
||||||
if (!_player_exec(ev))
|
if (!_player_exec(ev))
|
||||||
{
|
{
|
||||||
ERR("could not start player.");
|
ERR("could not start player.");
|
||||||
|
@ -998,15 +1030,13 @@ em_init(Evas_Object *obj, void **emotion_video, Emotion_Module_Options *opt)
|
||||||
ev->cmdline = eina_stringshare_add(player);
|
ev->cmdline = eina_stringshare_add(player);
|
||||||
*emotion_video = ev;
|
*emotion_video = ev;
|
||||||
|
|
||||||
return _fork_and_exec(obj, ev);
|
return _fork_and_exec(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
em_shutdown(void *data)
|
em_partial_shutdown(Emotion_Generic_Video *ev)
|
||||||
{
|
{
|
||||||
Emotion_Generic_Video *ev = data;
|
_emotion_image_reset(ev->obj);
|
||||||
|
|
||||||
if (!ev) return 0;
|
|
||||||
|
|
||||||
if (ev->player.exe)
|
if (ev->player.exe)
|
||||||
{
|
{
|
||||||
|
@ -1017,20 +1047,39 @@ em_shutdown(void *data)
|
||||||
|
|
||||||
if (ev->shared)
|
if (ev->shared)
|
||||||
munmap(ev->shared, ev->shared->size);
|
munmap(ev->shared, ev->shared->size);
|
||||||
|
ev->shared = NULL;
|
||||||
|
|
||||||
if (ev->fd_read >= 0)
|
if (ev->fd_read >= 0)
|
||||||
close(ev->fd_read);
|
close(ev->fd_read);
|
||||||
|
ev->fd_read = -1;
|
||||||
if (ev->fd_write >= 0)
|
if (ev->fd_write >= 0)
|
||||||
close(ev->fd_write);
|
close(ev->fd_write);
|
||||||
|
ev->fd_write = -1;
|
||||||
if (ev->fd_handler)
|
if (ev->fd_handler)
|
||||||
ecore_main_fd_handler_del(ev->fd_handler);
|
ecore_main_fd_handler_del(ev->fd_handler);
|
||||||
|
ev->fd_handler = NULL;
|
||||||
|
|
||||||
|
if (ev->player_add) ecore_event_handler_del(ev->player_add);
|
||||||
|
ev->player_add = NULL;
|
||||||
|
if (ev->player_data) ecore_event_handler_del(ev->player_data);
|
||||||
|
ev->player_data = NULL;
|
||||||
|
if (ev->player_del) ecore_event_handler_del(ev->player_del);
|
||||||
|
ev->player_del = NULL;
|
||||||
|
if (ev->player_restart) ecore_idler_del(ev->player_restart);
|
||||||
|
ev->player_restart = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
em_shutdown(void *data)
|
||||||
|
{
|
||||||
|
Emotion_Generic_Video *ev = data;
|
||||||
|
|
||||||
|
if (!ev) return 0;
|
||||||
|
|
||||||
eina_stringshare_del(ev->cmdline);
|
eina_stringshare_del(ev->cmdline);
|
||||||
eina_stringshare_del(ev->shmname);
|
eina_stringshare_del(ev->shmname);
|
||||||
|
|
||||||
ecore_event_handler_del(ev->player_add);
|
em_partial_shutdown(ev);
|
||||||
ecore_event_handler_del(ev->player_data);
|
|
||||||
ecore_event_handler_del(ev->player_del);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct _Emotion_Generic_Video
|
||||||
Emotion_Generic_Player player;
|
Emotion_Generic_Player player;
|
||||||
Emotion_Generic_Cmd_Buffer cmd;
|
Emotion_Generic_Cmd_Buffer cmd;
|
||||||
Ecore_Event_Handler *player_add, *player_del, *player_data;
|
Ecore_Event_Handler *player_add, *player_del, *player_data;
|
||||||
|
Ecore_Idler *player_restart;
|
||||||
int drop;
|
int drop;
|
||||||
int fd_read, fd_write;
|
int fd_read, fd_write;
|
||||||
Ecore_Fd_Handler *fd_handler;
|
Ecore_Fd_Handler *fd_handler;
|
||||||
|
|
Loading…
Reference in New Issue