summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraman.jeph <aman.jeph@samsung.com>2021-03-01 13:06:29 +0530
committerAman Jeph <aman.jeph@samsung.com>2021-03-02 07:37:38 +0000
commitba7da30dfa0b273b38456080df19d8aef93549b7 (patch)
tree7de414ec26c660a9051984b106c3ac8c3d53d39a
parentd3be76cb8d991317ab0aa4cd52c57331a97525d9 (diff)
downloadvideo-player-tizen_6.0.tar.gz
video-player-tizen_6.0.tar.bz2
video-player-tizen_6.0.zip
[TIZENIOT-2414] Resume file form last playedsubmit/tizen_6.0/20210302.074749tizen_6.0
Change-Id: I1c1a4bf7829cb2031baffd4ef326b12835f0b184 Signed-off-by: aman.jeph <aman.jeph@samsung.com> (cherry picked from commit 938ee9f77b0223970dc4939e5ccd1b029bf9c525)
-rwxr-xr-xvp-main/src/vp-main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/vp-main/src/vp-main.c b/vp-main/src/vp-main.c
index 4dbe234..0eaaf88 100755
--- a/vp-main/src/vp-main.c
+++ b/vp-main/src/vp-main.c
@@ -21,6 +21,7 @@
#include "vp-service-parser.h"
#include "vp-play-log.h"
#include "vp-play-view.h"
+#include "vp-playtime-db.h"
static void __appResume(void *pUserData);
@@ -82,6 +83,31 @@ static bool __appCreate(void *pUserData)
return TRUE;
}
+static int _sqlite_table_data_cb(void *user_data, int count, char **col_data, char **colums) {
+ int *nPosition = (int*)user_data;
+ for(int i = 0; i<count; ++i) {
+ if(col_data[i]) {
+ int current_duration = atoi(col_data[i]);
+ if(current_duration <= 5000){
+ *nPosition = 0;
+ } else {
+ *nPosition = current_duration - 5000;
+ }
+ }
+ }
+ //always return zero , otherwise sqlite3_exec will abort the subsequent statements
+ return 0;
+}
+static void _get_playback_time_for_current_file(const char* url, void *data)
+{
+ if(url == NULL) {
+ VideoLogError("Failed to get url");
+ return;
+ }
+ vp_playtime_db_get_progress((const char*)url, _sqlite_table_data_cb, data);
+}
+
+
/**
*
* @param data
@@ -386,6 +412,7 @@ static Eina_Bool __appControl_idler_cb(void *data)
}
} else {
int nPosition = 0;
+ _get_playback_time_for_current_file(pAppData->pServiceData->pMediaUri, &nPosition);
if (pAppData->pServiceData->bStoreDownload) {
nPosition = pAppData->pServiceData->nStorePlayedTime;
}