Remove SMACK rule file(.rule) according three domain model
[apps/core/preloaded/video-player.git] / src / mp-video-progressbar.c
index edfa604..6ad16d7 100644 (file)
@@ -1,19 +1,17 @@
 /*
- * 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.
- * 
- *    Copyright [2012] [JongDong Lee <jongdong.lee@samsung.com>, ChangSun Lee <cs78.lee@samsung.com>]
- * 
- *    Licensed under the Flora License, Version 1.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- * 
- *        http://www.tizenopensource.org/license
- * 
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
+ * Copyright (c) [2012] Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 
@@ -30,8 +28,8 @@
 #define PROGRESS_ADJUSTMENT_TIME_INTERVAL      2.0
 #define PROGRESS_ADJUSTMENT_RUN_INTERVAL       0.3
 
-#define PROGRESS_ADJUSTMENT_MOVE_LIMIT         10
-#define PROGRESS_ADJUSTMENT_MODE_LIMIT         10
+#define PROGRESS_ADJUSTMENT_MOVE_LIMIT         20
+#define PROGRESS_ADJUSTMENT_MODE_LIMIT         20
 
 
 static Evas_Object *pProgressbarEdj = NULL;
@@ -63,6 +61,18 @@ static void MpVideoProgressbarSetAdjustmentMode(bool bShow)
 }
 
 
+static void MpVideoProgressbarSetPointerVisible(bool bVisible)
+{
+       VideoLogInfo("");
+
+       if(bVisible) {
+               edje_object_signal_emit(pProgressbarEdj, SIGNAL_PROGRESS_POINTER_SHOW, "*");
+       }
+       else {
+               edje_object_signal_emit(pProgressbarEdj, SIGNAL_PROGRESS_POINTER_HIDE, "*");
+       }
+}
+
 /*
  * Internal function
  */
@@ -170,7 +180,7 @@ static Eina_Bool MpVideoProgressbarAdjustmentTimerCb(void *pUserData)
        VideoLogInfo("");
 
        if (!pUserData) {
-               VideoLogInfo("[ERR] No exist userdata.");
+               VideoLogError("[ERR] No exist userdata.");
                return EINA_FALSE;
        }
        VideoAppData *pAppData = (VideoAppData *)pUserData;
