emotion/generic - Set filename to NULL on file_close.

Otherwise if we try to call file_set(<some file>) after file_set(NULL),
it will send a close command to the player for an already closed file.

Also make the example cycle through the list of movies, but still
passing through a NULL file when reaching one of the ends of the list.

SVN revision: 63208
This commit is contained in:
Rafael Antognolli 2011-09-05 16:37:20 +00:00
parent c6ca436e79
commit a31e5f2b24
2 changed files with 12 additions and 6 deletions

View File

@ -72,7 +72,10 @@ _on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info)
else if (!strcmp(ev->keyname, "n"))
{
const char *file;
curfile = eina_list_next(curfile);
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);
@ -80,7 +83,10 @@ _on_key_down(void *data, Evas *e, Evas_Object *o, void *event_info)
else if (!strcmp(ev->keyname, "p"))
{
const char *file;
curfile = eina_list_prev(curfile);
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);

View File

@ -200,7 +200,7 @@ _file_open(Emotion_Generic_Video *ev)
INF("Opening file: %s", ev->filename);
ev->drop = 0;
if (!ev->ready)
if (!ev->ready || !ev->filename)
return;
_player_send_cmd(ev, EM_CMD_FILE_SET);
_player_send_str(ev, ev->filename, EINA_TRUE);
@ -801,11 +801,11 @@ em_file_close(void *data)
{
Emotion_Generic_Video *ev = data;
if (!ev) return;
if (!ev || !ev->filename) return;
INF("file close: %s", ev->filename);
if (!ev->filename)
return;
eina_stringshare_replace(&ev->filename, NULL);
if (ev->opening)
return;