2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <appcore-efl.h>
22 #include "mp-video-log.h"
23 #include "video-player.h"
24 #include "mp-video-value-define.h"
25 #include "mp-video-animation-ctrl.h"
27 #define BUFFERING_TXT_MAX_LEN 16
29 static Evas_Object *pAnimationEdj = NULL;
30 static Ecore_Timer *pAnimationTimer = NULL;
32 static int nIconIndex = 0;
34 static Eina_Bool MpVideoAnimationCtrlTimerCb(void *data)
36 char sig_format[SIGNAL_TEXT_MAX_LEN] = { 0, };
38 snprintf(sig_format, SIGNAL_TEXT_MAX_LEN, "%s.%d",
39 SIGNAL_ANIMATION_IMAGE_LOADING, nIconIndex);
41 edje_object_signal_emit(pAnimationEdj, sig_format, "*");
44 if (nIconIndex > ANIMATION_MAX_COUNT)
50 void *MpVideoAnimationCtrlInit(void *pUserData)
54 if (pUserData == NULL) {
55 VideoLogInfo("data is NULL");
59 Evas *pMainWindowEvas = (Evas *) pUserData;
61 pAnimationEdj = MpUtilLoadEdjFile(pMainWindowEvas,
62 VIDEO_PLAYER_ANIMATION_EDJ,
65 evas_object_hide(pAnimationEdj);
67 return (void *)pAnimationEdj;
70 void MpVideoAnimationCtrlDestroy(void)
74 if (pAnimationTimer) {
75 ecore_timer_del(pAnimationTimer);
76 pAnimationTimer = NULL;
80 evas_object_hide(pAnimationEdj);
81 evas_object_del(pAnimationEdj);
88 void MpVideoAnimationCtrlSetPercent(int nPercent)
92 char szBuffering[BUFFERING_TXT_MAX_LEN] = { 0, };
94 snprintf(szBuffering, BUFFERING_TXT_MAX_LEN, "Loading %d%%...",
96 edje_object_part_text_set(pAnimationEdj, "loading.txt",
99 edje_object_part_text_set(pAnimationEdj, "loading.txt",
104 void MpVideoAnimationCtrlPlay(void)
107 if (pAnimationTimer == NULL) {
108 pAnimationTimer = ecore_timer_add(ANIMATION_TIMER_INTERVAL,
109 MpVideoAnimationCtrlTimerCb,
114 void MpVideoAnimationCtrlStop(void)
118 if (pAnimationTimer) {
119 ecore_timer_del(pAnimationTimer);
120 pAnimationTimer = NULL;
124 void MpVideoAnimationCtrlShow(void)
128 if (pAnimationTimer == NULL) {
129 MpVideoAnimationCtrlPlay();
130 MpVideoAnimationCtrlSetPercent(-1);
131 evas_object_show(pAnimationEdj);
135 void MpVideoAnimationCtrlHide(void)
139 MpVideoAnimationCtrlStop();
140 evas_object_hide(pAnimationEdj);
143 bool MpVideoAnimationCtrlGetActiveState(void)