{
int result = MM_ERROR_NONE;
mm_player_t* player = (mm_player_t*)hplayer;
+ char *path = NULL;
MMPLAYER_FENTER();
/* check player handle */
MMPLAYER_RETURN_VAL_IF_FAIL(player, MM_ERROR_PLAYER_NOT_INITIALIZED);
- MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
+ /* filepath can be null in idle state */
+ if (filepath) {
+ /* check file path */
+ if ((path = strstr(filepath, "file://"))) {
+ result = util_exist_file_path(path + 7);
+ } else {
+ result = util_exist_file_path(filepath);
+ }
+
+ if (result != MM_ERROR_NONE) {
+ LOGE("invalid subtitle path 0x%X", result);
+ return result; /* file not found or permission denied */
+ }
+ }
if (!player->pipeline) {
- // IDLE state
+ /* IDLE state */
mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
if (mmf_attrs_commit(player->attrs)) {
LOGE("failed to commit"); /* subtitle path will not be created */
return MM_ERROR_PLAYER_INTERNAL;
}
} else {
- // cur state <> IDLE(READY, PAUSE, PLAYING..)
+ /* cur state <> IDLE(READY, PAUSE, PLAYING..) */
+ /* check filepath */
+ MMPLAYER_RETURN_VAL_IF_FAIL(filepath, MM_ERROR_COMMON_INVALID_ARGUMENT);
+
if (!__mmplayer_check_subtitle(player)) {
mm_attrs_set_string_by_name(player->attrs, "subtitle_uri", filepath);
if (mmf_attrs_commit(player->attrs)) {