2 * Copyright (c) [2012] Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (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://floralicense.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 "mp-video-log.h"
20 #include "video-player.h"
21 #include "mp-video-value-define.h"
22 #include "mp-video-animation-ctrl.h"
24 #define BUFFERING_TXT_MAX_LEN 16
26 static Evas_Object *pAnimationEdj = NULL;
27 static Ecore_Timer *pAnimationTimer = NULL;
29 static int nIconIndex = 0;
31 static Eina_Bool MpVideoAnimationCtrlTimerCb(void *data)
33 /* VideoLogInfo(""); */
35 char sig_format[SIGNAL_TEXT_MAX_LEN] = { 0, };
37 snprintf(sig_format, SIGNAL_TEXT_MAX_LEN, "%s.%d",
38 SIGNAL_ANIMATION_IMAGE_LOADING, nIconIndex);
40 edje_object_signal_emit(pAnimationEdj, sig_format, "*");
43 if (nIconIndex > ANIMATION_MAX_COUNT)
49 void *MpVideoAnimationCtrlInit(void *pUserData)
53 if (pUserData == NULL) {
54 VideoLogInfo("data is NULL");
58 Evas *pMainWindowEvas = (Evas *) pUserData;
60 pAnimationEdj = MpUtilLoadEdjFile(pMainWindowEvas,
61 VIDEO_PLAYER_ANIMATION_EDJ,
64 evas_object_hide(pAnimationEdj);
66 return (void *)pAnimationEdj;
69 void MpVideoAnimationCtrlDestroy(void)
73 if (pAnimationTimer) {
74 ecore_timer_del(pAnimationTimer);
75 pAnimationTimer = NULL;
79 evas_object_hide(pAnimationEdj);
80 evas_object_del(pAnimationEdj);
87 void MpVideoAnimationCtrlSetPercent(int nPercent)
91 char szBuffering[BUFFERING_TXT_MAX_LEN] = { 0, };
93 snprintf(szBuffering, BUFFERING_TXT_MAX_LEN, "Loading %d%%...",
95 edje_object_part_text_set(pAnimationEdj, "loading.txt",
98 edje_object_part_text_set(pAnimationEdj, "loading.txt",
103 void MpVideoAnimationCtrlPlay(void)
106 if (pAnimationTimer == NULL) {
107 pAnimationTimer = ecore_timer_add(ANIMATION_TIMER_INTERVAL,
108 MpVideoAnimationCtrlTimerCb,
113 void MpVideoAnimationCtrlStop(void)
117 if (pAnimationTimer) {
118 ecore_timer_del(pAnimationTimer);
119 pAnimationTimer = NULL;
123 void MpVideoAnimationCtrlShow(void)
127 if (pAnimationTimer == NULL) {
128 MpVideoAnimationCtrlPlay();
129 MpVideoAnimationCtrlSetPercent(-1);
130 evas_object_show(pAnimationEdj);
134 void MpVideoAnimationCtrlHide(void)
138 MpVideoAnimationCtrlStop();
139 evas_object_hide(pAnimationEdj);
142 bool MpVideoAnimationCtrlGetActiveState(void)