| 33 | } |
| 34 | |
| 35 | CacheRet CacheChecker::checkConfig() |
| 36 | { |
| 37 | if (!mCacheConfig.mEnable) { |
| 38 | AF_LOGE("cache config not enable"); |
| 39 | return CACHE_ERROR_NOT_ENABLE; |
| 40 | } |
| 41 | |
| 42 | string &cacheDir = mCacheConfig.mCacheDir; |
| 43 | |
| 44 | if (cacheDir.empty()) { |
| 45 | //not set cache dir |
| 46 | AF_LOGE("cache config not set cache dir"); |
| 47 | return CACHE_ERROR_CACHE_DIR_EMPTY; |
| 48 | } |
| 49 | |
| 50 | if (!FileUtils::isDirExist(cacheDir.c_str())) { |
| 51 | //create cache dir if not exits. |
| 52 | if (FileUtils::mkdirs(cacheDir.c_str())) { |
| 53 | return CACHE_SUCCESS; |
| 54 | } else { |
| 55 | return CACHE_ERROR_CACHE_DIR_ERROR; |
| 56 | } |
| 57 | } else { |
| 58 | return CACHE_SUCCESS; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void CacheChecker::setMediaInfo(int64_t fileSize, int64_t duration) |
| 63 | { |