@@ -245,8 +255,10 @@ static void MpVideoProgressbarDownCb(void *pUserData, Evas * e,
        if (bIsEventSkip)
                return;
 
+       MpVideoProgressbarDeleteTimer();
+       MpVideoProgressbarSetPointerVisible(TRUE);
 
-       int nTmpPlayerType = MpVideoServiceCtrlGetPlayerType();
+       int nTmpPlayerType = MpVideoServiceCtrlGetPlayerTypeWithoutLog();
        if(nTmpPlayerType != MP_STREAMING_PLAYER)
        {
                if(pProgressAdjustCheckTimer) {
@@ -264,7 +276,6 @@ static void MpVideoProgressbarDownCb(void *pUserData, Evas * e,
 
        }
        bIsDrag = TRUE;
-       MpVideoProgressbarDeleteTimer();
 
        VideoAppData *pAppData = (VideoAppData *)pUserData;
        Evas_Event_Mouse_Up *ev = event_info;
@@ -339,6 +350,7 @@ static void MpVideoProgressbarUpCb(void *pUserData, Evas * e, Evas_Object *obj,
        bIsDrag = FALSE;
 
        VideoAppData *pAppData = (VideoAppData *)pUserData;
+       MpVideoProgressbarSetPointerVisible(FALSE);
 
        if(pProgressAdjustRunTimer) {
                ecore_timer_del(pProgressAdjustRunTimer);
@@ -349,7 +361,6 @@ static void MpVideoProgressbarUpCb(void *pUserData, Evas * e, Evas_Object *obj,
                ecore_timer_del(pProgressAdjustCheckTimer);
                pProgressAdjustCheckTimer = NULL;
        }
-
        int nTmpPlayerType = MpVideoServiceCtrlGetPlayerTypeWithoutLog();
        if(nTmpPlayerType != MP_STREAMING_PLAYER)
        {
@@ -403,23 +414,41 @@ static void MpVideoProgressbarUpCb(void *pUserData, Evas * e, Evas_Object *obj,
        if (pAppData->nSetPosition < 0)
                pAppData->nSetPosition = 0;
 
+       pAppData->VideoAppCtrlCallbackFunc.VideoAppCtrlGetPosition(pAppData);
+
+       MpVideoProgressbarCreateTimer((void *)pAppData);
+
        if(nTmpPlayerType != MP_STREAMING_PLAYER)
        {
+
+               if (pAppData->nPrePlayerState == MP_PLAYER_STATE_PLAY ||
+                   pAppData->nPrePlayerState == MP_PLAYER_STATE_RESUME) {
+                       //pAppData->VideoAppCtrlCallbackFunc.VideoAppCtrlResume(pAppData);
+                       pAppData->nPrePlayerState = MP_PLAYER_STATE_PAUSE;
+                       pAppData->nSeekPlayerState = MP_PLAYER_STATE_RESUME;
+               }
+
                if(!pAppData->bSeekComplete)
                {
                        pAppData->nSeekPosition = pAppData->nSetPosition;
+                       if((pAppData->nCurPosition < pAppData->nSeekPosition + 5000) &&
+                               (pAppData->nCurPosition > pAppData->nSeekPosition - 5000))
+                       {
+                               VideoLogError("Skip for same position");
+                               pAppData->nSeekPosition = 0;
+                       }
+               }
+               else
+               {
+                       if((pAppData->nCurPosition < pAppData->nSetPosition + 5000) &&
+                               (pAppData->nCurPosition > pAppData->nSetPosition - 5000))
+                       {
+                               VideoLogError("Skip for same position");
                }
                else
                {
                        pAppData->VideoAppCtrlCallbackFunc.VideoAppCtrlSetPosition(pAppData);
-                       MpVideoProgressbarCreateTimer((void *)pAppData);
                }
-
-               if (pAppData->nPrePlayerState == MP_PLAYER_STATE_PLAY ||
-                   pAppData->nPrePlayerState == MP_PLAYER_STATE_RESUME) {
-                       //pAppData->VideoAppCtrlCallbackFunc.VideoAppCtrlResume(pAppData);
-                       pAppData->nPrePlayerState = MP_PLAYER_STATE_PAUSE;
-                       pAppData->nSeekPlayerState = MP_PLAYER_STATE_RESUME;
                }
        }
        else
@@ -450,7 +479,7 @@ static void MpVideoProgressbarMoveCb(void *pUserData, Evas * e,
                return;
        }
 
-       if (bIsEventSkip)
+       if (bIsEventSkip || bIsDrag == FALSE)
                return;
 
        VideoAppData *pAppData = (VideoAppData *)pUserData;
@@ -541,7 +570,7 @@ static void MpVideoProgressbarMoveCb(void *pUserData, Evas * e,
  */
 void MpVideoProgressbarSetSkipEvent(bool bSkip)
 {
-       VideoLogInfo("");
+//     VideoLogInfo("");
 
        bIsEventSkip = bSkip;
 }
@@ -636,15 +665,8 @@ void MpVideoProgressbarCreateTimer(void *pUserData)
                pProgressbarTimer = NULL;
        }
 
-       if(pProgressAdjustCheckTimer) {
-               ecore_timer_del(pProgressAdjustCheckTimer);
-               pProgressAdjustCheckTimer = NULL;
-       }
-
-       if(pProgressAdjustRunTimer) {
-               ecore_timer_del(pProgressAdjustRunTimer);
-               pProgressAdjustRunTimer = NULL;
-       }
+       if (bIsEventSkip)
+               return;
 
        double nPlayedRatio = 0.0;
        char szPlayingTime[PLAY_TIME_LENGTH] = { 0, };