summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-04-28 19:37:09 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-29 11:02:17 +0300
commit0657cd583f7c451b28130e699aef26893603c0b6 (patch)
treecba291bc1e40bf5aff5db9c7cabdf9f751a672bd
parent37c76b3920a7f09bc336ffbbb31758ff0986b7cd (diff)
elc_player: porting evas smart callbacks to eo
-rwxr-xr-x[-rw-r--r--]src/lib/elc_player.c206
1 files changed, 113 insertions, 93 deletions
diff --git a/src/lib/elc_player.c b/src/lib/elc_player.c
index 1818e1f29..91e38ed43 100644..100755
--- a/src/lib/elc_player.c
+++ b/src/lib/elc_player.c
@@ -210,16 +210,15 @@ _elm_player_elm_layout_sizing_eval(Eo *obj, Elm_Player_Data *sd EINA_UNUSED)
210 evas_object_size_hint_min_set(obj, w, h); 210 evas_object_size_hint_min_set(obj, w, h);
211} 211}
212 212
213static void 213static Eina_Bool
214_update_slider(void *data, 214_update_slider(void *data,
215 Evas_Object *obj EINA_UNUSED, 215 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
216 void *event_info EINA_UNUSED)
217{ 216{
218 double pos, length; 217 double pos, length;
219 Eina_Bool seekable; 218 Eina_Bool seekable;
220 219
221 ELM_PLAYER_DATA_GET(data, sd); 220 ELM_PLAYER_DATA_GET(data, sd);
222 if (!sd) return; 221 if (!sd) return EINA_TRUE;
223 222
224 seekable = elm_video_is_seekable_get(sd->video); 223 seekable = elm_video_is_seekable_get(sd->video);
225 length = elm_video_play_length_get(sd->video); 224 length = elm_video_play_length_get(sd->video);
@@ -231,22 +230,24 @@ _update_slider(void *data,
231 if ((elm_slider_value_get(sd->slider) != pos) && 230 if ((elm_slider_value_get(sd->slider) != pos) &&
232 (!sd->dragging)) 231 (!sd->dragging))
233 elm_slider_value_set(sd->slider, pos); 232 elm_slider_value_set(sd->slider, pos);
233
234 return EINA_TRUE;
234} 235}
235 236
236static void 237static Eina_Bool
237_update_frame(void *data, 238_update_frame(void *data,
238 Evas_Object *obj, 239 Eo *obj, const Eo_Event_Description *desc, void *event_info)
239 void *event_info)
240{ 240{
241 ELM_PLAYER_DATA_GET(data, sd); 241 ELM_PLAYER_DATA_GET(data, sd);
242 if (!sd) return; 242 if (!sd) return EINA_TRUE;
243 _update_slider(data, obj, event_info); 243 _update_slider(data, obj, desc, event_info);
244
245 return EINA_TRUE;
244} 246}
245 247
246static void 248static Eina_Bool
247_update_position(void *data, 249_update_position(void *data,
248 Evas_Object *obj EINA_UNUSED, 250 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
249 void *event_info EINA_UNUSED)
250{ 251{
251 double pos; 252 double pos;
252 ELM_PLAYER_DATA_GET(data, sd); 253 ELM_PLAYER_DATA_GET(data, sd);
@@ -254,30 +255,33 @@ _update_position(void *data,
254 pos = elm_slider_value_get(sd->slider); 255 pos = elm_slider_value_get(sd->slider);
255 if (pos != elm_video_play_position_get(sd->video)) 256 if (pos != elm_video_play_position_get(sd->video))
256 elm_video_play_position_set(sd->video, pos); 257 elm_video_play_position_set(sd->video, pos);
258
259 return EINA_TRUE;
257} 260}
258 261
259static void 262static Eina_Bool
260_drag_start(void *data, 263_drag_start(void *data,
261 Evas_Object *obj EINA_UNUSED, 264 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
262 void *event_info EINA_UNUSED)
263{ 265{
264 ELM_PLAYER_DATA_GET(data, sd); 266 ELM_PLAYER_DATA_GET(data, sd);
265 sd->dragging = EINA_TRUE; 267 sd->dragging = EINA_TRUE;
268
269 return EINA_TRUE;
266} 270}
267 271
268static void 272static Eina_Bool
269_drag_stop(void *data, 273_drag_stop(void *data,
270 Evas_Object *obj EINA_UNUSED, 274 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
271 void *event_info EINA_UNUSED)
272{ 275{
273 ELM_PLAYER_DATA_GET(data, sd); 276 ELM_PLAYER_DATA_GET(data, sd);
274 sd->dragging = EINA_FALSE; 277 sd->dragging = EINA_FALSE;
278
279 return EINA_TRUE;
275} 280}
276 281
277static void 282static Eina_Bool
278_update_volume(void *data, 283_update_volume(void *data,
279 Evas_Object *obj EINA_UNUSED, 284 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
280 void *event_info EINA_UNUSED)
281{ 285{
282 double vol; 286 double vol;
283 ELM_PLAYER_DATA_GET(data, sd); 287 ELM_PLAYER_DATA_GET(data, sd);
@@ -285,12 +289,13 @@ _update_volume(void *data,
285 vol = elm_slider_value_get(sd->vslider) / 100.0; 289 vol = elm_slider_value_get(sd->vslider) / 100.0;
286 if (vol != elm_video_audio_level_get(sd->video)) 290 if (vol != elm_video_audio_level_get(sd->video))
287 elm_video_audio_level_set(sd->video, vol); 291 elm_video_audio_level_set(sd->video, vol);
292
293 return EINA_TRUE;
288} 294}
289 295
290static void 296static Eina_Bool
291_forward(void *data, 297_forward(void *data,
292 Evas_Object *obj EINA_UNUSED, 298 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
293 void *event_info EINA_UNUSED)
294{ 299{
295 double pos, length; 300 double pos, length;
296 ELM_PLAYER_DATA_GET(data, sd); 301 ELM_PLAYER_DATA_GET(data, sd);
@@ -302,64 +307,70 @@ _forward(void *data,
302 elm_video_play_position_set(sd->video, pos); 307 elm_video_play_position_set(sd->video, pos);
303 308
304 elm_layout_signal_emit(data, "elm,button,forward", "elm"); 309 elm_layout_signal_emit(data, "elm,button,forward", "elm");
305 evas_object_smart_callback_call(data, SIG_FORWARD_CLICKED, NULL); 310 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_FORWARD_CLICKED, NULL));
311
312 return EINA_TRUE;
306} 313}
307 314
308static void 315static Eina_Bool
309_info(void *data, 316_info(void *data,
310 Evas_Object *obj EINA_UNUSED, 317 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
311 void *event_info EINA_UNUSED)
312{ 318{
313 elm_layout_signal_emit(data, "elm,button,info", "elm"); 319 elm_layout_signal_emit(data, "elm,button,info", "elm");
314 evas_object_smart_callback_call(data, SIG_INFO_CLICKED, NULL); 320 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_INFO_CLICKED, NULL));
321
322 return EINA_TRUE;
315} 323}
316 324
317static void 325static Eina_Bool
318_next(void *data, 326_next(void *data,
319 Evas_Object *obj EINA_UNUSED, 327 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
320 void *event_info EINA_UNUSED)
321{ 328{
322 elm_layout_signal_emit(data, "elm,button,next", "elm"); 329 elm_layout_signal_emit(data, "elm,button,next", "elm");
323 evas_object_smart_callback_call(data, SIG_NEXT_CLICKED, NULL); 330 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_NEXT_CLICKED, NULL));
331
332 return EINA_TRUE;
324} 333}
325 334
326static void 335static Eina_Bool
327_pause(void *data, 336_pause(void *data,
328 Evas_Object *obj EINA_UNUSED, 337 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
329 void *event_info EINA_UNUSED)
330{ 338{
331 ELM_PLAYER_DATA_GET(data, sd); 339 ELM_PLAYER_DATA_GET(data, sd);
332 340
333 elm_layout_signal_emit(data, "elm,player,pause", "elm"); 341 elm_layout_signal_emit(data, "elm,player,pause", "elm");
334 elm_video_pause(sd->video); 342 elm_video_pause(sd->video);
335 evas_object_smart_callback_call(data, SIG_PAUSE_CLICKED, NULL); 343 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_PAUSE_CLICKED, NULL));
344
345 return EINA_TRUE;
336} 346}
337 347
338static void 348static Eina_Bool
339_play(void *data, 349_play(void *data,
340 Evas_Object *obj EINA_UNUSED, 350 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
341 void *event_info EINA_UNUSED)
342{ 351{
343 ELM_PLAYER_DATA_GET(data, sd); 352 ELM_PLAYER_DATA_GET(data, sd);
344 353
345 elm_layout_signal_emit(data, "elm,player,play", "elm"); 354 elm_layout_signal_emit(data, "elm,player,play", "elm");
346 elm_video_play(sd->video); 355 elm_video_play(sd->video);
347 evas_object_smart_callback_call(data, SIG_PLAY_CLICKED, NULL); 356 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_PLAY_CLICKED, NULL));
357
358 return EINA_TRUE;
348} 359}
349 360
350static void 361static Eina_Bool
351_prev(void *data, 362_prev(void *data,
352 Evas_Object *obj EINA_UNUSED, 363 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
353 void *event_info EINA_UNUSED)
354{ 364{
355 evas_object_smart_callback_call(data, SIG_PREV_CLICKED, NULL); 365 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_PREV_CLICKED, NULL));
356 elm_layout_signal_emit(data, "elm,button,prev", "elm"); 366 elm_layout_signal_emit(data, "elm,button,prev", "elm");
367
368 return EINA_TRUE;
357} 369}
358 370
359static void 371static Eina_Bool
360_rewind(void *data, 372_rewind(void *data,
361 Evas_Object *obj EINA_UNUSED, 373 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
362 void *event_info EINA_UNUSED)
363{ 374{
364 double pos; 375 double pos;
365 ELM_PLAYER_DATA_GET(data, sd); 376 ELM_PLAYER_DATA_GET(data, sd);
@@ -370,28 +381,32 @@ _rewind(void *data,
370 elm_video_play_position_set(sd->video, pos); 381 elm_video_play_position_set(sd->video, pos);
371 382
372 elm_layout_signal_emit(data, "elm,button,rewind", "elm"); 383 elm_layout_signal_emit(data, "elm,button,rewind", "elm");
373 evas_object_smart_callback_call(data, SIG_REWIND_CLICKED, NULL); 384 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_REWIND_CLICKED, NULL));
385
386 return EINA_TRUE;
374} 387}
375 388
376static void 389static Eina_Bool
377_stop(void *data, 390_stop(void *data,
378 Evas_Object *obj EINA_UNUSED, 391 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
379 void *event_info EINA_UNUSED)
380{ 392{
381 elm_layout_signal_emit(data, "elm,button,stop", "elm"); 393 elm_layout_signal_emit(data, "elm,button,stop", "elm");
382 evas_object_smart_callback_call(data, SIG_STOP_CLICKED, NULL); 394 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_QUALITY_CLICKED, NULL));
395
396 return EINA_TRUE;
383} 397}
384 398
385static void 399static Eina_Bool
386_eject(void *data, 400_eject(void *data,
387 Evas_Object *obj EINA_UNUSED, 401 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
388 void *event_info EINA_UNUSED)
389{ 402{
390 ELM_PLAYER_DATA_GET(data, sd); 403 ELM_PLAYER_DATA_GET(data, sd);
391 404
392 elm_layout_signal_emit(data, "elm,button,eject", "elm"); 405 elm_layout_signal_emit(data, "elm,button,eject", "elm");
393 emotion_object_eject(elm_video_emotion_get(sd->video)); 406 emotion_object_eject(elm_video_emotion_get(sd->video));
394 evas_object_smart_callback_call(data, SIG_EJECT_CLICKED, NULL); 407 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_EJECT_CLICKED, NULL));
408
409 return EINA_TRUE;
395} 410}
396 411
397static void 412static void
@@ -411,40 +426,44 @@ _mute_toggle(Evas_Object *obj)
411 } 426 }
412} 427}
413 428
414static void 429static Eina_Bool
415_volume(void *data, 430_volume(void *data,
416 Evas_Object *obj EINA_UNUSED, 431 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
417 void *event_info EINA_UNUSED)
418{ 432{
419 elm_layout_signal_emit(data, "elm,button,volume", "elm"); 433 elm_layout_signal_emit(data, "elm,button,volume", "elm");
420 _mute_toggle(data); 434 _mute_toggle(data);
421 evas_object_smart_callback_call(data, SIG_VOLUME_CLICKED, NULL); 435 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_VOLUME_CLICKED, NULL));
436
437 return EINA_TRUE;
422} 438}
423 439
424static void 440static Eina_Bool
425_mute(void *data, 441_mute(void *data,
426 Evas_Object *obj EINA_UNUSED, 442 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
427 void *event_info EINA_UNUSED)
428{ 443{
429 elm_layout_signal_emit(data, "elm,button,mute", "elm"); 444 elm_layout_signal_emit(data, "elm,button,mute", "elm");
430 _mute_toggle(data); 445 _mute_toggle(data);
431 evas_object_smart_callback_call(data, SIG_MUTE_CLICKED, NULL); 446 eo_do(data, eo_event_callback_call(ELM_PLAYER_EVENT_MUTE_CLICKED, NULL));
447
448 return EINA_TRUE;
432} 449}
433 450
434static void 451static Eina_Bool
435_play_started(void *data, 452_play_started(void *data,
436 Evas_Object *obj EINA_UNUSED, 453 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
437 void *event_info EINA_UNUSED)
438{ 454{
439 elm_layout_signal_emit(data, "elm,player,play", "elm"); 455 elm_layout_signal_emit(data, "elm,player,play", "elm");
456
457 return EINA_TRUE;
440} 458}
441 459
442static void 460static Eina_Bool
443_play_finished(void *data, 461_play_finished(void *data,
444 Evas_Object *obj EINA_UNUSED, 462 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
445 void *event_info EINA_UNUSED)
446{ 463{
447 elm_layout_signal_emit(data, "elm,player,pause", "elm"); 464 elm_layout_signal_emit(data, "elm,player,pause", "elm");
465
466 return EINA_TRUE;
448} 467}
449 468
450static void 469static void
@@ -480,7 +499,7 @@ _video_del(void *data,
480static Evas_Object * 499static Evas_Object *
481_player_button_add(Evas_Object *obj, 500_player_button_add(Evas_Object *obj,
482 const char *name, 501 const char *name,
483 Evas_Smart_Cb func) 502 Eo_Event_Cb func)
484{ 503{
485 Evas_Object *ic; 504 Evas_Object *ic;
486 Evas_Object *bt; 505 Evas_Object *bt;
@@ -500,7 +519,8 @@ _player_button_add(Evas_Object *obj,
500 snprintf(buf, sizeof(buf), "media_player/%s/%s", name, 519 snprintf(buf, sizeof(buf), "media_player/%s/%s", name,
501 elm_widget_style_get(obj)); 520 elm_widget_style_get(obj));
502 elm_object_style_set(bt, buf); 521 elm_object_style_set(bt, buf);
503 evas_object_smart_callback_add(bt, "clicked", func, obj); 522 eo_do(bt, eo_event_callback_add
523 (EVAS_CLICKABLE_INTERFACE_EVENT_CLICKED,func, obj));
504 snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name); 524 snprintf(buf, sizeof(buf), "elm.swallow.media_player.%s", name);
505 if (!elm_layout_content_set(obj, buf, bt)) 525 if (!elm_layout_content_set(obj, buf, bt))
506 { 526 {
@@ -604,18 +624,18 @@ _elm_player_elm_container_content_set(Eo *obj, Elm_Player_Data *sd, const char *
604 elm_layout_signal_emit(obj, "elm,player,play", "elm"); 624 elm_layout_signal_emit(obj, "elm,player,play", "elm");
605 else elm_layout_signal_emit(obj, "elm,player,pause", "elm"); 625 else elm_layout_signal_emit(obj, "elm,player,pause", "elm");
606 626
607 evas_object_smart_callback_add(sd->emotion, "frame_decode", 627 eo_do(sd->emotion, eo_event_callback_add
608 _update_frame, obj); 628 (EMOTION_OBJECT_EVENT_FRAME_DECODE, _update_frame, obj));
609 evas_object_smart_callback_add(sd->emotion, "frame_resize", 629 eo_do(sd->emotion, eo_event_callback_add
610 _update_slider, obj); 630 (EMOTION_OBJECT_EVENT_FRAME_RESIZE, _update_slider, obj));
611 evas_object_smart_callback_add(sd->emotion, "length_change", 631 eo_do(sd->emotion, eo_event_callback_add
612 _update_slider, obj); 632 (EMOTION_OBJECT_EVENT_LENGTH_CHANGE, _update_slider, obj));
613 evas_object_smart_callback_add(sd->emotion, "position_update", 633 eo_do(sd->emotion, eo_event_callback_add
614 _update_frame, obj); 634 (EMOTION_OBJECT_EVENT_POSITION_UPDATE, _update_frame, obj));
615 evas_object_smart_callback_add(sd->emotion, "playback_started", 635 eo_do(sd->emotion, eo_event_callback_add
616 _play_started, obj); 636 (EMOTION_OBJECT_EVENT_PLAYBACK_STARTED, _play_started, obj));
617 evas_object_smart_callback_add(sd->emotion, "playback_finished", 637 eo_do(sd->emotion, eo_event_callback_add
618 _play_finished, obj); 638 (EMOTION_OBJECT_EVENT_PLAYBACK_FINISHED, _play_finished, obj));
619 639
620 /* FIXME: track info from video */ 640 /* FIXME: track info from video */
621end: 641end:
@@ -662,12 +682,12 @@ _elm_player_evas_object_smart_add(Eo *obj, Elm_Player_Data *priv)
662 (priv->slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 682 (priv->slider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
663 elm_layout_content_set(obj, "elm.swallow.media_player.positionslider", 683 elm_layout_content_set(obj, "elm.swallow.media_player.positionslider",
664 priv->slider); 684 priv->slider);
665 evas_object_smart_callback_add 685 eo_do(priv->slider, eo_event_callback_add
666 (priv->slider, "changed", _update_position, obj); 686 (ELM_SLIDER_EVENT_CHANGED, _update_position, obj));
667 evas_object_smart_callback_add 687 eo_do(priv->slider, eo_event_callback_add
668 (priv->slider, "slider,drag,start", _drag_start, obj); 688 (ELM_SLIDER_EVENT_SLIDER_DRAG_START, _drag_start, obj));
669 evas_object_smart_callback_add 689 eo_do(priv->slider, eo_event_callback_add
670 (priv->slider, "slider,drag,stop", _drag_stop, obj); 690 (ELM_SLIDER_EVENT_SLIDER_DRAG_STOP, _drag_stop, obj));
671 691
672 priv->vslider = elm_slider_add(obj); 692 priv->vslider = elm_slider_add(obj);
673 elm_slider_indicator_show_set(priv->vslider, EINA_FALSE); 693 elm_slider_indicator_show_set(priv->vslider, EINA_FALSE);
@@ -683,8 +703,8 @@ _elm_player_evas_object_smart_add(Eo *obj, Elm_Player_Data *priv)
683 (priv->vslider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 703 (priv->vslider, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
684 elm_layout_content_set(obj, "elm.swallow.media_player.volumeslider", 704 elm_layout_content_set(obj, "elm.swallow.media_player.volumeslider",
685 priv->vslider); 705 priv->vslider);
686 evas_object_smart_callback_add 706 eo_do(priv->vslider, eo_event_callback_add
687 (priv->vslider, "changed", _update_volume, obj); 707 (ELM_SLIDER_EVENT_CHANGED,_update_volume, obj));
688 708
689 elm_layout_sizing_eval(obj); 709 elm_layout_sizing_eval(obj);
690 elm_widget_can_focus_set(obj, EINA_TRUE); 710 elm_widget_can_focus_set(obj, EINA_TRUE);