summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2007-07-18 05:13:19 +0000
committerCarsten Haitzler <raster@rasterman.com>2007-07-18 05:13:19 +0000
commitade3911a135035745d8a4aba0b68f24e16303356 (patch)
tree6b5e373a8aaf88228ba7e3c525d2f2b395892cf4 /legacy
parent6f07dd49ee2c4672a7588fe95065763137f1674a (diff)
work around xine deadlock
SVN revision: 30891
Diffstat (limited to '')
-rw-r--r--legacy/emotion/src/modules/emotion_xine.c72
-rw-r--r--legacy/emotion/src/modules/emotion_xine.h1
2 files changed, 58 insertions, 15 deletions
diff --git a/legacy/emotion/src/modules/emotion_xine.c b/legacy/emotion/src/modules/emotion_xine.c
index 5755cfef23..9e324542e4 100644
--- a/legacy/emotion/src/modules/emotion_xine.c
+++ b/legacy/emotion/src/modules/emotion_xine.c
@@ -128,6 +128,7 @@ _em_slave(void *par)
128 ev->queue = xine_event_new_queue(ev->stream); 128 ev->queue = xine_event_new_queue(ev->stream);
129 xine_event_create_listener_thread(ev->queue, _em_event, ev); 129 xine_event_create_listener_thread(ev->queue, _em_event, ev);
130 ev->opening = 0; 130 ev->opening = 0;
131 ev->play_ok = 1;
131 _em_module_event(ev, 1); /* event - open done */ 132 _em_module_event(ev, 1); /* event - open done */
132 } 133 }
133 break; 134 break;
@@ -405,6 +406,7 @@ em_init(Evas_Object *obj, void **emotion_video, Emotion_Module_Options *opt)
405 ev->delete_me = 0; 406 ev->delete_me = 0;
406 ev->get_pos_thread_deleted = 0; 407 ev->get_pos_thread_deleted = 0;
407 ev->opening = 1; 408 ev->opening = 1;
409 ev->play_ok = 0;
408 410
409 if (opt) 411 if (opt)
410 { 412 {
@@ -471,6 +473,7 @@ em_play(void *ef, double pos)
471 473
472 ev = (Emotion_Xine_Video *)ef; 474 ev = (Emotion_Xine_Video *)ef;
473 ev->play = 1; 475 ev->play = 1;
476 ev->play_ok = 0;
474 ppos = malloc(sizeof(double)); 477 ppos = malloc(sizeof(double));
475 *ppos = pos; 478 *ppos = pos;
476 _em_slave_event(ev, 4, ppos); 479 _em_slave_event(ev, 4, ppos);
@@ -483,6 +486,7 @@ em_stop(void *ef)
483 486
484 ev = (Emotion_Xine_Video *)ef; 487 ev = (Emotion_Xine_Video *)ef;
485 ev->play = 0; 488 ev->play = 0;
489 ev->play_ok = 0;
486 _em_slave_event(ev, 5, NULL); 490 _em_slave_event(ev, 5, NULL);
487} 491}
488 492
@@ -591,7 +595,7 @@ em_video_handled(void *ef)
591 Emotion_Xine_Video *ev; 595 Emotion_Xine_Video *ev;
592 596
593 ev = (Emotion_Xine_Video *)ef; 597 ev = (Emotion_Xine_Video *)ef;
594 if (ev->opening) return 0; 598 if (ev->opening || (!ev->play_ok)) return 0;
595 return (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO) && 599 return (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO) &&
596 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_HANDLED)); 600 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_HANDLED));
597} 601}
@@ -602,7 +606,7 @@ em_audio_handled(void *ef)
602 Emotion_Xine_Video *ev; 606 Emotion_Xine_Video *ev;
603 607
604 ev = (Emotion_Xine_Video *)ef; 608 ev = (Emotion_Xine_Video *)ef;
605 if (ev->opening) return 0; 609 if (ev->opening || (!ev->play_ok)) return 0;
606 return (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_AUDIO) && 610 return (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_AUDIO) &&
607 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_AUDIO_HANDLED)); 611 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_AUDIO_HANDLED));
608} 612}
@@ -613,7 +617,7 @@ em_seekable(void *ef)
613 Emotion_Xine_Video *ev; 617 Emotion_Xine_Video *ev;
614 618
615 ev = (Emotion_Xine_Video *)ef; 619 ev = (Emotion_Xine_Video *)ef;
616 if (ev->opening) return 0; 620 if (ev->opening || (!ev->play_ok)) return 0;
617 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_SEEKABLE); 621 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_SEEKABLE);
618} 622}
619 623
@@ -707,7 +711,7 @@ em_event_feed(void *ef, int event)
707 xine_event_t xine_event; 711 xine_event_t xine_event;
708 712
709 ev = (Emotion_Xine_Video *)ef; 713 ev = (Emotion_Xine_Video *)ef;
710 if (ev->opening) return; 714 if ((ev->opening) || (!ev->play_ok)) return;
711 xine_event.data_length = 0; 715 xine_event.data_length = 0;
712 xine_event.data = NULL; 716 xine_event.data = NULL;
713 xine_event.stream = ev->stream; 717 xine_event.stream = ev->stream;
@@ -813,7 +817,7 @@ em_event_mouse_button_feed(void *ef, int button, int x, int y)
813 xine_input_data_t xine_input; 817 xine_input_data_t xine_input;
814 818
815 ev = (Emotion_Xine_Video *)ef; 819 ev = (Emotion_Xine_Video *)ef;
816 if (ev->opening) return; 820 if ((ev->opening) || (!ev->play_ok)) return;
817 xine_event.stream = ev->stream; 821 xine_event.stream = ev->stream;
818 gettimeofday(&xine_event.tv, NULL); 822 gettimeofday(&xine_event.tv, NULL);
819 xine_event.type = XINE_EVENT_INPUT_MOUSE_BUTTON; 823 xine_event.type = XINE_EVENT_INPUT_MOUSE_BUTTON;
@@ -833,7 +837,7 @@ em_event_mouse_move_feed(void *ef, int x, int y)
833 xine_input_data_t xine_input; 837 xine_input_data_t xine_input;
834 838
835 ev = (Emotion_Xine_Video *)ef; 839 ev = (Emotion_Xine_Video *)ef;
836 if (ev->opening) return; 840 if ((ev->opening) || (!ev->play_ok)) return;
837 xine_event.stream = ev->stream; 841 xine_event.stream = ev->stream;
838 gettimeofday(&xine_event.tv, NULL); 842 gettimeofday(&xine_event.tv, NULL);
839 xine_event.type = XINE_EVENT_INPUT_MOUSE_MOVE; 843 xine_event.type = XINE_EVENT_INPUT_MOUSE_MOVE;
@@ -852,7 +856,7 @@ em_video_channel_count(void *ef)
852 int v; 856 int v;
853 857
854 ev = (Emotion_Xine_Video *)ef; 858 ev = (Emotion_Xine_Video *)ef;
855 if (ev->opening) return 0; 859 if (ev->opening || (!ev->play_ok)) return 0;
856 v = xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_CHANNELS); 860 v = xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_CHANNELS);
857 if ((v < 1) && 861 if ((v < 1) &&
858 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO)) return 1; 862 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO)) return 1;
@@ -876,7 +880,7 @@ em_video_channel_get(void *ef)
876 Emotion_Xine_Video *ev; 880 Emotion_Xine_Video *ev;
877 881
878 ev = (Emotion_Xine_Video *)ef; 882 ev = (Emotion_Xine_Video *)ef;
879 if (ev->opening) return 0; 883 if (ev->opening || (!ev->play_ok)) return 0;
880 return xine_get_param(ev->stream, XINE_PARAM_VIDEO_CHANNEL); 884 return xine_get_param(ev->stream, XINE_PARAM_VIDEO_CHANNEL);
881} 885}
882 886
@@ -913,7 +917,7 @@ em_audio_channel_count(void *ef)
913 Emotion_Xine_Video *ev; 917 Emotion_Xine_Video *ev;
914 918
915 ev = (Emotion_Xine_Video *)ef; 919 ev = (Emotion_Xine_Video *)ef;
916 if (ev->opening) return 0; 920 if (ev->opening || (!ev->play_ok)) return 0;
917 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL); 921 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL);
918} 922}
919 923
@@ -934,7 +938,7 @@ em_audio_channel_get(void *ef)
934 Emotion_Xine_Video *ev; 938 Emotion_Xine_Video *ev;
935 939
936 ev = (Emotion_Xine_Video *)ef; 940 ev = (Emotion_Xine_Video *)ef;
937 if (ev->opening) return 0; 941 if (ev->opening || (!ev->play_ok)) return 0;
938 return xine_get_param(ev->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL); 942 return xine_get_param(ev->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL);
939} 943}
940 944
@@ -988,7 +992,7 @@ em_audio_channel_volume_get(void *ef)
988 Emotion_Xine_Video *ev; 992 Emotion_Xine_Video *ev;
989 993
990 ev = (Emotion_Xine_Video *)ef; 994 ev = (Emotion_Xine_Video *)ef;
991 if (ev->opening) return 0; 995 if (ev->opening || (!ev->play_ok)) return 0;
992 return (double)xine_get_param(ev->stream, XINE_PARAM_AUDIO_VOLUME) / 100.0; 996 return (double)xine_get_param(ev->stream, XINE_PARAM_AUDIO_VOLUME) / 100.0;
993} 997}
994 998
@@ -998,7 +1002,7 @@ em_spu_channel_count(void *ef)
998 Emotion_Xine_Video *ev; 1002 Emotion_Xine_Video *ev;
999 1003
1000 ev = (Emotion_Xine_Video *)ef; 1004 ev = (Emotion_Xine_Video *)ef;
1001 if (ev->opening) return 0; 1005 if (ev->opening || (!ev->play_ok)) return 0;
1002 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL); 1006 return xine_get_stream_info(ev->stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL);
1003} 1007}
1004 1008
@@ -1019,7 +1023,7 @@ em_spu_channel_get(void *ef)
1019 Emotion_Xine_Video *ev; 1023 Emotion_Xine_Video *ev;
1020 1024
1021 ev = (Emotion_Xine_Video *)ef; 1025 ev = (Emotion_Xine_Video *)ef;
1022 if (ev->opening) return 0; 1026 if (ev->opening || (!ev->play_ok)) return 0;
1023 return xine_get_param(ev->stream, XINE_PARAM_SPU_CHANNEL); 1027 return xine_get_param(ev->stream, XINE_PARAM_SPU_CHANNEL);
1024} 1028}
1025 1029
@@ -1061,7 +1065,7 @@ em_chapter_count(void *ef)
1061 Emotion_Xine_Video *ev; 1065 Emotion_Xine_Video *ev;
1062 1066
1063 ev = (Emotion_Xine_Video *)ef; 1067 ev = (Emotion_Xine_Video *)ef;
1064 if (ev->opening) return 0; 1068 if (ev->opening || (!ev->play_ok)) return 0;
1065 if (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_CHAPTERS)) 1069 if (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_CHAPTERS))
1066 return 99; 1070 return 99;
1067 return 0; 1071 return 0;
@@ -1126,7 +1130,7 @@ em_meta_get(void *ef, int meta)
1126 Emotion_Xine_Video *ev; 1130 Emotion_Xine_Video *ev;
1127 1131
1128 ev = (Emotion_Xine_Video *)ef; 1132 ev = (Emotion_Xine_Video *)ef;
1129 if (ev->opening) return NULL; 1133 if ((ev->opening) || (!ev->play_ok)) return NULL;
1130 switch (meta) 1134 switch (meta)
1131 { 1135 {
1132 case META_TRACK_TITLE: 1136 case META_TRACK_TITLE:
@@ -1254,6 +1258,44 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
1254 eev = buf[1]; 1258 eev = buf[1];
1255 if (eev->mtype != 0) 1259 if (eev->mtype != 0)
1256 { 1260 {
1261 switch (eev->mtype)
1262 {
1263 case 1: /* init done */
1264 ev->play_ok = 1;
1265 break;
1266 case 2: /* open done */
1267 ev->play_ok = 1;
1268 break;
1269 case 3: /* shutdown done */
1270 ev->play_ok = 1;
1271 break;
1272 case 4: /* play done */
1273 ev->play_ok = 1;
1274 break;
1275 case 5: /* stop done */
1276 ev->play_ok = 1;
1277 break;
1278 case 6: /* seek done */
1279 ev->play_ok = 1;
1280 break;
1281 case 7: /* eject done */
1282 ev->play_ok = 1;
1283 break;
1284 case 8: /* spu mute done */
1285 ev->play_ok = 1;
1286 break;
1287 case 9: /* channel done */
1288 ev->play_ok = 1;
1289 break;
1290 case 10: /* volume done */
1291 ev->play_ok = 1;
1292 break;
1293 case 11: /* close done */
1294 ev->play_ok = 1;
1295 break;
1296 default:
1297 break;
1298 }
1257 } 1299 }
1258 else 1300 else
1259 { 1301 {
diff --git a/legacy/emotion/src/modules/emotion_xine.h b/legacy/emotion/src/modules/emotion_xine.h
index f5e0121cc9..8a9efcc426 100644
--- a/legacy/emotion/src/modules/emotion_xine.h
+++ b/legacy/emotion/src/modules/emotion_xine.h
@@ -51,6 +51,7 @@ struct _Emotion_Xine_Video
51 volatile unsigned char opening : 1; 51 volatile unsigned char opening : 1;
52 volatile unsigned char closing : 1; 52 volatile unsigned char closing : 1;
53 volatile unsigned char have_vo : 1; 53 volatile unsigned char have_vo : 1;
54 volatile unsigned char play_ok : 1;
54 55
55 pthread_t get_pos_len_th; 56 pthread_t get_pos_len_th;
56 pthread_cond_t get_pos_len_cond; 57 pthread_cond_t get_pos_len_cond;