summaryrefslogtreecommitdiff
path: root/legacy/emotion
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-09-27 10:11:52 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-09-27 10:11:52 +0000
commit2d488b5d32f3bfa7baedadd272092c74c37f4fb2 (patch)
tree5308eff8e7ac94664a81ec090bb834e484d76cf3 /legacy/emotion
parentb04f0b0360b1565487aa183b3a6cffa4c67fd6b3 (diff)
some fixes/improvements to emotion -> foound some buggers in xine -
tried making gst do it - should kind of work. i think gst is broken tho. SVN revision: 52800
Diffstat (limited to 'legacy/emotion')
-rw-r--r--legacy/emotion/src/lib/emotion_private.h2
-rw-r--r--legacy/emotion/src/lib/emotion_smart.c33
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c7
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h1
-rw-r--r--legacy/emotion/src/modules/xine/emotion_xine.c66
-rw-r--r--legacy/emotion/src/modules/xine/emotion_xine.h4
6 files changed, 111 insertions, 2 deletions
diff --git a/legacy/emotion/src/lib/emotion_private.h b/legacy/emotion/src/lib/emotion_private.h
index 08ad1dbc85..aefde1298f 100644
--- a/legacy/emotion/src/lib/emotion_private.h
+++ b/legacy/emotion/src/lib/emotion_private.h
@@ -118,6 +118,8 @@ EAPI void _emotion_frame_new(Evas_Object *obj);
118EAPI void _emotion_video_pos_update(Evas_Object *obj, double pos, double len); 118EAPI void _emotion_video_pos_update(Evas_Object *obj, double pos, double len);
119EAPI void _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio); 119EAPI void _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio);
120EAPI void _emotion_decode_stop(Evas_Object *obj); 120EAPI void _emotion_decode_stop(Evas_Object *obj);
121EAPI void _emotion_open_done(Evas_Object *obj);
122EAPI void _emotion_playback_started(Evas_Object *obj);
121EAPI void _emotion_playback_finished(Evas_Object *obj); 123EAPI void _emotion_playback_finished(Evas_Object *obj);
122EAPI void _emotion_audio_level_change(Evas_Object *obj); 124EAPI void _emotion_audio_level_change(Evas_Object *obj);
123EAPI void _emotion_channels_change(Evas_Object *obj); 125EAPI void _emotion_channels_change(Evas_Object *obj);
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c
index 87ca600f28..34b63296f8 100644
--- a/legacy/emotion/src/lib/emotion_smart.c
+++ b/legacy/emotion/src/lib/emotion_smart.c
@@ -47,6 +47,7 @@ struct _Smart_Data
47 47
48 unsigned char play : 1; 48 unsigned char play : 1;
49 unsigned char seek : 1; 49 unsigned char seek : 1;
50 unsigned char seeking : 1;
50 51
51 char *title; 52 char *title;
52 struct { 53 struct {
@@ -99,6 +100,7 @@ static const char SIG_POSITION_UPDATE[] = "position_update";
99static const char SIG_LENGTH_CHANGE[] = "length_change"; 100static const char SIG_LENGTH_CHANGE[] = "length_change";
100static const char SIG_FRAME_RESIZE[] = "frame_resize"; 101static const char SIG_FRAME_RESIZE[] = "frame_resize";
101static const char SIG_DECODE_STOP[] = "decode_stop"; 102static const char SIG_DECODE_STOP[] = "decode_stop";
103static const char SIG_PLAYBACK_STARTED[] = "playback_started";
102static const char SIG_PLAYBACK_FINISHED[] = "playback_finished"; 104static const char SIG_PLAYBACK_FINISHED[] = "playback_finished";
103static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change"; 105static const char SIG_AUDIO_LEVEL_CHANGE[] = "audio_level_change";
104static const char SIG_CHANNELS_CHANGE[] = "channels_change"; 106static const char SIG_CHANNELS_CHANGE[] = "channels_change";
@@ -107,12 +109,14 @@ static const char SIG_PROGRESS_CHANGE[] = "progress_change";
107static const char SIG_REF_CHANGE[] = "ref_change"; 109static const char SIG_REF_CHANGE[] = "ref_change";
108static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change"; 110static const char SIG_BUTTON_NUM_CHANGE[] = "button_num_change";
109static const char SIG_BUTTON_CHANGE[] = "button_change"; 111static const char SIG_BUTTON_CHANGE[] = "button_change";
112static const char SIG_OPEN_DONE[] = "open_done";
110static const Evas_Smart_Cb_Description _smart_callbacks[] = { 113static const Evas_Smart_Cb_Description _smart_callbacks[] = {
111 {SIG_FRAME_DECODE, ""}, 114 {SIG_FRAME_DECODE, ""},
112 {SIG_POSITION_UPDATE, ""}, 115 {SIG_POSITION_UPDATE, ""},
113 {SIG_LENGTH_CHANGE, ""}, 116 {SIG_LENGTH_CHANGE, ""},
114 {SIG_FRAME_RESIZE, ""}, 117 {SIG_FRAME_RESIZE, ""},
115 {SIG_DECODE_STOP, ""}, 118 {SIG_DECODE_STOP, ""},
119 {SIG_PLAYBACK_STARTED, ""},
116 {SIG_PLAYBACK_FINISHED, ""}, 120 {SIG_PLAYBACK_FINISHED, ""},
117 {SIG_AUDIO_LEVEL_CHANGE, ""}, 121 {SIG_AUDIO_LEVEL_CHANGE, ""},
118 {SIG_CHANNELS_CHANGE, ""}, 122 {SIG_CHANNELS_CHANGE, ""},
@@ -121,6 +125,7 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
121 {SIG_REF_CHANGE, ""}, 125 {SIG_REF_CHANGE, ""},
122 {SIG_BUTTON_NUM_CHANGE, ""}, 126 {SIG_BUTTON_NUM_CHANGE, ""},
123 {SIG_BUTTON_CHANGE, ""}, 127 {SIG_BUTTON_CHANGE, ""},
128 {SIG_OPEN_DONE, ""},
124 {NULL, NULL} 129 {NULL, NULL}
125}; 130};
126 131
@@ -1014,6 +1019,18 @@ _emotion_decode_stop(Evas_Object *obj)
1014} 1019}
1015 1020
1016EAPI void 1021EAPI void
1022_emotion_open_done(Evas_Object *obj)
1023{
1024 evas_object_smart_callback_call(obj, SIG_OPEN_DONE, NULL);
1025}
1026
1027EAPI void
1028_emotion_playback_started(Evas_Object *obj)
1029{
1030 evas_object_smart_callback_call(obj, SIG_PLAYBACK_STARTED, NULL);
1031}
1032
1033EAPI void
1017_emotion_playback_finished(Evas_Object *obj) 1034_emotion_playback_finished(Evas_Object *obj)
1018{ 1035{
1019 evas_object_smart_callback_call(obj, SIG_PLAYBACK_FINISHED, NULL); 1036 evas_object_smart_callback_call(obj, SIG_PLAYBACK_FINISHED, NULL);
@@ -1089,6 +1106,20 @@ _emotion_spu_button_set(Evas_Object *obj, int button)
1089 evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL); 1106 evas_object_smart_callback_call(obj, SIG_BUTTON_CHANGE, NULL);
1090} 1107}
1091 1108
1109EAPI void
1110_emotion_seek_done(Evas_Object *obj)
1111{
1112 Smart_Data *sd;
1113
1114 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1115 if (sd->seeking)
1116 {
1117 sd->seeking = 0;
1118 if (sd->seek) emotion_object_position_set(obj, sd->seek_pos);
1119 }
1120}
1121
1122
1092 1123
1093/****************************/ 1124/****************************/
1094/* Internal object routines */ 1125/* Internal object routines */
@@ -1143,8 +1174,10 @@ _pos_set_job(void *data)
1143 obj = data; 1174 obj = data;
1144 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); 1175 E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
1145 sd->job = NULL; 1176 sd->job = NULL;
1177 if (sd->seeking) return;
1146 if (sd->seek) 1178 if (sd->seek)
1147 { 1179 {
1180 sd->seeking = 1;
1148 sd->module->pos_set(sd->video, sd->seek_pos); 1181 sd->module->pos_set(sd->video, sd->seek_pos);
1149 sd->seek = 0; 1182 sd->seek = 0;
1150 } 1183 }
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
index 0f8f9c5015..7670f49be1 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
@@ -441,6 +441,7 @@ em_file_open(const char *file,
441 em_audio_channel_volume_set(ev, ev->volume); 441 em_audio_channel_volume_set(ev, ev->volume);
442 442
443 _eos_timer_fct(ev); 443 _eos_timer_fct(ev);
444 _emotion_open_done(ev->obj);
444 445
445 return 1; 446 return 1;
446} 447}
@@ -498,6 +499,7 @@ em_play(void *video,
498 ev = (Emotion_Gstreamer_Video *)video; 499 ev = (Emotion_Gstreamer_Video *)video;
499 gst_element_set_state(ev->pipeline, GST_STATE_PLAYING); 500 gst_element_set_state(ev->pipeline, GST_STATE_PLAYING);
500 ev->play = 1; 501 ev->play = 1;
502 ev->play_started = 1;
501 503
502 /* eos */ 504 /* eos */
503 ev->eos_timer = ecore_timer_add(0.1, _eos_timer_fct, ev); 505 ev->eos_timer = ecore_timer_add(0.1, _eos_timer_fct, ev);
@@ -1385,6 +1387,11 @@ _eos_timer_fct(void *data)
1385 GstMessage *msg; 1387 GstMessage *msg;
1386 1388
1387 ev = (Emotion_Gstreamer_Video *)data; 1389 ev = (Emotion_Gstreamer_Video *)data;
1390 if (ev->play_started)
1391 {
1392 _emotion_playback_started(ev->obj);
1393 ev->play_started = 0;
1394 }
1388 while ((msg = gst_bus_poll(ev->eos_bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS | GST_MESSAGE_TAG, 0))) 1395 while ((msg = gst_bus_poll(ev->eos_bus, GST_MESSAGE_ERROR | GST_MESSAGE_EOS | GST_MESSAGE_TAG, 0)))
1389 { 1396 {
1390 switch (GST_MESSAGE_TYPE(msg)) 1397 switch (GST_MESSAGE_TYPE(msg))
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
index f89e32c3c7..fa59353ad9 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.h
@@ -87,6 +87,7 @@ struct _Emotion_Gstreamer_Video
87 Emotion_Vis vis; 87 Emotion_Vis vis;
88 88
89 unsigned char play : 1; 89 unsigned char play : 1;
90 unsigned char play_started : 1;
90 unsigned char video_mute : 1; 91 unsigned char video_mute : 1;
91 unsigned char audio_mute : 1; 92 unsigned char audio_mute : 1;
92}; 93};
diff --git a/legacy/emotion/src/modules/xine/emotion_xine.c b/legacy/emotion/src/modules/xine/emotion_xine.c
index 61d2585845..0afbde7ae0 100644
--- a/legacy/emotion/src/modules/xine/emotion_xine.c
+++ b/legacy/emotion/src/modules/xine/emotion_xine.c
@@ -430,7 +430,14 @@ em_shutdown(void *ef)
430 ev->delete_me = 1; 430 ev->delete_me = 1;
431 printf("EXM del fds %p\n", ev); 431 printf("EXM del fds %p\n", ev);
432 ecore_main_fd_handler_del(ev->fd_handler); 432 ecore_main_fd_handler_del(ev->fd_handler);
433 ev->fd_handler = NULL;
433 ecore_main_fd_handler_del(ev->fd_ev_handler); 434 ecore_main_fd_handler_del(ev->fd_ev_handler);
435 ev->fd_ev_handler = NULL;
436 if (ev->anim)
437 {
438 ecore_animator_del(ev->anim);
439 ev->anim = NULL;
440 }
434 441
435 ev->closing = 1; 442 ev->closing = 1;
436 _em_slave_event(ev, 3, NULL); 443 _em_slave_event(ev, 3, NULL);
@@ -1219,6 +1226,16 @@ _em_module_event(void *data, int type)
1219} 1226}
1220 1227
1221static Eina_Bool 1228static Eina_Bool
1229_em_audio_only_poller(void *data)
1230{
1231 Emotion_Xine_Video *ev;
1232
1233 ev = data;
1234 _em_get_pos_len(ev);
1235 return EINA_TRUE;
1236}
1237
1238static Eina_Bool
1222_em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh) 1239_em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
1223{ 1240{
1224 int fd, len; 1241 int fd, len;
@@ -1243,20 +1260,55 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
1243 break; 1260 break;
1244 case 2: /* open done */ 1261 case 2: /* open done */
1245 ev->play_ok = 1; 1262 ev->play_ok = 1;
1263 if (ev->anim)
1264 {
1265 ecore_animator_del(ev->anim);
1266 ev->anim = NULL;
1267 }
1268 _emotion_open_done(ev->obj);
1246 break; 1269 break;
1247 case 3: /* shutdown done */ 1270 case 3: /* shutdown done */
1271 if (ev->anim)
1272 {
1273 ecore_animator_del(ev->anim);
1274 ev->anim = NULL;
1275 }
1248 ev->play_ok = 1; 1276 ev->play_ok = 1;
1249 break; 1277 break;
1250 case 4: /* play done */ 1278 case 4: /* play done */
1251 ev->play_ok = 1; 1279 ev->play_ok = 1;
1280 if (ev->anim)
1281 {
1282 ecore_animator_del(ev->anim);
1283 ev->anim = NULL;
1284 }
1285 if ((!(xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_VIDEO) &&
1286 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_VIDEO_HANDLED))) &&
1287 (xine_get_stream_info(ev->stream, XINE_STREAM_INFO_HAS_AUDIO) &&
1288 xine_get_stream_info(ev->stream, XINE_STREAM_INFO_AUDIO_HANDLED)))
1289 ev->anim = ecore_animator_add(_em_audio_only_poller, ev);
1290 _emotion_playback_started(ev->obj);
1252 break; 1291 break;
1253 case 5: /* stop done */ 1292 case 5: /* stop done */
1293 if (ev->anim)
1294 {
1295 ecore_animator_del(ev->anim);
1296 ev->anim = NULL;
1297 }
1254 ev->play_ok = 1; 1298 ev->play_ok = 1;
1255 break; 1299 break;
1256 case 6: /* seek done */ 1300 case 6: /* seek done */
1257 ev->play_ok = 1; 1301 ev->play_ok = 1;
1302 _emotion_seek_done(ev->obj);
1303 _em_get_pos_len(ev);
1304 _emotion_video_pos_update(ev->obj, ev->pos, ev->len);
1258 break; 1305 break;
1259 case 7: /* eject done */ 1306 case 7: /* eject done */
1307 if (ev->anim)
1308 {
1309 ecore_animator_del(ev->anim);
1310 ev->anim = NULL;
1311 }
1260 ev->play_ok = 1; 1312 ev->play_ok = 1;
1261 break; 1313 break;
1262 case 8: /* spu mute done */ 1314 case 8: /* spu mute done */
@@ -1269,8 +1321,20 @@ _em_fd_ev_active(void *data, Ecore_Fd_Handler *fdh)
1269 ev->play_ok = 1; 1321 ev->play_ok = 1;
1270 break; 1322 break;
1271 case 11: /* close done */ 1323 case 11: /* close done */
1324 if (ev->anim)
1325 {
1326 ecore_animator_del(ev->anim);
1327 ev->anim = NULL;
1328 }
1272 ev->play_ok = 1; 1329 ev->play_ok = 1;
1273 break; 1330 break;
1331 case 15: /* get pos done */
1332 if (ev->last_pos != ev->pos)
1333 {
1334 ev->last_pos = ev->pos;
1335 _emotion_video_pos_update(ev->obj, ev->pos, ev->len);
1336 }
1337 break;
1274 default: 1338 default:
1275 break; 1339 break;
1276 } 1340 }
@@ -1409,6 +1473,7 @@ _em_get_pos_len_th(void *par)
1409 } 1473 }
1410 } 1474 }
1411 ev->get_poslen = 0; 1475 ev->get_poslen = 0;
1476 _em_module_event(ev, 15); /* event - getpos done */
1412 //printf("get pos %3.3f\n", ev->pos); 1477 //printf("get pos %3.3f\n", ev->pos);
1413 } 1478 }
1414 if (ev->delete_me) 1479 if (ev->delete_me)
@@ -1424,7 +1489,6 @@ static void
1424_em_get_pos_len(Emotion_Xine_Video *ev) 1489_em_get_pos_len(Emotion_Xine_Video *ev)
1425{ 1490{
1426 if (!ev->play_ok) return; 1491 if (!ev->play_ok) return;
1427 if (ev->get_poslen) return;
1428 ev->get_poslen = 1; 1492 ev->get_poslen = 1;
1429 pthread_mutex_lock(&(ev->get_pos_len_mutex)); 1493 pthread_mutex_lock(&(ev->get_pos_len_mutex));
1430 pthread_cond_broadcast(&(ev->get_pos_len_cond)); 1494 pthread_cond_broadcast(&(ev->get_pos_len_cond));
diff --git a/legacy/emotion/src/modules/xine/emotion_xine.h b/legacy/emotion/src/modules/xine/emotion_xine.h
index e5cf122588..fa6c082e83 100644
--- a/legacy/emotion/src/modules/xine/emotion_xine.h
+++ b/legacy/emotion/src/modules/xine/emotion_xine.h
@@ -20,6 +20,7 @@ struct _Emotion_Xine_Video
20 xine_event_queue_t *queue; 20 xine_event_queue_t *queue;
21 volatile double len; 21 volatile double len;
22 volatile double pos; 22 volatile double pos;
23 volatile double last_pos;
23 volatile double volume; 24 volatile double volume;
24 double fps; 25 double fps;
25 double ratio; 26 double ratio;
@@ -32,12 +33,13 @@ struct _Emotion_Xine_Video
32 volatile int video_channel; 33 volatile int video_channel;
33 volatile int fq; 34 volatile int fq;
34 Emotion_Vis vis; 35 Emotion_Vis vis;
35 int fd_read; 36 int fd_read;
36 int fd_write; 37 int fd_write;
37 Ecore_Fd_Handler *fd_handler; 38 Ecore_Fd_Handler *fd_handler;
38 int fd_ev_read; 39 int fd_ev_read;
39 int fd_ev_write; 40 int fd_ev_write;
40 Ecore_Fd_Handler *fd_ev_handler; 41 Ecore_Fd_Handler *fd_ev_handler;
42 Ecore_Animator *anim;
41 unsigned char play : 1; 43 unsigned char play : 1;
42 unsigned char just_loaded : 1; 44 unsigned char just_loaded : 1;
43 unsigned char video_mute : 1; 45 unsigned char video_mute : 1;