2 * To apply the Flora License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
4 * Copyright [2012] [JongDong Lee <jongdong.lee@samsung.com>, ChangSun Lee <cs78.lee@samsung.com>]
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include "mp-video-log.h"
22 #include "video-player.h"
23 #include "mp-video-value-define.h"
24 #include "mp-video-animation-ctrl.h"
26 #define BUFFERING_TXT_MAX_LEN 16
28 static Evas_Object *pAnimationEdj = NULL;
29 static Ecore_Timer *pAnimationTimer = NULL;
31 static int nIconIndex = 0;
33 static Eina_Bool MpVideoAnimationCtrlTimerCb(void *data)
35 /* VideoLogInfo(""); */
37 char sig_format[SIGNAL_TEXT_MAX_LEN] = { 0, };
39 snprintf(sig_format, SIGNAL_TEXT_MAX_LEN, "%s.%d",
40 SIGNAL_ANIMATION_IMAGE_LOADING, nIconIndex);
42 edje_object_signal_emit(pAnimationEdj, sig_format, "*");
45 if (nIconIndex > ANIMATION_MAX_COUNT)
51 void *MpVideoAnimationCtrlInit(void *pUserData)
55 if (pUserData == NULL) {
56 VideoLogInfo("data is NULL");
60 Evas *pMainWindowEvas = (Evas *) pUserData;
62 pAnimationEdj = MpUtilLoadEdjFile(pMainWindowEvas,
63 VIDEO_PLAYER_ANIMATION_EDJ,
66 evas_object_hide(pAnimationEdj);
68 return (void *)pAnimationEdj;
71 void MpVideoAnimationCtrlDestroy(void)
75 if (pAnimationTimer) {
76 ecore_timer_del(pAnimationTimer);
77 pAnimationTimer = NULL;
81 evas_object_hide(pAnimationEdj);
82 evas_object_del(pAnimationEdj);
89 void MpVideoAnimationCtrlSetPercent(int nPercent)
93 char szBuffering[BUFFERING_TXT_MAX_LEN] = { 0, };
95 snprintf(szBuffering, BUFFERING_TXT_MAX_LEN, "Loading %d%%...",
97 edje_object_part_text_set(pAnimationEdj, "loading.txt",
100 edje_object_part_text_set(pAnimationEdj, "loading.txt",
105 void MpVideoAnimationCtrlPlay(void)
108 if (pAnimationTimer == NULL) {
109 pAnimationTimer = ecore_timer_add(ANIMATION_TIMER_INTERVAL,
110 MpVideoAnimationCtrlTimerCb,
115 void MpVideoAnimationCtrlStop(void)
119 if (pAnimationTimer) {
120 ecore_timer_del(pAnimationTimer);
121 pAnimationTimer = NULL;
125 void MpVideoAnimationCtrlShow(void)
129 if (pAnimationTimer == NULL) {
130 MpVideoAnimationCtrlPlay();
131 MpVideoAnimationCtrlSetPercent(-1);
132 evas_object_show(pAnimationEdj);
136 void MpVideoAnimationCtrlHide(void)
140 MpVideoAnimationCtrlStop();
141 evas_object_hide(pAnimationEdj);
144 bool MpVideoAnimationCtrlGetActiveState(void)