mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
command: normalize paths for path and track-list/N/external-filename
It's better for API users to actually get predictable results.
This commit is contained in:
@@ -507,7 +507,10 @@ static int mp_property_path(void *ctx, struct m_property *prop,
|
||||
MPContext *mpctx = ctx;
|
||||
if (!mpctx->filename)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
return m_property_strdup_ro(action, arg, mpctx->filename);
|
||||
char *path = mp_normalize_path(NULL, mpctx->filename);
|
||||
int r = m_property_strdup_ro(action, arg, path);
|
||||
talloc_free(path);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int mp_property_filename(void *ctx, struct m_property *prop,
|
||||
@@ -1997,6 +2000,9 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
|
||||
struct MPContext *mpctx = ctx;
|
||||
struct track *track = mpctx->tracks[item];
|
||||
|
||||
char *external_filename = mp_normalize_user_path(NULL, mpctx->global,
|
||||
track->external_filename);
|
||||
|
||||
struct mp_codec_params p =
|
||||
track->stream ? *track->stream->codec : (struct mp_codec_params){0};
|
||||
|
||||
@@ -2048,8 +2054,8 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
|
||||
{"external", SUB_PROP_BOOL(track->is_external)},
|
||||
{"selected", SUB_PROP_BOOL(track->selected)},
|
||||
{"main-selection", SUB_PROP_INT(order), .unavailable = order < 0},
|
||||
{"external-filename", SUB_PROP_STR(track->external_filename),
|
||||
.unavailable = !track->external_filename},
|
||||
{"external-filename", SUB_PROP_STR(external_filename),
|
||||
.unavailable = !external_filename},
|
||||
{"ff-index", SUB_PROP_INT(track->ff_index)},
|
||||
{"hls-bitrate", SUB_PROP_INT(track->hls_bitrate),
|
||||
.unavailable = !track->hls_bitrate},
|
||||
@@ -2123,6 +2129,7 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
|
||||
}
|
||||
|
||||
done:
|
||||
talloc_free(external_filename);
|
||||
talloc_free(tag_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user