summaryrefslogtreecommitdiff
path: root/legacy/emotion
diff options
context:
space:
mode:
authorRafael Antognolli <antognolli@gmail.com>2011-09-05 16:07:00 +0000
committerRafael Antognolli <antognolli@gmail.com>2011-09-05 16:07:00 +0000
commitdca7c873b23c8f029e8cac549a64a62fc5c4969c (patch)
tree6901b82a084b06e3a17f2344c03c683aa7728c53 /legacy/emotion
parentce8904076d03e72551e80ea83e893ebee57dcd4f (diff)
emotion/generic - Don't start opening new file when another one is being open.
SVN revision: 63203
Diffstat (limited to 'legacy/emotion')
-rw-r--r--legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c12
-rw-r--r--legacy/emotion/src/modules/generic/emotion_generic.c55
-rw-r--r--legacy/emotion/src/modules/generic/emotion_generic.h1
3 files changed, 53 insertions, 15 deletions
diff --git a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
index 425aeb4d60..a29793151e 100644
--- a/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
+++ b/legacy/emotion/src/generic_players/vlc/emotion_generic_vlc.c
@@ -373,6 +373,13 @@ _event_cb(const struct libvlc_event_t *ev, void *data)
373static void 373static void
374_file_set(struct _App *app) 374_file_set(struct _App *app)
375{ 375{
376 if (app->opening)
377 {
378 libvlc_media_release(app->m);
379 libvlc_media_player_release(app->mp);
380 free(app->filename);
381 }
382
376 _em_str_read(app->em_read, &app->filename); 383 _em_str_read(app->em_read, &app->filename);
377 384
378 app->m = libvlc_media_new_path(app->libvlc, app->filename); 385 app->m = libvlc_media_new_path(app->libvlc, app->filename);
@@ -514,6 +521,9 @@ static void
514_file_close(struct _App *app) 521_file_close(struct _App *app)
515{ 522{
516 app->playing = 0; 523 app->playing = 0;
524 if (app->opening)
525 goto release_resources;
526
517 if (libvlc_media_player_get_state(app->mp) != libvlc_Playing) 527 if (libvlc_media_player_get_state(app->mp) != libvlc_Playing)
518 { 528 {
519 _send_file_closed(app); 529 _send_file_closed(app);
@@ -521,6 +531,8 @@ _file_close(struct _App *app)
521 } 531 }
522 532
523 app->closing = 1; 533 app->closing = 1;
534
535release_resources:
524 libvlc_media_player_stop(app->mp); 536 libvlc_media_player_stop(app->mp);
525 if (app->filename) 537 if (app->filename)
526 free(app->filename); 538 free(app->filename);
diff --git a/legacy/emotion/src/modules/generic/emotion_generic.c b/legacy/emotion/src/modules/generic/emotion_generic.c
index 3d8f1f0973..c0dfe89317 100644
--- a/legacy/emotion/src/modules/generic/emotion_generic.c
+++ b/legacy/emotion/src/modules/generic/emotion_generic.c
@@ -193,17 +193,6 @@ _player_new_frame(Emotion_Generic_Video *ev)
193} 193}
194 194
195static void 195static void
196_player_file_set_done(Emotion_Generic_Video *ev)
197{
198 if (!_create_shm_data(ev, ev->shmname))
199 {
200 ERR("could not create shared memory.");
201 return;
202 }
203 _player_send_cmd(ev, EM_CMD_FILE_SET_DONE);
204}
205
206static void
207_file_open(Emotion_Generic_Video *ev) 196_file_open(Emotion_Generic_Video *ev)
208{ 197{
209 INF("Opening file: %s", ev->filename); 198 INF("Opening file: %s", ev->filename);
@@ -221,6 +210,24 @@ _file_open(Emotion_Generic_Video *ev)
221} 210}
222 211
223static void 212static void
213_player_file_set_done(Emotion_Generic_Video *ev)
214{
215 if (ev->file_changed)
216 {
217 _file_open(ev);
218 ev->file_changed = EINA_FALSE;
219 return;
220 }
221
222 if (!_create_shm_data(ev, ev->shmname))
223 {
224 ERR("could not create shared memory.");
225 return;
226 }
227 _player_send_cmd(ev, EM_CMD_FILE_SET_DONE);
228}
229
230static void
224_player_ready(Emotion_Generic_Video *ev) 231_player_ready(Emotion_Generic_Video *ev)
225{ 232{
226 INF("received: player ready."); 233 INF("received: player ready.");
@@ -460,10 +467,17 @@ _player_open_done(Emotion_Generic_Video *ev)
460{ 467{
461 int success; 468 int success;
462 469
463 ev->opening = EINA_FALSE;
464 _player_int_read(ev, &success); 470 _player_int_read(ev, &success);
465
466 shm_unlink(ev->shmname); 471 shm_unlink(ev->shmname);
472
473 if (ev->file_changed)
474 {
475 _file_open(ev);
476 ev->file_changed = EINA_FALSE;
477 return;
478 }
479
480 ev->opening = EINA_FALSE;
467 if (!success) 481 if (!success)
468 { 482 {
469 ERR("Could not open file."); 483 ERR("Could not open file.");
@@ -761,10 +775,18 @@ em_file_open(const char *file, Evas_Object *obj __UNUSED__, void *data)
761 INF("file set: %s", file); 775 INF("file set: %s", file);
762 if (!ev) return 0; 776 if (!ev) return 0;
763 777
778 eina_stringshare_replace(&ev->filename, file);
779
764 ev->pos = 0; 780 ev->pos = 0;
765 ev->opening = EINA_TRUE;
766 781
767 eina_stringshare_replace(&ev->filename, file); 782 if (ev->ready && ev->opening)
783 {
784 INF("file changed while opening.");
785 ev->file_changed = EINA_TRUE;
786 return 1;
787 }
788
789 ev->opening = EINA_TRUE;
768 790
769 if (!ev->closing) 791 if (!ev->closing)
770 _file_open(ev); 792 _file_open(ev);
@@ -783,6 +805,9 @@ em_file_close(void *data)
783 if (!ev->filename) 805 if (!ev->filename)
784 return; 806 return;
785 807
808 if (ev->opening)
809 return;
810
786 _player_send_cmd(ev, EM_CMD_FILE_CLOSE); 811 _player_send_cmd(ev, EM_CMD_FILE_CLOSE);
787 ev->closing = EINA_TRUE; 812 ev->closing = EINA_TRUE;
788} 813}
diff --git a/legacy/emotion/src/modules/generic/emotion_generic.h b/legacy/emotion/src/modules/generic/emotion_generic.h
index 08084a5ad5..30af7de4ad 100644
--- a/legacy/emotion/src/modules/generic/emotion_generic.h
+++ b/legacy/emotion/src/modules/generic/emotion_generic.h
@@ -56,6 +56,7 @@ struct _Emotion_Generic_Video
56 Eina_Bool seekable : 1; 56 Eina_Bool seekable : 1;
57 volatile Eina_Bool opening : 1; 57 volatile Eina_Bool opening : 1;
58 volatile Eina_Bool closing : 1; 58 volatile Eina_Bool closing : 1;
59 Eina_Bool file_changed : 1;
59 int audio_channels_count; 60 int audio_channels_count;
60 int audio_channel_current; 61 int audio_channel_current;
61 struct _Emotion_Generic_Audio_Channel *audio_channels; 62 struct _Emotion_Generic_Audio_Channel *audio_channels;