Skip to content

Commit 23b57e9

Browse files
committed
player: store external filenames as normalized
Instead of re-normalizing the external filenames of tracks anytime the property is read, store it normalized in the first place.
1 parent 17a1388 commit 23b57e9

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

player/command.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,9 +2000,6 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
20002000
struct MPContext *mpctx = ctx;
20012001
struct track *track = mpctx->tracks[item];
20022002

2003-
char *external_filename = mp_normalize_user_path(NULL, mpctx->global,
2004-
track->external_filename);
2005-
20062003
struct mp_codec_params p =
20072004
track->stream ? *track->stream->codec : (struct mp_codec_params){0};
20082005

@@ -2054,8 +2051,8 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
20542051
{"external", SUB_PROP_BOOL(track->is_external)},
20552052
{"selected", SUB_PROP_BOOL(track->selected)},
20562053
{"main-selection", SUB_PROP_INT(order), .unavailable = order < 0},
2057-
{"external-filename", SUB_PROP_STR(external_filename),
2058-
.unavailable = !external_filename},
2054+
{"external-filename", SUB_PROP_STR(track->external_filename),
2055+
.unavailable = !track->external_filename},
20592056
{"ff-index", SUB_PROP_INT(track->ff_index)},
20602057
{"hls-bitrate", SUB_PROP_INT(track->hls_bitrate),
20612058
.unavailable = !track->hls_bitrate},
@@ -2129,7 +2126,6 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
21292126
}
21302127

21312128
done:
2132-
talloc_free(external_filename);
21332129
talloc_free(tag_list);
21342130
return ret;
21352131
}

player/loadfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ int mp_add_external_file(struct MPContext *mpctx, char *filename,
906906
} else {
907907
t->title = talloc_strdup(t, mp_basename(disp_filename));
908908
}
909-
t->external_filename = talloc_strdup(t, filename);
909+
t->external_filename = mp_normalize_user_path(t, mpctx->global, filename);
910910
t->no_default = sh->type != filter;
911911
t->no_auto_select = t->no_default;
912912
// if we found video, and we are loading cover art, flag as such.

0 commit comments

Comments
 (0)