#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);
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
}
} else {
int nPosition = 0;
+ _get_playback_time_for_current_file(pAppData->pServiceData->pMediaUri, &nPosition);
if (pAppData->pServiceData->bStoreDownload) {
nPosition = pAppData->pServiceData->nStorePlayedTime;
}